コード例 #1
0
 static public void Invoke(string eventName, object sender)
 {
     EventDescription[] items = MessengerList.GetElements(eventName);
     if (items.Length > 0)
     {
         foreach (EventDescription item in items)
         {
             item.Execute(sender, EventArgs.Empty);
         }
     }
 }
コード例 #2
0
    static public void Invoke <TEventArgs>(string eventName, object sender, TEventArgs eventargs) where TEventArgs : EventArgs
    {
        EventDescription <TEventArgs>[] items = MessengerList <TEventArgs> .GetElements(eventName);

        if (items.Length > 0)
        {
            foreach (EventDescription <TEventArgs> item in items)
            {
                item.Execute(sender, eventargs);
            }
        }
    }
コード例 #3
0
        public void CreateMessengers()
        {
            for (var i = 0; i < AreaArray.Count; i++)
            {
                for (var j = 0; j < Config.MessengersCount / AreaArray.Count; j++)
                {
                    var tempPosition = SetAgentPosition();
                    SetAgentVelocity(tempPosition);
                    var sId       = "M" + i + j;
                    var tempAgent = new Messenger(Config, tempPosition, sId, this, AreaArray[i]);

                    MessengerList.Add(tempAgent);
                }
            }
        }
コード例 #4
0
 static public void AddListener(string eventName, EventHandler handler, float timeout = 0)
 {
     MessengerList.Add(eventName, handler, timeout);
 }
コード例 #5
0
 static public void RemoveListener <TEventArgs>(string eventName, EventHandler <TEventArgs> handler, float timeout = 0) where TEventArgs : EventArgs
 {
     MessengerList <TEventArgs> .Remove(eventName, handler, timeout);
 }