/// <inheritdoc/> public override void Read(NetPacketReader message) { base.Read(message); try { NetworkID = message.GetUInt(); MethodID = message.GetUShort(); RPCInfo = Network.InstanceType == NetInstanceType.Server ? (RPCInfo)Network.ServerRPCLookupTable.GetRPCInfo(MethodID) : Network.ClientRPCLookupTable.GetRPCInfo(MethodID); ParametersNum = RPCInfo.ParameterTypes.Length; if (Parameters.Length < ParametersNum) { Parameters = new object[ParametersNum]; } for (int i = 0; i < ParametersNum; i++) { Parameters[i] = NetData.Read(RPCInfo.ParameterTypes[i], message); } } catch (Exception e) { throw new MalformedPacketException("Failed to read packet.", e); } }
public RPCInfo Resolve(string controllerName, string methodName) { var controller = _controllers[controllerName]; var r = new RPCInfo(controller, controller.GetType().GetMethod(methodName)); return r; }
public void Reset(uint networkID, ushort methodID, object[] parameters) { NetworkID = networkID; MethodID = methodID; Parameters = parameters; RPCInfo = Network.InstanceType == NetInstanceType.Server ? (RPCInfo)Network.ClientRPCLookupTable.GetRPCInfo(methodID) : Network.ServerRPCLookupTable.GetRPCInfo(methodID); ParametersNum = RPCInfo.ParameterTypes.Length; }
public static void Login(string account, string password, RPCInfo info) { self.Context.PlayerEventHandler.Raise<SlimNet.Events.Authenticated>(info.Caller, (ev) => { ev.Error = self.db.Login(account, password, info.Caller); ev.IsAuthenticated = ev.Error == ""; if (ev.IsAuthenticated) { (info.Caller.Tag as PlayerData).AccountName = account; } } ); }
public static void Login(string account, string password, RPCInfo info) { self.Context.PlayerEventHandler.Raise <SlimNet.Events.Authenticated>(info.Caller, (ev) => { ev.Error = self.db.Login(account, password, info.Caller); ev.IsAuthenticated = ev.Error == ""; if (ev.IsAuthenticated) { (info.Caller.Tag as PlayerData).AccountName = account; } } ); }
private void Awake() { Instance = this; Assembly assembly = Assembly.GetExecutingAssembly(); var methods = assembly.GetTypes() .SelectMany(t => t.GetMethods()) .Where(m => m.GetCustomAttributes(typeof(NetRPCAttribute), false).Length > 0) .ToArray(); foreach (var info in methods) { var rInfo = new RPCInfo(info.Name, info.DeclaringType.FullName, info); Rpcs.Add(info.Name, rInfo); Debug.Log(rInfo.declaringType); } }
public RpcArgs(object[] args, RPCInfo info) : this() { this.Args = args; this.Info = info; this.ReadIndex = 0; }
public static string CreateAccount(string account, string password, RPCInfo info) { return self.db.CreateAccount(account, password); }
public static string CreateAccount(string account, string password, RPCInfo info) { return(self.db.CreateAccount(account, password)); }