コード例 #1
0
ファイル: DeckSaveData.cs プロジェクト: pixeltris/Lotd
        protected void LoadDeckData(BinaryReader reader)
        {
            DeckName = Encoding.Unicode.GetString(reader.ReadBytes(Constants.DeckNameByteLen)).TrimEnd('\0');

            short numMainDeckCards  = reader.ReadInt16();
            short numSideDeckCards  = reader.ReadInt16();
            short numExtraDeckCards = reader.ReadInt16();

            for (int i = 0; i < maxMainDeckCards; i++)
            {
                short cardId = reader.ReadInt16();
                if (cardId > 0)
                {
                    MainDeckCards.Add(cardId);
                }
            }

            for (int i = 0; i < maxSideDeckCards; i++)
            {
                short cardId = reader.ReadInt16();
                if (cardId > 0)
                {
                    SideDeckCards.Add(cardId);
                }
            }

            for (int i = 0; i < maxExtraDeckCards; i++)
            {
                short cardId = reader.ReadInt16();
                if (cardId > 0)
                {
                    ExtraDeckCards.Add(cardId);
                }
            }

            reader.ReadBytes(12);                      //some kind of unique deck id? (8+4 bytes?)
            reader.ReadBytes(12);                      //some kind of unique deck id? (8+4 bytes?)
            reader.ReadUInt32();                       //0?
            reader.ReadUInt32();                       //0?
            reader.ReadUInt32();                       //0?
            DeckAvatarId = reader.ReadInt32();
            reader.ReadUInt32();                       //0?
            reader.ReadUInt32();                       //0?
            IsDeckComplete = reader.ReadUInt32() == 1; // must be 1 to be complete
        }
コード例 #2
0
        public void LoadDeckData(BinaryReader Reader)
        {
            DeckName = Encoding.Unicode.GetString(Reader.ReadBytes(Constants.DeckNameByteLen)).TrimEnd('\0');

            var NumMainDeckCards  = Reader.ReadInt16();
            var NumSideDeckCards  = Reader.ReadInt16();
            var NumExtraDeckCards = Reader.ReadInt16();

            for (var Count = 0; Count < MaxMainDeckCards; Count++)
            {
                var CardId = Reader.ReadInt16();
                if (CardId > 0)
                {
                    MainDeckCards.Add(CardId);
                }
            }

            for (var Count = 0; Count < MaxSideDeckCards; Count++)
            {
                var CardId = Reader.ReadInt16();
                if (CardId > 0)
                {
                    SideDeckCards.Add(CardId);
                }
            }

            for (var Count = 0; Count < MaxExtraDeckCards; Count++)
            {
                var CardId = Reader.ReadInt16();
                if (CardId > 0)
                {
                    ExtraDeckCards.Add(CardId);
                }
            }

            Reader.ReadBytes(12);
            Reader.ReadBytes(12);
            Reader.ReadUInt32();
            Reader.ReadUInt32();
            Reader.ReadUInt32();
            DeckAvatarId = Reader.ReadInt32();
            Reader.ReadUInt32();
            Reader.ReadUInt32();
            IsDeckComplete = Reader.ReadUInt32() == 1;
        }