12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Runtime.Remoting;
- using System.Runtime.Remoting.Channels;
- using System.Runtime.Serialization.Formatters;
- namespace GameEditorUnity3D
- {
- public class IpcRemoteObject : MarshalByRefObject
- {
- public delegate string RemoteCallBack(string s);
- public RemoteCallBack ServerCallback;
- private List<string> ClientMsgs = new List<string>();
- public string SendToServer(string s)
- {
- if (ServerCallback != null)
- return ServerCallback(s);
- else
- return null;
- }
- public void SendToClient(string s)
- {
- ClientMsgs.Add(s);
- }
- public List<string> RecvClientMsgs()
- {
- List<string> msg = new List<string>(ClientMsgs);
- ClientMsgs.Clear();
- return msg;
- }
- public override object InitializeLifetimeService()
- {
- return null;
- }
- }
- }
|