| | |
| | | /// 可生效总波数,生命周期类型为n波内生效才有作用,否则没有意义 |
| | | /// </summary> |
| | | public int TotalEffectWaves; |
| | | |
| | | /// <summary> |
| | | /// 记录被玩家选择的次数 |
| | | /// </summary> |
| | | public int SelectCount; |
| | | } |
| | | |
| | | public class EndlessBuffData |
| | |
| | | /// </summary> |
| | | private static List<EndlessBuffConfig> randomBuffList; |
| | | |
| | | /// <summary> |
| | | /// 被移除掉的buff id 列表 |
| | | /// </summary> |
| | | private static List<int> removedIdList; |
| | | |
| | | /// <summary> |
| | | /// 颜色品阶 |
| | | /// </summary> |
| | | /// <typeparam name="Color"></typeparam> |
| | | /// <returns></returns> |
| | | private static List<Color> rareColorList = new List<Color>() |
| | | { |
| | | new Color(68f / 255f, 148f / 255f, 57f / 255f), |
| | | new Color(74f / 255f, 124f / 255f, 207f / 255f), |
| | | new Color(149f / 255f, 79f / 255f, 214f / 255f), |
| | | new Color(220f / 255f, 96f / 255f, 63f / 255f), |
| | | }; |
| | | |
| | | public static void Init() |
| | | { |
| | | endlessBuffList = JsonDataCenter.GetList<endless_buff>(); |
| | | allEndlessConfig = new List<EndlessBuffConfig>(); |
| | | randomBuffList = new List<EndlessBuffConfig>(); |
| | | removedIdList = new List<int>(); |
| | | random = new System.Random(); |
| | | |
| | | foreach (endless_buff data in endlessBuffList) |
| | |
| | | } |
| | | allEndlessConfig.Add(newConfig); |
| | | } |
| | | |
| | | InitEndlessBuffPool(1); |
| | | GetRandomBuffList(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | for (int i = 0; i < allEndlessConfig.Count; ++i) |
| | | { |
| | | // 如果是一次性的buff就不再出现了 |
| | | if (removedIdList.Contains(allEndlessConfig[i].Config.id)) continue; |
| | | |
| | | if (level >= allEndlessConfig[i].Config.down_level && level <= allEndlessConfig[i].Config.upper_level) |
| | | endlessBuffPool.Add(allEndlessConfig[i]); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 从buff池中删除以后都不会再出现的buff |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | public static void RemoveFromBuffPool(int id) |
| | | { |
| | | removedIdList.Add(id); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | |
| | | randomBuffList = ret; |
| | | |
| | | return ret; |
| | | } |
| | | |
| | |
| | | { |
| | | return randomBuffList[index]; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据buff配置表id获取buff数据 |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | public static EndlessBuffConfig GetBuffById(int id) |
| | | { |
| | | for (int i = 0; i < allEndlessConfig.Count; ++i) |
| | | { |
| | | if (allEndlessConfig[i].Config.id == id) |
| | | return allEndlessConfig[i]; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据品质获得颜色值 |
| | | /// </summary> |
| | | /// <param name="rare"></param> |
| | | /// <returns></returns> |
| | | public static Color GetColorByRare(int rare) |
| | | { |
| | | return rareColorList[rare - 1]; |
| | | } |
| | | } |
| | | } |