public void Init(KeyControl keyController, ShipModel ship, UIRemodelEquipSlotItem slotItem)
        {
            this.ship     = ship;
            this.slotItem = slotItem;
            this.group    = this.GetHashCode();
            if (keyController != null)
            {
                keyController.ClearKeyAll();
                keyController.firstUpdate = true;
            }
            this.keyController = keyController;
            if (this.items == null)
            {
                this.items = new List <CategoryMenuItem>();
            }
            this.items.Clear();
            int index = 0;

            CategoryMenuItem[] componentsInChildren = this.itemContainer.get_transform().GetComponentsInChildren <CategoryMenuItem>();
            for (int i = 0; i < componentsInChildren.Length; i++)
            {
                CategoryMenuItem categoryMenuItem = componentsInChildren[i];
                categoryMenuItem.Init(this, index, this.selectableCategories.IndexOf(this.Categories[index++]) != -1);
                this.items.Add(categoryMenuItem);
            }
            for (int j = 0; j < this.items.get_Count(); j++)
            {
                if (this.changeCurrentItem(j))
                {
                    this._BeforeIdx = j;
                    break;
                }
            }
            bool flag = slotItem.GetModel() != null;

            if (flag)
            {
                this.removeItem.Init(this, -1, true);
            }
            this.removeItem.SetActive(flag);
        }
Exemplo n.º 2
0
        public void Init(KeyControl keyController, ShipModel ship, UIRemodelEquipSlotItem slotItem)
        {
            this.ship     = ship;
            this.slotItem = slotItem;
            group         = ((UnityEngine.Object) this).GetHashCode();
            if (keyController != null)
            {
                keyController.ClearKeyAll();
                keyController.firstUpdate = true;
            }
            this.keyController = keyController;
            if (items == null)
            {
                items = new List <CategoryMenuItem>();
            }
            items.Clear();
            int num = 0;

            CategoryMenuItem[] componentsInChildren = itemContainer.transform.GetComponentsInChildren <CategoryMenuItem>();
            foreach (CategoryMenuItem categoryMenuItem in componentsInChildren)
            {
                categoryMenuItem.Init(this, num, selectableCategories.IndexOf(Categories[num++]) != -1);
                items.Add(categoryMenuItem);
            }
            for (int j = 0; j < items.Count; j++)
            {
                if (changeCurrentItem(j))
                {
                    _BeforeIdx = j;
                    break;
                }
            }
            bool flag = slotItem.GetModel() != null;

            if (flag)
            {
                removeItem.Init(this, -1, enabled: true);
            }
            removeItem.SetActive(flag);
        }