示例#1
0
    private bool CheckMethodListEqualsName(TutorialInfo info, List <EventDelegate> evList)
    {
        if (evList != null)
        {
            for (int i = 0; i < evList.Count; i++)
            {
                if (info.CheckMethodNameExists(evList[i].methodName))
                {
                    return(true);
                }
            }
        }

        return(false);
    }
示例#2
0
    public bool CheckTutorialButtonActive(GameObject buttonObj, TUTORIAL_BUTTON_TYPE type)
    {
        if (CheckTutorialEnable == false && CheckTutorialBuildingEnable == false)
        {
            return(false);
        }

        bool isEnable = CheckTutorialType(new TUTORIAL_TRIGGER_TYPE[] {
            TUTORIAL_TRIGGER_TYPE.TYPE_TOUCH, TUTORIAL_TRIGGER_TYPE.TYPE_WAIT,
            TUTORIAL_TRIGGER_TYPE.TYPE_NONSERVER_WAIT, TUTORIAL_TRIGGER_TYPE.TYPE_DRAG_DROP
        });

        UIPlayAnimation uiAni  = buttonObj.GetComponent <UIPlayAnimation>();
        UIEventListener uiEv   = buttonObj.GetComponent <UIEventListener>();
        UIEventTrigger  uiTrig = buttonObj.GetComponent <UIEventTrigger>();
        UIButton        uiBtn  = buttonObj.GetComponent <UIButton>();

        TutorialInfo curTutInfo = null;

        switch (Tutorial.instance.TutorialType)
        {
        case TUTORIAL_TYPE.TYPE_BASIC: curTutInfo = m_curTutorialInfo; break;

        case TUTORIAL_TYPE.TYPE_BUILDING: curTutInfo = m_curTutorialBuildingInfo; break;
        }

        if (isEnable)
        {
            switch (type)
            {
            case TUTORIAL_BUTTON_TYPE.TYPE_ANIM:
                if (CheckMethodListEqualsName(curTutInfo, uiAni.onFinished))
                {
                    EventDelegate.Execute(uiAni.onFinished);
                    if (CheckTutorialType(TUTORIAL_TRIGGER_TYPE.TYPE_TOUCH))
                    {
                        switch (Tutorial.instance.TutorialType)
                        {
                        case TUTORIAL_TYPE.TYPE_BASIC: EndCurrentTutorialCode(true); break;

                        case TUTORIAL_TYPE.TYPE_BUILDING: EndSeqBuildingTrigger(true); break;
                        }
                    }
                }

                break;

            case TUTORIAL_BUTTON_TYPE.TYPE_EVENT:
                if (uiEv.onClick != null)
                {
                    if (curTutInfo.CheckMethodNameExists(uiEv.onClick.Method.Name))
                    {
                        uiEv.onClick(buttonObj);
                        if (CheckTutorialType(TUTORIAL_TRIGGER_TYPE.TYPE_TOUCH))
                        {
                            switch (Tutorial.instance.TutorialType)
                            {
                            case TUTORIAL_TYPE.TYPE_BASIC: EndCurrentTutorialCode(true); break;

                            case TUTORIAL_TYPE.TYPE_BUILDING: EndSeqBuildingTrigger(true); break;
                            }
                        }
                    }

                    else
                    {
                        bool isExists = (uiAni != null && CheckMethodListEqualsName(curTutInfo, uiAni.onFinished)) ||
                                        (uiBtn != null && CheckMethodListEqualsName(curTutInfo, uiBtn.onClick));
                        if (isExists)
                        {
                            uiEv.onClick(buttonObj);
                        }
                    }
                }

                break;

            case TUTORIAL_BUTTON_TYPE.TYPE_BUTTON:
                if (CheckMethodListEqualsName(curTutInfo, uiBtn.onClick))
                {
                    EventDelegate.Execute(uiBtn.onClick);
                    if (CheckTutorialType(TUTORIAL_TRIGGER_TYPE.TYPE_TOUCH))
                    {
                        switch (Tutorial.instance.TutorialType)
                        {
                        case TUTORIAL_TYPE.TYPE_BASIC: EndCurrentTutorialCode(true); break;

                        case TUTORIAL_TYPE.TYPE_BUILDING: EndSeqBuildingTrigger(true); break;
                        }
                    }
                }

                else
                {
                    bool isExists = (uiAni != null && CheckMethodListEqualsName(curTutInfo, uiAni.onFinished)) ||
                                    (uiEv != null && uiEv.onClick != null && curTutInfo.CheckMethodNameExists(uiEv.onClick.Method.Name));
                    if (isExists)
                    {
                        EventDelegate.Execute(uiBtn.onClick);
                    }
                }

                break;
            }
        }

        else
        {
            switch (StateManager.instance.m_curStateType)
            {
            case STATE_TYPE.STATE_TITLE:
            case STATE_TYPE.STATE_INTRO:
                return(false);

            default:
                switch (type)
                {
                case TUTORIAL_BUTTON_TYPE.TYPE_ANIM:
                    return(!CheckCommonMethodListEqualsName(uiAni.onFinished));

                case TUTORIAL_BUTTON_TYPE.TYPE_EVENT:
                    return(!CheckCommonMethodListEqualsName(uiEv.onClick.Method.Name));

                case TUTORIAL_BUTTON_TYPE.TYPE_BUTTON:
                    return(!CheckCommonMethodListEqualsName(uiBtn.onClick));
                }

                return(true);
            }
        }

        return(isEnable);
    }