Exemple #1
0
        public GuideStep ExcuteCurrentStep(GameObject stepObj, System.Action onFinish)
        {
            mCurrentStep = null;
            GuideStepData now;

            if (!GetStep(m_StepCurrentId, out now))
            {
                return(null);
            }
            if (m_StepExcuteState == eStepExcuteState.Excuted)
            {
                return(null);
            }
            m_StepExcuteState = eStepExcuteState.Excuted;
            string excute_type = now.excute_type.ToString();

            if (excute_type.Equals("default"))
            {
                GuideStep step = new GuideStep();
                step.GuideId   = m_StepCurrentId;
                step.m_StepObj = stepObj;
                if (onFinish != null)
                {
                    step.onFinish += onFinish;
                }
                step.ExcuteReal();
                mCurrentStep = step;
                return(step);
            }
            else
            {
                Type      type = Type.GetType(excute_type);
                object    obj  = Activator.CreateInstance(type);
                GuideStep step = (GuideStep)obj;
                step.GuideId   = m_StepCurrentId;
                step.m_StepObj = stepObj;
                if (onFinish != null)
                {
                    step.onFinish += onFinish;
                }
                step.ExcuteReal();
                mCurrentStep = step;
                return(step);
            }
        }
Exemple #2
0
        //完成当前步骤
        public void FinishStep()
        {
            EB.Debug.Log("=============FinishStep{0}", m_StepCurrentId);
            m_StepCurrentId = 0;
            MengBanController.Instance.Hide();
            if (!m_GuideState)
            {
                return;
            }
            GuideStepData now;

            if (!GetStep(m_StepProgress, out now))
            {
                m_StepCurrentId = 0;
                return;
            }
            if (now.next_id == 0)
            {
                m_GuideState = false;
            }

            m_StepExcuteState = eStepExcuteState.Excuting;
            //判定条件 设置m_StepCurrentId m_StepProgress
            FindCouldStep();
            //获取到了下一个步骤
            if (m_StepCurrentId > 0)
            {
                GuideStepData next;
                if (GetStep(m_StepCurrentId, out next))
                {
                    //判定执行类型  立即执行,还是触发执行
                    string trigger_type = next.trigger_type;
                    //if (trigger_type.Equals("now"))ExcuteCurrentStep(m_StepObjMap[StepCurrentId + ""] as GameObject);
                    if (trigger_type.Equals("now"))
                    {
                        if (m_StepObjMap[StepCurrentId + ""] != null)
                        {
                            ExcuteCurrentStep(m_StepObjMap[StepCurrentId + ""] as GameObject);
                        }
                        else
                        {
                            ExcuteEx(m_CurrentFrame.transform, null);
                        }
                    }
                    else if (trigger_type.Equals("late_1"))
                    {
                        mCurrentStep = null;
                    }
                    else if (trigger_type.Equals("late_2"))
                    {
                        mCurrentStep = null;
                        MengBanController.Instance.FobiddenAll();
                        return;
                    }
                    else
                    {
                        EB.Debug.LogError("trigger_type undefine for {0}", trigger_type);
                    }
                }
            }
        }