Пример #1
0
    public void InitializeDungeonDatabase()
    {
        instance    = this;
        dungeonList = new List <DungeonBaseData>();

        AddDungeonData(new DungeonBaseData((int)DungeonId.LostTeddyBear, "잃어버린 곰"));

        for (int i = 1; i < 11; i++)
        {
            #region 잃어버린 곰 던전 1 ~ 10레벨

            DungeonLevelData dungeonLevelData = new DungeonLevelData(i, 3);

            Stage missingBearStage0 = new Stage(0);
            Stage missingBearStage1 = new Stage(1);
            Stage missingBearStage2 = new Stage(2);

            //missingBearStage0.AddMonster((int)MonsterId.Frog, i, 4);
            //missingBearStage0.AddMonster((int)MonsterId.Duck, i, 4);
            //missingBearStage0.AddMonster((int)MonsterId.Rabbit, i, 1);
            missingBearStage0.AddMonster((int)MonsterId.BlackBear, i, 1);

            missingBearStage1.AddMonster((int)MonsterId.Frog, i, 3);
            missingBearStage1.AddMonster((int)MonsterId.Duck, i, 3);
            missingBearStage1.AddMonster((int)MonsterId.Rabbit, i, 2);

            missingBearStage2.AddMonster((int)MonsterId.BlackBear, i, 1);

            dungeonLevelData.AddStage(missingBearStage0);
            dungeonLevelData.AddStage(missingBearStage1);
            dungeonLevelData.AddStage(missingBearStage2);

            dungeonList[(int)DungeonId.LostTeddyBear].AddLevelData(dungeonLevelData);
            #endregion
        }
    }
        public bool Deserialize(ref DungeonLevelData element)
        {
            if (GetDataSize() == 0)
            {
                // 데이터가 설정되지 않았다.
                return(false);
            }

            bool ret          = true;
            byte stageNum     = 0;
            byte waveCount    = 0;
            byte monsterKind  = 0;
            byte monsterId    = 0;
            byte monsterLevel = 0;
            byte monsterNum   = 0;

            ret &= Deserialize(ref stageNum);
            ret &= Deserialize(ref waveCount);

            element = new DungeonLevelData(stageNum, waveCount);

            for (int stageIndex = 0; stageIndex < stageNum; stageIndex++)
            {
                ret &= Deserialize(ref monsterKind);

                element.AddStage(new Stage(stageIndex));

                for (int monsterIndex = 0; monsterIndex < monsterKind; monsterIndex++)
                {
                    ret &= Deserialize(ref monsterId);
                    ret &= Deserialize(ref monsterLevel);
                    ret &= Deserialize(ref monsterNum);

                    element.Stages[stageIndex].AddMonster(monsterId, monsterLevel, monsterNum);
                }
            }

            return(ret);
        }