This commit is contained in:
2026-06-19 18:18:04 +08:00
parent 1e3fe0e93c
commit c0fa64101d
75 changed files with 23458 additions and 5730 deletions
@@ -619,10 +619,10 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
return;
foreach (var item in bossList)
{
if (item.fishNumber == "13029")
item.isCreate = 2;
//if (item.fishNumber == "11027")
// item.isCreate = 2;
//if (item.fishNumber == "11030")
//if (item.fishNumber == "11042")
// item.isCreate = 2;
}
@@ -661,7 +661,7 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
if (configs == null || configs.Count == 0) return null;
int totalWeight = configs.Sum(c => c.fishWeight);
int randWeight = Random.Range(0, totalWeight);
int randWeight = Random.Range(0, totalWeight+1);
foreach (var cfg in configs)
{
@@ -761,6 +761,101 @@ public class CreateFishManager : MonoSingleton<CreateFishManager>
}
}
//IEnumerator buchongfu(
//List<RoomFishDetailConfig> bossList,
//int count,
//Dictionary<string, MonsterContral> targetDict,
//List<string> recentList = null,
//int recentMax = 0)
//{
// Debug.Log($"===【调试开始】本次需要生成数量: {count},配置总数: {bossList.Count} ===");
// // 打印场上已有 Boss
// Debug.Log($"当前场上已有 Boss 数量: {targetDict.Count}");
// foreach (var kv in targetDict)
// Debug.Log($"场上已有 Boss fishNumber = {kv.Value.fishTypeID}");
// var batchPicked = new HashSet<string>(); // 本轮已选
// for (int j = 0; j < count; j++)
// {
// Debug.Log($"--- 第 {j + 1}/{count} 次抽取 ---");
// // 1. 先筛选候选池
// var candidates = bossList
// .Where(b => !targetDict.Values
// .Any(existing => existing.fishTypeID.ToString() == b.fishNumber))
// .Where(b => !batchPicked.Contains(b.fishNumber))
// .ToList();
// // 打印被排除的原因
// foreach (var b in bossList)
// {
// bool inTarget = targetDict.Values.Any(e => e.fishTypeID.ToString() == b.fishNumber);
// bool inBatch = batchPicked.Contains(b.fishNumber);
// bool inRecent = recentList != null && recentList.Contains(b.fishNumber);
// if (inTarget || inBatch || inRecent)
// {
// Debug.Log(
// $"排除 fishNumber={b.fishNumber} | " +
// $"场上存在={inTarget} | 本轮已选={inBatch} | 最近出现={inRecent}"
// );
// }
// }
// // 排除最近出现过的鱼
// if (recentList != null && recentList.Count > 0)
// candidates = candidates.Where(c => !recentList.Contains(c.fishNumber)).ToList();
// Debug.Log($"候选池数量: {candidates.Count}");
// // 2. 候选池为空 → 触发重置逻辑
// if (candidates.Count == 0)
// {
// Debug.LogWarning("候选池为空,触发 recentList + batchPicked 清空重置");
// recentList?.Clear();
// batchPicked.Clear();
// candidates = bossList
// .Where(b => !targetDict.Values
// .Any(existing => existing.fishTypeID.ToString() == b.fishNumber))
// .ToList();
// Debug.Log($"重置后候选池数量: {candidates.Count}");
// if (candidates.Count == 0)
// {
// Debug.LogError("重置后仍然没有候选鱼 → 说明 targetDict 永远占着某条鱼,导致永远少生成 1 条!");
// yield break;
// }
// }
// // 3. 加权随机
// var chosen = GetRandomFishByWeight(candidates);
// Debug.Log($"选中 fishNumber = {chosen.fishNumber}");
// batchPicked.Add(chosen.fishNumber);
// // 4. 记录最近出现
// if (recentList != null && recentMax > 0)
// {
// recentList.Add(chosen.fishNumber);
// while (recentList.Count > recentMax)
// recentList.RemoveAt(0);
// }
// // 5. 标记激活
// chosen.isCreate = 2;
// yield return null;
// }
// Debug.Log("===【调试结束】本轮生成完成 ===");
//}
/// <summary>每 1~3 秒随机激活若干组鱼阵。</summary>
private void TickFishArraySpawn(float dt)