Beispiel #1
0
    private void smprocSetNextButton(GameObject menuObj, uItem smItem, int NextIndexInc)
    {
        Button mButton = menuObj.GetComponent <Button> ();

        CheckSubMenuSet(currSubMenuSetIndex + NextIndexInc);
        SubMenuSet smSet = menuSets [currSubMenuSetIndex + NextIndexInc];

        mButton.onClick.AddListener(() => gotoNextMenu(smItem, smSet));
    }
Beispiel #2
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();
    }
Beispiel #3
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;
            }
        }
    }