HeavenStudio/Assets/Scripts/LevelEditor/EditorTheme.cs
minenice55 bccd88e164
Beatmap Sections & Latency Reduction (#170)
* prep UI for chart section

* all special layers now on one area

todo: have buttons toggle between special layers  (selection mode shows all?), use the tabs system for this

* swapping between special timelines - prelim

* special entities can be placed

* spec. timeline base functions complete

music volume changes should work now

* attempt at input lag reduction

needs testing

* fix dsp issues

* smaller DSP buffer?

* Revert "smaller DSP buffer?"

This reverts commit 9d36db5ff9.

* make conductor clock use real time (double)

change order of execution of input-related scripts to further attempt a reduction in input latency

* start values can be changed

make the old special entity bar visible when the corresponding type is selected

* creation of Chart Sections (TODO: GO REFERENCE)

* added GO references

* section edit dialog

* disable wrapping on chart section obj

* backspace can now delete entities

* entities don't shift when duplicated

* fix PlayerActionEvent order of operations

- fixed remix loading trying to clear special timeline while it's writing to itself

* make oop check match parity

* more operation order fix

* fix Karate Man BG initialization

* show section progress in editor

todo: section progress in-game

* more fix for entity duping
2022-09-18 16:48:14 -04:00

80 lines
2.7 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Newtonsoft.Json;
using TMPro;
using Starpelly;
using HeavenStudio.Editor.Track;
namespace HeavenStudio.Editor
{
public class EditorTheme : MonoBehaviour
{
public TextAsset ThemeTXT;
public static Theme theme;
[Header("Components")]
[SerializeField] private Image layer;
[SerializeField] private Image specialLayers;
[SerializeField] private Image tempoLayer;
[SerializeField] private Image musicLayer;
[SerializeField] private Image sectionLayer;
private void Awake()
{
theme = JsonConvert.DeserializeObject<Theme>(ThemeTXT.text);
}
private void Start()
{
specialLayers.GetComponent<Image>().color = theme.properties.SpecialLayersCol.Hex2RGB();
tempoLayer.GetComponent<Image>().color = theme.properties.TempoLayerCol.Hex2RGB();
musicLayer.GetComponent<Image>().color = theme.properties.MusicLayerCol.Hex2RGB();
sectionLayer.GetComponent<Image>().color = theme.properties.SectionLayerCol.Hex2RGB();
Tooltip.AddTooltip(specialLayers.gameObject, $"All Special Tracks");
Tooltip.AddTooltip(tempoLayer.gameObject, $"Tempo Track");
Tooltip.AddTooltip(musicLayer.gameObject, $"Music Volume Track");
Tooltip.AddTooltip(sectionLayer.gameObject, $"Remix Sections Track");
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 = $"Track {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;
case 4:
c = theme.properties.Layer5Col.Hex2RGB();
break;
}
layer.GetComponent<Image>().color = c;
Tooltip.AddTooltip(layer, $"Track {i + 1}");
}
Destroy(layer);
}
}
}