コード例 #1
0
ファイル: Toolbar2D.cs プロジェクト: nobutora/pichan
    internal void SelectionChange(EQEQEvent e)
    {
        toggles[_selected].SetVal(false);
        Toggle2D toggle = (Toggle2D) e.value;
        _selected = toggle.id;

        DispatchEvent(new EQEQEvent(EQEQEvent.CHANGED, this));
    }
コード例 #2
0
ファイル: EventDispatcher.cs プロジェクト: nobutora/pichan
 /**
     Dispatches a new event object. If this object has any recorded listeners, those handler functions will be called.
 */
 public void DispatchEvent(EQEQEvent e)
 {
     if(_eventListeners[e.type] == null) return;
     for(int i = 0; i < (_eventListeners[e.type] as ArrayList).Count; i++)
     {
         EQEQEvent.EventHandler handler = (EQEQEvent.EventHandler) (_eventListeners[e.type] as ArrayList)[i];
         handler(e);
     }
 }
コード例 #3
0
ファイル: EventDispatcher.cs プロジェクト: nobutora/pichan
 /**
     Adds a delegate function (EQEQEvent.EventHandler handler) which will be called whenever this object dispatches the event (string type).
 */
 public virtual void AddEventListener(string type, EQEQEvent.EventHandler handler)
 {
     if(!_eventListeners.Contains(type))
     {
         _eventListeners.Add(type, new ArrayList());
         (_eventListeners[type] as ArrayList).Add(handler);
     }
     else
     {
         (_eventListeners[type] as ArrayList).Add(handler);
     }
 }
コード例 #4
0
ファイル: EventDispatcher.cs プロジェクト: nobutora/pichan
 /**
     Removes the specified event listener.
 */
 public virtual void RemoveEventListener(string type, EQEQEvent.EventHandler handler)
 {
     (_eventListeners[type] as ArrayList).Remove(handler);
 }