Exemplo n.º 1
0
 public void addSkills(Demo.Mob mb)
 {
     foreach (Skill sk in mb.skillList)
     {
         MenuItem skmi = new MenuItem(sk.name, null, Demo.OnKeyDown_SelectSkill, Demo.HighlightSkill);
         allScreens["Attack"].menu.Add(skmi);
         allMenuItems.Add(skmi);
     }
 }
Exemplo n.º 2
0
 public static bool OnKeyDown_Menu(InputEventArgs e)
 {
     if (isHidden)
     {
         return false;
     }
     else
     {
         if ((e.KeyCode == KeyCode.Up || (Demo.hjkl && e.KeyCode == KeyCode.K)) && currentUI.currentScreen.menu.Count > 1 && currentUI.currentScreen.currentMenuItem > 0)
             currentUI.currentScreen.currentMenuItem--;
         else if ((e.KeyCode == KeyCode.Down || (Demo.hjkl && e.KeyCode == KeyCode.J)) && currentUI.currentScreen.menu.Count > 1 && currentUI.currentScreen.currentMenuItem < currentUI.currentScreen.menu.Count - 1)
             currentUI.currentScreen.currentMenuItem++;
         else if (e.KeyCode == confirmKey && currentUI.currentScreen.menu[currentUI.currentScreen.currentMenuItem].enabled &&
                  (currentUI.currentScreen.menu[currentUI.currentScreen.currentMenuItem].linksTo != null ||
                   currentUI.currentScreen.menu[currentUI.currentScreen.currentMenuItem].eventLink != null
                || currentUI.currentScreen.menu[currentUI.currentScreen.currentMenuItem].actionLink != null))
         {
             menuItemForFinish = currentUI.currentScreen.menu[currentUI.currentScreen.currentMenuItem];
             menuItemsForRecall.Add(currentUI.currentScreen.menu[currentUI.currentScreen.currentMenuItem]);
             currentUI.currentScreen.menu[currentUI.currentScreen.currentMenuItem].enabled = false;
             currentUI.currentScreen.menu[currentUI.currentScreen.currentMenuItem].handleAction(e);
         }
         else if (e.KeyCode == backKey && currentUI.currentScreen.previousScreen != null && currentUI.currentScreen != currentUI.initialScreen)
         {
             currentUI.currentScreen.menu[currentUI.currentScreen.currentMenuItem].enabled = true;
             NavigateBackward(currentUI.currentScreen);
             HandleRecall();
         }
         return false;
     }
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 public static void HandleFinish()
 {
     if (menuItemForFinish != null)
     {
         menuItemsForRecall.Clear();
         menuItemForFinish.handleFinish();
         menuItemForFinish = null;
     }
 }