Ejemplo n.º 1
0
    public void Show()
    {
        if (_showAInv != null)
        {
            _showAInv.DestroyAll();
            RedoInvIfIfWhichIsEmpty();
        }


        _showAInv = new ShowAInventory(_inv, _content, _scroll_Ini_PosGO.transform.localPosition, Which);
        ResetScroolPos();
        AdjustContentHeight(_inv.InventItems.Count * _tileHeight);
    }
Ejemplo n.º 2
0
    public void Show(float pad = 0)
    {
        if (_inv == null)
        {
            return;
        }

        _pad = _pad == 0 ? pad : _pad;
        if (_showAInv != null)
        {
            _showAInv.DestroyAll();
            RedoInvIfWhichIsEmpty();
        }

        _showAInv = new ShowAInventory(_inv, _content, _scroll_Ini_PosGO.transform.localPosition, Which);
        ResetScroolPos();
        AdjustContentHeight((_inv.InventItems.Count * _tileHeight) + _pad);
    }
Ejemplo n.º 3
0
    void Inventory()
    {
        if (Building.Inventory == null)
        {
            return;
        }

        if (_showAInventory == null)
        {
            _showAInventory = new ShowAInventory(Building.Inventory, _gaveta.gameObject, _invIniPos.transform.localPosition);
            ShowProductionReport();
        }
        else if (oldBuildID != Building.MyId)
        {
            oldBuildID    = Building.MyId;
            oldItemsCount = Building.Inventory.InventItems.Count;

            _showAInventory.DestroyAll();
            _showAInventory = new ShowAInventory(Building.Inventory, _gaveta.gameObject, _invIniPos.transform.localPosition);

            //so when a new building is clicked changes
            ShowProductionReport();
        }
        else if (_showAInventory != null && (oldItemsCount != Building.Inventory.InventItems.Count ||
                                             Building.IsToReloadInv()))
        {
            //if new items got in the inv needs to redo Stats in case is a new production
            if (oldItemsCount != Building.Inventory.InventItems.Count)
            {
                ReloadStatsWhenNeeded(true);
                oldItemsCount = Building.Inventory.InventItems.Count;
            }
            _showAInventory.UpdateToThisInv(Building.Inventory);
        }

        ReloadStatsWhenNeeded();

        _showAInventory.ManualUpdate();
        _inv.text = BuildStringInv(Building);
    }
Ejemplo n.º 4
0
    private void LoadMenu()
    {
        if (_person == null)
        {
            return;
        }

        _title.text = _person.Name + "";
        _info.text  = BuildPersonInfo();

        if (_showAInventory == null)
        {
            _showAInventory = new ShowAInventory(_person.Inventory, _gaveta, _invIniPos.transform.localPosition);
        }
        //diff  person
        else if (_showAInventory != null && _person.IsToReloadInventory())
        {
            _showAInventory.DestroyAll();
            _showAInventory = new ShowAInventory(_person.Inventory, _gaveta, _invIniPos.transform.localPosition);
            _person.InventoryReloaded();
            //if (_aPersonBuildingDetails != null)
            //{
            //    _aPersonBuildingDetails.ManualUpdate(_person, true);
            //}
        }
        _showAInventory.ManualUpdate();
        _inv.text = BuildStringInv(_person);

        if (_aPersonBuildingDetails == null)
        {
            _aPersonBuildingDetails = new ShowAPersonBuildingDetails(_person, _general, _inv_Ini_Pos_Gen.transform.localPosition);
        }
        else
        {
            //manual update
            _aPersonBuildingDetails.ManualUpdate(_person);
        }
    }