Example #1
0
    /// <summary>
    ///检测是否有新功能开启
    /// </summary>
    /// <param name="triggerType">检测触发类型</param>
    private void CheckNewFuncOpen(CheckWorkFlowData checkData)
    {
        if (null == checkData || checkData.CheckTypeMask == 0)
        {
            return;
        }

        table.GuideTriggerCondiDataBase triggerData = null;
        foreach (KeyValuePair <uint, GuideDefine.LocalFuncOpenData> pair in m_dic_funcOpenDatas)
        {
            if ((m_lst_canDoFuncOpen.Contains(pair.Key) ||
                 m_lst_alreadyDoFuncOpen.Contains(pair.Key)) &&
                pair.Value.CloseTriggerId == 0)
            {
                continue;
            }
            if (pair.Value.AutoOpen)
            {
                if (pair.Value.CloseTriggerId != 0 &&
                    IsMatchTriggerCondition(pair.Value.CloseTriggerId, checkData.Param))
                {
                    CloseNewFuncOpen(pair.Key);
                }
                else
                {
                    CompleteNewFuncOpen(new
                                        GuideDefine.FuncOpenShowData()
                    {
                        FOT        = GuideDefine.FuncOpenType.Base,
                        FuncOpenId = pair.Key,
                    });
                }
            }
            else
            {
                triggerData = GameTableManager.Instance.GetTableItem <table.GuideTriggerCondiDataBase>(pair.Value.TriggerId);
                if (null == triggerData)
                {
                    continue;
                }

                if (GuideDefine.IsMaskMatchTriggerType(checkData.CheckTypeMask, GuideDefine.GuideTriggerType.Always) ||
                    GuideDefine.IsMaskMatchTriggerType(checkData.CheckTypeMask, triggerData.triggerType) ||
                    triggerData.triggerType == (uint)GuideDefine.GuideTriggerType.Always)
                {
                    if (IsMatchTriggerCondition(pair.Value.TriggerId, checkData.Param))
                    {
                        if (pair.Value.CloseTriggerId == 0 || !IsMatchTriggerCondition(pair.Value.CloseTriggerId, checkData.Param))
                        {
                            AddNewFuncOpen(pair.Key);
                        }
                        else if (IsMatchTriggerCondition(pair.Value.CloseTriggerId, checkData.Param))
                        {
                            CloseNewFuncOpen(pair.Key);
                        }
                    }
                }
            }
        }
    }
Example #2
0
    /// <summary>
    /// 事件处理
    /// </summary>
    /// <param name="nEventID"></param>
    /// <param name="param"></param>
    public void GlobalEventHandler(int nEventID, object param)
    {
        GuideDefine.GuideTriggerType triggerType = GuideDefine.GuideTriggerType.Invalide;
        bool playerLogin = false;

        switch (nEventID)
        {
        case (int)Client.GameEventID.ENTITYSYSTEM_LEVELUP:
        {
            triggerType = GuideDefine.GuideTriggerType.Level;
            CheckTabFuncOpen(true);
        }
        break;

        case (int)(int)Client.GameEventID.CHAPTER_EFFECT_END:
        {
            triggerType = GuideDefine.GuideTriggerType.ChapterEnd;
        }
        break;

        case (int)Client.GameEventID.TASK_ACCEPT:
        case (int)Client.GameEventID.TASK_DONING:
        case (int)Client.GameEventID.TASK_CANSUBMIT:
        case (int)Client.GameEventID.TASK_DONE:
        case (int)Client.GameEventID.UIEVENTGUIDERECYCLETRIGGER:
        {
            triggerType = GuideDefine.GuideTriggerType.Task;
        };
            break;

        case (int)Client.GameEventID.SEVENDAYOPENSTATUS:
        case (int)Client.GameEventID.GODWEAPENSTATUS:
        case (int)Client.GameEventID.OPENSERVERGIFTSTATUS:
        case (int)Client.GameEventID.FIRSTRECHARGESTATUS:
        case (int)Client.GameEventID.RETREWARDSTATUS:
        case (int)Client.GameEventID.QUESTIONSTATUS:
        {
            triggerType = GuideDefine.GuideTriggerType.Condition;
        }
        break;

        case (int)Client.GameEventID.TITLE_NEWTITLE:               //称号获得
        case (int)Client.GameEventID.MAINPANEL_SHOWREDWARING:      //日常
        {
            stShowMainPanelRedPoint st        = (stShowMainPanelRedPoint)param;
            WarningDirection        direction = (WarningDirection)st.direction;
            WarningEnum             model     = (WarningEnum)st.modelID;
            if (model == WarningEnum.Daily && st.bShowRed)
            {
                triggerType = GuideDefine.GuideTriggerType.Condition;
            }
        }
        break;

        case (int)Client.GameEventID.UIEVENTDOGUIDEWORKFLOWCHECK:
        {
            CheckWorkFlowData checkData = new CheckWorkFlowData
            {
                CheckTypeMask = GuideDefine.GetTriggerMaskByType(GuideDefine.GuideTriggerType.Always),
            };
            if (null != param && param is CheckWorkFlowData)
            {
                checkData = (CheckWorkFlowData)param;
            }
            CheckWorkFlow(checkData);
        }
        break;

        case (int)Client.GameEventID.SYSTEM_GAME_READY:
            //case (int)Client.GameEventID.PLAYER_LOGIN_SUCCESS:
        {
            triggerType = GuideDefine.GuideTriggerType.Always;
            playerLogin = true;
            CheckTabFuncOpen(false);
        }
        break;

        case (int)Client.GameEventID.RECONNECT_SUCESS:
        {
            //断线重连
            if (null != param && param is Client.stReconnectSucess)
            {
                Client.stReconnectSucess reconnect = (Client.stReconnectSucess)param;
            }
            triggerType = GuideDefine.GuideTriggerType.Always;
            playerLogin = true;
        }
        break;

        case (int)Client.GameEventID.UIEVENTGUIDEWORKFLOWCHECKCOMPLETE:
        {
            //设置数据状态
            m_bool_workFlowReady = true;
            //执行下一个工作流
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENTDOGUIDEWORKFLOW);
        }
        break;

        case (int)Client.GameEventID.UIEVENTDOGUIDEWORKFLOW:
        {
            DoWorkFlow();
        }
        break;

        case (int)Client.GameEventID.UIEVENT_PANELSTATUS:
        {
            if (null != param && param is UIPanelBase.PanelStatusData)
            {
                UIPanelBase.PanelStatusData status = (UIPanelBase.PanelStatusData)param;
                if (status.Status == UIPanelBase.PanelStatus.Show)
                {
                    DoRefreshNewFuncOpenStaus(status.ID);
                }
                else if (status.Status == UIPanelBase.PanelStatus.Hide)
                {
                    ClearRecycleTriggerGuideByPanel(status.ID);
                }
            }
        }
        break;

        /***************面板焦点状态改变********************/
        case (int)Client.GameEventID.UIEVENT_PANELFOCUSSTATUSCHANGED:
        {
            UIPanelManager.PanelFocusData status = (UIPanelManager.PanelFocusData)param;
            if (status.GetFocus)
            {
                //任务提交面板显示检测工作流(条件触发)
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENTDOGUIDEWORKFLOWCHECK
                                                                    , new CheckWorkFlowData()
                    {
                        CheckTypeMask = (1 << (int)GuideDefine.GuideTriggerType.Condition),
                    });

                //刷新新功能开启状态
                //DoRefreshNewFuncOpenStaus(status.ID);
                //执行下一个工作流
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENTDOGUIDEWORKFLOW);
            }
        }
        break;

        case (int)Client.GameEventID.UIEVENTGAMEOBJMOVESTATUSCHANGED:
        {
            if (null != param && param is UIDefine.GameObjMoveData)
            {
                UIDefine.GameObjMoveData moveData = param as UIDefine.GameObjMoveData;
                //Engine.Utility.Log.LogGroup("WJH", "MOveStatus status:{0} child:{1} ", moveData.Status, moveData.Objs.Count);
                bool adjustTime = false;
                bool matchTime  = false;
                switch (moveData.Status)
                {
                case UIDefine.GameObjMoveStatus.MoveToInvisible:
                {
                    adjustTime = true;
                    matchTime  = false;
                }
                break;

                case UIDefine.GameObjMoveStatus.Invisible:
                case UIDefine.GameObjMoveStatus.Visible:
                {
                    adjustTime = true;
                    matchTime  = true;
                }
                break;

                case UIDefine.GameObjMoveStatus.MoveToVisible:
                {
                }
                break;
                }

                AdjustWorkFlowDoTime(adjustTime, matchTime);
                AdjustUnGuideRefreshDoTime(adjustTime, matchTime);
            }
        }
        break;

        /**********新手引导*************/
        case (int)Client.GameEventID.UIEVENTGUIDECOMPLETE:
        {
            //完成一个引导
            CompleteGuide((uint)param);
            //执行下一个工作流
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENTDOGUIDEWORKFLOW);
        }
        break;

        case (int)Client.GameEventID.UIEVENTGUIDESKIP:
        {
            //跳过静默完成当前引导
            SilentCompleteGuideGroup((uint)param);
            //执行下一个工作流
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENTDOGUIDEWORKFLOW);
        }
        break;

        /**********新功能开启*************/
        case (int)Client.GameEventID.UIEVENTNEWFUNCOPENREAD:
        {
            OnNewFuncOpenRead((GuideDefine.FuncOpenShowData)param);
        }
        break;

        case (int)Client.GameEventID.UIEVENTNEWFUNCOPENADD:
        {
            OnNewFuncOpenAdd((GuideDefine.FuncOpenShowData)param);
        }
        break;

        case (int)Client.GameEventID.UIEVENTNEWFUNCCOMPLETE:
        {
            //执行下一个工作流
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENTDOGUIDEWORKFLOW);
        }
        break;

        //物品变更检测工作流(条件触发)
        case (int)Client.GameEventID.UIEVENT_UPDATEITEM:
        {
            if (null != param && param is ItemDefine.UpdateItemPassData)
            {
                ItemDefine.UpdateItemPassData passData = param as ItemDefine.UpdateItemPassData;
                if (passData.UpdateType == ItemDefine.UpdateItemType.Add ||
                    (passData.UpdateType == ItemDefine.UpdateItemType.Update && passData.ChangeNum > 0))
                {
                    GuideDefine.GetTriggerMaskByType(GuideDefine.GuideTriggerType.Condition);
                    //任务提交面板显示检测工作流(条件触发)
                    Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENTDOGUIDEWORKFLOWCHECK
                                                                        , new CheckWorkFlowData()
                        {
                            CheckTypeMask = (GuideDefine.GetTriggerMaskByType(GuideDefine.GuideTriggerType.Condition)
                                             | GuideDefine.GetTriggerMaskByType(GuideDefine.GuideTriggerType.ItemGet)),
                            Param = passData.BaseId,
                        });
                }
            }
        }
        break;

        case (int)Client.GameEventID.UIEVENTUISTATECHANGED:
        {
            if (null != param && param is PanelID)
            {
                PanelID pid = (PanelID)param;
                RefreshGuideTargetObj(pid);
            }
        }
        break;
        }

        if (triggerType != GuideDefine.GuideTriggerType.Invalide)
        {
            //检测工作流
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENTDOGUIDEWORKFLOWCHECK, new CheckWorkFlowData()
            {
                CheckTypeMask = GuideDefine.GetTriggerMaskByType(triggerType),
                Param         = param,
            });
        }

        if (playerLogin)
        {
            //数据流准备好
            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENTGUIDEWORKFLOWCHECKCOMPLETE);
        }
    }
Example #3
0
    //将要执行的引导工作流数据
    //System.Collections.Queue
    //private List<GuideDefine.GuideWorkFlowData> m_lst_waitWorkFlow = null;
    ////当前正在执行的工作流
    //private Dictionary<GuideDefine.GuideWorkFlowType, List<GuideDefine.GuideWorkFlowData>> m_dic_curDoWorkFlow = null;
    ////当前满足条件的工作流
    //private Dictionary<GuideDefine.GuideWorkFlowType, List<GuideDefine.GuideWorkFlowData>> m_dic_canDoWorkFlow = null;

    /// <summary>
    /// 工作流检测
    /// </summary>
    /// <param name="triggerType"></param>
    private void CheckWorkFlow(CheckWorkFlowData checkData)
    {
        CheckNewFuncOpen(checkData);
        CheckGuide(checkData);
    }
Example #4
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);
        }
    }