示例#1
0
        void Awake()
        {
            instance = this;
            thisObj  = gameObject;

            isOn = false;
        }
示例#2
0
        void OnCursorDown(Vector3 cursorPos)
        {
            UnitTower tower = GameControl.Select(cursorPos);

            GameControl.SelectTower(tower);

            if (tower != null)
            {
                if (!BuildManager.UseDragNDrop())
                {
                    UIBuildButton.Hide();
                }
                if (autoCenterCamera)
                {
                    CameraControl.SetPosition(tower.thisT.position);
                }

                UITowerView.Show(tower);
            }
            else
            {
                UITowerView.Hide();

                if (!BuildManager.UseDragNDrop())
                {
                    BuildInfo buildInfo = BuildManager.CheckBuildPoint(cursorPos);
                    UIBuildButton.Show(buildInfo);
                    if (buildInfo.status == _TileStatus.Available && autoCenterCamera)
                    {
                        CameraControl.SetPosition(buildInfo.position);
                    }
                }
            }
        }
示例#3
0
        private void OnCursorDown()
        {
            SelectInfo sInfo = TowerManager.GetSelectInfo(Input.mousePosition);

            bool select = false;
            bool build  = false;

            if (sInfo.HasValidPoint())
            {
                if (sInfo.GetTower() != null)
                {
                    select = true;
                    SelectControl.SelectUnit(sInfo.GetTower());
                    UITowerSelect.Show(sInfo.GetTower());
                }
                else if (buildMode == _BuildMode.PointNBuild && sInfo.AvailableForBuild())
                {
                    build = true;
                    UIBuildButton.Show(sInfo);
                    SelectControl.SelectNode(sInfo.platform, sInfo.nodeID);
                }
            }

            if (buildMode == _BuildMode.PointNBuild && !build)
            {
                SelectControl.ClearNode();
                UIBuildButton.Hide();
            }
            if (!select)
            {
                SelectControl.ClearUnit();
                UITowerSelect.Hide();
            }
        }
示例#4
0
        void OnTouchCursorDown(Vector3 cursorPos)
        {
            UnitTower tower = GameControl.Select(cursorPos);

            if (tower != null)
            {
                SelectTower(tower);
                UIBuildButton.Hide();
            }
            else
            {
                if (selectedTower != null)
                {
                    ClearSelectedTower();
                    return;
                }

                if (!UseDragNDrop())
                {
                    if (BuildManager.CheckBuildPoint(cursorPos) == _TileStatus.Available)
                    {
                        UIBuildButton.Show();
                    }
                    else
                    {
                        UIBuildButton.Hide();
                    }
                }
            }
        }
示例#5
0
        void Start()
        {
            if (limitScale)
            {
                for (int i = 0; i < scalerList.Count; i++)
                {
                    if (Screen.width >= scalerList[i].referenceResolution.x)
                    {
                        instance.scalerList[i].uiScaleMode = CanvasScaler.ScaleMode.ConstantPixelSize;
                    }
                    else
                    {
                        instance.scalerList[i].uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
                    }
                }
            }

            if (perkMenuOnly)
            {
                UIHUD.GetInstance().gameObject.SetActive(false);
                UIBuildButton.GetInstance().gameObject.SetActive(false);
                UIAbilityButton.GetInstance().gameObject.SetActive(false);
                UITowerView.GetInstance().gameObject.SetActive(false);

                UIPerkMenu.DisableCloseButton();
                OnPerkMenu();
            }
        }
示例#6
0
        void OnFPSMode(bool flag)
        {
            //FPSModeCrosshairObj.SetActive(flag);

                        #if UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8 || UNITY_BLACKBERRY
            UIGameMessage.DisplayMessage("FPS mode is not supported in mobile");
                        #endif

            if (flag)
            {
                UIBuildButton.Hide();
                UIAbilityButton.Hide();
                UIPerkMenu.Hide();
                UIFPSHUD.Show();
            }
            else
            {
                if (UseDragNDrop())
                {
                    UIBuildButton.Show();
                }
                if (AbilityManager.IsOn())
                {
                    UIAbilityButton.Show();
                }
                if (PerkManager.IsOn())
                {
                    UIPerkMenu.Show();
                }
                UIFPSHUD.Hide();
            }
        }
示例#7
0
        IEnumerator _OnGameOver(int _star)
        {
            UIBuildButton.Hide();

            yield return(new WaitForSeconds(1.0f));

            UIGameOverMenu.Show(_star);
        }
示例#8
0
        IEnumerator _OnGameOver(bool playerWon)
        {
            UIBuildButton.Hide();

            yield return(new WaitForSeconds(1.0f));

            UIGameOverMenu.Show(playerWon);
        }
示例#9
0
 public static void OnFPSMode(bool flag)
 {
     if (flag)
     {
         UIBuildButton.Hide();
         UIAbilityButton.Hide();
         UIFPS.Show();
     }
     else
     {
         UIBuildButton.Show();
         UIAbilityButton.Show();
         UIFPS.Hide();
     }
 }
示例#10
0
        // Update is called once per frame
        void Update()
        {
            if (GameControl.GetGameState() == _GameState.Over)
            {
                return;
            }

            if (UIUtilities.IsCursorOnUI())
            {
                return;
            }

            if (!UseDragNDrop() && !UIBuildButton.isOn)
            {
                BuildManager.SetIndicator(Input.mousePosition);
            }

            if (Input.GetMouseButtonDown(0))
            {
                UnitTower tower = GameControl.Select(Input.mousePosition);

                if (tower != null)
                {
                    SelectTower(tower);
                    UIBuildButton.Hide();
                }
                else
                {
                    if (selectedTower != null)
                    {
                        ClearSelectedTower();
                        return;
                    }

                    if (!UseDragNDrop())
                    {
                        if (BuildManager.CheckBuildPoint(Input.mousePosition) == _TileStatus.Available)
                        {
                            UIBuildButton.Show();
                        }
                        else
                        {
                            UIBuildButton.Hide();
                        }
                    }
                }
            }
        }
示例#11
0
        void Awake()
        {
            instance    = this;
            thisObj     = gameObject;
            rectT       = thisObj.GetComponent <RectTransform>();
            canvasGroup = thisObj.GetComponent <CanvasGroup>();
            if (canvasGroup == null)
            {
                canvasGroup = thisObj.AddComponent <CanvasGroup>();
            }

            tooltipCanvasG       = tooltipObj.GetComponent <CanvasGroup>();
            tooltipCanvasG.alpha = 0;

            rectT = thisObj.GetComponent <RectTransform>();
        }
示例#12
0
 void OnNewBuildable(UnitTower tower)
 {
     UIBuildButton.NewBuildable(tower);
 }
示例#13
0
        public override void Awake()
        {
            base.Awake();

            instance = this;
        }
示例#14
0
 void OnNewTower(UnitTower newTower)
 {
     UIBuildButton.AddNewTower(newTower);
 }
示例#15
0
        void Awake()
        {
            instance=this;
            thisObj=gameObject;

            isOn=false;
        }
示例#16
0
 void Awake()
 {
     instance = this;
     isOn     = false;
 }