Esempio n. 1
0
 public void RegistersEvent(EventDefine eventName , EventHandler handler , object sender = null )
 {
     if ( eventDict.ContainsKey(eventName) )
     {
         Dictionary<EventHandler,EventClass> ecDict;
         eventDict.TryGetValue(eventName, out ecDict);
         if ( ecDict == null )
         {
             Debug.LogError("No event class list found in " + eventName.ToString() +"'s dictionary");
         }else
         {
             if ( ecDict.ContainsKey(handler) )
             {
                 Debug.LogError("Mutiply define of handler" + eventName.ToString());
             }else
             {
                 ecDict.Add(handler, new EventClass(eventName,handler,sender));
             }
         }
     }
     else
     {
         var ecDict = new Dictionary<EventHandler,EventClass>();
         ecDict.Add(handler, new EventClass(eventName,handler,sender));
         eventDict.Add(eventName, ecDict);
     }
 }
Esempio n. 2
0
 public void RegistersEvent(EventDefine eventName, EventHandler handler, object sender = null)
 {
     if (eventDict.ContainsKey(eventName))
     {
         Dictionary <EventHandler, EventClass> ecDict;
         eventDict.TryGetValue(eventName, out ecDict);
         if (ecDict == null)
         {
             Debug.LogError("No event class list found in " + eventName.ToString() + "'s dictionary");
         }
         else
         {
             if (ecDict.ContainsKey(handler))
             {
                 Debug.LogError("Mutiply define of handler" + eventName.ToString());
             }
             else
             {
                 ecDict.Add(handler, new EventClass(eventName, handler, sender));
             }
         }
     }
     else
     {
         var ecDict = new Dictionary <EventHandler, EventClass>();
         ecDict.Add(handler, new EventClass(eventName, handler, sender));
         eventDict.Add(eventName, ecDict);
     }
 }
Esempio n. 3
0
	public void UnregistersEvent(EventDefine eventName , EventHandler handler)
	{
		if ( eventDict.ContainsKey(eventName))
		{
			Dictionary<EventHandler,EventClass> ecDict;
			eventDict.TryGetValue(eventName, out ecDict);
			if ( ecDict == null )
			{
				Debug.LogError("no event class list found in " + eventName.ToString() +"'s list");
			}else
			{
				if ( !ecDict.ContainsKey(handler) )
				{
					Debug.LogError("No define of handler" + eventName.ToString());
				}else
				{
					ecDict.Remove(handler);
				}
			}
		}
	}
Esempio n. 4
0
 public void UnregistersEvent(EventDefine eventName, EventHandler handler)
 {
     if (eventDict.ContainsKey(eventName))
     {
         Dictionary <EventHandler, EventClass> ecDict;
         eventDict.TryGetValue(eventName, out ecDict);
         if (ecDict == null)
         {
             Debug.LogError("no event class list found in " + eventName.ToString() + "'s list");
         }
         else
         {
             if (!ecDict.ContainsKey(handler))
             {
                 Debug.LogError("No define of handler" + eventName.ToString());
             }
             else
             {
                 ecDict.Remove(handler);
             }
         }
     }
 }