コード例 #1
0
        private void RefreshCategories()
        {
            foreach (CategorySlot slot in slots)
            {
                slot.Hide();
            }

            PlayerCharacter player = parent_ui.GetPlayer();

            if (player != null)
            {
                int index = 0;
                List <GroupData> groups = player.Crafting.GetCraftGroups();

                foreach (GroupData group in groups)
                {
                    if (index < slots.Length)
                    {
                        CategorySlot     slot  = (CategorySlot)slots[index];
                        List <CraftData> items = CraftData.GetAllCraftableInGroup(parent_ui.GetPlayer(), group);
                        if (items.Count > 0)
                        {
                            slot.SetSlot(group);
                            index++;
                        }
                    }
                }

                CraftSubPanel.Get(GetPlayerID())?.Hide();
            }
        }
コード例 #2
0
        protected override void Awake()
        {
            base.Awake();
            panel_list.Add(this);
            parent_ui = GetComponentInParent <PlayerUI>();

            for (int i = 0; i < slots.Length; i++)
            {
                CategorySlot cslot = (CategorySlot)slots[i];
                if (cslot.group)
                {
                    default_categories.Add(cslot.group);
                }
            }

            if (animator != null)
            {
                animator.SetBool("Visible", IsVisible());
            }
        }
コード例 #3
0
        private void OnClick(UISlot uislot)
        {
            if (uislot != null)
            {
                CategorySlot cslot = (CategorySlot)uislot;

                for (int i = 0; i < slots.Length; i++)
                {
                    slots[i].UnselectSlot();
                }

                if (cslot.group == CraftSubPanel.Get(GetPlayerID())?.GetCurrentCategory())
                {
                    CraftSubPanel.Get(GetPlayerID())?.Hide();
                }
                else
                {
                    selected_slot = uislot.index;
                    uislot.SelectSlot();
                    CraftSubPanel.Get(GetPlayerID())?.ShowCategory(cslot.group);
                }
            }
        }