コード例 #1
0
 private void OnPacketReceived(Packet packet)
 {
     if (packet is PingPacket pingPacket)
     {
         PingResponsePacket pingResponsePacket = new PingResponsePacket(pingPacket.GetPingId());
         karmanClient.Send(pingResponsePacket);
     }
 }
コード例 #2
0
 protected void FixedUpdate()
 {
     foreach (var character in characters.Values)
     {
         if (character.RequestPositionSyncCheck())
         {
             CharacterUpdatePositionPacket characterUpdatePositionPacket = character.GetUpdatePositionPacket();
             karmanClient.Send(characterUpdatePositionPacket);
         }
     }
 }
コード例 #3
0
ファイル: ClientFlow.cs プロジェクト: simonkarman/karmannet
 public void Update()
 {
     if (karmanClient.IsConnected() && sendConnectionMessages)
     {
         float connectedTime = Time.timeSinceLevelLoad;
         if (connectedTime > connectedTimeAtLastSend + sendConnectionMessagesInterval)
         {
             connectedTimeAtLastSend = Time.timeSinceLevelLoad;
             karmanClient.Send(new MessagePacket(string.Format(
                                                     "{0} has been connected for {1} second(s).",
                                                     karmanClient.id,
                                                     connectedTime.ToString("0")
                                                     )));
         }
     }
 }
コード例 #4
0
ファイル: Replicator.cs プロジェクト: simonkarman/karmannet
 protected override void Request(MutationPacket mutationPacket, Mutation mutation)
 {
     client.Send(mutationPacket);
     pending.Add(mutationPacket.GetId(), $"{mutation.GetType().Name} on fragment[{fragmentKeyFactory.FromBytes(mutationPacket.GetKey()).AsString()}].\nStackTrace: {Environment.StackTrace}");
 }