public void SendMsg(PTMsg msg)
 {
     if (msg.GetMgrID() == MgrId)
     {
         Process(msg.msgId, msg);
     }
     else
     {
         PTMsgCenter.SendMsg(msg);
     }
 }
Example #2
0
        protected override void ProcessMsg(int eventId, PTMsg msg)
        {
            switch (eventId)
            {
            case (int)LagecyActionEvent.ExecuteAction:

                var actionMsg = msg as ActionMsg;

                mActiveActions.Find(action => action.Name.Equals(actionMsg.Name)).Execute();

                break;
            }
        }
Example #3
0
        public static void SendMsg(PTMsg tmpMsg)
        {
            // Framework Msg
            switch (tmpMsg.GetMgrID())
            {
            case PTMgrID.UI:
                PTUIManager.Instance.SendMsg(tmpMsg);
                break;

            case PTMgrID.Audio:
                //AudioManager.Instance.SendMsg(tmpMsg);
                break;

            case PTMgrID.Action:
                ActionMgr.Instance.SendMsg(tmpMsg);
                break;

            case PTMgrID.PCConnectMobile:
//					PCConnectMobileManager.Instance.SendMsg(tmpMsg);
                break;
            }

            if (!mIsInit)
            {
                mMsgCenters = new List <IMsgCenter>();
                var subTypeQuery = AppDomain.CurrentDomain.GetAssemblies()
                                   .SelectMany(a => a.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(IMsgCenter))))
                                   .ToArray();
                Debug.Log("===Inhert IMsgCenter>>>" + subTypeQuery.Count());
                foreach (var type in subTypeQuery)
                {
                    Debug.Log("===Inhert IMsgCenter>>>" + type.Name);
                    var data = Activator.CreateInstance(type);
                    mMsgCenters.Add((IMsgCenter)data);
                }
                mIsInit = true;
            }
            mMsgCenters.ForEach(t => t.SendMsg(tmpMsg));
        }
Example #4
0
        protected override void ProcessMsg(int key, PTMsg msg)
        {
            PTDebug.Log("{0}", msg.EventID);
            switch (key)
            {
            case (ushort)UIFilterEvent.DelayLock:
                PTDebug.Log("receive");
                var lockOnClickEventMsg = msg as UILockOnClickEventMsg;
                LockBtnOnClick = true;
                var delayNode = new DelayAction(lockOnClickEventMsg.LockTime)
                {
                    OnEndedCallback = delegate
                    {
                        LockBtnOnClick = false;
                    }
                };
                StartCoroutine(delayNode.Execute());
                break;

            case (ushort)UIFilterEvent.Lock:
                PTDebug.Log("Lock");
                Lock = true;
                break;

            case (ushort)UIFilterEvent.UnLock:
                PTDebug.Log("UnLock");
                Lock = false;
                break;

            case (int)UIFilterEvent.LockObjEvent:
            {
                var lockObjEventMsg = msg as UILockObjEventMsg;
                if (null == LockedObj)
                {
                    LockedObj = lockObjEventMsg.LockedObj;
                }
                else if (LockedObj == lockObjEventMsg.LockedObj)
                {
                    // maybe two finger in one obj
                    PTDebug.LogWarning("error: curLockedObj is already seted");
                }
                else if (LockedObj != lockObjEventMsg.LockedObj)
                {
                    throw new Exception("error: pre obj need unlocked");
                }
            }
            break;

            case (int)UIFilterEvent.UnlockObjEvent:
            {
                var unlockObjEventMsg = msg as UIUnlockObjEventMsg;
                if (unlockObjEventMsg.UnlockedObj == LockedObj)
                {
                    unlockObjEventMsg.UnlockedObj = null;
                    LockedObj = null;
                }
                else if (LockedObj == null)
                {
                    PTDebug.LogWarning("error: curLockedObj is already unlocked");
                }
                else if (LockedObj != unlockObjEventMsg.UnlockedObj)
                {
                    throw new Exception("error: pre obj need unlocked");
                }
            }
            break;
            }
        }
 // 来了消息以后,通知整个消息链
 protected override void ProcessMsg(int eventId, PTMsg msg)
 {
     mEventSystem.Send(msg.msgId, msg);
 }
 public void SendEvent <T>(T eventId) where T : IConvertible
 {
     SendMsg(PTMsg.Allocate(eventId));
 }
Example #7
0
 public void SendMsg(PTMsg msg)
 {
     mMgr.SendMsg(msg);
 }
Example #8
0
 protected virtual void ProcessMsg(int eventId, PTMsg msg)
 {
 }