コード例 #1
0
 public void Serialize(SerializeWriter writer)
 {
     // Determine how to serialize this object, so that it can be send via the Socket Stream
     writer.Write(x);
     writer.Write(y);
     writer.WriteText(z);
 }
コード例 #2
0
ファイル: Reward.cs プロジェクト: tim-low/SSAD-game-server
 public void Serialize(SerializeWriter writer)
 {
     writer.WriteTextStatic(Token, 44);
     writer.Write(IsCorrect);
     writer.Write(Step);
     writer.Write((int)Item.Item);
     writer.Write(Timeout);
 }
コード例 #3
0
 public void Serialize(SerializeWriter writer)
 {
     writer.Write(Id);
     writer.WriteText(Name, false);
     writer.WriteText(Message, false);
     writer.Write(Image.Length);
     writer.Write(Image);
 }
コード例 #4
0
 public void Serialize(SerializeWriter writer)
 {
     writer.Write(Id);
     writer.Write(Name);
     writer.Write(Questions.Count);
     foreach (Question question in Questions)
     {
         writer.Write(question);
     }
 }
コード例 #5
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.Write(AttributeNumber);
             sw.Write(ItemNumber);
         }
         return(ms.ToArray());
     }
 }
コード例 #6
0
ファイル: Player.cs プロジェクト: tim-low/SSAD-game-server
 /// <summary>
 /// We will be sending this data over,
 /// </summary>
 /// <param name="writer"></param>
 public void Serialize(SerializeWriter writer)
 {
     writer.WriteTextStatic(GetIdentifier(), 44); // Write Token (44)
     writer.WriteTextStatic(Client.Character.Name, 13);
     writer.Write(Position);                      // Write Position (3)
     writer.Write(MoveLeft);                      // Write MoveLeft (4)
     writer.Write(Items.Count);                   // Write Item Count (4)
     foreach (InventoryItem item in Items)
     {
         writer.Write(item); // Write Individual Item (0)
     }
 }
コード例 #7
0
 public override byte[] GetBytes()
 {
     using (MemoryStream ms = new MemoryStream())
     {
         using (SerializeWriter sw = new SerializeWriter(ms))
         {
             sw.Write(Key);
             sw.Write(IV);
         }
         return(ms.ToArray());
     }
 }
コード例 #8
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.Write(Question);
             sw.Write(DurationInSec);
         }
         return(ms.ToArray());
     }
 }
コード例 #9
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.WriteTextStatic(Token, 44);
             sw.Write(StartPos);
             sw.Write(TargetPos);
         }
         return(ms.ToArray());
     }
 }
コード例 #10
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.Write(Experience);
             sw.Write(LeaderboardStats);
             sw.Write(GameCount);
         }
         return(ms.ToArray());
     }
 }
コード例 #11
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.Write(Inventory.Head);
             sw.Write(Inventory.Shirt);
             sw.Write(Inventory.Pant);
             sw.Write(Inventory.Shoe);
         }
         return(ms.ToArray());
     }
 }
コード例 #12
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.Write(IsLegalMove);
             sw.WriteTextStatic(Token, 44);
             sw.Write(NewPos);
             sw.Write((int)Direction);
         }
         return(ms.ToArray());
     }
 }
コード例 #13
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.Write(PlayerSequence.Count);
             foreach (Player p in PlayerSequence)
             {
                 sw.Write(p);
             }
         }
         return(ms.ToArray());
     }
 }
コード例 #14
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.Write(Rewards.Length);
             foreach (Reward r in Rewards)
             {
                 sw.Write(r);
             }
         }
         return(ms.ToArray());
     }
 }
コード例 #15
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.Write(Lobby.RoomManager.GetRooms().Count);
             foreach (Room r in Lobby.RoomManager.GetRooms())
             {
                 sw.Write(r);
             }
         }
         return(ms.ToArray());
     }
 }
コード例 #16
0
ファイル: Room.cs プロジェクト: tim-low/SSAD-game-server
        public void Serialize(SerializeWriter writer)
        {
            writer.WriteTextStatic(Guid.ToString(), 36);
            // Write Room Name
            writer.WriteTextStatic(Name, 40);
            // Write IsRoomLocked
            writer.Write(IsLocked);
            // Write Num Of Client
            writer.Write(Clients.Count);
            // Write Room Size
            writer.Write(Size);

            // Write IsInGame
            writer.Write(IsInGame);
        }
コード例 #17
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.Write(Notices.Length);
             foreach (var noticeIndex in Notices)
             {
                 sw.Write(noticeIndex);
             }
         }
         return(ms.ToArray());
     }
 }
コード例 #18
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.Write(Scores.Count);
             foreach (GameScoreModel model in Scores)
             {
                 sw.Write(model);
             }
         }
         return(ms.ToArray());
     }
 }
コード例 #19
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.Write(Annoucements.Length);
             foreach (var annoucement in Annoucements)
             {
                 sw.Write(annoucement);
             }
         }
         return(ms.ToArray());
     }
 }
コード例 #20
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.Write(IsLastPage);
             sw.Write(Entries.Count);
             foreach (var entry in Entries)
             {
                 sw.Write(entry);
             }
         }
         return(ms.ToArray());
     }
 }
コード例 #21
0
 public void Serialize(SerializeWriter writer)
 {
     foreach (Mastery mastery in Masteries)
     {
         writer.Write(mastery.Exp);
     }
 }
コード例 #22
0
        public Packet(ushort id)
        {
            Writer = new SerializeWriter(new MemoryStream());
            Id     = id;

            Writer.Write(id);
        }
コード例 #23
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.Write(Room.Clients.Count);
             foreach (GameClient client in Room.Clients)
             {
                 sw.WriteTextStatic(client.Character.Token, 44);
                 sw.Write(client.Character);
             }
             sw.WriteTextStatic(Room.Owner.Character.Token, 44);
         }
         return(ms.ToArray());
     }
 }
コード例 #24
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.WriteTextStatic(Token, 44);
             sw.Write(Character);
             sw.Write(HasOwnerChange);
             if (HasOwnerChange)
             {
                 sw.WriteTextStatic(Owner, 44);
             }
         }
         return(ms.ToArray());
     }
 }
コード例 #25
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.Write(OwnRanking);
             sw.Write(IsLastPage);
             sw.Write(Entries.Length);
             foreach (Ranking r in Entries)
             {
                 sw.Write(r);
             }
         }
         return(ms.ToArray());
     }
 }
コード例 #26
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             Log.Debug("Caster: {0}", Caster);
             sw.WriteTextStatic(Caster, 44);
             Log.Debug("Victim: {0}", Victim);
             sw.WriteTextStatic(Victim, 44);
             Log.Debug("Item: {0}", (int)Item.Item);
             sw.Write(Item);
             Log.Debug("Tile: {0}, {1}, {2}", Tile.X, Tile.Y, Tile.Color);
             sw.Write(Tile);
         }
         return(ms.ToArray());
     }
 }
コード例 #27
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.WriteText(QuizName, false);
             sw.Write(WaitingRoom.Clients.Count);
             foreach (var client in WaitingRoom.Clients)
             {
                 sw.WriteTextStatic(client.Character.Token, 44);
                 sw.WriteTextStatic(client.Character.Name, 13);
                 sw.Write(client.Character.CharacterDb.HeadEqp);
             }
         }
         return(ms.ToArray());
     }
 }
コード例 #28
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.Write(0);
         }
         return(ms.ToArray());
     }
 }
コード例 #29
0
        public void Serialize(SerializeWriter writer)
        {
            writer.WriteText(QuestionStr, false);
            List <Answer> answers = new List <Answer>(Answers);

            answers.Shuffle();
            foreach (Answer answer in answers)
            {
                writer.Write(answer);
            }
        }
コード例 #30
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.WriteTextStatic(Room.GetIdentifier(), 36);
             sw.Write(Room.IsInGame);
         }
         return(ms.ToArray());
     }
 }