示例#1
0
 public void SignalEODMessage(VMNetEODMessageCmd msg)
 {
     if (OnEODMessage != null)
     {
         OnEODMessage(msg);
     }
 }
示例#2
0
        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;
            }
        }
示例#3
0
 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);
         }
     }
 }
示例#4
0
 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);
         }
     }
 }
示例#5
0
        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);
        }
示例#6
0
文件: VM.cs 项目: fHachenberg/FreeSO
 public void SignalEODMessage(VMNetEODMessageCmd msg)
 {
     OnEODMessage?.Invoke(msg);
 }