Esempio n. 1
0
        //完成当前步骤
        public void FinishStep()
        {
            EB.Debug.Log("=============FinishStep{0}", m_StepCurrentId);
            m_StepCurrentId = 0;
            if (!m_GuideState)
            {
                return;
            }
            GuideStepData now;

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

            m_StepExcuteState = eStepExcuteState.Finished;
            //判定条件 设置m_StepCurrentId m_StepProgress
            FindCouldStep();
            //获取到了下一个步骤
            if (m_StepCurrentId > 0)
            {
                GuideStepData next;
                if (GuideManager.Instance.GetStep(m_StepCurrentId, out next))
                {
                    //判定执行类型  立即执行,还是触发执行
                    string trigger_type = next.trigger_type;
                    if (trigger_type.Equals("now"))
                    {
                        ExcuteEx(m_CurrentFrame.transform, null);
                    }
                    else if (trigger_type.Equals("late_1"))
                    {
                        return;
                    }
                    else if (trigger_type.Equals("late_2"))
                    {
                        MengBanController.Instance.FobiddenAll();
                        return;
                    }
                    else
                    {
                        EB.Debug.LogError("trigger_type undefine for {0}", trigger_type);
                    }
                }
            }
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
0
        public OpenGuideStep ExcuteCurrentStep(GameObject stepObj, GameObject panel, System.Action onFinish)
        {
            GuideStepData now;

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

            if (excute_type.Equals("default"))
            {
                OpenGuideStep step = new OpenGuideStep();
                step.GuideId   = m_StepCurrentId;
                step.m_Panel   = panel;
                step.m_StepObj = stepObj;
                if (onFinish != null)
                {
                    step.onFinish += onFinish;
                }
                step.ExcuteReal();
                return(step);
            }
            else
            {
                System.Type   type = System.Type.GetType(excute_type);
                object        obj  = System.Activator.CreateInstance(type);
                OpenGuideStep step = (OpenGuideStep)obj;
                step.GuideId   = m_StepCurrentId;
                step.m_StepObj = stepObj;
                step.m_Panel   = panel;
                if (onFinish != null)
                {
                    step.onFinish += onFinish;
                }
                step.ExcuteReal();
                return(step);
            }
        }
Esempio n. 4
0
 public void PopFrameGuideStackEx()
 {
     if (m_StepStack.Count == 0)
     {
         return;
     }
     if (m_StepExcuteState == eStepExcuteState.Excuted)
     {
         GuideStepData step = (GuideStepData)m_StepStack.Peek();
         m_StepCurrentId   = step.rollback_id;
         m_StepProgress    = m_StepCurrentId;
         m_StepExcuteState = eStepExcuteState.Excuting;
         while (m_StepStack.Count > 0)
         {
             m_StepStack.Pop();
         }
         RemoveFxs();
     }
 }
Esempio n. 5
0
 /// <summary>
 /// 判定是否有满足条件的步骤   在一个步骤完成 或者 条件满足时激发
 /// </summary>
 public void FindCouldStep()
 {
     if (m_StepCurrentId > 0)
     {
         return;
     }
     if (m_StepProgress == 0)
     {
     }
     else
     {
         //判定条件 设置m_StepCurrentId
         GuideStepData next;
         if (GuideManager.Instance.GetNextStep(m_StepProgress, out next))
         {
             if (m_RemoteProgressId != m_StepProgress && next.guide_id == next.rollback_id)
             {
                 //将stack弹出
                 m_StepStack.Clear();
                 RemoveFxs();
                 m_RemoteProgressId = m_StepProgress;
                 m_StepExcuteState  = eStepExcuteState.Excuting;
             }
             if (next.EnoughCondition())
             {
                 m_StepCurrentId   = next.guide_id;
                 m_StepProgress    = m_StepCurrentId;
                 m_StepExcuteState = eStepExcuteState.Excuting;
             }
         }
         else
         {
             //将stack弹出
             m_StepStack.Clear();
             m_RemoteProgressId = m_StepProgress;
             m_GuideState       = false;
         }
     }
 }
Esempio n. 6
0
        public void InitGuideState()
        {
            m_StepExcuteState = eStepExcuteState.Excuting;
            if (!GameEngine.Instance.IsFTE)
            {
                m_GuideState = false;
                return;
            }


            int progressid;
            int local_progressid = PlayerPrefs.GetInt(LoginManager.Instance.LocalUserId.Value + "_progress_id", -1);

            if (local_progressid != -1)
            {
                progressid = local_progressid;
            }
            else
            {
                if (!DataLookupsCache.Instance.SearchIntByID("guide_progress", out progressid))
                {
                    progressid = 0;
                }
            }

            if (0 == progressid)
            {
                m_StepCurrentId = m_StepStartId;
                m_StepProgress  = m_StepStartId;
                m_GuideState    = true;
            }
            else
            {
                GuideStepData step;
                if (!GetStep(progressid, out step))
                {
                    m_GuideState = false;
                }
                else
                {
                    //if (0 == step.next_id )
                    GuideStepData next_step;
                    if (!GetStep(step.next_id, out next_step))
                    {
                        m_GuideState = false;
                        return;
                    }
                    if (next_step.type == 0)                    // 接下来是开放式引导了
                    {
                        m_GuideState = false;
                        //OpenGuideManager.Instance.InitGuideState();
                    }
                    else
                    {
                        //1 判定当前的回滚点是否条件满足 满足则设置回滚 否则找前一个回滚点
                        GuideStepData rollback;
                        if (!GetStep(step.rollback_id, out rollback))
                        {
                            m_GuideState = false;
                        }
                        else
                        {
                            int rollbackid;
                            if (rollback.EnoughCondition())
                            {
                                rollbackid = step.rollback_id;
                            }
                            else
                            {
                                rollbackid = GetLastRollBackId(progressid);
                                if (!GetStep(rollbackid, out rollback) || !rollback.EnoughCondition())
                                {
                                    m_GuideState = false;
                                    EB.Debug.LogWarning("GuideManager init ===========rollbackid={0}Condition is not ok  stop guide", rollbackid);
                                    return;
                                }
                            }
                            EB.Debug.Log("GuideManager init ===========progressid={0}==rollbackid={1}", progressid, rollbackid);
                            m_StepCurrentId = rollbackid;
                            m_StepProgress  = rollbackid;
                            m_GuideState    = true;
                        }
                    }
                }
            }

            if (m_GuideState)
            {
                IsBigThanMaxLevel();
            }
        }
Esempio n. 7
0
        public void InitGuideState()
        {
            if (GuideManager.Instance.GuideState)
            {
                m_GuideState = false;
            }
            m_StepExcuteState = eStepExcuteState.Excuting;
            m_StepStack.Clear();
            int progressid;
            int local_progressid = PlayerPrefs.GetInt(LoginManager.Instance.LocalUserId.Value + "_progress_id", -1);

            if (local_progressid != -1)
            {
                progressid = local_progressid;
            }
            else
            {
                if (!DataLookupsCache.Instance.SearchIntByID("guide_progress", out progressid))
                {
                    progressid = 0;
                }
            }
            m_RemoteProgressId = progressid;
            if (0 == progressid)
            {
                m_StepCurrentId = 0;
                m_StepProgress  = GuideManager.Instance.m_StepEndId;
                m_GuideState    = true;
            }
            else
            {
                GuideStepData step;
                if (!GuideManager.Instance.GetStep(progressid, out step))
                {
                    m_GuideState = false;
                }
                else
                {
                    GuideStepData next_step;
                    if (!GuideManager.Instance.GetStep(step.next_id, out next_step))
                    {
                        m_GuideState = false;
                        return;
                    }
                    if (step.type == 1)
                    {
                        if (next_step.type == 0)// 接下来是开放式引导了
                        {
                            m_GuideState    = true;
                            m_StepCurrentId = 0;
                            m_StepProgress  = progressid;
                        }
                    }
                    else
                    {
                        m_GuideState    = true;
                        m_StepCurrentId = 0;
                        m_StepProgress  = progressid;
                    }
                }
            }
        }