using System.Collections; using System.Collections.Generic; using UnityEngine; using static XPlugin.Data.JsonLiteDB.JsonLiteDB; public enum FishType { LightFish = 1,//小光鱼 YellowFish = 2,//小黄鱼 Angelfish=3,//神仙鱼 PufferFish=4,//河豚鱼 ClownFish=5,//小丑鱼 BreamFish=6,//鳊鱼 RedSnapperFish=7,//红杉鱼 Turtle=8,//海龟 LanternFish=9,//灯笼鱼 DevilRay=10,//魔鬼鱼 Shark=11,//鲨鱼 AngelHorse=12,//天使马 } public enum FishValueLevel { Low, // 低价值(小光鱼 / 小黄鱼 / 小丑鱼) Middle, // 中价值(鳊鱼 / 红杉鱼 / 海龟 / 灯笼鱼) High, // 高价值(魔鬼鱼 / 鲨鱼) UltraHigh // 特高价值(天使马,唯一) } public class FishData { public int FishId; public string FishName; public int CoinValue; public int CoinCount; public int[] FishCount; public float Odds; public int RefreshTime; public float IntervalTime; public string Feature; public float Speed; public string Value; public string Rate_1; public string Rate_2; public FishData(TableReader table) { FishId = table["FishId"].OptInt(); FishName = table["Name"].OptString(); CoinValue = table["CoinValue"].OptInt(); CoinCount = table["CoinCount"].OptInt(); FishCount= ParseStringToIntArray(table["FishCount"].OptString()); Odds = table["Odds"].OptFloat(); IntervalTime = table["IntervalTime"].OptFloat(); RefreshTime = table["RefreshTime"].OptInt(); IntervalTime = table["IntervalTime"].OptFloat(); Feature = table["Feature"].OptString(); Speed = table["Speed"].OptFloat(); Value = table["Value"].OptString(); Rate_1 = table["Rate_1"].OptString(); Rate_2 = table["Rate_2"].OptString(); } int[] ParseStringToIntArray(string input) { if (input == "") { return null; } // 去除字符串中的括号,并以逗号分割成元素数组 string[] elements = input.Replace("(", "").Replace(")", "").Split(','); int[] intArray = new int[elements.Length]; for (int i = 0; i < elements.Length; i++) { // 将每个元素解析为整数并存入整数数组 intArray[i] = int.Parse(elements[i]); } return intArray; } } public class FishSpawnState { public float CooldownEndTime; public int NoMiddleFishCount; // 仅低价值鱼使用 } public static class FishValueHelper { public static FishValueLevel GetValueLevel(FishData data) { FishType type = (FishType)data.FishId; if (type == FishType.AngelHorse) return FishValueLevel.UltraHigh; if (type == FishType.Shark || type == FishType.DevilRay) return FishValueLevel.High; if (data.CoinValue <= 20) return FishValueLevel.Low; return FishValueLevel.Middle; } } public static class CoinMultiplier { public static float GetMultiplier(FishValueLevel level) { switch (level) { case FishValueLevel.Low: return 1f; case FishValueLevel.Middle: return 1.5f; case FishValueLevel.High: return 3f; case FishValueLevel.UltraHigh: return 8f; // 天使马 } return 1f; } }