// PRIVATE STATIC //-------------------------------------- // Methods //-------------------------------------- // PUBLIC /// <summary> /// Start this instance. /// </summary> void Start() { //TEST FROM OTHER CLASS testFromOtherScope = new TestFromOtherScope("blah1"); //PASS SIMPLE STRING FOR DEBUGGING testFromOtherScope2 = new TestFromOtherScope("blah2"); //PASS SIMPLE STRING FOR DEBUGGING //TODO, PASS INSTANCE IN OF 'this'? why? eventDispatcher = new EventDispatcher(this); eventDispatcher.addEventListener(TestEvent.TEST_EVENT_NAME, _onCustomEvent1); eventDispatcher.addEventListener(TestEvent.TEST_EVENT_NAME, _onCustomEvent2, EventDispatcherAddMode.SINGLE_SHOT); //TEST REMOVE ALL //eventDispatcher.removeAllEventListeners(); //TEST HAS AND REMOVE //Debug.Log (" hasEventListener(): " + eventDispatcher.hasEventListener (TestEvent.TEST_EVENT_NAME, _onCustomEvent1)); //Debug.Log (" removeEventListener(): " + eventDispatcher.removeEventListener (TestEvent.TEST_EVENT_NAME, _onCustomEvent1)); //Debug.Log (" hasEventListener(): " + eventDispatcher.hasEventListener (TestEvent.TEST_EVENT_NAME, _onCustomEvent1)); //TEST EVENT SETUP FROM 3 DIFFERENT SCOPES dispatchIt(); testFromOtherScope.dispatchIt(); testFromOtherScope2.dispatchIt(); }
// PRIVATE STATIC //-------------------------------------- // Methods //-------------------------------------- // PUBLIC /// <summary> /// Start this instance. /// </summary> void Start () { //TEST FROM OTHER CLASS testFromOtherScope = new TestFromOtherScope("blah1"); //PASS SIMPLE STRING FOR DEBUGGING testFromOtherScope2 = new TestFromOtherScope("blah2"); //PASS SIMPLE STRING FOR DEBUGGING //TODO, PASS INSTANCE IN OF 'this'? why? eventDispatcher = new EventDispatcher (this); eventDispatcher.addEventListener (TestEvent.TEST_EVENT_NAME, _onCustomEvent1); eventDispatcher.addEventListener (TestEvent.TEST_EVENT_NAME, _onCustomEvent2, EventDispatcherAddMode.SINGLE_SHOT); //TEST REMOVE ALL //eventDispatcher.removeAllEventListeners(); //TEST HAS AND REMOVE //Debug.Log (" hasEventListener(): " + eventDispatcher.hasEventListener (TestEvent.TEST_EVENT_NAME, _onCustomEvent1)); //Debug.Log (" removeEventListener(): " + eventDispatcher.removeEventListener (TestEvent.TEST_EVENT_NAME, _onCustomEvent1)); //Debug.Log (" hasEventListener(): " + eventDispatcher.hasEventListener (TestEvent.TEST_EVENT_NAME, _onCustomEvent1)); //TEST EVENT SETUP FROM 3 DIFFERENT SCOPES dispatchIt(); testFromOtherScope.dispatchIt(); testFromOtherScope2.dispatchIt(); }