Ejemplo n.º 1
0
 internal MenuItem(MenuItem fatherItem, MenuKind menuKind, ContextMenu contextMenu)
 {
     this.IsRootItem = false;
     this.fatherItem = fatherItem;
     this.menuKind = menuKind;
     this.contextMenu = contextMenu;
     this.MenuItems = new List<MenuItem>();
 }
Ejemplo n.º 2
0
 internal void ResetOtherSelected(MenuItem menuItem)
 {
     foreach (MenuItem item in this.MenuItems)
     {
         if (item == menuItem)
         {
             item.ResetAllItemsSelected();
         }
         else
         {
             item.ResetSelected();
             item.ResetAllItemsSelected();
         }
     }
 }
Ejemplo n.º 3
0
 internal void ResetOtherOpen(MenuItem menuItem)
 {
     foreach (MenuItem item in this.MenuItems)
     {
         if (item == menuItem)
         {
             item.ResetAllItemsOpen();
         }
         else
         {
             item.ResetOpen();
             item.ResetAllItemsOpen();
         }
     }
 }
Ejemplo n.º 4
0
 internal void LoadFromXmlNode(XmlNode rootNode)
 {
     this.ID = int.Parse(rootNode.Attributes.GetNamedItem("ID").Value);
     this.Name = rootNode.Attributes.GetNamedItem("Name").Value;
     this.DisplayName = rootNode.Attributes.GetNamedItem("DisplayName").Value;
     this.DefaultName = this.DisplayName;
     if (rootNode.Attributes.GetNamedItem("DisplayIfTrue") != null)
     {
         this.DisplayIfTrue = rootNode.Attributes.GetNamedItem("DisplayIfTrue").Value;
     }
     if (rootNode.Attributes.GetNamedItem("DisplayAll") != null)
     {
         this.DisplayAll = bool.Parse(rootNode.Attributes.GetNamedItem("DisplayAll").Value);
     }
     if (rootNode.Attributes.GetNamedItem("IsParamIDItem") != null)
     {
         this.IsParamIDItem = bool.Parse(rootNode.Attributes.GetNamedItem("IsParamIDItem").Value);
     }
     if (rootNode.Attributes.GetNamedItem("Param") != null)
     {
         this.Param = rootNode.Attributes.GetNamedItem("Param").Value;
     }
     if (rootNode.Attributes.GetNamedItem("ChangeDisplayName") != null)
     {
         this.ChangeDisplayName = rootNode.Attributes.GetNamedItem("ChangeDisplayName").Value;
     }
     if (rootNode.Attributes.GetNamedItem("OppositeName") != null)
     {
         this.OppositeName = rootNode.Attributes.GetNamedItem("OppositeName").Value;
     }
     if (rootNode.Attributes.GetNamedItem("OppositeIfTrue") != null)
     {
         this.OppositeIfTrue = rootNode.Attributes.GetNamedItem("OppositeIfTrue").Value;
     }
     foreach (XmlNode node in rootNode)
     {
         MenuItem item = new MenuItem(this, this.menuKind, this.contextMenu);
         item.LoadFromXmlNode(node);
         this.MenuItems.Add(item);
     }
 }
Ejemplo n.º 5
0
 internal void LoadFromXmlNode(XmlNode rootNode)
 {
     this.ID = int.Parse(rootNode.Attributes.GetNamedItem("ID").Value);
     this.Name = rootNode.Attributes.GetNamedItem("Name").Value;
     this.DisplayName = rootNode.Attributes.GetNamedItem("DisplayName").Value;
     this.IsLeft = bool.Parse(rootNode.Attributes.GetNamedItem("IsLeft").Value);
     this.ItemWidth = int.Parse(rootNode.Attributes.GetNamedItem("Width").Value);
     this.ItemHeight = int.Parse(rootNode.Attributes.GetNamedItem("Height").Value);
     if (rootNode.Attributes.GetNamedItem("DisplayIfTrue") != null)
     {
         this.DisplayIfTrue = rootNode.Attributes.GetNamedItem("DisplayIfTrue").Value;
     }
     if (rootNode.Attributes.GetNamedItem("DisplayAll") != null)
     {
         this.DisplayAll = bool.Parse(rootNode.Attributes.GetNamedItem("DisplayAll").Value);
     }
     foreach (XmlNode node in rootNode)
     {
         MenuItem item = new MenuItem(this, this.contextMenu);
         item.IsRootItem = true;
         item.LoadFromXmlNode(node);
         this.MenuItems.Add(item);
     }
 }
 public void SetScenario(GameScenario scen)
 {
     foreach (MenuKind kind in this.contextMenu.MenuKinds)
     {
         if (kind.Name.Equals("TroopLeftClick"))
         {
             foreach (MenuItem i in kind.MenuItems)
             {
                 if (i.Name.Equals("TroopCombatMethod"))
                 {
                     i.MenuItems.Clear();
                     foreach (GameObjects.TroopDetail.CombatMethod m in scen.GameCommonData.AllCombatMethods.CombatMethods.Values)
                     {
                         MenuItem item = new MenuItem(i, kind, kind.contextMenu);
                         item.ID = m.ID;
                         item.Name = m.ID.ToString();
                         item.DisplayName = m.Name;
                         item.ChangeDisplayName = "GetCombatMethodDisplayName";
                         item.DisplayIfTrue = "HasCombatMethod";
                         item.IsParamIDItem = true;
                         item.Param = m.ID.ToString();
                         i.MenuItems.Add(item);
                     }
                 }
                 else if (i.Name.Equals("TroopStratagem"))
                 {
                     i.MenuItems.Clear();
                     foreach (GameObjects.TroopDetail.Stratagem m in scen.GameCommonData.AllStratagems.Stratagems.Values)
                     {
                         MenuItem item = new MenuItem(i, kind, kind.contextMenu);
                         item.ID = m.ID;
                         item.Name = m.ID.ToString();
                         item.DisplayName = m.Name;
                         item.ChangeDisplayName = "GetStratagemDisplayName";
                         item.DisplayIfTrue = "HasStratagem";
                         item.Param = m.ID.ToString();
                         i.MenuItems.Add(item);
                     }
                 }
                 else if (i.Name.Equals("TroopStunt"))
                 {
                     i.MenuItems.Clear();
                     foreach (GameObjects.PersonDetail.Stunt m in scen.GameCommonData.AllStunts.Stunts.Values)
                     {
                         MenuItem item = new MenuItem(i, kind, kind.contextMenu);
                         item.ID = m.ID;
                         item.Name = m.ID.ToString();
                         item.DisplayName = m.Name;
                         item.ChangeDisplayName = "GetStuntDisplayName";
                         item.DisplayIfTrue = "HasStunt";
                         item.IsParamIDItem = true;
                         item.Param = m.ID.ToString();
                         i.MenuItems.Add(item);
                     }
                 }
             }
         }
     }
 }