Пример #1
0
    public void SortAsType(int type)
    {
        Inventories.ResetInventory();

        for (int i = 0; i < GameManager.Inst().Player.MaxInventory; i++)
        {
            Player.EqData eq = GameManager.Inst().Player.GetItem(i);
            Inventories.GetSlot(i).Selected.SetActive(false);

            if (eq != null)
            {
                if (eq.Type == type)
                {
                    Sprite icon = GameManager.Inst().UiManager.FoodImages[eq.Type + eq.Rarity * Constants.MAXREINFORCETYPE];
                    if (eq.UID / 100 == 6)
                    {
                        icon = eq.Icon;
                    }

                    InventorySlot slot = Inventories.GetSlot(i);
                    slot.gameObject.SetActive(true);
                    slot.GetNotExist().SetActive(false);
                    slot.GetExist().SetActive(true);
                    slot.SetIcon(icon);
                    slot.SetDisable(false);
                    slot.SetGradeSprite(eq.Rarity);
                }
                else
                {
                    Sprite        icon = GameManager.Inst().UiManager.FoodImages[eq.Type + eq.Rarity * Constants.MAXREINFORCETYPE];
                    InventorySlot slot = Inventories.GetSlot(i);
                    slot.gameObject.SetActive(true);

                    slot.GetNotExist().SetActive(false);
                    slot.GetExist().SetActive(true);
                    slot.SetIcon(icon);
                    slot.SetDisable(true);
                    slot.SetGradeSprite(eq.Rarity);
                }
            }
        }

        GameManager.Inst().Player.SortOption = type + (int)InventorySlot.SortOption.TYPE_RARITY;

        Inventories.Sort();
    }
Пример #2
0
    public void DisableSelectedSlot()
    {
        if (SelectedIndex <= -1)
        {
            return;
        }

        //for (int i = 0; i < GameManager.Inst().Player.MAXINVENTORY; i++)
        //{
        //    if (Inventories.GetSlot(i).GetItemUID() == GameManager.Inst().Player.GetItem(SelectedIndex).UID)
        //        Inventories.GetSlot(i).SetSelected(false);
        //}
        Inventories.GetSlot(Inventories.GetSwitchedIndex(SelectedIndex)).SetSelected(false);
    }
Пример #3
0
    public void SortAsDefault()
    {
        for (int i = 0; i < GameManager.Inst().Player.MaxInventory; i++)
        {
            Player.EqData eq = GameManager.Inst().Player.GetItem(i);

            if (eq != null)
            {
                if (eq.UID / 100 == 6)
                {
                    Sprite        icon = eq.Icon;
                    InventorySlot slot = Inventories.GetSlot(i);
                    slot.gameObject.SetActive(true);

                    slot.GetNotExist().SetActive(false);
                    slot.GetExist().SetActive(true);
                    slot.SetIcon(icon);
                    slot.SetDisable(false);
                    slot.SetGradeSprite(eq.Rarity);

                    for (int j = 0; j < Constants.MAXBULLETS; j++)
                    {
                        if (GameManager.Inst().UpgManager.BData[j].GetEquipIndex() == Inventories.GetSwitchedIndex(i))
                        {
                            slot.EMark.SetActive(true);
                        }
                    }
                }
            }
            else
            {
                Inventories.HideSlot(i);
            }
        }

        GameManager.Inst().Player.SortOption = (int)InventorySlot.SortOption.SYNTHESIS;

        Inventories.Sort();
    }
Пример #4
0
    void ShowInventory()
    {
        Inventories = GameManager.Inst().UiManager.InventoryScroll.GetComponent <InventoryScroll>();
        Inventories.transform.SetParent(InventoryArea.transform, false);
        Inventories.SetSlotType(1);

        Inventories.ShowInventory();

        for (int i = 0; i < Constants.MAXBULLETS; i++)
        {
            if (GameManager.Inst().UpgManager.BData[i].GetEquipIndex() != -1)
            {
                InventorySlot slot = Inventories.GetSlot(Inventories.GetSwitchedIndex(GameManager.Inst().UpgManager.BData[i].GetEquipIndex()));
                slot.EMark.SetActive(true);
            }
        }
    }