Ejemplo n.º 1
0
        public int SendToPlayers(BaseRequest request)
        {
            SidekickSettings settings = BridgingContext.Instance.container.Settings;

            lastRequestID++;
            if (settings.InspectionConnection == InspectionConnection.LocalEditor)
            {
                if (ResponseReceived != null)
                {
                    ResponseReceived(request.GenerateResponse());
                }
            }
            else
            {
                byte[] bytes;
                using (MemoryStream ms = new MemoryStream())
                {
                    using (BinaryWriter bw = new BinaryWriter(ms))
                    {
                        bw.Write(lastRequestID);

                        bw.Write(request.GetType().Name);
                        request.Write(bw);
                    }
                    bytes = ms.ToArray();
                }
#if SIDEKICK_DEBUG
                if (settings.LocalDevMode)
                {
                    byte[]           testResponse = SidekickRequestProcessor.Process(bytes);
                    MessageEventArgs messageEvent = new MessageEventArgs();
                    messageEvent.data = testResponse;
                    BaseResponse response = SidekickResponseProcessor.Process(testResponse);
                    if (ResponseReceived != null)
                    {
                        ResponseReceived(response);
                    }
                }
                else
#endif
                {
                    EditorConnection.instance.Send(RuntimeSidekickBridge.SEND_EDITOR_TO_PLAYER, bytes);
                }
            }
            return(lastRequestID);
        }
Ejemplo n.º 2
0
        public int SendToPlayers(BaseRequest request)
        {
            lastRequestID++;
            if (commonContext.Settings.InspectionConnection == InspectionConnection.LocalEditor)
            {
                ResponseReceived(request.GenerateResponse());
            }
            else
            {
                byte[] bytes;
                using (MemoryStream ms = new MemoryStream())
                {
                    using (BinaryWriter bw = new BinaryWriter(ms))
                    {
                        bw.Write(lastRequestID);

                        bw.Write(request.GetType().Name);
                        request.Write(bw);
                    }
                    bytes = ms.ToArray();
                }
#if SIDEKICK_DEBUG
                if (commonContext.Settings.LocalDevMode)
                {
                    byte[]           testResponse = SidekickRequestProcessor.Process(bytes);
                    MessageEventArgs messageEvent = new MessageEventArgs();
                    messageEvent.data = testResponse;
                    BaseResponse response = SidekickResponseProcessor.Process(testResponse);
                    ResponseReceived(response);
                }
                else
#endif
                {
                    EditorConnection.instance.Send(RuntimeSidekick.kMsgSendEditorToPlayer, bytes);
                }
            }
            return(lastRequestID);
        }
Ejemplo n.º 3
0
 private void OnMessageReceived(MessageEventArgs args)
 {
     byte[] response = SidekickRequestProcessor.Process(args.data);
     PlayerConnection.instance.Send(kMsgSendPlayerToEditor, response);
 }
 private void OnMessageReceived(MessageEventArgs args)
 {
     byte[] response = SidekickRequestProcessor.Process(args.data);
     PlayerConnection.instance.Send(SEND_PLAYER_TO_EDITOR, response);
 }
Ejemplo n.º 5
0
 byte[] OnRequestReceived(byte[] request)
 {
     byte[] response = SidekickRequestProcessor.Process(request);
     return(response);
 }