repaired the motherfucking hold note problem which troubled us longer than 2 months
added some UI
This commit is contained in:
@@ -68,7 +68,7 @@ public class NotePool : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
//Debug.LogWarning("对象池已满,生成新的音符!");
|
||||
Debug.LogWarning("对象池已满,生成新的音符!");
|
||||
GameObject obj = Instantiate(prefab);
|
||||
obj.SetActive(true);
|
||||
return obj;
|
||||
@@ -86,11 +86,11 @@ public class NotePool : MonoBehaviour
|
||||
if (pool.Count < maxPoolSize)
|
||||
{
|
||||
pool.Push(obj);
|
||||
//Debug.Log($"已归还对象:{obj.name},当前池容量:{pool.Count}");
|
||||
Debug.Log($"已归还对象:{obj.name},当前池容量:{pool.Count}");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Debug.LogWarning("对象池已满,无法继续归还对象!");
|
||||
Debug.LogWarning("对象池已满,无法继续归还对象!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,18 +128,12 @@ public class NotePool : MonoBehaviour
|
||||
|
||||
public void ReturnNote(GameObject note, string color)
|
||||
{
|
||||
Note noteComponent = note.GetComponent<Note>();
|
||||
if (noteComponent != null)
|
||||
|
||||
NoteController noteScript = note.GetComponent<NoteController>();
|
||||
if (noteScript != null)
|
||||
{
|
||||
JudgeManager.Instance?.UnregisterNote(noteComponent.GetKey(), noteComponent);
|
||||
noteScript.ResetState();
|
||||
}
|
||||
|
||||
NoteController noteController = note.GetComponent<NoteController>();
|
||||
if (noteController != null)
|
||||
{
|
||||
noteController.ResetState();
|
||||
}
|
||||
|
||||
ReturnObjectToPool(notePools[GetColorIndexFromName(color)], note);
|
||||
}
|
||||
|
||||
@@ -147,7 +141,7 @@ public class NotePool : MonoBehaviour
|
||||
{
|
||||
if (string.IsNullOrEmpty(color))
|
||||
{
|
||||
//Debug.LogWarning($" 归还 StartNote 时 color 为空!音符名: {startNote.name}");
|
||||
Debug.LogWarning($" 归还 StartNote 时 color 为空!音符名: {startNote.name}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -164,7 +158,7 @@ public class NotePool : MonoBehaviour
|
||||
{
|
||||
if (string.IsNullOrEmpty(color))
|
||||
{
|
||||
//Debug.LogWarning($" 归还 HoldNoteSegment 时 color 为空!音符名: {holdNote.name}");
|
||||
Debug.LogWarning($" 归还 HoldNoteSegment 时 color 为空!音符名: {holdNote.name}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -189,7 +183,7 @@ public class NotePool : MonoBehaviour
|
||||
case "purple": return 3;
|
||||
case "blue": return 4;
|
||||
default:
|
||||
//Debug.LogError($"未识别的颜色: {colorName},默认使用红色");
|
||||
Debug.LogError($"未识别的颜色: {colorName},默认使用红色");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user