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()); } }
public virtual void OnOtherEvent(string parameter) { OnCustomEvent?.Invoke(parameter); }