コード例 #1
0
ファイル: BuildRequest.cs プロジェクト: Biang2016/Mech-Storm
 public override void Deserialize(DataStream reader)
 {
     base.Deserialize(reader);
     BuildInfo = BuildInfo.Deserialize(reader);
     isSingle  = reader.ReadByte() == 0x01;
     isStory   = reader.ReadByte() == 0x01;
 }
コード例 #2
0
    public override void Deserialize(DataStream reader)
    {
        base.Deserialize(reader);
        int count = reader.ReadSInt32();

        OnlineBuildInfos = new SortedDictionary <int, BuildInfo>();
        for (int i = 0; i < count; i++)
        {
            BuildInfo bi = BuildInfo.Deserialize(reader);
            OnlineBuildInfos.Add(bi.BuildID, bi);
        }

        OnlineGamePlaySettings = GamePlaySettings.Deserialize(reader);

        HasStory = reader.ReadByte() == 0x01;
        if (HasStory)
        {
            Story = Story.Deserialize(reader);
        }
    }
コード例 #3
0
ファイル: Level.cs プロジェクト: Biang2016/Mech-Storm
    public static Level BaseDeserialize(DataStream reader)
    {
        LevelTypes levelType      = (LevelTypes)reader.ReadSInt32();
        int        levelID        = reader.ReadSInt32();
        int        levelPicID     = reader.ReadSInt32();
        int        levelNameCount = reader.ReadSInt32();
        SortedDictionary <string, string> LevelNames = new SortedDictionary <string, string>();

        for (int i = 0; i < levelNameCount; i++)
        {
            string ls    = reader.ReadString8();
            string value = reader.ReadString8();
            LevelNames[ls] = value;
        }

        int difficultyLevel = reader.ReadSInt32();

        Level res = null;

        switch (levelType)
        {
        case LevelTypes.Enemy:
        {
            BuildInfo         BuildInfo   = BuildInfo.Deserialize(reader);
            EnemyType         EnemyType   = (EnemyType)(reader.ReadSInt32());
            int               bonusCount  = reader.ReadSInt32();
            List <BonusGroup> BonusGroups = new List <BonusGroup>();
            for (int i = 0; i < bonusCount; i++)
            {
                BonusGroups.Add(BonusGroup.Deserialize(reader));
            }

            CardPriority cp = CardPriority.Deserialize(reader);

            int cardComboCount             = reader.ReadSInt32();
            List <CardCombo> cardComboList = new List <CardCombo>();
            for (int i = 0; i < cardComboCount; i++)
            {
                cardComboList.Add(CardCombo.Deserialize(reader));
            }

            res = new Enemy(levelPicID, LevelNames, difficultyLevel, BuildInfo, EnemyType, BonusGroups, cardComboList, cp);
            break;
        }

        case LevelTypes.Shop:
        {
            int             count     = reader.ReadSInt32();
            List <ShopItem> shopItems = new List <ShopItem>();
            for (int i = 0; i < count; i++)
            {
                ShopItem si = ShopItem.Deserialize(reader);
                shopItems.Add(si);
            }

            int shopItemCardCount   = reader.ReadSInt32();
            int shopItemOthersCount = reader.ReadSInt32();

            res = new Shop(levelPicID, LevelNames, difficultyLevel, shopItems, shopItemCardCount, shopItemOthersCount);
            break;
        }
        }

        res.LevelID = levelID;
        return(res);
    }
コード例 #4
0
 public override void Deserialize(DataStream reader)
 {
     base.Deserialize(reader);
     buildInfo = BuildInfo.Deserialize(reader);
 }
コード例 #5
0
ファイル: Story.cs プロジェクト: Biang2016/Mech-Storm
    public static Story Deserialize(DataStream reader)
    {
        Story newStory = new Story();

        newStory.StoryName = reader.ReadString8();
        int chapterCount = reader.ReadSInt32();

        newStory.Chapters = new SortedDictionary <int, Chapter>();
        for (int i = 0; i < chapterCount; i++)
        {
            Chapter chapter = Chapter.Deserialize(reader);
            if (newStory.Chapters.ContainsKey(chapter.ChapterID))
            {
                Utils.DebugLog("Duplicate! chapter.ChapterID: " + chapter.ChapterID);
            }
            else
            {
                newStory.Chapters.Add(chapter.ChapterID, chapter);
            }
        }

        int cldCount = reader.ReadSInt32();

        newStory.Base_CardLimitDict = new SortedDictionary <int, int>();
        for (int i = 0; i < cldCount; i++)
        {
            int key   = reader.ReadSInt32();
            int value = reader.ReadSInt32();
            if (newStory.Base_CardLimitDict.ContainsKey(key))
            {
                Utils.DebugLog("Duplicate! Base_CardLimitDict.key: " + key);
            }
            else
            {
                newStory.Base_CardLimitDict.Add(key, value);
            }
        }

        int cardUnlockInfoCount = reader.ReadSInt32();
        SortedDictionary <int, bool> cardUnlockInfos = new SortedDictionary <int, bool>();

        for (int i = 0; i < cardUnlockInfoCount; i++)
        {
            int  cardID = reader.ReadSInt32();
            bool unlock = reader.ReadByte() == 0x01;
            cardUnlockInfos.Add(cardID, unlock);
        }

        newStory.CardUnlockInfos = cardUnlockInfos;

        int buildCount = reader.ReadSInt32();

        newStory.PlayerBuildInfos = new SortedDictionary <int, BuildInfo>();
        for (int i = 0; i < buildCount; i++)
        {
            BuildInfo bi = BuildInfo.Deserialize(reader);
            if (newStory.PlayerBuildInfos.ContainsKey(bi.BuildID))
            {
                Utils.DebugLog("Duplicate! bi.BuildID: " + bi.BuildID);
            }
            else
            {
                newStory.PlayerBuildInfos.Add(bi.BuildID, bi);
            }
        }

        newStory.StoryGamePlaySettings    = GamePlaySettings.Deserialize(reader);
        newStory.CurrentFightingChapterID = reader.ReadSInt32();
        newStory.Crystal = reader.ReadSInt32();
        return(newStory);
    }