Beispiel #1
0
        protected UXElement FetchPerkGridItem(UXGrid perkGrid, string itemUid)
        {
            UXElement uXElement = null;

            if (perkGrid != null)
            {
                int i     = 0;
                int count = perkGrid.Count;
                while (i < count)
                {
                    UXElement item = perkGrid.GetItem(i);
                    if (item.Root.name.Contains(itemUid))
                    {
                        uXElement = item;
                        uXElement.SetRootName(itemUid);
                        break;
                    }
                    i++;
                }
            }
            if (uXElement == null)
            {
                uXElement = perkGrid.CloneTemplateItem(itemUid);
            }
            return(uXElement);
        }
Beispiel #2
0
        protected override void FilterGridBasedOnId(string filterId)
        {
            base.FilterGridBasedOnId(filterId);
            List <UXElement> list = new List <UXElement>(this.perkGrid.GetElementList());

            this.perkGrid.ClearWithoutDestroy();
            list.Sort(new Comparison <UXElement>(this.SortUpgradeList));
            UXUtils.SortListForTwoRowGrids(list, this.perkGrid);
            int count = list.Count;

            for (int i = 0; i < count; i++)
            {
                UXElement uXElement = list[i];
                PerkVO    perkVO    = uXElement.Tag as PerkVO;
                string    rootName  = "PerkItem_" + perkVO.PerkGroup;
                uXElement.SetRootName(rootName);
                this.perkGrid.AddItem(uXElement, i);
            }
            List <UXElement> list2 = this.filterMap[filterId];

            this.gridToFilter.MaxItemsPerLine = (list2.Count + 1) / 2;
            this.perkGrid.RepositionItemsFrameDelayed(new UXDragDelegate(base.OnRepositionComplete));
            list.Clear();
        }