Exemplo n.º 1
0
 public void RmvEventHandler(GameEventDef evt, Action handler)
 {
     if (this.CheckValidRmv(evt, handler))
     {
         this.ActionTable[(int)evt] = (Action)Delegate.Remove((Action)this.ActionTable[(int)evt], handler);
     }
 }
Exemplo n.º 2
0
 public void RmvEventHandler <ParamType>(GameEventDef evt, RefAction <ParamType> handler)
 {
     if (this.CheckValidRmv(evt, handler))
     {
         this.ActionTable[(int)evt] = (RefAction <ParamType>)Delegate.Remove((RefAction <ParamType>) this.ActionTable[(int)evt], handler);
     }
 }
Exemplo n.º 3
0
 public void AddEventHandler(GameEventDef evt, Action handler)
 {
     if (this.CheckValidAdd(evt, handler))
     {
         this.ActionTable[(int)evt] = (Action)Delegate.Combine((Action)this.ActionTable[(int)evt], handler);
     }
 }
Exemplo n.º 4
0
		public void SendEvent<ParamType>(GameEventDef evt, ref ParamType prm)
		{
			RefAction<ParamType> refAction = this.ActionTable[(int)evt] as RefAction<ParamType>;
			if (refAction != null)
			{
				refAction(ref prm);
			}
		}
Exemplo n.º 5
0
		public void SendEvent(GameEventDef evt)
		{
			Action action = this.ActionTable[(int)evt] as Action;
			if (action != null)
			{
				action.Invoke();
			}
		}
Exemplo n.º 6
0
        protected override void CopyData(BaseEvent src)
        {
            base.CopyData(src);
            SendGameEventTick sendGameEventTick = src as SendGameEventTick;

            this.eventType    = sendGameEventTick.eventType;
            this.eventSrcId   = sendGameEventTick.eventSrcId;
            this.eventAtkerId = sendGameEventTick.eventAtkerId;
        }
Exemplo n.º 7
0
		public void PostEvent<ParamType>(GameEventDef evt, ref ParamType prm)
		{
			RefAction<ParamType> refAction = this.ActionTable[(int)evt] as RefAction<ParamType>;
			if (refAction != null)
			{
				PostEventWrapper<ParamType> postEventWrapper = new PostEventWrapper<ParamType>(refAction, prm, 1u);
				this.postEventList.Add(postEventWrapper);
			}
		}
Exemplo n.º 8
0
        private bool CheckValidAdd(GameEventDef evt, Delegate handler)
        {
            Delegate delegate2 = this.ActionTable[(int)evt];

            if ((delegate2 != null) && (delegate2.GetType() != handler.GetType()))
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 9
0
        private bool CheckValidRmv(GameEventDef evt, Delegate handler)
        {
            Delegate @delegate = this.ActionTable[(int)evt];

            return(@delegate != null && @delegate.GetType() == handler.GetType());
        }
Exemplo n.º 10
0
		private bool CheckValidAdd(GameEventDef evt, Delegate handler)
		{
			Delegate @delegate = this.ActionTable[(int)evt];
			return @delegate == null || @delegate.GetType() == handler.GetType();
		}