Ejemplo n.º 1
0
        private MPDispatchBehavior CheckForDispatchBehavior(BaseEvent evt)
        {
            System.Type item = evt.GetType();
            if (!MPData.ReplicatedEventTypes.Contains(item))
            {
                return(MPDispatchBehavior.NormalDispatch);
            }
            if (evt.remoteState == EventRemoteState.IsAutorityReceiveRedirected)
            {
                return(MPDispatchBehavior.NormalDispatch);
            }
            if (evt.remoteState == EventRemoteState.IsRemoteReceiveHandledReplcated)
            {
                return(MPDispatchBehavior.NormalDispatch);
            }
            bool flag = false;

            if (evt.remoteState == EventRemoteState.Idle)
            {
                flag = true;
            }
            else if (evt.remoteState == EventRemoteState.NeedCheckForRemote)
            {
                IEvtWithRemoteID eid       = (IEvtWithRemoteID)evt;
                uint             senderID  = eid.GetSenderID();
                uint             remoteID  = eid.GetRemoteID();
                BaseMPIdentity   identity  = this.ResolveRemoteModeIdentity(senderID);
                BaseMPIdentity   identity2 = this.ResolveRemoteModeIdentity(remoteID);
                if ((identity2 == null) || (identity == null))
                {
                    return(MPDispatchBehavior.RemoteModeDropped);
                }
                bool flag2 = identity.isAuthority || ((identity.remoteMode == IdentityRemoteMode.SendAndNoReceive) || (identity.remoteMode == IdentityRemoteMode.SendAndReceive));
                bool flag3 = identity2.isAuthority || ((identity2.remoteMode == IdentityRemoteMode.ReceiveAndNoSend) || (identity2.remoteMode == IdentityRemoteMode.SendAndReceive));
                flag = flag2 && flag3;
            }
            if (!Singleton <RuntimeIDManager> .Instance.IsSyncedRuntimeID(evt.targetID))
            {
                return(MPDispatchBehavior.NormalDispatch);
            }
            BaseMPIdentity identity3 = Singleton <MPManager> .Instance.TryGetIdentity(evt.targetID);

            if (!flag || (identity3 == null))
            {
                return(MPDispatchBehavior.RemoteModeDropped);
            }
            if (identity3.isAuthority)
            {
                return(MPDispatchBehavior.NormalDispatch);
            }
            return(MPDispatchBehavior.RemoteModeDirectToAuthority);
        }
Ejemplo n.º 2
0
        protected virtual void DispatchListenEvent(BaseEvent evt)
        {
            List <ListenerRegistry> list;

            this._evtListeners.TryGetValue(evt.GetType(), out list);
            if (list != null)
            {
                ListenerRegistry[] registryArray = list.ToArray();
                for (int i = 0; i < registryArray.Length; i++)
                {
                    this._curParentEvt = evt;
                    this._actors[registryArray[i].listenerID].ListenEvent(evt);
                    this._curParentEvt = null;
                }
            }
        }
Ejemplo n.º 3
0
 public virtual void FireEvent(BaseEvent evt, MPEventDispatchMode mode = 0)
 {
     if (!this._isStopped && ((this._maskedEvtTypes.Count <= 0) || !this._maskedEvtTypes.Contains(evt.GetType())))
     {
         evt.parent = this._curParentEvt;
         this._queuedEvents.Add(evt);
     }
 }