コード例 #1
0
    public void Layout(InventoryDisplayLayoutPolicy displayLayout)
    {
        _currentLayoutPolicy = displayLayout;
        int    displayArea     = _layoutSettings[displayLayout];
        string displayStr      = displayArea.ToString("D4");
        int    containerLength = displayStr.Length;

        for (int index = containerLength - 1; index >= 0; --index)
        {
            MonoBehaviour mb  = _containerMapping[index];
            string        bit = "";
            bit = displayStr[index] + "";
            if (bit == "1")
            {
                if (mb.gameObject.activeInHierarchy)
                {
                    mb.SendMessage("OnEnable");
                }
                else
                {
                    mb.gameObject.SetActive(true);
                }
                if (mb == itemsListContainer)
                {
                    mb.transform.localPosition = leftAreaPoint.transform.localPosition +
                                                 rightAreaPoint.transform.parent.localPosition;
                }
                else
                {
                    mb.transform.parent        = leftAreaPoint.transform;
                    mb.transform.localPosition = Vector3.zero;
                }
            }
            else if (bit == "2")
            {
                if (mb.gameObject.activeInHierarchy)
                {
                    mb.SendMessage("OnEnable");
                }
                else
                {
                    mb.gameObject.SetActive(true);
                }
                if (mb == itemsListContainer)
                {
                    mb.transform.localPosition = rightAreaPoint.transform.localPosition +
                                                 rightAreaPoint.transform.parent.localPosition;
                }
                else
                {
                    mb.transform.localPosition = Vector3.zero;
                    mb.transform.parent        = rightAreaPoint.transform;
                }
            }
            else
            {
                mb.gameObject.SetActive(false);
            }
        }
    }
コード例 #2
0
    void OnDisable()
    {
        heroPreviewContainer.UpdateTownModel();
        _currentLayoutPolicy = InventoryDisplayLayoutPolicy.NotAvilable;
        PlayerInfo.Instance.PlayerInventory.ClearNewItemInInventory();
        itemsListContainer.ClearNewIcon();

        int containerLength = 4;

        for (int index = containerLength - 1; index >= 0; --index)
        {
            MonoBehaviour mb = _containerMapping[index];
            mb.gameObject.SetActive(false);
        }
        TownHUD.Instance.ResumeShow();
    }
コード例 #3
0
 void OnInitializeWithCaller(InventoryDisplayLayoutPolicy policy)
 {
     TownHUD.Instance.TempHide();
     Layout(policy);
     CurrentSelectionItem = null;
 }