/// <summary>
    /// 刷新已经显示的引导可见状态
    /// </summary>
    private void RefreshShowGuideVisbieStatus(UIDefine.GameObjMoveData moveData = null)
    {
        if (null != m_dic_showGuide && m_dic_showGuide.Count > 0)
        {
            bool         visible  = false;
            GuideTrigger gTrigger = null;
            foreach (KeyValuePair <uint, UIUnconstraintGrid> pair in m_dic_showGuide)
            {
                GuideDefine.LocalGuideData localData = null;
                if (!DataManager.Manager <GuideManager>().TryGetGuideLocalData(pair.Key, out localData))
                {
                    continue;
                }

                visible = DataManager.Manager <GuideManager>().IsGuideUIStatusReady(pair.Key) && UIManager.IsObjVisibleByCamera(localData.GuideTargetObj);
                if (visible && null != moveData && null != moveData.Objs &&
                    moveData.Objs.Contains(localData.GuideTargetObj))
                {
                    switch (moveData.Status)
                    {
                    case UIDefine.GameObjMoveStatus.MoveToInvisible:
                    case UIDefine.GameObjMoveStatus.Invisible:
                        visible = false;
                        break;

                    case UIDefine.GameObjMoveStatus.Visible:
                        visible = true;
                        break;
                    }
                }
                if (null != pair.Value)
                {
                    if (visible)
                    {
                        if (!pair.Value.Visible)
                        {
                            ShowGuide(pair.Key);
                        }
                        if (localData.RefreshPosInTime)
                        {
                            pair.Value.RefreshPos();
                        }
                    }
                    else if (!visible && pair.Value.Visible)
                    {
                        pair.Value.SetVisible(false);
                        if (null != localData.GuideTargetObj)
                        {
                            gTrigger = localData.GuideTargetObj.GetComponent <GuideTrigger>();
                            if (null != gTrigger && gTrigger.enabled)
                            {
                                gTrigger.enabled = false;
                            }
                        }
                    }
                }
            }
        }
    }
    private void OnUIEventHandler(int eventType, object data)
    {
        switch (eventType)
        {
        case (int)Client.GameEventID.UIEVENT_PANELFOCUSSTATUSCHANGED:
        case (int)Client.GameEventID.UIEVENTREFRESHUNCONSTRAINTGUIDESTATUS:
        {
            RefreshShowGuideVisbieStatus();
        }
        break;

        case (int)Client.GameEventID.UIEVENTGAMEOBJMOVESTATUSCHANGED:
        {
            if (null != data && data is UIDefine.GameObjMoveData)
            {
                UIDefine.GameObjMoveData moveData = data as UIDefine.GameObjMoveData;
                if (moveData.Status != UIDefine.GameObjMoveStatus.MoveToVisible && null != moveData.Objs)
                {
                    RefreshShowGuideVisbieStatus(moveData);
                }
            }
        }
        break;

        case (int)Client.GameEventID.UIEVENTGUIDERESET:
        {
            //重置引导
            if (null != data && data is uint)
            {
                uint guideID = (uint)data;
                ResetGuide(guideID);
            }
        }
        break;
        }
    }
Beispiel #3
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);
        }
    }