Exemple #1
0
 /// <summary>
 /// Set current window <see cref="vInventoryWindow"/> call automatically when Enabled
 /// </summary>
 /// <param name="inventoryWindow"></param>
 internal void SetCurrentWindow(InventoryWindow inventoryWindow)
 {
     if (!windows.Contains(inventoryWindow))
     {
         windows.Add(inventoryWindow);
         if (currentWindow != null)
         {
             currentWindow.gameObject.SetActive(false);
         }
         currentWindow = inventoryWindow;
     }
 }
Exemple #2
0
        void ControlWindowsInput()
        {
            InventoryInput();
            EquipmentInput();

            if (!isOpen)
            {
                return;
            }
            // disable current window
            if ((windows.Count > 0 && windows[windows.Count - 1] != firstWindow) && cancel.GetButtonDown())
            {
                if (windows[windows.Count - 1].ContainsPop_up())
                {
                    windows[windows.Count - 1].RemoveLastPop_up();
                    return;
                }
                else
                {
                    windows[windows.Count - 1].gameObject.SetActive(false);
                    windows.RemoveAt(windows.Count - 1);//remove last window of the window list
                    if (windows.Count > 0)
                    {
                        windows[windows.Count - 1].gameObject.SetActive(true);
                        currentWindow = windows[windows.Count - 1];
                    }
                    else
                    {
                        currentWindow = null; //clear currentWindow if  window list count == 0
                    }
                }
            }
            //check if currenWindow  that was closed
            if (currentWindow != null && !currentWindow.gameObject.activeSelf)
            {
                //remove currentWindow of the window list
                if (windows.Contains(currentWindow))
                {
                    windows.Remove(currentWindow);
                }
                // set currentWindow if window list have more windows
                if (windows.Count > 0)
                {
                    windows[windows.Count - 1].gameObject.SetActive(true);
                    currentWindow = windows[windows.Count - 1];
                }
                else
                {
                    currentWindow = null;//clear currentWindow if  window list count == 0
                }
            }
        }
Exemple #3
0
        void Start()
        {
            inventory = GetComponentInParent <Inventory>();

            if (equipSlots.Count == 0)
            {
                var equipSlotsArray = GetComponentsInChildren <EquipSlot>(true);
                equipSlots = equipSlotsArray.vToList();
            }

            rootWindow = GetComponentInParent <InventoryWindow>();

            foreach (EquipSlot slot in equipSlots)
            {
                slot.onSubmitSlotCallBack   = OnSubmitSlot;
                slot.onSelectSlotCallBack   = OnSelectSlot;
                slot.onDeselectSlotCallBack = OnDeselect;
            }
        }