Exemplo n.º 1
0
    /// <summary>
    /// 是否引导已完成
    /// </summary>
    /// <param name="guideId"></param>
    /// <returns></returns>
    public bool IsGuideStepComplete(uint guideId)
    {
        GuideDefine.LocalGuideGroupData localGroupData = null;
        uint groupId = 0;

        if (TryGetGuideGroupID(guideId, out groupId) && TryGetGuideGroupData(groupId, out localGroupData))
        {
            if (IsGuideGroupComplete(guideId))
            {
                return(true);
            }
            if (localGroupData.GType == GuideDefine.GuideType.Unconstrain)
            {
                if (null != CurDoConstriantGuide && CurDoConstriantGuide.GroupId == guideId)
                {
                    return(CurDoConstriantGuide.IsCompleteStep(guideId));
                }
            }
            else if (localGroupData.GType == GuideDefine.GuideType.Constraint)
            {
                if (CurDoUnConstraintGuide.ContainsKey(localGroupData.GroupId))
                {
                    return(CurDoUnConstraintGuide[localGroupData.GroupId].IsCompleteStep(guideId));
                }
            }
        }
        return(false);
    }
Exemplo n.º 2
0
    /// <summary>
    /// 引导组是否满足忽略条件
    /// </summary>
    /// <param name="groupId"></param>
    /// <returns></returns>
    public bool IsNeedIgnoreGroup(uint groupId)
    {
        bool ignore = true;

        GuideDefine.LocalGuideGroupData tempGroup = null;
        if (TryGetGuideGroupData(groupId, out tempGroup) &&
            null != tempGroup.IgnoreTriggerIds &&
            tempGroup.IgnoreTriggerIds.Count > 0)
        {
            for (int i = 0, maxCount = tempGroup.IgnoreTriggerIds.Count; i < maxCount; i++)
            {
                if (!IsNeedIgnoreByCondi(tempGroup.IgnoreTriggerIds[i]))
                {
                    ignore = false;
                    break;
                }
            }
        }
        else
        {
            ignore = false;
        }

        return(ignore);
    }
Exemplo n.º 3
0
    /// <summary>
    ///刷新
    /// </summary>
    /// <param name="pid"></param>
    private void RefreshGuideTargetObj(PanelID pid)
    {
        GuideDefine.LocalGuideGroupData localGroupData = null;
        GuideDefine.LocalGuideData      localGuideData = null;
        if (null != CurDoUnConstraintGuide && CurDoUnConstraintGuide.Count > 0)
        {
            var iemurator = CurDoUnConstraintGuide.GetEnumerator();
            while (iemurator.MoveNext())
            {
                localGroupData = iemurator.Current.Value;
                if (null == localGroupData || !localGroupData.LoopTrigger)
                {
                    continue;
                }
                if (localGroupData.CurStep != 0 &&
                    TryGetGuideLocalData(localGroupData.CurStep, out localGuideData) &&
                    localGuideData.GuideTargetDependPanel == pid)
                {
                    localGuideData.GuideTargetObj = null;
                }
            }
        }

        if (null != CurDoRepeatUnConstraintGuide)
        {
            if (CurDoRepeatUnConstraintGuide.CurStep != 0 &&
                TryGetGuideLocalData(CurDoRepeatUnConstraintGuide.CurStep, out localGuideData) &&
                localGuideData.GuideTargetDependPanel == pid)
            {
                localGuideData.GuideTargetObj = null;
            }
        }
    }
Exemplo n.º 4
0
 /// <summary>
 /// 静默完成引导组
 /// </summary>
 /// <param name="guideGroup">引导组</param>
 private void SilentCompleteGuideGroup(uint guideGroup)
 {
     GuideDefine.LocalGuideGroupData groupData = null;
     if (TryGetGuideGroupData(guideGroup, out groupData))
     {
         for (int i = 0; i < groupData.GroupSteps.Count; i++)
         {
             //完成当前组
             CompleteGuide(groupData.GroupSteps[i]);
         }
     }
     else
     {
         Engine.Utility.Log.Error("GuideManager->SilentCompleteGuideGroup failed,get groupdata error ,groupId:{0}", guideGroup);
     }
 }
Exemplo n.º 5
0
    /// <summary>
    /// 重置引导组
    /// </summary>
    /// <param name="groupID"></param>
    private void ResetGuideGroup(uint groupID)
    {
        uint curDoGuide = 0;

        if (IsDoingGroup(groupID, out curDoGuide))
        {
            if (CurDoUnConstraintGuide.ContainsKey(groupID))
            {
                CurDoUnConstraintGuide.Remove(groupID);
            }
            else if (null != CurDoRepeatUnConstraintGuide && CurDoRepeatUnConstraintGuide.GroupId == groupID)
            {
                m_curDoRepeatUnConstraintGuide = null;
            }
            CancelUnconstrainGuideShow(curDoGuide);
        }
    }
Exemplo n.º 6
0
    /// <summary>
    /// 重置引导
    /// </summary>
    private void ResetGuide()
    {
        //新手引导
        m_lst_completeGroupGuide.Clear();
        m_curDoConstraintGuide = null;
        m_lstTriggerGuideGroups.Clear();
        m_bGuideDataReady = false;
        if (null != m_dic_guideGroupDatas && m_dic_guideGroupDatas.Count != 0)
        {
            List <uint> groupIds = new List <uint>(m_dic_guideGroupDatas.Keys);
            for (int i = 0, max = groupIds.Count; i < max; i++)
            {
                m_dic_guideGroupDatas[groupIds[i]].Reset();
            }
        }

        if (null != m_dic_canDoGuideGroup)
        {
            m_dic_canDoGuideGroup.Clear();
        }

        if (null != CurDoUnConstraintGuide && CurDoUnConstraintGuide.Count > 0)
        {
            var iemurator = CurDoUnConstraintGuide.GetEnumerator();
            GuideDefine.LocalGuideGroupData localGroupData = null;
            while (iemurator.MoveNext())
            {
                localGroupData = iemurator.Current.Value;
                if (localGroupData.CurStep != 0)
                {
                    CancelUnconstrainGuideShow(localGroupData.CurStep);
                }
            }
            CurDoUnConstraintGuide.Clear();
        }

        if (null != m_curDoRepeatUnConstraintGuide)
        {
            if (m_curDoRepeatUnConstraintGuide.CurStep != 0)
            {
                CancelUnconstrainGuideShow(m_curDoRepeatUnConstraintGuide.CurStep);
            }
            m_curDoRepeatUnConstraintGuide = null;
        }
    }
Exemplo n.º 7
0
    /// <summary>
    /// 是否当前正在执行引导组
    /// </summary>
    /// <param name="guideGroup"></param>
    /// <param name="guideId"></param>
    /// <returns></returns>
    public bool IsDoingGroup(uint guideGroup, out uint guideId)
    {
        guideId = 0;
        GuideDefine.LocalGuideGroupData groupData = null;
        if (TryGetGuideGroupData(guideGroup, out groupData))
        {
            if (groupData.GType == GuideDefine.GuideType.Unconstrain)
            {
                if (!groupData.LoopTrigger)
                {
                    if (null != CurDoUnConstraintGuide && CurDoUnConstraintGuide.Count != 0)
                    {
                        var iemurator = CurDoUnConstraintGuide.GetEnumerator();
                        GuideDefine.LocalGuideGroupData tempGroup = null;
                        while (iemurator.MoveNext())
                        {
                            tempGroup = iemurator.Current.Value;
                            if (tempGroup.GroupId == guideGroup)
                            {
                                guideId = tempGroup.CurStep;
                                return(true);
                            }
                        }
                    }
                }
                else if (null != CurDoRepeatUnConstraintGuide &&
                         CurDoRepeatUnConstraintGuide.GroupId == guideGroup)
                {
                    guideId = CurDoRepeatUnConstraintGuide.CurStep;
                    return(true);
                }
            }
            else if (groupData.GType == GuideDefine.GuideType.Constraint)
            {
                if (null != CurDoConstriantGuide &&
                    CurDoConstriantGuide.GroupId == guideGroup)
                {
                    guideId = CurDoConstriantGuide.CurStep;
                    return(true);
                }
            }
        }

        return(false);
    }
Exemplo n.º 8
0
    /// <summary>
    /// 获取下一个强制引导
    /// </summary>
    /// <param name="guideId"></param>
    /// <returns></returns>
    private bool TakeNextConstraitGuide(out uint guideId)
    {
        guideId = 0;
        List <uint> guideIds = null;
        List <uint> groups   = null;
        bool        isMatch  = false;

        GuideDefine.GuideType gType = GuideDefine.GuideType.Constraint;
        if (m_dic_canDoGuideGroup.TryGetValue(gType, out groups) && groups.Count > 0)
        {
            GuideDefine.LocalGuideGroupData groupData = null;
            GuideDefine.LocalGuideData      localData = null;
            uint tempGuideId = 0;
            if (!IsDoingGuide(gType))
            {
                do
                {
                    isMatch = false;
                    if (IsGuideGroupComplete(groups[0]))
                    {
                        SilentCompleteGuideGroup(groups[0]);
                    }
                    else
                    {
                        if (TryGetGuideGroupData(groups[0], out groupData) &&
                            groupData.TryGetNextStep(out guideId) &&
                            TryGetGuideLocalData(guideId, out localData) &&
                            (localData.IsStartStep || localData.TryGetPreStep(out tempGuideId) && IsGuideStepComplete(tempGuideId)))
                        {
                            isMatch = true;
                        }

                        if (isMatch && IsNeedIgnoreGroup(groups[0]))
                        {
                            CompleteGuide(guideId);
                            isMatch = false;
                        }
                    }
                } while (groups.Count > 0 && !isMatch);
            }
        }
        return(isMatch);
    }
Exemplo n.º 9
0
 /// <summary>
 /// 新引导组触发
 /// </summary>
 /// <param name="groupID"></param>
 private void OnNewGuideGroupTrigger(uint groupID)
 {
     GuideDefine.LocalGuideGroupData tempGroup = null;
     if (TryGetGuideGroupData(groupID, out tempGroup))
     {
         if (tempGroup.LoopTrigger)
         {
             curCanDoRepeatGroup = tempGroup.GroupId;
         }
         else if (!IsTriggerGuideGroup(groupID))
         {
             m_lstTriggerGuideGroups.Add(groupID);
             //添加组
             List <uint> groups = null;
             if (!m_dic_canDoGuideGroup.TryGetValue(tempGroup.GType, out groups))
             {
                 groups = new List <uint>();
                 m_dic_canDoGuideGroup.Add(tempGroup.GType, groups);
             }
             if (!groups.Contains(tempGroup.GroupId))
             {
                 groups.Add(tempGroup.GroupId);
                 //排序
                 groups.Sort((left, right) =>
                 {
                     GuideDefine.LocalGuideGroupData lleft  = null;
                     GuideDefine.LocalGuideGroupData lright = null;
                     if (TryGetGuideGroupData(left, out lleft) && TryGetGuideGroupData(right, out lright))
                     {
                         return(lleft.Priority - lright.Priority);
                     }
                     return(0);
                 });
             }
         }
     }
 }
Exemplo n.º 10
0
 /// <summary>
 /// 是否正在执行该类型
 /// </summary>
 /// <param name="guideType"></param>
 /// <param name="guideId"></param>
 /// <returns></returns>
 public bool IsDoingGuide(GuideDefine.GuideType guideType, uint guideId = 0)
 {
     if (guideType == GuideDefine.GuideType.Constraint)
     {
         if (guideId == 0)
         {
             return(null != CurDoConstriantGuide);
         }
         else
         {
             return(null != CurDoConstriantGuide && CurDoConstriantGuide.CurStep != 0 &&
                    CurDoConstriantGuide.CurStep == guideId);
         }
     }
     else if (guideType == GuideDefine.GuideType.Unconstrain)
     {
         if (guideId == 0)
         {
             return(m_dic_curDoUnConstraintGuide.Count > 0);
         }
         else
         {
             GuideDefine.LocalGuideGroupData tempGroup = null;
             var iemurator = m_dic_curDoUnConstraintGuide.GetEnumerator();
             while (iemurator.MoveNext())
             {
                 tempGroup = iemurator.Current.Value;
                 if (iemurator.Current.Value.CurStep != 0 &&
                     iemurator.Current.Value.CurStep == guideId)
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Exemplo n.º 11
0
    /// <summary>
    /// 执行非强制引导
    /// </summary>
    private void DoUnconstrainGuide()
    {
        //新功能开启优先于功能引导
        if (IsDoingNewFuncOpen)
        {
            return;
        }
        //如果还有下一个新功能开启
        if (IsNextNewFuncOpenReady())
        {
            return;
        }
        //如果正在执行强制引导
        //存在一个连续的强制引导
        if (HaveUnFinishGuide(GuideDefine.GuideType.Constraint) ||
            IsDoingGuide(GuideDefine.GuideType.Constraint) ||
            IsNextConstraitGuideReady())
        {
            return;
        }

        GuideDefine.LocalGuideGroupData localGroupData = null;
        //1、等待执行列表
        List <uint> canDoGuideGroups = TakeCanDoUnConstraitGuideGroup();

        if (null != canDoGuideGroups && canDoGuideGroups.Count > 0)
        {
            for (int i = 0; i < canDoGuideGroups.Count; i++)
            {
                if (!TryGetGuideGroupData(canDoGuideGroups[i], out localGroupData) ||
                    !IsGuideUIStatusReady(localGroupData.FirstStep))
                {
                    continue;
                }

                DoGuideGroup(canDoGuideGroups[i]);
            }
        }

        //2、执行正在进行的引导
        if (CurDoUnConstraintGuide.Count > 0)
        {
            List <uint> groupIds = new List <uint>();
            groupIds.AddRange(CurDoUnConstraintGuide.Keys);
            for (int i = 0, max = groupIds.Count; i < max; i++)
            {
                localGroupData = CurDoUnConstraintGuide[groupIds[i]];
                if (localGroupData.CurStep == 0)
                {
                    DoGuideGroup(localGroupData.GroupId);
                }
            }
        }

        //3、执行正在执行的重复引导
        if (curCanDoRepeatGroup != 0)
        {
            if (!IsDoingGroup(curCanDoRepeatGroup) &&
                !IsGuideGroupComplete(curCanDoRepeatGroup) &&
                !IsNeedIgnoreGroup(curCanDoRepeatGroup))
            {
                if (TryGetGuideGroupData(curCanDoRepeatGroup, out localGroupData) &&
                    IsGuideUIStatusReady(localGroupData.FirstStep))
                {
                    DoGuideGroup(curCanDoRepeatGroup);
                }
            }
        }
        else if (null != CurDoRepeatUnConstraintGuide)
        {
            if (CurDoRepeatUnConstraintGuide.CurStep == 0)
            {
                DoGuideGroup(CurDoRepeatUnConstraintGuide.GroupId);
            }
        }
    }
Exemplo n.º 12
0
    /// <summary>
    /// 依赖面板关闭清空相应的循环触发引导(正在执行,或者等待执行的)
    /// </summary>
    /// <param name="id"></param>
    private void ClearRecycleTriggerGuideByPanel(PanelID pid)
    {
        //1、等待列表移除
        uint        tempID     = 0;
        List <uint> waitDoList = null;
        List <uint> removeList = null;
        List <uint> stepList   = null;

        GuideDefine.LocalGuideGroupData localGroupData = null;
        GuideDefine.LocalGuideData      localGuideData = null;
        if (m_dic_canDoGuideGroup.TryGetValue(GuideDefine.GuideType.Unconstrain, out waitDoList) &&
            waitDoList.Count > 0)
        {
            for (int i = 0, max = waitDoList.Count; i < max; i++)
            {
                tempID = waitDoList[i];
                if (!TryGetGuideGroupData(tempID, out localGroupData) || !localGroupData.LoopTrigger)
                {
                    continue;
                }
                stepList = localGroupData.GroupSteps;
                if (null == stepList || stepList.Count == 0)
                {
                    continue;
                }

                for (int j = 0, maxj = stepList.Count; j < maxj; j++)
                {
                    tempID = stepList[j];
                    if (!TryGetGuideLocalData(tempID, out localGuideData))
                    {
                        continue;
                    }

                    if (localGuideData.GuideTargetDependPanel == pid)
                    {
                        if (null == removeList)
                        {
                            removeList = new List <uint>();
                        }
                        if (!removeList.Contains(waitDoList[i]))
                        {
                            removeList.Add(waitDoList[i]);
                        }
                    }
                }
            }
        }
        if (null != removeList)
        {
            for (int i = 0, max = removeList.Count; i < max; i++)
            {
                tempID = removeList[i];
                waitDoList.Remove(tempID);
            }
        }

        //2、进行中引导
        if (null != CurDoUnConstraintGuide && CurDoUnConstraintGuide.Count > 0)
        {
            var iemurator = CurDoUnConstraintGuide.GetEnumerator();
            while (iemurator.MoveNext())
            {
                localGroupData = iemurator.Current.Value;
                if (null == localGroupData || !localGroupData.LoopTrigger)
                {
                    continue;
                }
                if (localGroupData.CurStep != 0 &&
                    TryGetGuideLocalData(localGroupData.CurStep, out localGuideData) &&
                    localGuideData.GuideTargetDependPanel == pid &&
                    (   //localGroupData.CurStep != localGroupData.FirstStep ||
                        pid != PanelID.MainPanel))
                {
                    if (null == removeList)
                    {
                        removeList = new List <uint>();
                    }
                    if (!removeList.Contains(localGroupData.GroupId))
                    {
                        removeList.Add(localGroupData.GroupId);
                    }
                }
            }
        }
        if (null != removeList)
        {
            for (int i = 0, max = removeList.Count; i < max; i++)
            {
                tempID = removeList[i];
                ResetGuideGroup(tempID);
            }
        }

        //3、重复触发引导
        if (null != CurDoRepeatUnConstraintGuide && CurDoRepeatUnConstraintGuide.CurStep != 0)
        {
            if (CurDoRepeatUnConstraintGuide.CurStep != 0 &&
                TryGetGuideLocalData(CurDoRepeatUnConstraintGuide.CurStep, out localGuideData) &&
                localGuideData.GuideTargetDependPanel == pid &&
                (       //localGroupData.CurStep != localGroupData.FirstStep ||
                    pid != PanelID.MainPanel))
            {
                ResetGuideGroup(CurDoRepeatUnConstraintGuide.GroupId);
            }
        }
    }
Exemplo n.º 13
0
    private void InitGuideData()
    {
        m_lst_completeGroupGuide     = new List <uint>();
        m_dic_canDoGuideGroup        = new Dictionary <GuideDefine.GuideType, List <uint> >();
        m_dic_guideDatas             = new Dictionary <uint, GuideDefine.LocalGuideData>();
        m_dic_guideGroupDatas        = new Dictionary <uint, GuideDefine.LocalGuideGroupData>();
        m_dic_curDoUnConstraintGuide = new Dictionary <uint, GuideDefine.LocalGuideGroupData>();
        m_lstGuideGroups             = new List <uint>();
        m_lstTriggerGuideGroups      = new List <uint>();

        List <table.GuideDataBase> guideDatas = GameTableManager.Instance.GetTableList <table.GuideDataBase>();

        if (null != guideDatas)
        {
            GuideDefine.LocalGuideData      localData      = null;
            GuideDefine.LocalGuideGroupData localGroupData = null;
            for (int i = 0; i < guideDatas.Count; i++)
            {
                localData = GuideDefine.LocalGuideData.Create(guideDatas[i].id);
                if (null == localData || localData.GuideGroupID == 0)
                {
                    continue;
                }
                if (!m_dic_guideDatas.ContainsKey(localData.ID))
                {
                    m_dic_guideDatas.Add(localData.ID, localData);
                }

                if (!m_dic_guideGroupDatas.TryGetValue(localData.GuideGroupID, out localGroupData))
                {
                    localGroupData = GuideDefine.LocalGuideGroupData.Create(localData.GuideGroupID);
                    m_dic_guideGroupDatas.Add(localData.GuideGroupID
                                              , localGroupData);
                }
                localGroupData.Add(localData);

                //构造数据引导组步骤数据
                if (!m_lstGuideGroups.Contains(localData.GuideGroupID))
                {
                    m_lstGuideGroups.Add(localData.GuideGroupID);
                }
            }

            //对引导组内部步骤排序
            if (m_dic_guideGroupDatas.Count > 0)
            {
                var groupEmurator = m_dic_guideGroupDatas.GetEnumerator();
                GuideDefine.LocalGuideData leftData  = null;
                GuideDefine.LocalGuideData rightData = null;
                while (groupEmurator.MoveNext())
                {
                    localGroupData = groupEmurator.Current.Value;
                    localGroupData.InitData();
                    localGroupData.GroupSteps.Sort((left, right) =>
                    {
                        if (TryGetGuideLocalData(left, out leftData) && TryGetGuideLocalData(right, out rightData))
                        {
                            return((int)leftData.GuideGroupStep - (int)rightData.GuideGroupStep);
                        }
                        return(0);
                    });
                }
            }
        }
    }
Exemplo n.º 14
0
 /// <summary>
 /// 获取引导组本地数据
 /// </summary>
 /// <param name="guideGroupId">引导组ID</param>
 /// <returns></returns>
 public bool TryGetGuideGroupData(uint guideGroupId, out GuideDefine.LocalGuideGroupData groupData)
 {
     return(m_dic_guideGroupDatas.TryGetValue(guideGroupId, out groupData));
 }
Exemplo n.º 15
0
    /// <summary>
    /// 完成引导
    /// </summary>
    /// <param name="guideId"></param>
    private void CompleteGuide(uint guideId)
    {
        //   Engine.Utility.Log.LogGroup("WJH", "CompleteGuide:" + guideId);
        GuideDefine.LocalGuideGroupData groupdata = null;
        uint groupID = 0;

        if (TryGetGuideGroupID(guideId, out groupID) && TryGetGuideGroupData(groupID, out groupdata))
        {
            bool complete = false;
            if (groupdata.GType == GuideDefine.GuideType.Constraint)
            {
                if (null != CurDoConstriantGuide && CurDoConstriantGuide.CurStep == guideId)
                {
                    CurDoConstriantGuide.LastestDoStep = guideId;
                    CurDoConstriantGuide.EndCur();
                    if (CurDoConstriantGuide.CurStep == CurDoConstriantGuide.LastStepGuideID)
                    {
                        complete             = true;
                        CurDoConstriantGuide = null;
                    }
                }
            }
            else if (groupdata.GType == GuideDefine.GuideType.Unconstrain)
            {
                if (CurDoUnConstraintGuide.ContainsKey(groupID))
                {
                    if (CurDoUnConstraintGuide[groupID].CurStep == guideId)
                    {
                        CurDoUnConstraintGuide[groupID].LastestDoStep = guideId;
                        CurDoUnConstraintGuide[groupID].EndCur();
                        if (CurDoUnConstraintGuide[groupID].LastestDoStep == CurDoUnConstraintGuide[groupID].LastStepGuideID)
                        {
                            complete = true;
                            CurDoUnConstraintGuide.Remove(groupID);
                        }
                    }
                }
                else if (null != CurDoRepeatUnConstraintGuide && CurDoRepeatUnConstraintGuide.CurStep == guideId)
                {
                    CurDoRepeatUnConstraintGuide.LastestDoStep = guideId;
                    CurDoRepeatUnConstraintGuide.EndCur();
                    if (CurDoRepeatUnConstraintGuide.LastestDoStep == CurDoRepeatUnConstraintGuide.LastStepGuideID)
                    {
                        complete = true;
                        CurDoRepeatUnConstraintGuide = null;
                    }
                }
            }

            //如果组最后一步发送消息到服务器保存已完成组
            if (complete && !m_lst_completeGroupGuide.Contains(groupdata.GroupId))
            {
                m_lst_completeGroupGuide.Add(groupdata.GroupId);
                //非循环引导
                if (!groupdata.LoopTrigger)
                {
                    SendGuideComplete(groupdata.GroupId);
                }
            }
        }
    }
Exemplo n.º 16
0
    /// <summary>
    /// 检测引导是否可以触发
    /// </summary>
    /// <param name="checkData"></param>
    private void CheckGuide(CheckWorkFlowData checkData)
    {
        if (null == checkData || checkData.CheckTypeMask == 0)
        {
            return;
        }
        GuideDefine.LocalGuideGroupData tempGroup = null;
        bool newAdd = false;

        for (int i = 0, max = m_lstGuideGroups.Count; i < max; i++)
        {
            if (!TryGetGuideGroupData(m_lstGuideGroups[i], out tempGroup) || null == tempGroup)
            {
                Engine.Utility.Log.Error("GuideManager_Guide->CheckGuide faield,groupData null groupID:{0}", tempGroup.GroupId);
                continue;
            }

            if (!tempGroup.LoopTrigger && (IsGuideGroupComplete(tempGroup.GroupId) || IsTriggerGuideGroup(tempGroup.GroupId)))
            {
                continue;
            }

            if (null == tempGroup.TriggerIds || tempGroup.TriggerIds.Count == 0)
            {
                Engine.Utility.Log.Error("GuideManager_Guide->CheckGuide faield,triggerData error GroupID:{0}", tempGroup.GroupId);
                continue;
            }


            bool matchCheck = false;
            table.GuideTriggerCondiDataBase tempTriggerData = null;
            if (!tempGroup.LoopTrigger || null != checkData.Param && checkData.Param is GuideDefine.RecycleTriggerGuidePassData)
            {
                for (int k = 0, triggerCount = tempGroup.TriggerIds.Count; k < triggerCount; k++)
                {
                    tempTriggerData = GameTableManager.Instance.GetTableItem <table.GuideTriggerCondiDataBase>(tempGroup.TriggerIds[k]);
                    if (null == tempTriggerData)
                    {
                        break;
                    }

                    if (GuideDefine.IsMaskMatchTriggerType(checkData.CheckTypeMask, GuideDefine.GuideTriggerType.Always) ||
                        GuideDefine.IsMaskMatchTriggerType(checkData.CheckTypeMask, tempTriggerData.triggerType) ||
                        tempTriggerData.triggerType == (uint)GuideDefine.GuideTriggerType.Always)
                    {
                        matchCheck = true;
                        break;
                    }
                }
            }

            bool triggerGuideGroup = true;
            if (matchCheck)
            {
                for (int j = 0, maxCount = tempGroup.TriggerIds.Count; j < maxCount; j++)
                {
                    if (!IsMatchTriggerCondition(tempGroup.TriggerIds[j], checkData.Param))
                    {
                        triggerGuideGroup = false;
                        break;
                    }
                }
            }
            else
            {
                triggerGuideGroup = false;
            }

            if (triggerGuideGroup)
            {
                Engine.Utility.Log.LogGroup("WJH", "TriggerGuideGroup:{0}", tempGroup.GroupId);
                newAdd = true;

                if (tempGroup.LoopTrigger)
                {
                    if (IsGuideGroupComplete(tempGroup.GroupId))
                    {
                        m_lst_completeGroupGuide.Remove(tempGroup.GroupId);
                    }
                    ResetGuideGroup(tempGroup.GroupId);

                    if (null != CurDoRepeatUnConstraintGuide)
                    {
                        ResetGuideGroup(CurDoRepeatUnConstraintGuide.GroupId);
                    }
                }

                OnNewGuideGroupTrigger(tempGroup.GroupId);
                //非强制引导触发就发送服务器保存
                if (tempGroup.GType == GuideDefine.GuideType.Unconstrain &&
                    !tempGroup.LoopTrigger)
                {
                    SendGuideComplete(tempGroup.GroupId);
                }
            }
        }

        if (newAdd)
        {
            //执行引导工作流
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENTDOGUIDEWORKFLOW);
        }
    }
Exemplo n.º 17
0
    /// <summary>
    /// 执行引导组
    /// </summary>
    /// <param name="groupId"></param>
    /// <returns></returns>
    private bool DoGuideGroup(uint groupId)
    {
        bool success = false;

        if (GuideManager.IsGuideEnable)
        {
            GuideDefine.LocalGuideGroupData localGroupData = null;
            if (TryGetGuideGroupData(groupId, out localGroupData))
            {
                uint curDoGuideID = 0;
                if (!IsDoingGroup(groupId, out curDoGuideID))
                {
                    localGroupData.Reset();
                    if (localGroupData.GType == GuideDefine.GuideType.Constraint)
                    {
                        m_curDoConstraintGuide = localGroupData;
                    }
                    else if (localGroupData.GType == GuideDefine.GuideType.Unconstrain)
                    {
                        if (!localGroupData.LoopTrigger)
                        {
                            m_dic_curDoUnConstraintGuide.Add(groupId, localGroupData);
                        }
                        else
                        {
                            if (curCanDoRepeatGroup != 0)
                            {
                                curCanDoRepeatGroup = 0;
                            }
                            m_curDoRepeatUnConstraintGuide = localGroupData;
                        }
                    }
                }

                if (localGroupData.CurStep == 0)
                {
                    if (localGroupData.TryGetNextStep(out curDoGuideID))
                    {
                        GuideDefine.LocalGuideData localData = null;
                        if (CheckGuideDataReady(curDoGuideID) && TryGetGuideLocalData(curDoGuideID, out localData))
                        {
                            localData.GuideTargetObj = null;
                            localGroupData.MoveToNextStep();
                            if (localData.JumpID != 0)
                            {
                                ItemManager.DoJump(localData.JumpID);
                            }
                            if (localData.GDType != GuideDefine.GuideGUIDependType.None)
                            {
                                Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENTGUIDEITEMFOCUS, new GuideDefine.GuideItemFocusData()
                                {
                                    DependType = localData.GDType,
                                    Data       = localData.GDParam[0],
                                });
                            }
                            if (localGroupData.GType == GuideDefine.GuideType.Unconstrain)
                            {
                                DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.GuideUnconstrainPanel, data: localData);
                            }
                            else if (localGroupData.GType == GuideDefine.GuideType.Constraint)
                            {
                                DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.GuidePanel, data: localData);
                            }
                            Engine.Utility.Log.LogGroup("WJH", "DoGuide:" + localData.ID);
                            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENTGUIDESHOWOUT);
                        }
                    }
                    else
                    {
                        SilentCompleteGuideGroup(groupId);
                    }
                }
            }
            else
            {
                SilentCompleteGuideGroup(groupId);
            }
        }
        else
        {
            SilentCompleteGuideGroup(groupId);
        }
        return(success);
    }