public MenuItem(string txt, Screen screenLink, LinkedEvent evLink) { enabled = true; text = txt; linksTo = screenLink; if (evLink != null) { eventLink = new InputEventHandler(evLink); } else { eventLink = null; } }
public static SimpleUI InitUI() { FontSurface fnt = FontSurface.BitmapMonospace("Resources" + "/" + "monkey.png", new Size(6, 14)); Screen initialActionChoices = new Screen("Act!", new List<MenuItem>()), attackChoices = new Screen("Attack!", new List<MenuItem>()); MenuItem moveItem = new MenuItem("Move", null, Demo.OnKeyDown_SelectMove, Demo.HighlightMove), attackItem = new MenuItem("Attack", attackChoices, null), waitItem = new MenuItem("Wait", null, null, Demo.waitAction), lookItem = new MenuItem("Look", null, Demo.OnKeyDown_LookAround); initialActionChoices.menu.Add(moveItem); initialActionChoices.menu.Add(attackItem); initialActionChoices.menu.Add(waitItem); initialActionChoices.menu.Add(lookItem); attackChoices.previousScreen = initialActionChoices; //attackChoices.menu.Add(new MenuItem("Scorch", null, Demo.OnKeyDown_SelectSkill)); SimpleUI sui = new SimpleUI(initialActionChoices, fnt); sui.allScreens.Add("Act", initialActionChoices); sui.allScreens.Add("Attack", attackChoices); sui.allMenuItems.Add(moveItem); sui.allMenuItems.Add(attackItem); sui.allMenuItems.Add(waitItem); sui.allMenuItems.Add(lookItem); return sui; }
public SimpleUI(Screen s, FontSurface fnt) { initialScreen = s; // previousScreen = s.Clone(); currentScreen = s; allScreens = new Dictionary<String, Screen>() { { s.title, s } }; allMenuItems = new List<MenuItem>(s.menu); font = fnt; }
public static void NavigateBackward(Screen s) { // currentUI.initialScreen = currentUI.currentScreen.Clone(); // currentUI.previousScreen = currentUI.currentScreen.Clone(); currentUI.currentScreen = s.previousScreen; }