A couple more tweaks

This commit is contained in:
Paul Chote
2010-03-15 18:27:57 +13:00
parent 928c3a69c0
commit 31198c25e5
3 changed files with 3 additions and 2 deletions

View File

@@ -0,0 +1,51 @@
using System.Collections.Generic;
using System.Drawing;
using OpenRA.FileFormats;
using OpenRA.Graphics;
namespace OpenRA.Widgets.Delegates
{
public interface IWidgetDelegate { bool OnClick(Widget w, MouseInput mi); }
public class MainMenuButtonsDelegate : IWidgetDelegate
{
public bool OnClick(Widget w, MouseInput mi)
{
// Main Menu root
if (w.Id == "MAINMENU_BUTTON_QUIT")
{
Game.Exit();
return true;
}
if (w.Id == "MAINMENU_BUTTON_JOIN")
{
Game.JoinServer(Game.Settings.NetworkHost, Game.Settings.NetworkPort);
return true;
}
if (w.Id == "MAINMENU_BUTTON_CREATE")
{
WidgetLoader.rootWidget.GetWidget("MAINMENU_BG").Visible = false;
WidgetLoader.rootWidget.GetWidget("CREATESERVER_BG").Visible = true;
return true;
}
// "Create Server" submenu
if (w.Id == "CREATESERVER_BUTTON_CANCEL")
{
WidgetLoader.rootWidget.GetWidget("MAINMENU_BG").Visible = true;
WidgetLoader.rootWidget.GetWidget("CREATESERVER_BG").Visible = false;
return true;
}
if (w.Id == "CREATESERVER_BUTTON_START")
{
Game.CreateServer();
return true;
}
return false;
}
}
}