public void Hide() { if (shown) { shown = false; UIMan.RemoveRange(buts); } }
void Awake(){ SetupCamera (); Time.timeScale = 1f; uiMan = GetComponent<UIMan> (); CameraControl.main.m_MinSize = 20f; Invoke ("Awaken", 2f); }
public void Show() { if (!shown) { shown = true; UIMan.AddRange(buts); } }
void Awake() { GameObject go = GameObject.Find("Canvas/dbgInfo/titles"); titles = getCompsInChildren <Text>(go.transform); go = GameObject.Find("Canvas/dbgInfo/values"); values = getCompsInChildren <Text>(go.transform); mInst = this; }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Debug.Log("Instance already exists, destroying object!"); Destroy(this); } }
//Enter the battle (voluntarily) public void enterBattle() { //Set flag isInBattle = true; //Move camera to center Camera.main.GetComponent <CombatCam>().resetCamera(); //Draw tiles unitGameObject().GetComponent <UnitObjectScript>().drawEnterBattleTiles(); UIMan.removeMenu(); //Flag moveable tiles script (so we know not to subtract movement) UIMan.godEnteringBattle = true; }
public void UpdateUserSelectedCategoriesCallback() { //LoadToggleStates(); //count = 0; UIMan.showLoadingPanel = true; togglesGroupList.Clear(); foreach (Toggle toggle in GetComponentsInChildren <Toggle>()) { if (toggle.isOn) { togglesGroupList.Add(toggle); //count++; } } Globals.currentUser.userCategories = new string[4]; for (int i = 0; i < togglesGroupList.Count; i++) { Globals.currentUser.userCategories[i] = togglesGroupList[i].gameObject.GetComponentInChildren <Text>().text.ToString(); } Globals.userLanguage = userLanguageDD.options[userLanguageDD.value].text.ToString(); Globals.currentUser.userLanguage = Globals.userLanguage; isLanguageChanged = true; string json = JsonUtility.ToJson(Globals.currentUser); FirebaseDatabase.DefaultInstance.RootReference.Child("users").Child(Globals.userId).Child("profile").SetRawJsonValueAsync(json).ContinueWith(task => { if (task.IsCompleted) { if (Globals.userLanguage == "AR") { UIMan.ViewMessageOnScreen(ArabicSupport.ArabicFixer.Fix("يرجى اعادة التسجيل ...")); AuthMan.LogOut(); } else { UIMan.ViewMessageOnScreen("Please login again ... "); AuthMan.LogOut(); } } UIMan.showLoadingPanel = false; }); //DBMan.UpdateUserProfile(Globals.currentUser, Globals.userId); //LoadToggleStates(); }
// This is the actual window. void DialogWindow(int windowID) { float y = 20; GUI.Label(new Rect(0, 0, Screen.width, (0.5f * Screen.height) / 2), msg, textStyle); //if (GUI.Button(new Rect(5, y, windowRect.width - 10, 20), "Restart")) //{ // Application.LoadLevel(0); // show = false; //} if (GUI.Button(new Rect(125, ((0.9f * Screen.height) / 4), Screen.width - 250, windowRect.height / 4), "Close")) { show = false; if (exit) { UIMan.LogOut(); //Application.Quit(); } } }
private void Awake() { Instance = this; GameObject.DontDestroyOnLoad(this); }
// Use this for initialization void Start() { uiManager = GetComponent<UIMan>(); soundManager = GetComponent<SoundMan>(); speedFactor = 0; Meter = 0; HighScore = PlayerPrefs.GetInt("HighScore"); liveObstacles = new List<GameObject>(); # if UNITY_STANDALONE InputManager = (InputMan)gameObject.AddComponent<PCInputMan>(); #elif UNITY_ANDROID InputManager = (InputMan)gameObject.AddComponent<AndroidInputMan>(); #endif //InputManager.enabled = false; }
// Update is called once per frame public virtual void Update() { //Debug.Log("UIMan is Running"); //touch input #if !UNITY_EDITOR if (Input.touches.Length <= 0) //if there are touches { inputCount = 0; if (!selectiveInput) { selectiveActive = false; } OnNoTouches(); } else { inputCount = Input.touches.Length; if (!selectiveInput) { selectiveActive = false; } if (currTouch == 0) { curPos = Camera.main.ScreenToWorldPoint(Input.touches[0].position); } curPos.z = transform.position.z; if (disableUIInput) { if (Input.touches[0].phase == TouchPhase.Ended) { OnTouchEndedAnywhere(); } return; } if (bypass || (!disableUIInputGlobal) || (selectiveInput && selectiveActive)) { //if((selectiveInput && !selectiveActive)) // return; if (casting && casting.uiLayer == uiLayer) { Debug.Log("ActiveLayer is Wrong"); return; } foreach (Touch touch in Input.touches) { currTouch = touch.fingerId; //if(currTouch ==0) Ray ray = customRaycastCam?customRaycastCam.ScreenPointToRay(touch.position):Camera.main.ScreenPointToRay(touch.position); // Raycast to check if there are hits. if (Physics.Raycast(ray, out hitUI, Mathf.Infinity, uiLayer)) { casting = this; if (hitUI.transform.gameObject == gameObject) { didHitUI = true; didHitUIGlobal = true; if (touch.phase == TouchPhase.Began) { // firstTouchPos = Camera.main.ScreenToWorldPoint(touch.position); // if(hitUI.transform.gameObject.name == "List") // Debug.Log("TouchBegan!"); OnTouchBegan(); touch2Watch = currTouch; } if (touch.phase == TouchPhase.Ended) { OnTouchEnded(); } if (touch.phase == TouchPhase.Moved) { // if(hitUI.transform.gameObject.name == "List") // Debug.Log("TouchMoved!!"); OnTouchMoved(); } if (touch.phase == TouchPhase.Stationary) { OnTouchStayed(); } } } else { didHitUI = false; didHitUIGlobal = false; } if (!isTutorial || (selectiveInput && selectiveActive)) { switch (touch.phase) { case TouchPhase.Began: OnTouchBeganAnywhere(); break; case TouchPhase.Ended: OnTouchEndedAnywhere(); break; case TouchPhase.Moved: OnTouchMovedAnywhere(); break; case TouchPhase.Stationary: OnTouchStayedAnywhere(); break; } } } casting = null; } else { // if(gameObject.name == "List_Debug") // { // if(disableUIInputGlobal) // Debug.Log("Global Disabled!"); // if(disableUIInput) // Debug.Log("Local Disabled"); // if((selectiveInput && !selectiveActive)) // Debug.Log("Not Selective Active!"); // } // if(!disabling) // { // Debug.Log("Input Disabled by " + gameObject.name); // disabling = true; // }else{ // Debug.Log("Input Re-enabled by " + gameObject.name); // disabling = false; // } } } #else // if(disableUIInputGlobal) // { // Debug.Log("UIINput Disabled GLobal"+ gameObject.name); // }if(disableUIInput) // Debug.Log("UIINput Disabled" + gameObject.name); if (!selectiveInput) { selectiveActive = false; } // if(disableUIInputGlobal) // Debug.Log("InputDisabledGlobally!"); curPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); curPos.z = transform.position.z; if (disableUIInput) { if (Input.GetMouseButtonUp(0)) { OnTouchEndedAnywhere(); } return; } if (bypass || (!disableUIInputGlobal) || (selectiveInput && selectiveActive)) { if (casting && casting.uiLayer == uiLayer) { return; } Ray ray = customRaycastCam?customRaycastCam.ScreenPointToRay(Input.mousePosition):Camera.main.ScreenPointToRay(Input.mousePosition); //Debug.Log("MouseDown"); // Raycast to check if there are hits. if (Physics.Raycast(ray, out hitUI, Mathf.Infinity, uiLayer)) { casting = this; if (hitUI.transform.gameObject == gameObject) { //Debug.Log("HitSomething"); didHitUI = true; didHitUIGlobal = true; //Debug.Log("HitUIGlobal:" + didHitUIGlobal); if (Input.GetMouseButtonDown(0)) { OnTouchBegan(); firstTouchPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); touch2Watch = currTouch; } if (Input.GetMouseButtonUp(0)) { OnTouchEnded(); } if (Input.GetMouseButton(0) && Input.GetAxis("Mouse X") != 0 && Input.GetAxis("Mouse Y") != 0) { OnTouchMoved(); } if (Input.GetMouseButton(0) && Input.GetAxis("Mouse X") == 0 && Input.GetAxis("Mouse Y") == 0) { OnTouchStayed(); } } } else { didHitUI = false; didHitUIGlobal = false; } if (!isTutorial || (selectiveInput && selectiveActive)) { if (Input.GetMouseButtonDown(0)) { inputCount = 1; OnTouchBeganAnywhere(); } if (Input.GetMouseButtonUp(0)) { inputCount = 0; OnTouchEndedAnywhere(); } if (Input.GetMouseButton(0)) { OnTouchMovedAnywhere(); } } //OnTouchStayedAnywhere(); casting = null; } #endif }