예제 #1
0
        public override void Serialize(JHSNetworkWriter writer)
        {
            writer.Write(RESPONSE);
            if (RESPONSE == SUCCESS)
            {
                writer.WriteBytesFull(Encoding.UTF8.GetBytes(PlayerNick));
                writer.Write((byte)LeaguePosition);
                writer.WritePackedUInt32(Gold);
                writer.WritePackedUInt32(Silver);
                writer.WritePackedUInt32(LoginTocken);
                writer.Write(GameCount);
                writer.WritePackedUInt32(LEVEL);
                writer.WritePackedUInt32(EXP);
                writer.Write((byte)League);
                writer.Write(SEASON);
                writer.Write((byte)LEGUE_STATUS);
                writer.Write(Priviledge);

                if (characters != null && characters.Length > 0)
                {
                    int lenght = characters.Length;
                    writer.Write((byte)lenght);
                    for (int i = 0; i < lenght; i++)
                    {
                        writer.WritePackedUInt32(characters[i].PlayerId);
                        writer.WritePackedUInt32(characters[i].ModelId);
                        writer.Write(characters[i].IsChanged);
                        if (characters[i].IsChanged)
                        {
                            writer.Write(characters[i].SkinColorId);
                            writer.Write(characters[i].HairColorId);
                            writer.Write(characters[i].EyeColorId);
                            writer.Write(characters[i].ShirtColorId);
                            writer.Write(characters[i].PantsColorId);
                            writer.Write(characters[i].BootsColorId);
                            writer.Write(characters[i].GlovesColorId);
                        }
                    }
                }
                else
                {
                    writer.Write((byte)0);
                }

                if (actives != null && actives.Length > 0)
                {
                    int alenght = actives.Length;
                    writer.Write((byte)alenght);
                    for (int i = 0; i < alenght; i++)
                    {
                        writer.WritePackedUInt32(actives[i]);
                    }
                }
                else
                {
                    writer.Write((byte)0);
                }

                writer.Write(IsPushLevelUp);
            }
        }