示例#1
0
        private void PostInternalMessage(short msgType)
        {
            var networkWriter = new QNetworkWriter();

            networkWriter.StartMessage(msgType);
            networkWriter.FinishMessage();
            PostInternalMessage(networkWriter.AsArray(), 0);
        }
示例#2
0
        internal void InvokeHandlerOnClient(short msgType, QMessageBase msg, int channelId)
        {
            var networkWriter = new QNetworkWriter();

            networkWriter.StartMessage(msgType);
            msg.Serialize(networkWriter);
            networkWriter.FinishMessage();
            InvokeBytesOnClient(networkWriter.AsArray(), channelId);
        }
 protected void SendTargetRPCInternal(QNetworkConnection conn, QNetworkWriter writer, int channelId, string rpcName)
 {
     if (!IsServer)
     {
         QLog.Warning("TargetRpc call on un-spawned object");
         return;
     }
     writer.FinishMessage();
     conn.SendWriter(writer, channelId);
 }
 protected void SendRPCInternal(QNetworkWriter writer, int channelId, string rpcName)
 {
     if (!IsServer)
     {
         QLog.Warning("ClientRpc call on un-spawned object");
         return;
     }
     writer.FinishMessage();
     QNetworkServer.SendWriterToReady(gameObject, writer, channelId);
 }
 protected void SendEventInternal(QNetworkWriter writer, int channelId, string eventName)
 {
     if (!QNetworkServer.active)
     {
         QLog.Error($"Tried to send event {eventName} on channel {channelId} but QSBNetworkServer isn't active.");
         return;
     }
     writer.FinishMessage();
     QNetworkServer.SendWriterToReady(gameObject, writer, channelId);
 }
 protected void SendCommandInternal(QNetworkWriter writer, int channelId, string cmdName)
 {
     if (!IsLocalPlayer && !HasAuthority)
     {
         QLog.Warning("Trying to send command for object without authority.");
     }
     else if (QClientScene.readyConnection == null)
     {
         QLog.Error($"Send command attempted with no client running [client={ConnectionToServer}].");
     }
     else
     {
         writer.FinishMessage();
         QClientScene.readyConnection.SendWriter(writer, channelId);
     }
 }