UI换了很多,spine主视觉停用

This commit is contained in:
2026-06-15 20:17:25 +08:00
parent 5eec879582
commit 216ab08e8d
3634 changed files with 814422 additions and 382766 deletions
+8 -8
View File
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -351,7 +351,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
private void ResolveUIReferences()
{
// Try singleton first, fallback to scene search (works in editor)
var ui = teamUIController.Instance != null ? teamUIController.Instance : UnityEngine.Object.FindAnyObjectByType<teamUIController>();
var ui = teamUIController.Instance != null ? teamUIController.Instance : SceneObjectLookupCache.FindAny<teamUIController>();
if (ui == null) return;
switch (slotIndex)
{
@@ -2876,7 +2876,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
for (int i = 0; i < adj.Length; i++)
{
int idx = adj[i];
GameObject go = ui.GetAllyObjectBySlot(idx) ?? GameObject.Find($"ally_0{idx + 1}");
GameObject go = ui.GetAllyObjectBySlot(idx) ?? SceneObjectLookupCache.Find($"ally_0{idx + 1}");
if (go == null) continue;
var ally = go.GetComponent<AllyCombatant>() ?? go.GetComponentInChildren<AllyCombatant>(true);
eval(ally);
@@ -2888,13 +2888,13 @@ public class AllyCombatant : MonoBehaviour, ICombatant
int right = slotIndex + 1;
if (left >= 0)
{
var go = GameObject.Find($"ally_0{left + 1}");
var go = SceneObjectLookupCache.Find($"ally_0{left + 1}");
var ally = go != null ? (go.GetComponent<AllyCombatant>() ?? go.GetComponentInChildren<AllyCombatant>(true)) : null;
eval(ally);
}
if (right <= 4)
{
var go = GameObject.Find($"ally_0{right + 1}");
var go = SceneObjectLookupCache.Find($"ally_0{right + 1}");
var ally = go != null ? (go.GetComponent<AllyCombatant>() ?? go.GetComponentInChildren<AllyCombatant>(true)) : null;
eval(ally);
}
@@ -2951,7 +2951,7 @@ public class AllyCombatant : MonoBehaviour, ICombatant
for (int i = 0; i < adj.Length; i++)
{
int idx = adj[i];
GameObject go = ui.GetAllyObjectBySlot(idx) ?? GameObject.Find($"ally_0{idx + 1}");
GameObject go = ui.GetAllyObjectBySlot(idx) ?? SceneObjectLookupCache.Find($"ally_0{idx + 1}");
if (go == null) continue;
var ally = go.GetComponent<AllyCombatant>() ?? go.GetComponentInChildren<AllyCombatant>(true);
eval(ally);
@@ -2963,13 +2963,13 @@ public class AllyCombatant : MonoBehaviour, ICombatant
int right = slotIndex + 1;
if (left >= 0)
{
var go = GameObject.Find($"ally_0{left + 1}");
var go = SceneObjectLookupCache.Find($"ally_0{left + 1}");
var ally = go != null ? (go.GetComponent<AllyCombatant>() ?? go.GetComponentInChildren<AllyCombatant>(true)) : null;
eval(ally);
}
if (right <= 4)
{
var go = GameObject.Find($"ally_0{right + 1}");
var go = SceneObjectLookupCache.Find($"ally_0{right + 1}");
var ally = go != null ? (go.GetComponent<AllyCombatant>() ?? go.GetComponentInChildren<AllyCombatant>(true)) : null;
eval(ally);
}
+8 -8
View File
@@ -776,7 +776,7 @@ public class EffectSystem : MonoBehaviour
List<GameObject> list = new List<GameObject>();
// prefer teamUIController when available for authoritative ally/enemy objects
var ui = teamUIController.Instance != null ? teamUIController.Instance : UnityEngine.Object.FindAnyObjectByType<teamUIController>();
var ui = teamUIController.Instance != null ? teamUIController.Instance : SceneObjectLookupCache.FindAny<teamUIController>();
switch (selector)
{
@@ -858,7 +858,7 @@ public class EffectSystem : MonoBehaviour
if (go != null) list.Add(go);
else
{
var named = GameObject.Find($"ally_0{idx + 1}");
var named = SceneObjectLookupCache.Find($"ally_0{idx + 1}");
if (named != null) list.Add(named);
}
}
@@ -870,11 +870,11 @@ public class EffectSystem : MonoBehaviour
int right = slotIndex + 1;
if (left >= 0)
{
var g = GameObject.Find($"ally_0{left + 1}"); if (g != null) list.Add(g);
var g = SceneObjectLookupCache.Find($"ally_0{left + 1}"); if (g != null) list.Add(g);
}
if (right <= 4)
{
var g = GameObject.Find($"ally_0{right + 1}"); if (g != null) list.Add(g);
var g = SceneObjectLookupCache.Find($"ally_0{right + 1}"); if (g != null) list.Add(g);
}
}
}
@@ -884,11 +884,11 @@ public class EffectSystem : MonoBehaviour
int right = slotIndex + 1;
if (left >= 0)
{
var g = GameObject.Find($"ally_0{left + 1}"); if (g != null) list.Add(g);
var g = SceneObjectLookupCache.Find($"ally_0{left + 1}"); if (g != null) list.Add(g);
}
if (right <= 4)
{
var g = GameObject.Find($"ally_0{right + 1}"); if (g != null) list.Add(g);
var g = SceneObjectLookupCache.Find($"ally_0{right + 1}"); if (g != null) list.Add(g);
}
}
}
@@ -963,7 +963,7 @@ public class EffectSystem : MonoBehaviour
for (int i = 1; i <= 5; i++)
{
string name = $"ally_0{i}"; // ally_01..ally_05
var go = GameObject.Find(name);
var go = SceneObjectLookupCache.Find(name);
if (go != null && !_cachedAllies.Contains(go)) _cachedAllies.Add(go);
}
@@ -1002,7 +1002,7 @@ public class EffectSystem : MonoBehaviour
// If we really need to find "thisEnemy" by name even if inactive, we should do it differently.
try
{
var single = GameObject.Find("thisEnemy");
var single = SceneObjectLookupCache.Find("thisEnemy");
if (single != null && !_cachedEnemies.Contains(single)) _cachedEnemies.Add(single);
} catch { }
+4 -4
View File
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using UnityEngine;
@@ -435,7 +435,7 @@ public class EnemyCombatant : MonoBehaviour, ICombatant
}
else
{
var sb = UnityEngine.Object.FindAnyObjectByType<SkillBuilder>();
var sb = SceneObjectLookupCache.FindAny<SkillBuilder>();
if (sb != null)
{
Debug.LogWarning("[EnemyCombatant] SkillBuilder.Instance was null on Die(); using FindObjectOfType fallback");
@@ -461,7 +461,7 @@ public class EnemyCombatant : MonoBehaviour, ICombatant
{
try
{
var ui = UnityEngine.Object.FindAnyObjectByType<teamUIController>();
var ui = SceneObjectLookupCache.FindAny<teamUIController>();
if (ui != null)
{
return;
@@ -488,7 +488,7 @@ public class EnemyCombatant : MonoBehaviour, ICombatant
}
else
{
var sb = UnityEngine.Object.FindAnyObjectByType<SkillBuilder>();
var sb = SceneObjectLookupCache.FindAny<SkillBuilder>();
if (sb != null)
{
sb.TriggerOnAllEnemiesDefeated();
+36 -24
View File
@@ -189,7 +189,7 @@ public class ScoreManager : MonoBehaviour
perfectBonusHooked = false;
}
var jm = JudgeManager.Instance ?? UnityEngine.Object.FindAnyObjectByType<JudgeManager>();
var jm = JudgeManager.Instance ?? SceneObjectLookupCache.FindAny<JudgeManager>();
if (jm == null) return;
jm.AllNotesJudged -= OnAllNotesJudgedForPerfectBonus;
@@ -211,7 +211,7 @@ public class ScoreManager : MonoBehaviour
private int GetCurrentChartLogicalNoteCount()
{
var bmm = UnityEngine.Object.FindAnyObjectByType<BeatmapManager>();
var bmm = SceneObjectLookupCache.FindAny<BeatmapManager>();
if (bmm != null)
{
if (bmm.beatmap != null && bmm.beatmap.notes != null && bmm.beatmap.notes.Length > 0)
@@ -226,7 +226,7 @@ public class ScoreManager : MonoBehaviour
private int GetCurrentChartLeftoverScore()
{
var bmm = UnityEngine.Object.FindAnyObjectByType<BeatmapManager>();
var bmm = SceneObjectLookupCache.FindAny<BeatmapManager>();
if (bmm == null) return 0;
return Mathf.Max(0, bmm.leftoverScore);
}
@@ -289,11 +289,11 @@ public class ScoreManager : MonoBehaviour
private void EnsureIdolscoreKeys()
{
// Try to resolve missing refs (GameObject.Find doesn't return inactive objects).
if (_idolscoreKeys[0] == null) _idolscoreKeys[0] = GameObject.Find("idolscoreKey_red")?.transform;
if (_idolscoreKeys[1] == null) _idolscoreKeys[1] = GameObject.Find("idolscoreKey_green")?.transform;
if (_idolscoreKeys[2] == null) _idolscoreKeys[2] = GameObject.Find("idolscoreKey_yellow")?.transform;
if (_idolscoreKeys[3] == null) _idolscoreKeys[3] = GameObject.Find("idolscoreKey_purple")?.transform;
if (_idolscoreKeys[4] == null) _idolscoreKeys[4] = GameObject.Find("idolscoreKey_blue")?.transform;
if (_idolscoreKeys[0] == null) _idolscoreKeys[0] = SceneObjectLookupCache.Find("idolscoreKey_red")?.transform;
if (_idolscoreKeys[1] == null) _idolscoreKeys[1] = SceneObjectLookupCache.Find("idolscoreKey_green")?.transform;
if (_idolscoreKeys[2] == null) _idolscoreKeys[2] = SceneObjectLookupCache.Find("idolscoreKey_yellow")?.transform;
if (_idolscoreKeys[3] == null) _idolscoreKeys[3] = SceneObjectLookupCache.Find("idolscoreKey_purple")?.transform;
if (_idolscoreKeys[4] == null) _idolscoreKeys[4] = SceneObjectLookupCache.Find("idolscoreKey_blue")?.transform;
for (int i = 0; i < 5; i++)
{
@@ -345,18 +345,17 @@ public class ScoreManager : MonoBehaviour
for (int i = 0; i < 5; i++)
{
if (allyCombatants[i] != null) continue;
var current = allyCombatants[i];
if (current != null) continue;
var go = allyObjects[i];
if (go == null)
{
go = GameObject.Find($"ally_0{i + 1}");
go = SceneObjectLookupCache.Find($"ally_0{i + 1}");
allyObjects[i] = go;
}
if (go != null)
{
allyCombatants[i] = go.GetComponent<AllyCombatant>();
}
}
}
@@ -436,19 +435,32 @@ public class ScoreManager : MonoBehaviour
// Legacy Text fields on teamUIController
try
{
if (ui.red_pmScore_sum != null) ui.red_pmScore_sum.text = red_pmScore_sum.ToString();
if (ui.green_pmScore_sum != null) ui.green_pmScore_sum.text = green_pmScore_sum.ToString();
if (ui.yellow_pmScore_sum != null) ui.yellow_pmScore_sum.text = yellow_pmScore_sum.ToString();
if (ui.purple_pmScore_sum != null) ui.purple_pmScore_sum.text = purple_pmScore_sum.ToString();
if (ui.blue_pmScore_sum != null) ui.blue_pmScore_sum.text = blue_pmScore_sum.ToString();
if (ui.allSum_pmScore != null) ui.allSum_pmScore.text = allSum_pmScore.ToString();
string redPmText = red_pmScore_sum.ToString();
string greenPmText = green_pmScore_sum.ToString();
string yellowPmText = yellow_pmScore_sum.ToString();
string purplePmText = purple_pmScore_sum.ToString();
string bluePmText = blue_pmScore_sum.ToString();
string allPmText = allSum_pmScore.ToString();
string redIdolText = red_idolScore_sum.ToString();
string greenIdolText = green_idolScore_sum.ToString();
string yellowIdolText = yellow_idolScore_sum.ToString();
string purpleIdolText = purple_idolScore_sum.ToString();
string blueIdolText = blue_idolScore_sum.ToString();
string allIdolText = allSum_idolScore.ToString();
if (ui.red_idolScore_sum != null) ui.red_idolScore_sum.text = red_idolScore_sum.ToString();
if (ui.green_idolScore_sum != null) ui.green_idolScore_sum.text = green_idolScore_sum.ToString();
if (ui.yellow_idolScore_sum != null) ui.yellow_idolScore_sum.text = yellow_idolScore_sum.ToString();
if (ui.purple_idolScore_sum != null) ui.purple_idolScore_sum.text = purple_idolScore_sum.ToString();
if (ui.blue_idolScore_sum != null) ui.blue_idolScore_sum.text = blue_idolScore_sum.ToString();
if (ui.allSum_idolScore != null) ui.allSum_idolScore.text = allSum_idolScore.ToString();
if (ui.red_pmScore_sum != null) ui.red_pmScore_sum.text = redPmText;
if (ui.green_pmScore_sum != null) ui.green_pmScore_sum.text = greenPmText;
if (ui.yellow_pmScore_sum != null) ui.yellow_pmScore_sum.text = yellowPmText;
if (ui.purple_pmScore_sum != null) ui.purple_pmScore_sum.text = purplePmText;
if (ui.blue_pmScore_sum != null) ui.blue_pmScore_sum.text = bluePmText;
if (ui.allSum_pmScore != null) ui.allSum_pmScore.text = allPmText;
if (ui.red_idolScore_sum != null) ui.red_idolScore_sum.text = redIdolText;
if (ui.green_idolScore_sum != null) ui.green_idolScore_sum.text = greenIdolText;
if (ui.yellow_idolScore_sum != null) ui.yellow_idolScore_sum.text = yellowIdolText;
if (ui.purple_idolScore_sum != null) ui.purple_idolScore_sum.text = purpleIdolText;
if (ui.blue_idolScore_sum != null) ui.blue_idolScore_sum.text = blueIdolText;
if (ui.allSum_idolScore != null) ui.allSum_idolScore.text = allIdolText;
}
catch (System.Exception ex)
{
+10 -10
View File
@@ -300,7 +300,7 @@ public class SkillBuilder : MonoBehaviour
// Note: AllyCombatant.ReceiveDamage already applies (1 - Resistance), so we calculate the base here.
float enemyAtk = 0f;
var enemyGO = GameObject.Find("thisEnemy");
var enemyGO = SceneObjectLookupCache.Find("thisEnemy");
if (enemyGO != null)
{
var ec = enemyGO.GetComponent<EnemyCombatant>();
@@ -417,7 +417,7 @@ public class SkillBuilder : MonoBehaviour
{
for (int i = 1; i <= 5; i++)
{
var go = GameObject.Find($"ally_0{i}");
var go = SceneObjectLookupCache.Find($"ally_0{i}");
if (go != null && !_cachedAllies.Contains(go)) _cachedAllies.Add(go);
}
}
@@ -497,14 +497,14 @@ public class SkillBuilder : MonoBehaviour
{
var go = ui.GetAllyObjectBySlot(idx);
if (go != null) list.Add(go);
else { var named = GameObject.Find($"ally_0{idx + 1}"); if (named != null) list.Add(named); }
else { var named = SceneObjectLookupCache.Find($"ally_0{idx + 1}"); if (named != null) list.Add(named); }
}
}
else
{
int left = slotIndex - 1, right = slotIndex + 1;
if (left >= 0) { var g = GameObject.Find($"ally_0{left + 1}"); if (g != null) list.Add(g); }
if (right <= 4) { var g = GameObject.Find($"ally_0{right + 1}"); if (g != null) list.Add(g); }
if (left >= 0) { var g = SceneObjectLookupCache.Find($"ally_0{left + 1}"); if (g != null) list.Add(g); }
if (right <= 4) { var g = SceneObjectLookupCache.Find($"ally_0{right + 1}"); if (g != null) list.Add(g); }
}
}
else
@@ -514,14 +514,14 @@ public class SkillBuilder : MonoBehaviour
break;
case Selector.CurrentEnemies:
if (specificTarget != null) list.Add(specificTarget);
else { try { var tagged = GameObject.FindGameObjectsWithTag("Enemy"); foreach (var g in tagged) if (!list.Contains(g)) list.Add(g); } catch { var single = GameObject.Find("thisEnemy"); if (single != null) list.Add(single); } }
else { try { var tagged = GameObject.FindGameObjectsWithTag("Enemy"); foreach (var g in tagged) if (!list.Contains(g)) list.Add(g); } catch { var single = SceneObjectLookupCache.Find("thisEnemy"); if (single != null) list.Add(single); } }
break;
case Selector.AllEntities:
foreach (var go in GetAlliesCached())
{
if (go != null) list.Add(go);
}
try { var taggedE = GameObject.FindGameObjectsWithTag("Enemy"); foreach (var g in taggedE) if (!list.Contains(g)) list.Add(g); } catch { var single = GameObject.Find("thisEnemy"); if (single != null && !list.Contains(single)) list.Add(single); }
try { var taggedE = GameObject.FindGameObjectsWithTag("Enemy"); foreach (var g in taggedE) if (!list.Contains(g)) list.Add(g); } catch { var single = SceneObjectLookupCache.Find("thisEnemy"); if (single != null && !list.Contains(single)) list.Add(single); }
break;
}
list.RemoveAll(x => x == null);
@@ -730,7 +730,7 @@ public class SkillBuilder : MonoBehaviour
{
var ui = teamUIController.Instance;
if (ui != null) return ui.GetAllyObjectBySlot(slotIndex);
var named = GameObject.Find($"ally_0{slotIndex + 1}");
var named = SceneObjectLookupCache.Find($"ally_0{slotIndex + 1}");
return named;
}
@@ -1414,7 +1414,7 @@ ResolvedGroup:
}
if (caster == null)
{
var byName = GameObject.Find($"ally_0{slotIndex + 1}");
var byName = SceneObjectLookupCache.Find($"ally_0{slotIndex + 1}");
if (byName != null)
{
caster = byName;
@@ -3560,7 +3560,7 @@ ResolvedGroup:
LogVerbose($"[SkillBuilder] teamUIController.allySlotIds = [{string.Join(",", teamUIController.Instance.allySlotIds)}]");
}
// Try to find ally GameObject named by convention
var foundGO = GameObject.Find($"ally_0{trackIndex + 1}");
var foundGO = SceneObjectLookupCache.Find($"ally_0{trackIndex + 1}");
if (foundGO != null)
{
LogVerbose($"[SkillBuilder] Found GameObject by name ally_0{trackIndex + 1}: {foundGO.name}");