2022-01-14 02:33:51 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
using Newtonsoft.Json;
|
2022-01-14 22:46:14 +00:00
|
|
|
using TMPro;
|
|
|
|
|
|
|
|
using Starpelly;
|
2022-01-14 02:33:51 +00:00
|
|
|
|
|
|
|
namespace RhythmHeavenMania.Editor
|
|
|
|
{
|
|
|
|
public class EditorTheme : MonoBehaviour
|
|
|
|
{
|
|
|
|
public TextAsset ThemeTXT;
|
|
|
|
public static Theme theme;
|
|
|
|
|
|
|
|
[Header("Components")]
|
2022-01-14 22:46:14 +00:00
|
|
|
[SerializeField] private Image layer;
|
|
|
|
[SerializeField] private Image tempoLayer;
|
|
|
|
[SerializeField] private Image musicLayer;
|
2022-01-14 02:33:51 +00:00
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
theme = JsonConvert.DeserializeObject<Theme>(ThemeTXT.text);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
{
|
2022-01-14 22:46:14 +00:00
|
|
|
tempoLayer.GetComponent<Image>().color = theme.properties.TempoLayerCol.Hex2RGB();
|
|
|
|
musicLayer.GetComponent<Image>().color = theme.properties.MusicLayerCol.Hex2RGB();
|
|
|
|
|
|
|
|
layer.gameObject.SetActive(false);
|
|
|
|
|
|
|
|
for (int i = 0; i < Timeline.instance.LayerCount; i++)
|
|
|
|
{
|
|
|
|
GameObject layer = Instantiate(this.layer.gameObject, this.layer.transform.parent);
|
|
|
|
layer.SetActive(true);
|
|
|
|
layer.transform.GetChild(0).GetComponent<TMP_Text>().text = $"Layer {i + 1}";
|
|
|
|
|
|
|
|
Color c = Color.white;
|
|
|
|
|
|
|
|
switch (i)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
c = theme.properties.Layer1Col.Hex2RGB();
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
c = theme.properties.Layer2Col.Hex2RGB();
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
c = theme.properties.Layer3Col.Hex2RGB();
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
c = theme.properties.Layer4Col.Hex2RGB();
|
|
|
|
break;
|
|
|
|
}
|
2022-01-14 02:33:51 +00:00
|
|
|
|
2022-01-14 22:46:14 +00:00
|
|
|
layer.GetComponent<Image>().color = c;
|
|
|
|
}
|
|
|
|
Destroy(layer);
|
2022-01-14 02:33:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|