예제 #1
0
 public static void ClearSelectedTower()
 {
     if (instance.selectedTower == null)
     {
         return;
     }
     instance.selectedTower = null;
     UITowerInfo.Hide();
     GameControl.ClearSelectedTower();
 }
예제 #2
0
        void SelectTower(UnitTower tower)
        {
            selectedTower = tower;

            Vector3 screenPos = Camera.main.WorldToScreenPoint(selectedTower.thisT.position);

            UITowerInfo.SetScreenPos(screenPos);

            UITowerInfo.Show(selectedTower, true);
        }
예제 #3
0
        public void OnExitHoverButton(GameObject butObj)
        {
            if (GameControl.GetSelectedTower() != null && !GameControl.GetSelectedTower().IsSampleTower())
            {
                return;
            }

            BuildManager.ClearSampleTower();

            //clear tooltip
            UITowerInfo.Hide();
        }
예제 #4
0
        void Start()
        {
            instance = this;
            thisObj  = gameObject;

            //for build cost
            List <Rsc> rscList = ResourceManager.GetResourceList();

            for (int i = 0; i < rscList.Count; i++)
            {
                if (i == 0)
                {
                    rscObjList[i].Init();
                }
                else
                {
                    rscObjList.Add(rscObjList[0].Clone("RscObj" + i, new Vector3(i * 80, 0, 0)));
                }
                rscObjList[i].imageIcon.sprite = rscList[i].icon;
            }
            rscObj = rscObjList[0].rootT.parent.gameObject;


            //for upgrade/selling cost
            for (int i = 0; i < rscList.Count; i++)
            {
                if (i == 0)
                {
                    rscTooltipObjList[i].Init();
                }
                else
                {
                    rscTooltipObjList.Add(rscTooltipObjList[0].Clone("RscObj" + i, new Vector3(i * 50, 0, 0)));
                }
                rscTooltipObjList[i].imageIcon.sprite = rscList[i].icon;
            }
            float offset = 0.5f * (rscList.Count - 1) * 50;

            for (int i = 0; i < rscList.Count; i++)
            {
                rscTooltipObjList[i].rootT.localPosition += new Vector3(-offset, 0, 0);
            }
            rscTooltipObj.GetComponent <RectTransform>().sizeDelta += new Vector2((rscList.Count - 1) * 50, 0);

            rscTooltipObj.SetActive(false);

            Hide();
        }
예제 #5
0
        public void OnHoverTowerButton(GameObject butObj)
        {
            if (GameControl.GetSelectedTower() != null)
            {
                return;
            }

            int ID = GetButtonID(butObj);

            UnitTower tower = BuildManager.GetSampleTower(ID);

            if (!UI.UseDragNDrop())
            {
                BuildManager.ShowSampleTower(ID);
            }                                                             //clear sample

            //show tooltip
            UITowerInfo.Show(tower);
        }