Commit 7561f915 authored by 15박보승's avatar 15박보승

Result, Music Selection 관련 UI 구현

parent f4ec1461
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -3,6 +3,13 @@ using System.Collections.Generic; ...@@ -3,6 +3,13 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
public enum UISetType
{
INGAME,
SELECTION,
RESULT
}
public class IngameUIManager : SingletonBehaviour<IngameUIManager> public class IngameUIManager : SingletonBehaviour<IngameUIManager>
{ {
public GameObject ringUIPrefab; public GameObject ringUIPrefab;
...@@ -11,9 +18,17 @@ public class IngameUIManager : SingletonBehaviour<IngameUIManager> ...@@ -11,9 +18,17 @@ public class IngameUIManager : SingletonBehaviour<IngameUIManager>
public Text comboText; public Text comboText;
private Vector3 comboTextPosition; private Vector3 comboTextPosition;
private int musicIdx = 0;
public Image prevMusicImage, nextMusicImage, curMusicImage;
public List<GameObject> UISetList = new List<GameObject>();
public Text perfectCountText, hitCountText, missCountText, scoreResultText, maxComboText;
private void Start() private void Start()
{ {
NoteObject.OnNoteHit += OnNoteHit; NoteObject.OnNoteHit += OnNoteHit;
ChangeUISet(UISetType.SELECTION);
} }
public void OnNoteHit(JudgeResult type) public void OnNoteHit(JudgeResult type)
{ {
...@@ -47,4 +62,51 @@ public class IngameUIManager : SingletonBehaviour<IngameUIManager> ...@@ -47,4 +62,51 @@ public class IngameUIManager : SingletonBehaviour<IngameUIManager>
} }
comboText.transform.localPosition = Vector3.zero; comboText.transform.localPosition = Vector3.zero;
} }
public void OnChangeMusicButtonClicked(int delta)
{
musicIdx += delta;
//Need MAX_MUSIC_COUNT constant in PlayEngine or etc...
/*
if (musicIdx < 0)
{
musicIdx = MAX_MUSIC_COUNT - 1;
}
else if (musicIdx > MAX_MUSIC_COUNT - 1)
{
musicIdx = 0;
}
prevMusicImage.sprite = ImageList[musicIdx - 1 >= 0 ?musicIdx - 1: MAX_MUSIC_COUNT - 1 ];
nextMusicImage.sprite = ImageList[musicIdx + 1 < MAX_MUSIC_COUNT ? musicIdx + 1 : 0 ];
curMusicImage.sprite = ImageList[musicIdx];
*/
}
public void OnStartButtonClicked()
{
PlayEngine.inst.LoadAndPlay(musicIdx);
ChangeUISet(UISetType.INGAME);
}
public void ChangeUISet(UISetType type)
{
ChangeUISet((int)type);
}
public void ChangeUISet(int idx)
{
foreach(var set in UISetList)
{
set.SetActive(false);
}
UISetList[idx].SetActive(true);
}
public void UpdateResultUIs(int perfect, int hit, int miss, int score, int combo)
{
perfectCountText.text = perfect.ToString();
hitCountText.text = hit.ToString();
missCountText.text = miss.ToString();
scoreResultText.text = score.ToString();
maxComboText.text = "x " + combo.ToString();
}
} }
...@@ -44,7 +44,7 @@ public class PlayEngine : SingletonBehaviour<PlayEngine> ...@@ -44,7 +44,7 @@ public class PlayEngine : SingletonBehaviour<PlayEngine>
public void Start() public void Start()
{ {
audioSource = GetComponent<AudioSource>(); audioSource = GetComponent<AudioSource>();
LoadAndPlay(0); //LoadAndPlay(0);
} }
public void LoadAndPlay(int idx) public void LoadAndPlay(int idx)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment