fixed up the chrome/widgets tree

This commit is contained in:
Chris Forbes
2010-03-24 08:30:59 +13:00
parent f37eea8b04
commit 41fe6f01fc
15 changed files with 413 additions and 291 deletions

View File

@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OpenRA.Widgets.Delegates
{
public class SettingsMenuDelegate : WidgetDelegate
{
public override bool GetState(Widget w)
{
if (w.Id == "SETTINGS_CHECKBOX_UNITDEBUG") return Game.Settings.UnitDebug;
if (w.Id == "SETTINGS_CHECKBOX_PATHDEBUG") return Game.Settings.PathDebug;
if (w.Id == "SETTINGS_CHECKBOX_INDEXDEBUG") return Game.Settings.IndexDebug;
if (w.Id == "SETTINGS_CHECKBOX_PERFGRAPH") return Game.Settings.PerfGraph;
if (w.Id == "SETTINGS_CHECKBOX_PERFTEXT") return Game.Settings.PerfText;
return false;
}
public override bool OnMouseDown(Widget w, MouseInput mi)
{
if (w.Id == "SETTINGS_CHECKBOX_UNITDEBUG")
{
Game.Settings.UnitDebug = !Game.Settings.UnitDebug;
return true;
}
if (w.Id == "SETTINGS_CHECKBOX_PATHDEBUG")
{
Game.Settings.PathDebug = !Game.Settings.PathDebug;
return true;
}
if (w.Id == "SETTINGS_CHECKBOX_INDEXDEBUG")
{
Game.Settings.IndexDebug = !Game.Settings.IndexDebug;
return true;
}
if (w.Id == "SETTINGS_CHECKBOX_PERFGRAPH")
{
Game.Settings.PerfGraph = !Game.Settings.PerfGraph;
return true;
}
if (w.Id == "SETTINGS_CHECKBOX_PERFTEXT")
{
Game.Settings.PerfText = !Game.Settings.PerfText;
return true;
}
return false;
}
public override bool OnMouseUp(Widget w, MouseInput mi)
{
if (w.Id == "MAINMENU_BUTTON_SETTINGS")
{
Game.chrome.rootWidget.ShowMenu("SETTINGS_BG");
return true;
}
if (w.Id == "SETTINGS_BUTTON_OK")
{
Game.chrome.rootWidget.ShowMenu("MAINMENU_BG");
return true;
}
return false;
}
}
}