/// <summary>
    /// 这里用来分配病毒大小
    /// </summary>
    private static void FillCache(int level)
    {
        //这里进行npc数量控制
        if (IGamerProfile.Instance != null)
        {
            //根据关卡配置的刷怪总数和当前关卡信息进行npc大小分配
            int maxNpc = 0;
            FtGameLevel.MapData mpDt = IGamerProfile.gameLevel.mapData[level - 1];
            for (int i = 0; i < mpDt.spawnDatas.Length; i++)
            {
                maxNpc += mpDt.spawnDatas[i].NpcNum;
            }

            int split01  = GetSplitLevel1(level);
            int split02  = GetSplitLevel2(level);
            int split03  = GetSplitLevel3(level);
            int split04  = GetSplitLevel4(level);
            int splitMax = split01 + split02 + split03 + split04;
            if (splitMax > maxNpc)
            {
                int dVal = splitMax - maxNpc;
                if (dVal <= split04)
                {
                    split04 -= dVal;
                }
                else
                {
                    dVal   -= split04;
                    split04 = 0;
                    if (dVal <= split03)
                    {
                        split03 -= dVal;
                    }
                    else
                    {
                        dVal   -= split03;
                        split03 = 0;
                        if (dVal <= split02)
                        {
                            split02 -= dVal;
                        }
                        else
                        {
                            dVal   -= split02;
                            split02 = 0;
                            if (dVal <= split01)
                            {
                                split01 -= dVal;
                            }
                        }
                    }
                }
            }
            else if (splitMax < maxNpc)
            {
                split01 += (maxNpc - splitMax);
            }

            _data.Cache.Add(SplitLevel.Level1, split01);
            _data.Cache.Add(SplitLevel.Level2, split02);
            _data.Cache.Add(SplitLevel.Level3, split03);
            _data.Cache.Add(SplitLevel.Level4, split04);
        }
        else
        {
            _data.Cache.Add(SplitLevel.Level1, GetSplitLevel1(level));
            _data.Cache.Add(SplitLevel.Level2, GetSplitLevel2(level));
            _data.Cache.Add(SplitLevel.Level3, GetSplitLevel3(level));
            _data.Cache.Add(SplitLevel.Level4, GetSplitLevel4(level));
        }
    }
 private static void FillVirusNames(int level)
 {
     if (IGamerProfile.Instance != null)
     {
         InitFillName();
         int index = level - 1;
         FtGameLevel.MapData mpDt = IGamerProfile.gameLevel.mapData[index];
         string bossType          = mpDt.bossData.BossType;
         if (bossType != "")
         {
             FillName(GetBossVirusName(bossType));
         }
         if (FtGameLevel.MapData.SpawnState.Spawn == mpDt.spawnVirusData.AdsorptionVirus)
         {
             FillName(VirusName.AdsorptionVirus);
         }
         if (FtGameLevel.MapData.SpawnState.Spawn == mpDt.spawnVirusData.CollisionVirus)
         {
             FillName(VirusName.CollisionVirus);
         }
         if (FtGameLevel.MapData.SpawnState.Spawn == mpDt.spawnVirusData.CureVirus)
         {
             FillName(VirusName.CureVirus);
         }
         if (FtGameLevel.MapData.SpawnState.Spawn == mpDt.spawnVirusData.DartVirus)
         {
             FillName(VirusName.DartVirus);
         }
         if (FtGameLevel.MapData.SpawnState.Spawn == mpDt.spawnVirusData.DefendingVirus)
         {
             FillName(VirusName.DefendingVirus);
         }
         if (FtGameLevel.MapData.SpawnState.Spawn == mpDt.spawnVirusData.ExpansionVirus)
         {
             FillName(VirusName.ExpansionVirus);
         }
         if (FtGameLevel.MapData.SpawnState.Spawn == mpDt.spawnVirusData.ExplosiveVirus)
         {
             FillName(VirusName.ExplosiveVirus);
         }
         if (FtGameLevel.MapData.SpawnState.Spawn == mpDt.spawnVirusData.FastVirus)
         {
             FillName(VirusName.FastVirus);
         }
         if (FtGameLevel.MapData.SpawnState.Spawn == mpDt.spawnVirusData.LaunchVirus)
         {
             FillName(VirusName.LaunchVirus);
         }
         if (FtGameLevel.MapData.SpawnState.Spawn == mpDt.spawnVirusData.NormalVirus)
         {
             FillName(VirusName.NormalVirus);
         }
         if (FtGameLevel.MapData.SpawnState.Spawn == mpDt.spawnVirusData.RegenerativeVirus)
         {
             FillName(VirusName.RegenerativeVirus);
         }
         if (FtGameLevel.MapData.SpawnState.Spawn == mpDt.spawnVirusData.SlowDownVirus)
         {
             FillName(VirusName.SlowDownVirus);
         }
         if (FtGameLevel.MapData.SpawnState.Spawn == mpDt.spawnVirusData.SwallowVirus)
         {
             FillName(VirusName.SwallowVirus);
         }
         if (FtGameLevel.MapData.SpawnState.Spawn == mpDt.spawnVirusData.ThreePointsVirus)
         {
             FillName(VirusName.ThreePointsVirus);
         }
         if (FtGameLevel.MapData.SpawnState.Spawn == mpDt.spawnVirusData.TrackingVirus)
         {
             FillName(VirusName.TrackingVirus);
         }
         if (FtGameLevel.MapData.SpawnState.Spawn == mpDt.spawnVirusData.VampireVirus)
         {
             FillName(VirusName.VampireVirus);
         }
     }
     else
     {
         if (level <= 2)
         {
             FillNames(1);
             //FillNames(16); //testSyq
         }
         else if (level <= 5)
         {
             FillNames(2);
         }
         else if (level <= 70)
         {
             int c = (level - 1) / 5;
             FillNames(c + 2);
         }
         else
         {
             FillNames();
         }
     }
 }
    private static int FillData()
    {
        List <WaveVirusItem> items = new List <WaveVirusItem>();

        foreach (var t1 in _data.Cache)
        {
            for (int i = 0; i < t1.Value; i++)
            {
                WaveVirusItem item      = new WaveVirusItem();
                int           nameIndex = _nameRoll.Roll();
                item.SplitLevel = t1.Key;
                item.VirusName  = _virusNames[nameIndex];
                item.ColorLevel = (ColorLevel)_colorRoll.Roll();
                items.Add(item);
            }
        }

        int count = items.Count;

        items.Reshuffle();
        List <WaveVirusItem> list1 = new List <WaveVirusItem>();
        List <WaveVirusItem> list2 = new List <WaveVirusItem>();
        List <WaveVirusItem> list3 = new List <WaveVirusItem>();

        if (IGamerProfile.Instance != null)
        {
            int leval = VirusGameDataAdapter.GetLevel();
            FtGameLevel.MapData mpDt = IGamerProfile.gameLevel.mapData[leval - 1];
            int index  = 0;
            int maxNpc = mpDt.spawnDatas[index].NpcNum;
            for (int i = 0; i < count; i++)
            {
                if (list1.Count < maxNpc && index == 0)
                {
                    list1.Add(items[i]);
                    if (list1.Count == maxNpc)
                    {
                        index++;
                        maxNpc = mpDt.spawnDatas[index].NpcNum;
                    }
                }
                else if (list2.Count < maxNpc && index == 1)
                {
                    list2.Add(items[i]);
                    if (list2.Count == maxNpc)
                    {
                        index++;
                        maxNpc = mpDt.spawnDatas[index].NpcNum;
                    }
                }
                else
                {
                    list3.Add(items[i]);
                }
            }
        }
        else
        {
            int t = count / MaxWave;
            for (int i = 0; i < count; i++)
            {
                if (i < t)
                {
                    list1.Add(items[i]);
                }
                else if (i < 2 * t)
                {
                    list2.Add(items[i]);
                }
                else
                {
                    list3.Add(items[i]);
                }
            }
        }
        _data.Data.Add(list1);
        _data.Data.Add(list2);
        _data.Data.Add(list3);

        int value = 0;

        for (int i = 0; i < items.Count; i++)
        {
            var item = items[i];
            value += VirusTool.GetChildSplit(item.SplitLevel, item.VirusName);
        }
        items.Clear();
        return(value);
    }