Example #1
0
    /// <summary>
    /// 面板状态改变
    /// </summary>
    /// <param name="status">面板状态数据</param>
    private void OnPanelStatusChanged(UIPanelBase.PanelStatusData status)
    {
        switch (status.Status)
        {
        case UIPanelBase.PanelStatus.Awake:
            break;

        case UIPanelBase.PanelStatus.PrepareShow:
            break;

        case UIPanelBase.PanelStatus.Show:
        {
            OnPanelShow(status.ID);
            //播放音效
            LocalPanelInfo localInfo = null;
            if (TryGetLocalPanelInfo(status.ID, out localInfo) && localInfo.HaveSoundEffect)
            {
                DataManager.Manager <UIManager>().PlayUIAudioEffect(localInfo.SoundEffectId);
            }
        }
        break;

        case UIPanelBase.PanelStatus.Hide:
        {
            OnPanelHide(status.ID);
        }
        break;

        case UIPanelBase.PanelStatus.Destroy:
        {
            //if (IsShowPanel(status.ID))
            //{
            //    UnityEngine.Debug.LogError("p1:" + status.Obj.transform.GetInstanceID());
            //}
            //RemoveHidePanel(status.ID);
        }
        break;
        }

        //if (UIDefine.IsUIDebugLogEnable)
        //    Engine.Utility.Log.Info("UIPanelManager:<color=red>{0}->{1}</color>", status.ID, status.Status.ToString().ToUpper());
        CheckFocusDatas(status.ID);
        Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENT_PANELSTATUSDATACHANGED, status);
    }
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);
        }
    }