示例#1
0
        void Start()
        {
            List <Rsc> rscList = ResourceManager.GetResourceList();

            for (int i = 0; i < rscList.Count; i++)
            {
                if (i == 0)
                {
                    rscItemList[0].Init();
                }
                else
                {
                    rscItemList.Add(UIObject.Clone(rscItemList[0].rootObj, "Rsc" + (i + 1)));
                }

                rscItemList[i].imgRoot.sprite = rscList[i].icon;
                rscItemList[i].label.text     = rscList[i].value.ToString();
            }

            rscPanelObj.SetActive(false);

            //buttonParentDefaultPos=buttonParent.localPosition;

            towerPanelPosX = towerPanelRectT.localPosition.x;

            //thisObj.SetActive(false);
        }
示例#2
0
        // Use this for initialization
        void Start()
        {
            List <Rsc> rscList = ResourceManager.GetResourceList();

            for (int i = 0; i < rscList.Count; i++)
            {
                if (i == 0)
                {
                    rscItemList[0].Init();
                }
                else
                {
                    rscItemList.Add(UIObject.Clone(rscItemList[0].rootObj, "Rsc" + (i + 1)));
                }

                rscItemList[i].imgRoot.sprite = rscList[i].icon;
                rscItemList[i].label.text     = rscList[i].value.ToString();
            }

            txtTimer.text = "";
            butSpawn.Init();
            butSpawnDefaultPos = butSpawn.rectT.localPosition;

            butFF.Init();

            butPerkMenuObj.SetActive(PerkManager.IsOn());

            OnLife(0);
            OnNewWave(0);
            OnEnableSpawn();
        }
示例#3
0
        void Start()
        {
            List <Rsc> rscList = ResourceManager.GetResourceList();

            for (int i = 0; i < rscList.Count; i++)
            {
                if (i == 0)
                {
                    rscItemList[0].Init();
                }
                else
                {
                    rscItemList.Add(UIObject.Clone(rscItemList[0].rootObj, "Rsc" + (i + 1)));
                }

                rscItemList[i].imgRoot.sprite = rscList[i].icon;
                rscItemList[i].label.text     = rscList[i].value.ToString();
            }

            rscPanelObj.SetActive(false);

            //buttonParentDefaultPos=buttonParent.localPosition;

            towerPanelPosX = towerPanelRectT.localPosition.x;

            if (UIMainControl.InTouchMode())
            {
                butSell.SetCallback(null, null, this.OnSellButton, null);
                butUpgrade1.SetCallback(null, null, this.OnUpgradeButton1, null);
                butUpgrade2.SetCallback(null, null, this.OnUpgradeButton2, null);
            }
            else
            {
                butSell.SetCallback(this.OnHoverSellButton, this.OnExitSellButton, this.OnSellButton, null);
                butUpgrade1.SetCallback(this.OnHoverUpgradeButton1, this.OnExitUpgradeButton, this.OnUpgradeButton1, null);
                butUpgrade2.SetCallback(this.OnHoverUpgradeButton2, this.OnExitUpgradeButton, this.OnUpgradeButton2, null);
            }

            butSell.imgHighlight.enabled     = false;
            butUpgrade1.imgHighlight.enabled = false;
            butUpgrade2.imgHighlight.enabled = false;

            //thisObj.SetActive(false);
        }
示例#4
0
        void Start()
        {
            if (BuildManager.GetInstance() == null)
            {
                return;
            }

            List <UnitTower> towerList = BuildManager.GetTowerList();

            for (int i = 0; i < towerList.Count; i++)
            {
                if (i == 0)
                {
                    buttonList[0].Init();
                }
                else if (i > 0)
                {
                    buttonList.Add(UIButton.Clone(buttonList[0].rootObj, "BuildButton" + (i + 1)));
                }

                buttonList[i].imgIcon.sprite       = towerList[i].iconSprite;
                buttonList[i].imgHighlight.enabled = false;

                if (UIMainControl.InTouchMode())
                {
                    buttonList[i].SetCallback(null, null, this.OnTowerButton, null);
                }
                else
                {
                    buttonList[i].SetCallback(this.OnHoverButton, this.OnExitButton, this.OnTowerButton, null);
                }
            }

            if (!BuildManager.UseDragNDrop())
            {
                canvasGroup.alpha   = 0;
                rectT.localPosition = new Vector3(0, 99999, 0);
            }

            if (!BuildManager.UseDragNDrop() && UIMainControl.UsePieMenu())
            {
                layoutGroup.enabled = false;
                tooltipObj.transform.localPosition -= new Vector3(0, 60, 0);
            }
            else
            {
                layoutGroup.enabled = true;
            }


            List <Rsc> rscList = ResourceManager.GetResourceList();

            for (int i = 0; i < rscList.Count; i++)
            {
                if (i == 0)
                {
                    tooltipRscItemList[0].Init();
                }
                else
                {
                    tooltipRscItemList.Add(UIObject.Clone(tooltipRscItemList[0].rootObj, "Rsc" + (i + 1)));
                }

                tooltipRscItemList[i].imgRoot.sprite = rscList[i].icon;
                tooltipRscItemList[i].label.text     = rscList[i].value.ToString();
            }

            if (!BuildManager.UseDragNDrop())
            {
                butCancelObj.SetActive(false);
            }
            else
            {
                butCancelCanvasG = butCancelObj.AddComponent <CanvasGroup>();
                butCancelObj.transform.SetAsLastSibling();
                OnDragNDrop(false);
            }

            tooltipObj.SetActive(false);
        }
示例#5
0
        void Start()
        {
            if (!manuallySetupItem)
            {
                List <Perk> perkList = PerkManager.GetPerkList();
                for (int i = 0; i < perkList.Count; i++)
                {
                    if (i == 0)
                    {
                        perkItemList[0].Init();
                    }
                    else if (i > 0)
                    {
                        perkItemList.Add(UIPerkItem.Clone(perkItemList[0].rootObj, "PerkButton" + (i + 1)));
                    }

                    perkItemList[i].imgIcon.sprite = perkList[i].icon;
                    perkItemList[i].perkID         = perkList[i].ID;
                    perkItemList[i].selectHighlight.SetActive(i == 0);

                    perkItemList[i].SetCallback(null, null, this.OnPerkItem, null);
                }

                UpdateContentRectSize();
            }
            else
            {
                for (int i = 0; i < perkItemList.Count; i++)
                {
                    perkItemList[i].Init();
                    perkItemList[i].selectHighlight.SetActive(i == 0);
                    perkItemList[i].SetCallback(null, null, this.OnPerkItem, null);
                }
            }


            List <Rsc> rscList = ResourceManager.GetResourceList();

            for (int i = 0; i < rscList.Count; i++)
            {
                if (i == 0)
                {
                    rscItemList[0].Init();
                }
                else
                {
                    rscItemList.Add(UIObject.Clone(rscItemList[0].rootObj, "Rsc" + (i + 1)));
                }

                rscItemList[i].imgRoot.sprite = rscList[i].icon;
                rscItemList[i].label.text     = "";
            }
            rscRootObj = rscItemList[0].rectT.parent.gameObject;

            butPurchase.Init();

            UpdatePerkItemList();
            UpdateDisplay();

            //thisObj.SetActive(false);
            rectT.localPosition = new Vector3(0, 99999, 0);
        }