public bool UnsubEvent(Event e) { if (null == e) { return(false); } if (null == mList) { return(false); } EventProxy ep = GetProxy(e.Name); if (null == ep) { return(false); } if (false == ep.Remove(e)) { return(false); } if (ep.Count <= 0) { ep.Unsubscribe(); mList.Remove(ep); } return(true); }
public EventProxy CreateEventProxy(string name) { if (null != mDicEvent && mDicEvent.ContainsKey(name)) { EventProxy e = CreateByName(mDicEvent[name].proxyClass) as EventProxy; if (null != e) { return(e); } } throw new System.Exception("no corresponding Event proxy to " + name); }
public bool SubEvent(Event e) { if (null == e) { return(false); } if (null == mList) { mList = new List <EventProxy>(5); } EventProxy eventProxy = GetProxy(e.Name); if (null == eventProxy) { eventProxy = mScriptMgr.Factory.CreateEventProxy(e.Name); if (null == eventProxy) { return(false); } eventProxy.Name = e.Name; if (!eventProxy.Subscribe()) { return(false); } else { mList.Add(eventProxy); } } eventProxy.Add(e); return(true); }