Esempio n. 1
0
 void HandleSendEvent(Message msg)
 {
     if (msg.TryGetValue("eventId", out object eventIdObj) &&
         byte.TryParse(eventIdObj.ToString(), out byte eventId))
     {
         var senderId = -1;
         if (msg.TryGetValue("fromActorId", out object senderIdObj))
         {
             int.TryParse(senderIdObj.ToString(), out senderId);
         }
         Dictionary <string, object> eventData = null;
         if (msg.TryGetValue("msg", out object eventDataObj))
         {
             eventData = eventDataObj as Dictionary <string, object>;
         }
         OnCustomEvent?.Invoke(eventId, eventData, senderId);
     }
     else
     {
         Logger.Error("Handle custom event error: {0}", msg.ToJson());
     }
 }
Esempio n. 2
0
 public virtual void OnOtherEvent(string parameter)
 {
     OnCustomEvent?.Invoke(parameter);
 }