示例#1
0
 // Helper to check UIMode for UI object toggles
 private bool CheckLgUIToggle(LgUIToggle uiToggleScript, UIModeTypes currentUIMode)
 {
     if (uiToggleScript.modeType1 == UIModeTypes.None)
     {
         return(true);
     }
     if (uiToggleScript.modeType1 == currentUIMode || uiToggleScript.modeType2 == currentUIMode || uiToggleScript.modeType3 == currentUIMode)
     {
         return(true);
     }
     return(false);
 }
示例#2
0
    public override void OnInspectorGUI()
    {
        LgUIToggle component = (LgUIToggle)target;

        base.OnInspectorGUI();

        component.modeTypeSize = EditorGUILayout.IntSlider("UI Modes", component.modeTypeSize, 1, 3);
        if (component.modeTypeSize == 1)
        {
            component.modeType1 = (UIModeTypes)EditorGUILayout.EnumPopup("Mode Type 1", component.modeType1);
        }
        else if (component.modeTypeSize == 2)
        {
            component.modeType1 = (UIModeTypes)EditorGUILayout.EnumPopup("Mode Type 1", component.modeType1);
            component.modeType2 = (UIModeTypes)EditorGUILayout.EnumPopup("Mode Type 2", component.modeType2);
        }
        else if (component.modeTypeSize == 3)
        {
            component.modeType1 = (UIModeTypes)EditorGUILayout.EnumPopup("Mode Type 1", component.modeType1);
            component.modeType2 = (UIModeTypes)EditorGUILayout.EnumPopup("Mode Type 2", component.modeType2);
            component.modeType3 = (UIModeTypes)EditorGUILayout.EnumPopup("Mode Type 3", component.modeType3);
        }
    }
示例#3
0
    //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);
    }