public void Bind <T0, T1, T2, T3>(string name, RPCMethod <T0, T1, T2, T3> rpc) { RPCMethodHelper <T0, T1, T2, T3> helper = new RPCMethodHelper <T0, T1, T2, T3>(); m_MapRPCBind[name] = helper; helper.method = rpc; }
public void Bind <T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(string name, RPCMethod <T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> rpc) { RPCMethodHelper <T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> helper = new RPCMethodHelper <T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(); m_MapRPCBind[name] = helper; helper.method = rpc; }
//========================================================================== public void Bind(string name, RPCMethod rpc) { RPCMethodHelper helper = new RPCMethodHelper(); m_MapRPCBind[name] = helper; helper.method = rpc; }
public void Bind <T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(string name, RPCMethod <T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> rpc) { m_RPCBindMap[name] = new RPCMethodHelper <T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>() { method = rpc }; }
public void Bind <T0, T1, T2, T3>(string name, RPCMethod <T0, T1, T2, T3> rpc) { m_RPCBindMap[name] = new RPCMethodHelper <T0, T1, T2, T3>() { method = rpc }; }
//===================================================================== #region Bind public void Bind(string name, RPCMethod rpc) { m_RPCBindMap[name] = new RPCMethodHelper() { method = rpc }; }
protected void Consumer_Received(object model, BasicDeliverEventArgs e) { //Console.WriteLine("Recieved {0}", e); string response = null; var body = e.Body; var props = e.BasicProperties; var replyProps = cmdchannel.CreateBasicProperties(); replyProps.CorrelationId = props.CorrelationId; try { var message = Encoding.UTF8.GetString(body.ToArray()); RPCMethod method = JsonSerializer.Deserialize <RPCMethod>(message); switch (method.Method) { case "GetSystem": response = JsonSerializer.Serialize(sys); break; default: Console.WriteLine(" [.] Unknown Method: {0}", method.Method); response = ""; break; } } catch (Exception ex) { Console.WriteLine(" [.] " + ex.Message); response = ""; } finally { var responseBytes = Encoding.UTF8.GetBytes(response); cmdchannel.BasicPublish(exchange: "", routingKey: props.ReplyTo, basicProperties: replyProps, body: responseBytes); cmdchannel.BasicAck(deliveryTag: e.DeliveryTag, multiple: false); } }
/// <inheritdoc /> public override void OnFixedUpdate() { base.OnUpdate(); if (!IsSetup) { return; } if (!IsOwner) { TransformUpdate(); return; } if (physObj == null) { physObj = Owner.GetComponent <PhysicsObject>(); } curPosition = Owner.Transform.GlobalPositionInternal; curRotation = Owner.Transform.GlobalRotationInternal; curVelocity = physObj.Body.LinearVelocity; RPCMethod velocityMethod = Quality == CompensationQuality.High ? updateVelocityMethodReliable : updateVelocityMethod; bool changedRotation = MathF.Abs(curRotation - oldRotation) > 0.01f; bool changedVelocity = MathF.Abs(curVelocity.X - oldVelocity.X) > 1.0f || MathF.Abs(curVelocity.Y - oldVelocity.Y) > 1.0f; if (changedVelocity || changedRotation) { SE.Core.Network.SendRPC(velocityMethod, curPosition, curVelocity, curRotation); } oldVelocity = curVelocity; oldRotation = curRotation; }
/// <inheritdoc /> protected override void OnInitialize() { base.OnInitialize(); updateVelocityMethod = new RPCMethod(this, "UpdateVelocity"); updateVelocityMethodReliable = new RPCMethod(this, "UpdateVelocity", DeliveryMethod.ReliableSequenced); }