拼图测试场景

This commit is contained in:
xinkl
2025-11-09 23:36:29 +08:00
parent 011c274bcf
commit 4ecd1d0e7e
22 changed files with 1398 additions and 117 deletions

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using A2W;
using Unity.Cinemachine;
using UnityEngine;
@@ -15,11 +16,10 @@ public class MusicGame : SceneSingleton<MusicGame>
public Vector3 judgeLine;
private List<GameObject> tickNote = new List<GameObject>();
double startDsp;
public int Sroce = 0;
void Start()
{
mainCamera = Camera.main;
}
void Update()
@@ -27,6 +27,11 @@ public class MusicGame : SceneSingleton<MusicGame>
// if (Keyboard.current.qKey.wasPressedThisFrame) Play();
}
public async Task openGameUI()
{
await UIManager.instance.ShowPanel<MusicGamePanel>();
}
public void Play()
{
mainCamera.transform.position = new Vector3(0, 100, -10);
@@ -93,11 +98,13 @@ public class MusicGame : SceneSingleton<MusicGame>
// ActivateTick(musicData.musicTicks[tickId]);
else
{
UIManager.instance.HidePanel<MusicGamePanel>();
gameObject.GetComponent<AudioSource>().Stop();
isPlaying = false;
tickId = 0;
noteId = 0;
mainCamera.GetComponent<CinemachineBrain>().enabled = true;
Debug.Log("完成所有tick");
Debug.Log($"完成所有tick,分数{Sroce}");
GameFlowMgr.instance.completeLevel(0);
}
}

View File

@@ -56,6 +56,7 @@ public class Note : MonoBehaviour
Debug.Log($"音符 {Uid}击中");
judged = true;
lastSpaceTime = double.NegativeInfinity;
MusicGame.instance.Sroce += 10;
MusicGame.instance.onNoteHit(Uid);
}
else

View File

@@ -12,8 +12,8 @@ public class PianoInteractable : MonoBehaviour, IInteractable
Debug.Log("OnExitInteractionRange");
}
public void OnInteract()
public async void OnInteract()
{
MusicGame.instance.Play();
await MusicGame.instance.openGameUI();
}
}

View File

@@ -0,0 +1,20 @@
using System.Threading.Tasks;
using A2W;
using UnityEngine;
public class SceneInit : MonoBehaviour
{
MessagePanel messagePanel;
async Task Init()
{
// messagePanel = await UIManager.instance.ShowPanel<MessagePanel>();
// messagePanel.AddMessage("寻找有关于音乐的物品");
// Debug.Log("寻找有关于音乐的物品");
}
async void Start()
{
messagePanel = await UIManager.instance.ShowPanel<MessagePanel>();
messagePanel.AddMessage("Search for items related to music");
Debug.Log("寻找有关于音乐的物品");
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 03f01a4a562213c419a7595dcf397006