//TODO: Refactor this spagetti code /// <summary> /// UI buttons call this to make sure that they can process their clicks. /// Note: the order of these checks is actually important, so don't go changing /// things willy-nilly. /// </summary> /// <returns><c>true</c> if this instance can respond to tap; otherwise, <c>false</c>.</returns> /// <param name="goCaller">Go caller.</param> /// <param name="eException">E exception.</param> public bool CanRespondToTap(GameObject goCaller = null, ClickLockExceptions eException = ClickLockExceptions.None) { // hard stop (for now): If the partition is transitioning, don't allow anything if (CameraManager.Instance && CameraManager.Instance.IsCameraMoving()) { return(false); } // if pet is currently attacking gate. can't do anything else if (AttackGate.Instance) { return(false); } // if a tutorial is playing, check with that tutorial if (TutorialManager.Instance && !TutorialManager.Instance.CanProcess(goCaller)) { return(false); } // if there is an exception in effect for the incoming action, then it can bypass the mode check // this check should appear BEFORE the tweening checks because exceptions should be an auto-accept if (listExceptions.Contains(eException) || listTempExceptions.Contains(eException)) { return(true); } // if the UI is tweening, no soup for you if (IsTweeningUI()) { return(false); } // get the mode key from the incoming object, if it is an LgButton. // it's possible goCaller is not an LgButton, which should be fine. if (goCaller != null) { LgWorldButton worldButtonScript = goCaller.GetComponent <LgWorldButton>(); if (worldButtonScript != null && CheckLgWorldButton(worldButtonScript, CurrentMode)) { return(true); } LgUIButton uiButtonScript = goCaller.GetComponent <LgUIButton>(); if (uiButtonScript != null && CheckLgUIButton(uiButtonScript, CurrentMode)) { return(true); } LgUIToggle uiToggleScript = goCaller.GetComponent <LgUIToggle>(); if (uiToggleScript != null && CheckLgUIToggle(uiToggleScript, CurrentMode)) { return(true); } } // Last case, if mode is None, allow all clicks if (CurrentMode == UIModeTypes.None) { return(true); } // otherwise some condition(s) above was not met, so return false return(false); }
public void AddTemporaryException(ClickLockExceptions eException) { listTempExceptions.Add(eException); }