コード例 #1
0
        public void Call(Object c, string method, params object[] args)
        {
            method = getUniqueClassString(c) + "." + method;
            InvokeHelper helper = this.GetHelper(method);

            if (helper == null)
            {
                return;
            }
            bool client = false;
            bool server = false;

            switch (helper.type)
            {
            case InvokeType.Client:
                client = true;
                break;

            case InvokeType.Server:
                server = true;
                break;

            case InvokeType.MultiCast:
                client = true;
                server = true;
                break;
            }
            if (client)
            {
                this.ClientCall(helper, args);
            }
            if (server)
            {
                DataStorage ds = DataStorage.CreateForWrite();
                ds.Push(method);
                foreach (object obj in args)
                {
                    if (IsValidBasicType(obj.GetType()))
                    {
                        pushBasicType(obj, ds);
                        continue;
                    }
                    else
                    {
                        pushCustomType(obj as IMarshalable, ds);
                    }
                }

                NetworkController.Instance.SendMessage(ds, (short)MessageType.Resend);
            }
        }
コード例 #2
0
        internal void RPC(string method, DataStorage request)
        {
            if (method.StartsWith(syncMethodPrefix))
            {
                SyncRPC(method, request);
                //syncRPCThread = new Thread(() => SyncRPC(method, request));
                //syncRPCThread.Start();
                return;
            }
            InvokeHelper helper = this.GetHelper(method);

            if (helper == null)
            {
                return;
            }
            this.ClientCall(helper, parseRequest(request));
        }
コード例 #3
0
 private void ClientCall(InvokeHelper helper, params object[] args)
 {
     helper.method.Invoke(helper.classInstance, args);
 }