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(); } }
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(); } }
public static void OnFPSMode(bool flag) { if (flag) { UIBuildButton.Hide(); UIAbilityButton.Hide(); UIFPS.Show(); } else { UIBuildButton.Show(); UIAbilityButton.Show(); UIFPS.Hide(); } }
//~ void OnGUI(){ //~ GUI.Label(new Rect(10, Screen.height/2, 130, 35), "ability:"); //~ if(GUI.Button(new Rect(80, Screen.height/2, 130, 35), ""+targetMode)){ //~ if(targetMode==_TargetMode.DragNDrop) targetMode=_TargetMode.SelectNDeploy; //~ else if(targetMode==_TargetMode.SelectNDeploy) targetMode=_TargetMode.DragNDrop; //~ } //~ GUI.Label(new Rect(10, Screen.height/2+40, 130, 35), "build:"); //~ if(GUI.Button(new Rect(80, Screen.height/2+40, 130, 35), ""+buildMode)){ //~ if(buildMode==_BuildMode.DragNDrop) buildMode=_BuildMode.PointNBuild; //~ else if(buildMode==_BuildMode.PointNBuild) buildMode=_BuildMode.PointNBuild; //~ } //~ } void Update() { if (!isGameScene) { return; } if (TowerManager.InDragNDropPhase()) { //for mobile, to prevent getting stuck in DnD phase if user click but not drag the button //if(Input.touchCount==0) TowerManager.ExitDragNDropPhase(); return; } //for mobile, to prevent getting stuck in target select phase if user click but not drag the button //if(AbilityManager.InTargetSelectionMode()){ // if(Input.touchCount==0) AbilityManager.ClearSelect(); //} int pointerID = Input.touchCount == 0 ? -1 : 0; if (Input.GetMouseButtonDown(0) && !UI.IsCursorOnUI(pointerID)) { if (!InTargetSelectionMode()) { OnCursorDown(); } } if (Input.GetMouseButtonUp(0) && !wasCursorOnUI) { if (AbilityManager.InTargetSelectionMode()) { OnCursorDownAbilityTargetMode(); } else if (pendingAbilityIdx >= 0) { OnCursorDownAbilityTargetMode(pendingAbilityIdx); pendingAbilityIdx = -1; } } if (Input.GetMouseButtonDown(1)) { UIAbilityButton.ClearSelect(); //ClearSelectedAbility(); } wasCursorOnUI = UI.IsCursorOnUI(pointerID); //to be used for next frame }
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.localPosition = new Vector3(0, 0, 0); }
void OnNewAbility(Ability ability) { UIAbilityButton.NewAbility(ability); }
void Awake(){ instance=this; thisObj=gameObject; }
void Awake() { instance = this; thisObj = gameObject; }
void Awake() { instance = this; }
void OnNewAbility(Ability newAbility) { Debug.Log("new abiility"); UIAbilityButton.AddNewAbility(newAbility); }
public override void Awake() { base.Awake(); instance = this; }