功能批量实现 优化 服务端 新浮动小游戏框架 新界面UI
This commit is contained in:
@@ -12,6 +12,7 @@ using UnityEditor;
|
||||
|
||||
public class teamUIController : MonoBehaviour
|
||||
{
|
||||
private const bool VerboseLogs = false;
|
||||
public static teamUIController Instance
|
||||
{
|
||||
get;
|
||||
@@ -266,7 +267,7 @@ public class teamUIController : MonoBehaviour
|
||||
case 4: isAlly05_active = true; break;
|
||||
}
|
||||
ToggleAllyObject(i, true);
|
||||
Debug.Log($"[teamUIController] slot {i + 1} id=0 -> kept active (empty display)");
|
||||
if (VerboseLogs) Debug.Log($"[teamUIController] slot {i + 1} id=0 -> kept active (empty display)");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -282,7 +283,7 @@ public class teamUIController : MonoBehaviour
|
||||
if (obj is TeamCharacterDataInfo tc)
|
||||
{
|
||||
found = tc;
|
||||
Debug.Log($"[teamUIController] (Editor) matched asset by path: {path} for id={id} slot={i + 1}");
|
||||
if (VerboseLogs) Debug.Log($"[teamUIController] (Editor) matched asset by path: {path} for id={id} slot={i + 1}");
|
||||
break;
|
||||
}
|
||||
// if it's AllyHero_SO, map to a runtime TeamCharacterDataInfo instance
|
||||
@@ -295,7 +296,7 @@ public class teamUIController : MonoBehaviour
|
||||
mapped.CharacterTeamSprite = ah.ally_heroProfile;
|
||||
mapped.name = ah.name;
|
||||
found = mapped;
|
||||
Debug.Log($"[teamUIController] (Editor) matched AllyHero_SO by path: {path} for id={id} slot={i + 1}");
|
||||
if (VerboseLogs) Debug.Log($"[teamUIController] (Editor) matched AllyHero_SO by path: {path} for id={id} slot={i + 1}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -335,7 +336,7 @@ public class teamUIController : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"[teamUIController] (Editor) slot {i + 1} resolved to SO: {found.name} (id={found.CharacterID})");
|
||||
if (VerboseLogs) Debug.Log($"[teamUIController] (Editor) slot {i + 1} resolved to SO: {found.name} (id={found.CharacterID})");
|
||||
// Documentation text normalized.
|
||||
switch (i)
|
||||
{
|
||||
@@ -351,7 +352,7 @@ public class teamUIController : MonoBehaviour
|
||||
try
|
||||
{
|
||||
// first try to find AllyHero_SO by the same id
|
||||
var ahList = Resources.LoadAll<AllyHero_SO>("");
|
||||
var ahList = RuntimeResourcesCache.LoadAllAllyHeroes();
|
||||
AllyHero_SO matched = null;
|
||||
foreach (var a in ahList) if (a != null && a.ally_heroID == id) { matched = a; break; }
|
||||
if (matched != null)
|
||||
@@ -399,7 +400,7 @@ public class teamUIController : MonoBehaviour
|
||||
// keep associated object active
|
||||
ToggleAllyObject(i, true);
|
||||
|
||||
Debug.Log($"[teamUIController] (Runtime) slot {i+1} id=0 -> kept active (empty display)");
|
||||
if (VerboseLogs) Debug.Log($"[teamUIController] (Runtime) slot {i+1} id=0 -> kept active (empty display)");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -500,7 +501,7 @@ public class teamUIController : MonoBehaviour
|
||||
{
|
||||
runtimeSourceInfo = found.name + " (mapped)";
|
||||
}
|
||||
Debug.Log($"[teamUIcontroller] (Runtime) slot {i + 1} resolved to SO: {found.name} (id={found.CharacterID}) Source={runtimeSourceInfo}");
|
||||
if (VerboseLogs) Debug.Log($"[teamUIcontroller] (Runtime) slot {i + 1} resolved to SO: {found.name} (id={found.CharacterID}) Source={runtimeSourceInfo}");
|
||||
switch (i)
|
||||
{
|
||||
case 0: isAlly01_active = true; break;
|
||||
@@ -558,7 +559,7 @@ public class teamUIController : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"[teamUIcontroller] (Runtime) Loaded {runtimeDiscovered.Count} objects from Resources/{resourcesPath}");
|
||||
if (VerboseLogs) Debug.Log($"[teamUIcontroller] (Runtime) Loaded {runtimeDiscovered.Count} objects from Resources/{resourcesPath}");
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
@@ -573,7 +574,7 @@ public class teamUIController : MonoBehaviour
|
||||
var arr = Resources.LoadAll("");
|
||||
if (arr != null && arr.Length > 0)
|
||||
runtimeDiscovered.AddRange(arr);
|
||||
Debug.Log($"[teamUIController] (Runtime) Loaded {arr?.Length ?? 0} objects from Resources (project-wide)");
|
||||
if (VerboseLogs) Debug.Log($"[teamUIController] (Runtime) Loaded {arr?.Length ?? 0} objects from Resources (project-wide)");
|
||||
}
|
||||
|
||||
_runtimeAllyResourcesPath = resourcesPath;
|
||||
@@ -592,7 +593,7 @@ public class teamUIController : MonoBehaviour
|
||||
|
||||
if (_cachedRuntimeAllyHeroes == null)
|
||||
{
|
||||
_cachedRuntimeAllyHeroes = Resources.LoadAll<AllyHero_SO>("") ?? System.Array.Empty<AllyHero_SO>();
|
||||
_cachedRuntimeAllyHeroes = RuntimeResourcesCache.LoadAllAllyHeroes() ?? System.Array.Empty<AllyHero_SO>();
|
||||
_runtimeAllyHeroById = new Dictionary<int, AllyHero_SO>();
|
||||
foreach (var hero in _cachedRuntimeAllyHeroes)
|
||||
{
|
||||
@@ -622,7 +623,7 @@ public class teamUIController : MonoBehaviour
|
||||
// Populate enemy SOs from enemySlotIds using editor/runtime paths similar to allies
|
||||
public void PopulateEnemySOsFromIds()
|
||||
{
|
||||
Debug.Log($"PopulateEnemySOsFromIds called, enemySlotIds: {string.Join(",", enemySlotIds)}");
|
||||
if (VerboseLogs) Debug.Log($"PopulateEnemySOsFromIds called, enemySlotIds: {string.Join(",", enemySlotIds)}");
|
||||
if (enemySlotIds == null || enemySlotIds.Count == 0)
|
||||
{
|
||||
currentEnemySOs = new EnemyData_SO[0];
|
||||
@@ -802,7 +803,7 @@ public class teamUIController : MonoBehaviour
|
||||
string mode = isEditor ? "Editor" : "Runtime";
|
||||
string spriteCard = so.CharacterCardSprite != null ? so.CharacterCardSprite.name : "(null)";
|
||||
string spriteTeam = so.CharacterTeamSprite != null ? so.CharacterTeamSprite.name : "(null)";
|
||||
Debug.Log($"[teamUIController] ({mode}) Slot {slotIndex} -> CharacterID={so.CharacterID}, Name={so.CharacterName}, Skill={so.CharacterSkillName}, MaxHealth={so.CharacterMaxHealth}, CardSprite={spriteCard}, TeamSprite={spriteTeam}");
|
||||
if (VerboseLogs) Debug.Log($"[teamUIController] ({mode}) Slot {slotIndex} -> CharacterID={so.CharacterID}, Name={so.CharacterName}, Skill={so.CharacterSkillName}, MaxHealth={so.CharacterMaxHealth}, CardSprite={spriteCard}, TeamSprite={spriteTeam}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1370,14 +1371,14 @@ public class teamUIController : MonoBehaviour
|
||||
field = FindOrConvertTMP(parent, null);
|
||||
if (field != null)
|
||||
{
|
||||
Debug.Log($"[teamUIController] Resolved score TMP from parent {parent?.name} -> {field.gameObject.name}");
|
||||
if (VerboseLogs) Debug.Log($"[teamUIController] Resolved score TMP from parent {parent?.name} -> {field.gameObject.name}");
|
||||
return;
|
||||
}
|
||||
// 2) by scene object name
|
||||
field = FindOrConvertTMP(null, sceneName);
|
||||
if (field != null)
|
||||
{
|
||||
Debug.Log($"[teamUIController] Resolved score TMP by scene name '{sceneName}' -> {field.gameObject.name}");
|
||||
if (VerboseLogs) Debug.Log($"[teamUIController] Resolved score TMP by scene name '{sceneName}' -> {field.gameObject.name}");
|
||||
return;
|
||||
}
|
||||
Debug.LogWarning($"[teamUIController] Could not resolve {sceneName} TMP (parent '{parent?.name}')");
|
||||
@@ -1480,7 +1481,7 @@ public class teamUIController : MonoBehaviour
|
||||
int id = allySlotIds[slotIndex];
|
||||
if (id <= 0) return;
|
||||
|
||||
AllyHero_SO[] all = Resources.LoadAll<AllyHero_SO>("");
|
||||
AllyHero_SO[] all = RuntimeResourcesCache.LoadAllAllyHeroes();
|
||||
for (int i = 0; i < all.Length; i++)
|
||||
{
|
||||
AllyHero_SO so = all[i];
|
||||
@@ -1887,7 +1888,7 @@ public class teamUIController : MonoBehaviour
|
||||
if (SkillBuilder.Instance != null)
|
||||
{
|
||||
SkillBuilder.Instance.TriggerOnAllEnemiesDefeated();
|
||||
Debug.Log("[teamUIController] All enemies defeated -> TriggerOnAllEnemiesDefeated fired.");
|
||||
if (VerboseLogs) Debug.Log("[teamUIController] All enemies defeated -> TriggerOnAllEnemiesDefeated fired.");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2303,7 +2304,7 @@ public class teamUIController : MonoBehaviour
|
||||
{
|
||||
if (recognizedEnemySOs != null && recognizedEnemySOs.Length > 0 && individualHPList != null)
|
||||
{
|
||||
Debug.Log($"[teamUIController] Applying calculated HP list to {recognizedEnemySOs.Length} recognized enemies.");
|
||||
if (VerboseLogs) Debug.Log($"[teamUIController] Applying calculated HP list to {recognizedEnemySOs.Length} recognized enemies.");
|
||||
|
||||
for (int i = 0; i < recognizedEnemySOs.Length; i++)
|
||||
{
|
||||
@@ -2324,7 +2325,7 @@ public class teamUIController : MonoBehaviour
|
||||
{
|
||||
int diffID = BeatmapManager.Instance != null ? BeatmapManager.Instance.assignedDifficulty : 0;
|
||||
var stats = currentSO.GetStatsByDifficultyID(diffID);
|
||||
Debug.Log($"[teamUIController] Re-initializing current enemy instance with new HP: {stats.enemy_maxHP}");
|
||||
if (VerboseLogs) Debug.Log($"[teamUIController] Re-initializing current enemy instance with new HP: {stats.enemy_maxHP}");
|
||||
enemyCombatantInstance.InitializeFromSO(currentSO, diffID);
|
||||
UpdateEnemyUIImmediate();
|
||||
|
||||
@@ -2357,7 +2358,7 @@ public class teamUIController : MonoBehaviour
|
||||
if (so != null) totalMaxHP += so.GetStatsByDifficultyID(CurrentDifficultyID).enemy_maxHP;
|
||||
}
|
||||
}
|
||||
Debug.Log($"[teamUIController] Total Max HP has been recalculated to: {totalMaxHP}");
|
||||
if (VerboseLogs) Debug.Log($"[teamUIController] Total Max HP has been recalculated to: {totalMaxHP}");
|
||||
// Documentation text normalized.
|
||||
UpdateAllEnemyTotalHealthUIImmediate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user