Beispiel #1
0
        public void SendMsg(QMsg tmpMsg)
        {
            // Framework Msg
            switch (tmpMsg.ManagerID)
            {
            case QMgrID.UI:
                QUIManager.Instance.SendMsg(tmpMsg);
                return;

            case QMgrID.Audio:
                AudioManager.Instance.SendMsg(tmpMsg);
                return;

            case QMgrID.Camera:
                CameraManager.Instance.SendMsg(tmpMsg);
                return;

            case QMgrID.Network_WEB:
                WebManager.Instance.SendMsg(tmpMsg);
                return;

            case QMgrID.Model:
                ModelManager.Instance.SendMsg(tmpMsg);
                return;

            case QMgrID.Pointer:
                PointerManager.Instance.SendMsg(tmpMsg);
                return;
            }

            // ForwardMsg(tmpMsg);
        }
Beispiel #2
0
 public void Process(int eventId, params object[] param)
 {
     if (gameObject.activeInHierarchy)
     {
         QMsg msg = param[0] as QMsg;
         ProcessMsg(eventId, msg);
     }
 }
Beispiel #3
0
        public static QMsg Allocate <T>(T eventId) where T : IConvertible
        {
            QMsg msg = SafeObjectPool <QMsg> .Instance.Allocate();

            msg.EventID   = eventId.ToInt32(null);
            msg.ReuseAble = true;
            return(msg);
        }
Beispiel #4
0
 public static void ForwardMsg(QMsg msg)
 {
     switch (msg.ManagerID)
     {
     case QMgrID.Game:
         Player.GameManager.Instance.SendMsg(msg);
         break;
     }
 }
Beispiel #5
0
 protected override void ProcessMsg(int eventId, QMsg msg)
 {
     switch (eventId)
     {
     case (int)UIEvent.Msg:
         Text.text += (msg as SocketMsg).Msg;
         break;
     }
 }
 /// <summary>
 /// 覆盖掉上一级的消息转发
 /// </summary>
 public override void ProcessMsg(QMsg msg)
 {
     switch (msg.msgId)
     {
     case (ushort)QSoundEvent.SoundSwitch:
         Debug.Log("SoundOn:" + ((QSoundMsg)msg).soundOn);
         break;
     }
 }
Beispiel #7
0
 protected void Process(int key, params object[] param)
 {
     if (gameObject.activeInHierarchy)
     {
         QMsg msg = param[0] as QMsg;
         ProcessMsg(key, msg);
         ProcessMsg(msg);
     }
 }
Beispiel #8
0
        protected override void ProcessMsg(int key, QMsg msg)
        {
            switch (msg.msgId)
            {
            case (int)AudioEvent.SoundSwitch:
                AudioMsgWithBool soundSwitchMsg = msg as AudioMsgWithBool;
                SoundOn = soundSwitchMsg.on;
                break;

            case (int)AudioEvent.MusicSwitch:
                AudioMsgWithBool musicSwitchMsg = msg as AudioMsgWithBool;
                MusicOn = musicSwitchMsg.on;
                if (!MusicOn)
                {
                    StopMusic();
                }
                break;

            case (int)AudioEvent.PlayMusic:
                Debug.LogFormat("play music msg: {0}, is musicOn: ", AudioEvent.PlayMusic.ToString(), MusicOn);
                PlayMusic(msg as AudioMusicMsg);
                break;

            case (int)AudioEvent.StopMusic:
                StopMusic();
                break;

            case (int)AudioEvent.PlaySound:
                AudioSoundMsg audioSoundMsg = msg as AudioSoundMsg;
                PlaySound(audioSoundMsg);
                break;

            case (int)AudioEvent.PlayVoice:
                PlayVoice(msg as AudioVoiceMsg);
                break;

            case (int)AudioEvent.StopVoice:
                StopVoice();
                break;

            case (int)AudioEvent.PlayNode:
                IAction msgPlayNode = (msg as AudioMsgWithNode).Node;
                StartCoroutine(msgPlayNode.Execute());
                break;

            case (int)AudioEvent.AddRetainAudio:
                AddRetainAudioMsg addRetainAudioMsg = msg as AddRetainAudioMsg;
                AddRetainAudio(addRetainAudioMsg.AudioName);
                break;

            case (int)AudioEvent.RemoveRetainAudioAudio:
                RemoveRetainAudioMsg removeRetainAudioMsg = msg as RemoveRetainAudioMsg;
                RemoveRetainAudio(removeRetainAudioMsg.AudioName);
                break;
            }
        }
 partial void ForwardMsg(QMsg tmpMsg)
 {
     switch (tmpMsg.ManagerID)
     {
     case QMgrID.Player:
         // Manager的SendMsg方法如果发现是自己管理的事件会自己处理
         PlayerManager.Instance.SendMsg(tmpMsg);
         break;
     }
 }
Beispiel #10
0
 public override void SendMsg(QMsg msg)
 {
     if (msg.GetMgrID() == mMgrId)
     {
         Process(msg.msgId, msg);
     }
     else
     {
         QMsgCenter.Instance.SendMsg(msg);
     }
 }
Beispiel #11
0
 public void SendMsg(QMsg msg)
 {
     if ((ushort)msg.GetMgrID() == mMgrId)
     {
         ProcessMsg(msg);
     }
     else
     {
         QMsgCenter.Instance.SendToMsg(msg);
     }
 }
Beispiel #12
0
 public override void SendMsg(QMsg msg)
 {
     if (msg.ManagerID == ManagerId)
     {
         Process(msg.EventID, msg);
     }
     else
     {
         QMsgCenter.Instance.SendMsg(msg);
     }
 }
Beispiel #13
0
        public void SendMsg(QMsg tmpMsg)
        {
            foreach (var manager in mRegisteredManagers)
            {
                if (manager.Key == tmpMsg.ManagerID)
                {
                    manager.Value().SendMsg(tmpMsg);
                    return;
                }
            }

            ForwardMsg(tmpMsg);
        }
Beispiel #14
0
        public void Process(int eventId, params object[] param)
        {
            if (mReceiveMsgOnlyObjActive && gameObject.activeInHierarchy || !mReceiveMsgOnlyObjActive)
            {
                QMsg msg = param[0] as QMsg;
                ProcessMsg(eventId, msg);
                msg.Processed = true;

                if (msg.ReuseAble)
                {
                    msg.Recycle2Cache();
                }
            }
        }
Beispiel #15
0
 static int SendMsg(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         QFramework.QMgrBehaviour obj  = (QFramework.QMgrBehaviour)ToLua.CheckObject <QFramework.QMgrBehaviour>(L, 1);
         QFramework.QMsg          arg0 = (QFramework.QMsg)ToLua.CheckObject <QFramework.QMsg>(L, 2);
         obj.SendMsg(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #16
0
        /// <summary>
        /// 转发消息
        /// </summary>
        private static void ForwardMsg(QMsg msg)
        {
            int tmpId = msg.GetMgrID();

            switch (tmpId)
            {
            case  QMgrID.UI:
                QUIManager.Instance.SendMsg(msg);
                break;

            case QMgrID.Data:
                ToDoListManager.Instance.SendMsg(msg);
                break;
            }
        }
Beispiel #17
0
        public void SendMsg(QMsg tmpMsg)
        {
            // Framework Msg
            switch (tmpMsg.ManagerID)
            {
            case QMgrID.UI:
                UIManager.Instance.SendMsg(tmpMsg);
                return;

            case QMgrID.Audio:
                AudioManager.Instance.SendMsg(tmpMsg);
                return;
            }

            // ForwardMsg(tmpMsg);
        }
Beispiel #18
0
        protected override void ProcessMsg(int key, QMsg msg)
        {
            switch (msg.msgId)
            {
            case (ushort)AudioEvent.SoundSwitch:
                AudioMsgWithBool soundSwitchMsg = msg as AudioMsgWithBool;
                mSoundOn = soundSwitchMsg.on;
                break;

            case (ushort)AudioEvent.MusicSwitch:
                AudioMsgWithBool musicSwitchMsg = msg as AudioMsgWithBool;
                mMusicOn = musicSwitchMsg.on;
                if (!mMusicOn)
                {
                    StopMusic();
                }
                break;

            case (ushort)AudioEvent.PlayMusic:
                Debug.LogFormat("play music msg: {0}, is musicOn: ", AudioEvent.PlayMusic.ToString(), mMusicOn);
                PlayMusic(msg as AudioMsgPlayMusic);
                break;

            case (ushort)AudioEvent.StopMusic:
                StopMusic();
                break;

            case (ushort)AudioEvent.PlaySound:
                AudioMsgPlaySound audioMsgPlaySound = msg as AudioMsgPlaySound;
                PlaySound(audioMsgPlaySound);
                break;

            case (ushort)AudioEvent.PlayVoice:
                PlayVoice(msg as AudioMsgPlayVoice);
                break;

            case (ushort)AudioEvent.StopVoice:
                StopVoice();
                break;

            case (ushort)AudioEvent.PlayNode:
                ICoroutineCmdNode msgPlayNode = (msg as AudioMsgWithNode).Node;

                StartCoroutine(msgPlayNode.Execute());
                break;
            }
        }
        protected override void ProcessMsg(int eventId, QMsg msg)
        {
            switch (eventId)
            {
            case (int)PCConnectMobileEvent.PCClientCreated:

                if (IsMobileServer)
                {
                    throw new Exception(
                              "mobile server already created,cannot create both pc client and mobile server");
                }
                IsPCClient     = true;
                IsMobileServer = false;
                break;

            case (int)PCConnectMobileEvent.MobileServerCreated:
                if (IsPCClient)
                {
                    throw new Exception("pc client already created,cannot create both pc client and mobile server");
                }
                IsPCClient     = false;
                IsMobileServer = true;
                break;

            case (int)PCConnectMobileEvent.SocketEvent:
                SocketMsg socketMsg = msg as SocketMsg;
                socketMsg.EventID = socketMsg.ToEventID;

                if (IsPCClient)
                {
                    PCClient.Instance.SendMsg(msg as SocketMsg);
                }
                else if (IsMobileServer)
                {
                    MobileServer.Instance.SendMsg(msg as SocketMsg);
                }
                else
                {
                    SendMsg(socketMsg);
                }
                break;
            }
        }
Beispiel #20
0
        // 来了消息以后,通知整个消息链
        public override void ProcessMsg(QMsg msg)
        {
            if (!msgDic.ContainsKey(msg.msgId))
            {
                Debug.LogError("msg not found:" + msg.msgId);
                return;
            }
            else
            {
                QMsgNode msgNode = msgDic[msg.msgId];

                // 进行广播
                do
                {
                    msgNode.behaviour.ProcessMsg(msg);

                    msgNode = msgNode.next;
                }while (msgNode != null);
            }
        }
Beispiel #21
0
        public void SendMsg(QMsg tmpMsg)
        {
            // Framework Msg
            switch (tmpMsg.GetMgrID())
            {
            case QMgrID.UI:
                QUIManager.Instance.SendMsg(tmpMsg);
                return;

            case QMgrID.Audio:
                AudioManager.Instance.SendMsg(tmpMsg);
                return;

            case QMgrID.PCConnectMobile:
                PCConnectMobileManager.Instance.SendMsg(tmpMsg);
                return;
            }

            // ForwardMsg(tmpMsg);
        }
Beispiel #22
0
        /// <summary>
        /// 转发消息
        /// </summary>
        private static void ForwardMsg(QMsg msg)
        {
            int tmpId = msg.GetMgrID();

            switch (tmpId)
            {
            case QMgrID.AB:
                break;

            case QMgrID.Sound:
                break;

            case  QMgrID.CharactorManager:
                break;

            case  QMgrID.Framework:
                break;

            case  QMgrID.Network:

                break;

            case  QMgrID.NPCManager:
                break;

            case  QMgrID.UI:
                QUIManager.Instance.SendMsg(msg);
                break;

            case QMgrID.Data:
                ToDoList.ToDoListManager.Instance.SendMsg(msg);
                break;

            default:
                break;
            }
        }
Beispiel #23
0
 protected override void ProcessMsg(int eventId, QFramework.QMsg msg)
 {
     throw new System.NotImplementedException();
 }
Beispiel #24
0
 protected virtual void ProcessMsg(int eventId, QMsg msg)
 {
 }
Beispiel #25
0
 /// <summary>
 /// 兼容之前版本
 /// </summary>
 protected virtual void ProcessMsg(QMsg msg)
 {
 }
Beispiel #26
0
 public virtual void SendMsg(QMsg msg)
 {
     mCurMgr.SendMsg(msg);
 }
Beispiel #27
0
 public virtual void SendMsg(QMsg msg)
 {
     Manager.SendMsg(msg);
 }
Beispiel #28
0
 protected override void ProcessMsg(int key, QMsg msg)
 {
     throw new System.NotImplementedException();
 }
Beispiel #29
0
 // 来了消息以后,通知整个消息链
 protected override void ProcessMsg(int eventId, QMsg msg)
 {
     mEventSystem.Send(msg.EventID, msg);
 }
Beispiel #30
0
 public override void SendEvent <T>(T eventId)
 {
     SendMsg(QMsg.Allocate(eventId));
 }