示例#1
0
    private subMenuItemExtra AddSubMenuItemExtra(List <uItem> ItemList, string Text, string SubText, float Height)
    {
        subMenuItemExtra new_item = new subMenuItemExtra(Text, SubText, Height);

        ItemList.Add(new_item);
        return(new_item);
    }
示例#2
0
    public void addSubMenu(GameObject Container, subMenuItemExtra smItem)
    {
        GameObject newMenu = Instantiate(submenuItem, new Vector3(0, 0, 0), new Quaternion(0, 0, 0, 0)) as GameObject;

        smprocSetNextButton(newMenu, smItem, 2);
        smprocSetText(newMenu, "Text", smItem.Text);
        smprocSetText(newMenu, "ExtraText", smItem.ExtraText);
        FillItemRectTransform(newMenu.GetComponent <RectTransform> (), smItem.Height, Container.transform);
    }
示例#3
0
 private void fillNextContainer(List <uItem> Items, GameObject NextContainer)
 {
     for (int itemIndex = 0; itemIndex < Items.Count; itemIndex++)
     {
         if (Items[itemIndex] is subMenuItemExtra)
         {
             subMenuItemExtra smItem = Items[itemIndex] as subMenuItemExtra;
             addSubMenu(NextContainer, smItem);
         }
         if (Items[itemIndex] is subMenuItemSingle)
         {
             subMenuItemSingle smItem = Items[itemIndex] as subMenuItemSingle;
             addSubMenu2(NextContainer, smItem);
         }
         if (Items[itemIndex] is callInfoItem)
         {
             callInfoItem iItem = Items[itemIndex] as callInfoItem;
             addInfoPhoneNumber(NextContainer, iItem);
         }
         if (Items[itemIndex] is inetLinkItem)
         {
             inetLinkItem iItem = Items[itemIndex] as inetLinkItem;
             addUrlItem(NextContainer, iItem);
         }
         if (Items[itemIndex] is calendarItem)
         {
             calendarItem iItem = Items[itemIndex] as calendarItem;
             addCalendarItem(NextContainer, iItem);
         }
         if (Items[itemIndex] is tableItem)
         {
             tableItem iItem = Items[itemIndex] as tableItem;
             addTableItem(NextContainer, iItem);
         }
         if (Items[itemIndex] is textInfoItem)
         {
             textInfoItem iItem = Items[itemIndex] as textInfoItem;
             addTextInfoItem(NextContainer, iItem);
         }
         if (Items[itemIndex] is mapItem)
         {
             mapItem iItem = Items[itemIndex] as mapItem;
             addMapItem(NextContainer, iItem);
         }
     }
 }
示例#4
0
    public void gotoNextMenu(uItem Item, SubMenuSet subMenuSet)
    {
        if (menuMover.IsCancelNextMenu() || menuMover.IsMenuMoving())
        {
            return;
        }
        currMenuHeight = 0;
        clearMenu(subMenuSet.Container);

        List <uItem> subItems = null;

        if (Item is mainMenuItem)
        {
            mainMenuItem mmItem = Item as mainMenuItem;
            subMenuSet.Title.text = mmItem.Text;
            subItems = mmItem.Items;
        }
        if (Item is subMenuItemExtra)
        {
            subMenuItemExtra smItem = Item as subMenuItemExtra;
            subMenuSet.Title.text = smItem.Text;
            subItems = smItem.Items;
        }
        if (Item is subMenuItemSingle)
        {
            subMenuItemSingle smItem = Item as subMenuItemSingle;
            subMenuSet.Title.text = smItem.Text;
            subItems = smItem.Items;
        }

        if (subItems != null)
        {
            fillNextContainer(subItems, subMenuSet.Container);
        }

        Resources.UnloadUnusedAssets();
        menuMover.nextMenuLevel();
    }
示例#5
0
    //----------------------------------------------------------------
    //----------------------------------------------------------------

    private void ParseNode(XmlNode Node, uItem ParentItem)
    {
        List <uItem> ParentItems = null;

        if (ParentItem is mainMenuItem)
        {
            ParentItems = (ParentItem as mainMenuItem).Items;
        }
        if (ParentItem is subMenuItemSingle)
        {
            ParentItems = (ParentItem as subMenuItemSingle).Items;
        }
        if (ParentItem is subMenuItemExtra)
        {
            ParentItems = (ParentItem as subMenuItemExtra).Items;
        }
        if ((ParentItems == null) || (Node == null))
        {
            return;
        }

        for (int childInd = 0; childInd < Node.ChildNodes.Count; childInd++)
        {
            XmlNode childNode = Node.ChildNodes[childInd];
            switch (childNode.Name)
            {
            case "subitem": {
                string            itemText   = GetLocalizedTextFromAttribute(childNode, "text");
                float             itemHeight = GetFloatFromAttribute(childNode, "height", itemHeightSingle);
                subMenuItemSingle subItem    = AddSubMenuItemSingle(ParentItems, itemText, itemHeight);
                subItem.Items = new List <uItem> ();
                ParseNode(childNode, subItem);
            } break;

            case "subitemextra": {
                string           itemText      = GetLocalizedTextFromAttribute(childNode, "text");
                string           itemTextExtra = GetLocalizedTextFromAttribute(childNode, "extratext");
                float            itemHeight    = GetFloatFromAttribute(childNode, "height", itemHeightExtra);
                subMenuItemExtra subItem       = AddSubMenuItemExtra(ParentItems, itemText, itemTextExtra, itemHeight);
                subItem.Items = new List <uItem> ();
                ParseNode(childNode, subItem);
            } break;

            case "textitem": {
                string itemText   = GetLocalizedTextFromAttribute(childNode, "text");
                float  itemHeight = GetFloatFromAttribute(childNode, "height", itemHeightText);
                AddTextInfoItem(ParentItems, itemText, itemHeight);
            } break;

            case "mapitem": {
                string CenterCoord = GetTextFromAttribute(childNode, "center");
                string MarkCoord   = GetTextFromAttribute(childNode, "mark");
                float  itemHeight  = GetFloatFromAttribute(childNode, "height", itemHeightMap);
                AddMapItem(ParentItems, CenterCoord, MarkCoord, itemHeight);
            } break;

            case "phone": {
                string itemText   = GetLocalizedTextFromAttribute(childNode, "text");
                string callNumber = GetTextFromAttribute(childNode, "callnum");
                float  itemHeight = GetFloatFromAttribute(childNode, "height", itemHeightCall);
                AddCallInfoItem(ParentItems, itemText, callNumber, itemHeight);
            } break;

            case "link": {
                string itemText   = GetLocalizedTextFromAttribute(childNode, "text");
                string inetLink   = GetLocalizedTextFromAttribute(childNode, "link");
                float  itemHeight = GetFloatFromAttribute(childNode, "height", itemHeightLink);
                AddInetLinkItem(ParentItems, itemText, inetLink, itemHeight);
            } break;

            case "table": {
                float rowHeight = GetFloatFromAttribute(childNode, "rowheight", rowHeightTable);

                List <List <tableCell> > table = new List <List <tableCell> >();

                for (int rowInd = 0; rowInd < childNode.ChildNodes.Count; rowInd++)
                {
                    XmlNode rowNode = childNode.ChildNodes[rowInd];
                    if (rowNode.Name != "row")
                    {
                        continue;
                    }
                    List <tableCell> tableRow = new List <tableCell>();
                    Color            rowColor = GetColorFromAttribute(rowNode, "rowcolor", themeManager.menuColor);
                    for (int col = rowNode.Attributes.Count - 1; col >= 0; col--)
                    {
                        string coltext = GetLocalizedTextFromAttribute(rowNode, "c" + (col + 1).ToString());
                        if (coltext != "")
                        {
                            tableCell Cell = new tableCell();
                            Cell.value = coltext;
                            Cell.color = rowColor;
                            tableRow.Add(Cell);
                        }
                    }
                    table.Add(tableRow);
                }

                AddTableItem(ParentItems, table, rowHeight);
            } break;

            case "calendar": {
                float itemHeight  = GetFloatFromAttribute(childNode, "height", itemHeightCalendar);
                int   monthId     = Convert.ToInt32(GetTextFromAttribute(childNode, "num"));
                int   monthDays   = Convert.ToInt32(GetTextFromAttribute(childNode, "days"));
                int   monthDayPos = Convert.ToInt32(GetTextFromAttribute(childNode, "daypos"));
                if ((monthId < 1) || (monthId > 12))
                {
                    monthId = 0;
                }
                if (monthDays < 28)
                {
                    monthDays = 28;
                }
                if (monthDays > 31)
                {
                    monthDays = 31;
                }
                if (monthDayPos < 0)
                {
                    monthDayPos = 0;
                }
                if (monthDayPos > 6)
                {
                    monthDayPos = 6;
                }

                List <int> days = new List <int>();
                for (int dayInd = 0; dayInd < childNode.ChildNodes.Count; dayInd++)
                {
                    XmlNode dayNode = childNode.ChildNodes[dayInd];
                    if (dayNode.Name != "day")
                    {
                        continue;
                    }

                    int dayId = Convert.ToInt32(dayNode.InnerText);
                    if ((dayId >= 1) && (dayId <= monthDays))
                    {
                        days.Add(dayId);
                    }
                }

                AddCalendarItem(ParentItems, month_names[monthId], monthDayPos, monthDays, days, itemHeight);
            } break;
            }
        }
    }