public void Deliver(VMNetEODMessageCmd msg, VMAvatar avatar) { VMEODServer server = null; if (AvatarToEOD.TryGetValue(avatar.PersistID, out server)) { var avatarClient = server.Clients.FirstOrDefault(x => x.Avatar == avatar); if (avatarClient != null) { server.Deliver(msg, avatarClient); } } }
public void Send(string evt, byte[] body) { if (Avatar == null) return; var cmd = new VMNetEODMessageCmd { PluginID = ActivePID, ActorUID = Avatar.PersistID, Binary = true, EventName = evt, BinData = body, Verified = true }; vm.ForwardCommand(cmd); }
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 SignalEODMessage(VMNetEODMessageCmd msg) { if (OnEODMessage != null) OnEODMessage(msg); }
public void Deliver(VMNetEODMessageCmd msg, VMEODClient client) { if (msg.Binary) { EODBinaryEventHandler handle = null; if (Handler.BinaryHandlers.TryGetValue(msg.EventName, out handle)) { handle(msg.EventName, msg.BinData, client); } } else { EODPlaintextEventHandler handle = null; if (Handler.PlaintextHandlers.TryGetValue(msg.EventName, out handle)) { handle(msg.EventName, msg.TextData, client); } } }