예제 #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);
    }
예제 #2
0
    private void ShowProductionReport(List <Inventory> list)
    {
        Hide();
        _bulletinWindow.ShowScrool();

        var itemsOnReport = 0;

        for (int i = 0; i < ShowLastYears(list); i++)
        {
            var a = new ShowAInventory(list[i], _bulletinWindow.Content.gameObject,
                                       _bulletinWindow.ScrollIniPosGo.transform.localPosition + new Vector3(0, itemsOnReport * -3.7f, 0));

            _reports.Add(a);
            itemsOnReport += list[i].InventItems.Count;
        }
        _bulletinWindow.AdjustContentHeight(ItemsOnReport(_productionReport.ConsumeReport) * 1.5f);
    }
예제 #3
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);
    }
예제 #4
0
파일: BuildingWindow.cs 프로젝트: Cdrix/SM
    private void ShowProductionReport()
    {
        for (int i = 0; i < _reports.Count; i++)
        {
            _reports[i].DestroyAll();
        }
        _reports.Clear();

        var pastItems = 0;

        for (int i = 0; i < ShowLastYears(); i++)
        {
            var a = new ShowAInventory(Building.ProductionReport.ProduceReport[i], _stats.gameObject,
                                       _invIniPosSta.transform.localPosition + new Vector3(0, pastItems * -3.5f * i, 0));

            _reports.Add(a);
            pastItems = Building.ProductionReport.ProduceReport[i].InventItems.Count;
        }
    }
예제 #5
0
    private void ShowProductionReport(List <Inventory> list)
    {
        Hide();
        _bulletinWindow.ShowScrool();

        var pastItems = 0;

        for (int i = 0; i < list.Count; i++)
        {
            var margin = i > 0 ? -4f : 0f;
            var yPos   = (pastItems * -3.75f) + margin;

            var a = new ShowAInventory(list[i], _bulletinWindow.Content.gameObject, new Vector3(), "Bulletin.Prod.Report");


            _reports.Add(a);
            pastItems = list[i].InventItems.Count;
        }
    }
예제 #6
0
파일: BuildingWindow.cs 프로젝트: Cdrix/SM
    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);
    }
예제 #7
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);
        }
    }
예제 #8
0
    static public ShowInvetoryItem Create(Transform container, InvItem invItem, Vector3 iniPos, ShowAInventory parent,
                                          string invType = "")
    {
        ShowInvetoryItem obj = null;
        var root             = "";

        if (string.IsNullOrEmpty(invType))
        {
            root = Root.show_Invent_Item_Small_3_Text + " 2";
        }
        else if (invType == "Bulletin.Prod.Report")
        {
            root = Root.show_Invent_Item_Small_3_Text + " 4";
        }
        else
        {
            //for
            root = Root.show_Invent_Item_Small_Med + " 2";
        }

        obj = (ShowInvetoryItem)Resources.Load(root, typeof(ShowInvetoryItem));
        obj = Instantiate(obj, container.transform);

        if (obj.InitialPositionPoint != null && obj.InitialPositionPoint.position != new Vector3())
        {
            obj.transform.SetParent(container);
            obj.transform.localPosition = obj.InitialPositionPoint.localPosition;
        }

        obj.Parent   = parent;
        obj.InvItem1 = invItem;
        obj.InvType  = invType;

        return(obj);
    }
예제 #9
0
    static public ShowInvetoryItem Create(Transform container, InvItem invItem, Vector3 iniPos, ShowAInventory parent,
                                          string invType = "")
    {
        ShowInvetoryItem obj = null;
        var root             = "";

        if (string.IsNullOrEmpty(invType))
        {
            root = Root.show_Invent_Item_Small_3_Text + " 2";
        }
        else
        {
            //for main
            root = Root.show_Invent_Item_Small_Med + " 2";
        }
        obj = (ShowInvetoryItem)Resources.Load(root, typeof(ShowInvetoryItem));
        obj = (ShowInvetoryItem)Instantiate(obj, new Vector3(), Quaternion.identity);


        //var iniScale = obj.transform.localScale;
        //obj.transform.SetParent(container);
        //obj.transform.localPosition = iniPos;
        //obj.transform.localScale = iniScale;

        obj.transform.SetParent(container);

        //CorrectLocalScaleBasedOnScreenSize(obj.transform);

        obj.transform.localPosition = iniPos;

        obj.Parent   = parent;
        obj.InvItem1 = invItem;
        obj.InvType  = invType;

        return(obj);
    }