Пример #1
0
 /// <summary>
 /// Raises the event. Call this function to do the thing.
 /// </summary>
 /// <param name="eventId">Event identifier.</param>
 /// <param name="content">Content.</param>
 /// <param name="sendReliable">If set to <c>true</c> send reliable.</param>
 /// <param name="options">Options.</param>
 public void RaiseEvent(EventsIDs eventId, object content, bool sendReliable, RaiseEventOptions options)
 {
     //byte evCode = 0;    // my event 0. could be used as "group units"
     //byte[] content = new byte[] { 1, 2, 5, 10 };    // e.g. selected unity 1,2,5 and 10
     //bool reliable = true;
     Debug.LogError("Raising Event.");
     PhotonNetwork.RaiseEvent((byte)eventId, content, sendReliable, options);
 }
Пример #2
0
 /// <summary>
 /// Remove the specified Event.
 /// </summary>
 /// <returns>The remove.</returns>
 /// <param name="eventId">Event identifier.</param>
 /// <param name="eventToRemove">Event to remove.</param>
 public void Remove(EventsIDs eventId, Action <System.Object, int> eventToRemove)
 {
     eventTable[eventId] = (Action <System.Object, int>)eventTable[eventId] - eventToRemove;
 }
Пример #3
0
    //public event Action<System.Object, int> OnChatMessage
    //{
    //    add
    //    {
    //        lock (eventTable)
    //        {
    //            eventTable[EventsIDs.ChatMessage] = (Action<System.Object, int>)eventTable[EventsIDs.ChatMessage] + value;
    //        }
    //    }
    //    remove
    //    {
    //        lock (eventTable)
    //        {
    //            eventTable[EventsIDs.ChatMessage] = (Action<System.Object, int>)eventTable[EventsIDs.ChatMessage] - value;
    //        }
    //    }
    //}


    /// <summary>
    /// Gets or sets the <see cref="T:PhotonRaisedEventsHandler"/> with the specified id.
    /// Setting would just add a new Handler to the previous one.
    /// </summary>
    /// <param name="id">Identifier.</param>
    public Action <System.Object, int> this[EventsIDs id]
    {
        get { return((Action <System.Object, int>)eventTable[id]); }
        set { eventTable[id] = (Action <System.Object, int>)eventTable[id] + value; }
    }