public void SignalEODMessage(VMNetEODMessageCmd msg) { if (OnEODMessage != null) { OnEODMessage(msg); } }
public void OnEODMessage(VMNetEODMessageCmd cmd) { switch (cmd.EventName) { case "eod_enter": //attempt to create the EOD UI for the given plugin (live mode will detect this) if (cmd.Binary) { return; //??? } Type handlerType = null; if (IDToHandler.TryGetValue(cmd.PluginID, out handlerType)) { ActiveEOD = (UIEOD)Activator.CreateInstance(handlerType, this); ActivePID = cmd.PluginID; Add(ActiveEOD); } break; case "eod_leave": if (cmd.Binary || ActiveEOD == null) { return; //??? } DisplayMode = null; Remove(ActiveEOD); ActivePID = 0; ActiveEOD = null; break; default: //forward to existing ui if (ActiveEOD == null) { return; //uh... what UI? } if (cmd.Binary) { EODDirectBinaryEventHandler handle = null; if (ActiveEOD.BinaryHandlers.TryGetValue(cmd.EventName, out handle)) { handle(cmd.EventName, cmd.BinData); } } else { EODDirectPlaintextEventHandler handle = null; if (ActiveEOD.PlaintextHandlers.TryGetValue(cmd.EventName, out handle)) { handle(cmd.EventName, cmd.TextData); } } break; } }
public void Deliver(VMNetEODMessageCmd msg, VMAvatar avatar) { if (AvatarToEOD.TryGetValue(avatar.ObjectID, out var server)) { var avatarClient = server.Clients.FirstOrDefault(x => x.Avatar == avatar); if (avatarClient != null) { server.Deliver(msg, avatarClient); } } }
public void Deliver(VMNetEODMessageCmd msg, VMEODClient client) { if (msg.Binary) { if (Handler.BinaryHandlers.TryGetValue(msg.EventName, out var handle)) { handle(msg.EventName, msg.BinData, client); } } else { if (Handler.PlaintextHandlers.TryGetValue(msg.EventName, out var handle)) { handle(msg.EventName, msg.TextData, client); } } }
public void Send(string evt, byte[] body) { if (Avatar == null || body == null) { return; } var cmd = new VMNetEODMessageCmd { PluginID = ActivePID, ActorUID = Avatar.PersistID, Binary = true, EventName = evt, BinData = body, Verified = true }; vm.ForwardCommand(cmd); }
public void SignalEODMessage(VMNetEODMessageCmd msg) { OnEODMessage?.Invoke(msg); }