public bool AddLevelData(DungeonLevelData newDungeonLevelData)
 {
     try
     {
         dungeonLevelData.Add(newDungeonLevelData);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #2
0
    //Server - 던전 몬스터 소환 데이터 수신
    public void MonsterSpawnList(DataPacket packet)
    {
        Debug.Log("던전 몬스터 소환 데이터 수신");

        MonsterSpawnListPacket monsterSpawnListPacket = new MonsterSpawnListPacket(packet.msg);
        DungeonLevelData       monsterSpawnList       = monsterSpawnListPacket.GetData();

        DungeonManager.Instance.SetMonsterSpawnList(monsterSpawnList);

        if (SceneChanger.Instance.CurrentScene == SceneChanger.SceneName.LoadingScene)
        {
            SceneChanger.Instance.LoadingCheck[0] = true;
        }
    }
예제 #3
0
    //몬스터 스텟 데이터 요청
    public void RequestMonsterStatusData(DataPacket packet)
    {
        Console.WriteLine(packet.client.RemoteEndPoint.ToString() + "몬스터 스텟 데이터 요청");

        RequestDungeonDataPacket requestDungeonDataPacket = new RequestDungeonDataPacket(packet.msg);
        RequestDungeonData       requestDungeonData       = requestDungeonDataPacket.GetData();

        DungeonLevelData dungeonLevelData = dungeonDatabase.GetDungeonBaseData(requestDungeonData.DungeonId).GetLevelData(requestDungeonData.DungeonLevel);

        int monsterNum = dungeonLevelData.GetMonsterNum();

        MonsterBaseData[] monsterBaseData = new MonsterBaseData[monsterNum];
        int dataIndex = 0;

        for (int stageIndex = 0; stageIndex < dungeonLevelData.Stages.Count; stageIndex++)
        {
            for (int monsterIndex = 0; monsterIndex < dungeonLevelData.Stages[stageIndex].MonsterSpawnData.Count; monsterIndex++)
            {
                int monsterId    = dungeonLevelData.Stages[stageIndex].MonsterSpawnData[monsterIndex].MonsterId;
                int monsterLevel = dungeonLevelData.Stages[stageIndex].MonsterSpawnData[monsterIndex].MonsterLevel;

                monsterBaseData[dataIndex] = new MonsterBaseData(monsterDatabase.GetBaseData(monsterId));
                MonsterLevelData monsterLevelData = new MonsterLevelData(monsterDatabase.GetBaseData(monsterId).GetLevelData(monsterLevel));
                monsterBaseData[dataIndex].MonsterLevelData.Clear();
                monsterBaseData[dataIndex].AddLevelData(monsterLevelData);
                dataIndex++;
            }
        }

        MonsterStatusData   monsterStatusData   = new MonsterStatusData((byte)monsterNum, monsterBaseData);
        MonsterStatusPacket monsterStatusPacket = new MonsterStatusPacket(monsterStatusData);

        monsterStatusPacket.SetPacketId((int)ServerPacketId.MonsterStatusData);

        byte[] msg = CreatePacket(monsterStatusPacket);

        packet = new DataPacket(msg, packet.client);

        lock (sendLock)
        {
            sendMsgs.Enqueue(packet);
        }
    }
        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);
        }
예제 #5
0
    //몬스터 소환 리스트 요청
    public void RequestMonsterSpawnList(DataPacket packet)
    {
        Console.WriteLine(packet.client.RemoteEndPoint.ToString() + "몬스터 소환 리스트 요청");

        RequestDungeonDataPacket requestDungeonDataPacket = new RequestDungeonDataPacket(packet.msg);
        RequestDungeonData       requestDungeonData       = requestDungeonDataPacket.GetData();

        DungeonLevelData dungeonLevelData = dungeonDatabase.GetDungeonBaseData(requestDungeonData.DungeonId).GetLevelData(requestDungeonData.DungeonLevel);

        MonsterSpawnListPacket monsterSpawnListPacket = new MonsterSpawnListPacket(dungeonLevelData);

        monsterSpawnListPacket.SetPacketId((int)ServerPacketId.MonsterSpawnList);

        byte[] msg = CreatePacket(monsterSpawnListPacket);

        packet = new DataPacket(msg, packet.client);

        lock (sendLock)
        {
            sendMsgs.Enqueue(packet);
        }
    }
        public bool Serialize(DungeonLevelData data)
        {
            bool ret = true;

            //총 스테이지 개수
            ret &= Serialize((byte)data.Stages.Count);
            ret &= Serialize((byte)data.WaveCount);

            for (int stageIndex = 0; stageIndex < data.Stages.Count; stageIndex++)
            {
                //이 스테이지의 몬스터 개수
                ret &= Serialize((byte)data.Stages[stageIndex].MonsterSpawnData.Count);

                for (int monsterIndex = 0; monsterIndex < data.Stages[stageIndex].MonsterSpawnData.Count; monsterIndex++)
                {
                    ret &= Serialize(data.Stages[stageIndex].MonsterSpawnData[monsterIndex].MonsterId);
                    ret &= Serialize(data.Stages[stageIndex].MonsterSpawnData[monsterIndex].MonsterLevel);
                    ret &= Serialize(data.Stages[stageIndex].MonsterSpawnData[monsterIndex].MonsterNum);
                }
            }

            return(ret);
        }
예제 #7
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
        }
    }
예제 #8
0
 public void SetMonsterSpawnList(DungeonLevelData newDungeonData)
 {
     dungeonLevelData = newDungeonData;
 }