45 lines
1.5 KiB
C#
45 lines
1.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Ichni;
|
|
using Ichni.RhythmGame;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class NotefabContoler : MonoBehaviour
|
|
{
|
|
public NoteBase noteBase;
|
|
public RawImage ifHold;
|
|
public void Initialize(NoteBase note, float timePerBeat, int beatDeviver)
|
|
{
|
|
noteBase = note;
|
|
Image color = GetComponent<Image>();
|
|
transform.localPosition = new Vector3(0, note.exactJudgeTime / timePerBeat * beatDeviver, 0);
|
|
switch (note)
|
|
{
|
|
case Hold hold:
|
|
color.color = new Color(0, 1, 0, 1);
|
|
if (ifHold != null)
|
|
{
|
|
ifHold.transform.localPosition = new Vector3(0, (hold.holdEndTime - hold.exactJudgeTime) / timePerBeat * beatDeviver / 2, 0);
|
|
var rect = ifHold.GetComponent<RectTransform>();
|
|
rect.sizeDelta = new Vector2(rect.sizeDelta.x, (hold.holdEndTime - hold.exactJudgeTime) / timePerBeat * beatDeviver);
|
|
ifHold.color = new Color(0, 1, 0, 1);
|
|
}
|
|
break;
|
|
case Tap:
|
|
color.color = new Color(0, 1, 1, 1);
|
|
break;
|
|
case Stay:
|
|
color.color = new Color(1, 1, 0, 1);
|
|
break;
|
|
case Flick:
|
|
color.color = new Color(1, 0.2f, 0, 1);
|
|
break;
|
|
}
|
|
}
|
|
public void Onclick()
|
|
{
|
|
EditorManager.instance.uiManager.hierarchy.FindTab(noteBase);
|
|
}
|
|
}
|