예제 #1
0
 public void SendMsg(PTMsg msg)
 {
     if (msg.GetMgrID() == MgrId)
     {
         Process(msg.msgId, msg);
     }
     else
     {
         PTMsgCenter.SendMsg(msg);
     }
 }
예제 #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;
            }
        }
예제 #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));
        }
예제 #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;
            }
        }
예제 #5
0
 // 来了消息以后,通知整个消息链
 protected override void ProcessMsg(int eventId, PTMsg msg)
 {
     mEventSystem.Send(msg.msgId, msg);
 }
예제 #6
0
 public void SendEvent <T>(T eventId) where T : IConvertible
 {
     SendMsg(PTMsg.Allocate(eventId));
 }
예제 #7
0
 public void SendMsg(PTMsg msg)
 {
     mMgr.SendMsg(msg);
 }
예제 #8
0
 protected virtual void ProcessMsg(int eventId, PTMsg msg)
 {
 }