Exemple #1
0
        public void Awake()
        {
            instance    = this;
            thisObj     = gameObject;
            canvasGroup = thisObj.GetComponent <CanvasGroup>();
            if (canvasGroup == null)
            {
                canvasGroup = thisObj.AddComponent <CanvasGroup>();
            }

            canvasGroup.alpha = 0;
            thisObj.SetActive(false);
            thisObj.GetComponent <RectTransform>().anchoredPosition = new Vector3(0, 0, 0);

            fpsItem.Init();
            recticleSpreadDefaultSize = recticleSpreadRectT.sizeDelta;

            reloadProgressObj = imgReloadProgress.transform.parent.gameObject;
            reloadProgressObj.SetActive(false);

            UIItemCallback itemCallback = buttonFireObj.AddComponent <UIItemCallback>();

            itemCallback.SetDownCallback(this.OnFireButtonDown);
            itemCallback.SetUpCallback(this.OnFireButtonUp);

            buttonExit.Init();
        }
 public static void OnFPSMode(bool flag)
 {
     if (flag)
     {
         UIBuildButton.Hide();
         UIAbilityButton.Hide();
         UIFPS.Show();
     }
     else
     {
         UIBuildButton.Show();
         UIAbilityButton.Show();
         UIFPS.Hide();
     }
 }
        void Update()
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                if (BuildManager.UseDragNDrop() && BuildManager.InDragNDrop())
                {
                    return;
                }
                if (!UITowerView.IsOn() && !AbilityManager.IsSelectingTarget() && !UIPerkMenu.IsOn() && !UIFPS.IsOn())
                {
                    TogglePause();
                }
            }

            //keyboard for cursor based input start here
            if (!enableInput)
            {
                return;
            }

            if (Input.touchCount > 1)
            {
                return;
            }
            if (UI.IsCursorOnUI(0) || UI.IsCursorOnUI())
            {
                return;
            }

            if (Input.GetMouseButtonDown(0))
            {
                OnCursorDown(Input.mousePosition);
            }
        }