Dynamic editor theme (WIP), read desc for more info

Spaceball has been improved, you can now hit multiple balls at a time. Fork Lifter and Karate Man need this update soon as well. No idea why I did it the way I did.

Time jumping also has been improved by pausing.

Dynamic editor themes for custom theme support, however that won't be implemented until later.
This commit is contained in:
Braedon
2022-01-13 21:33:51 -05:00
parent 38b8b6737d
commit 8760412bb2
18 changed files with 539 additions and 66 deletions

View File

@ -1,6 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Starpelly;
namespace RhythmHeavenMania.Editor
{
@ -24,6 +27,9 @@ namespace RhythmHeavenMania.Editor
private void Start()
{
DrawVisual();
Color boxCol = EditorTheme.theme.properties.BoxSelectionCol.Hex2RGB();
boxVisual.GetComponent<Image>().color = new Color(boxCol.r, boxCol.g, boxCol.b, 0.3f);
}
private void Update()

View File

@ -4,6 +4,8 @@ using UnityEngine;
using UnityEngine.UI;
using Newtonsoft.Json;
namespace RhythmHeavenMania.Editor
{
public class Editor : MonoBehaviour

View File

@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Newtonsoft.Json;
namespace RhythmHeavenMania.Editor
{
public class EditorTheme : MonoBehaviour
{
public TextAsset ThemeTXT;
public static Theme theme;
[Header("Components")]
[SerializeField] private Image[] Layers;
private void Awake()
{
theme = JsonConvert.DeserializeObject<Theme>(ThemeTXT.text);
}
private void Start()
{
Layers[0].color = Starpelly.Colors.Hex2RGB(theme.properties.Layer1Col);
Layers[1].color = Starpelly.Colors.Hex2RGB(theme.properties.Layer2Col);
Layers[2].color = Starpelly.Colors.Hex2RGB(theme.properties.Layer3Col);
Layers[3].color = Starpelly.Colors.Hex2RGB(theme.properties.Layer4Col);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c6b7fb8acdd40984c8ae195548f05680
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,9 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using DG.Tweening;
using Starpelly;
namespace RhythmHeavenMania.Editor
{
@ -114,10 +116,11 @@ namespace RhythmHeavenMania.Editor
{
for (int i = 0; i < EventRef.transform.parent.childCount; i++)
{
EventRef.transform.parent.GetChild(i).GetComponent<TMP_Text>().color = Color.white;
EventRef.transform.parent.GetChild(i).GetComponent<TMP_Text>().color = EditorTheme.theme.properties.EventNormalCol.Hex2RGB();
}
EventRef.transform.parent.GetChild(ind + 1).GetComponent<TMP_Text>().color = Color.cyan;
EventRef.transform.parent.GetChild(ind + 1).GetComponent<TMP_Text>().color = EditorTheme.theme.properties.EventSelectedCol.Hex2RGB();
CurrentSelected.GetComponent<Image>().color = EditorTheme.theme.properties.EventSelectedCol.Hex2RGB();
}
private void DestroyEvents()

View File

@ -0,0 +1,29 @@
using System;
using UnityEngine;
namespace RhythmHeavenMania.Editor
{
[Serializable]
public class Theme
{
public string name;
public Properties properties;
[Serializable]
public class Properties
{
public string Layer1Col;
public string Layer2Col;
public string Layer3Col;
public string Layer4Col;
public string EventSelectedCol;
public string EventNormalCol;
public string BeatMarkerCol;
public string CurrentTimeMarkerCol;
public string BoxSelectionCol;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 80e5467f2435b6b4089b73747ac8fc71
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -43,6 +43,12 @@ namespace RhythmHeavenMania.Editor
AddEventObject(e.datamodel, false, new Vector3(e.beat, Mathp.Round2Nearest(Random.Range(0, -205.36f), 51.34f)), i);
}
TimelineSlider.GetChild(0).GetComponent<Image>().color = EditorTheme.theme.properties.BeatMarkerCol.Hex2RGB();
TimelineSlider.GetChild(1).GetComponent<Image>().color = EditorTheme.theme.properties.BeatMarkerCol.Hex2RGB();
TimelineSlider.GetChild(2).GetComponent<TMP_Text>().color = EditorTheme.theme.properties.BeatMarkerCol.Hex2RGB();
TimelineSlider.GetChild(3).GetComponent<TMP_Text>().color = EditorTheme.theme.properties.BeatMarkerCol.Hex2RGB();
TimelineSongPosLineRef.GetComponent<Image>().color = EditorTheme.theme.properties.CurrentTimeMarkerCol.Hex2RGB();
}
#endregion

View File

@ -31,8 +31,6 @@ namespace RhythmHeavenMania.Editor
[Header("Colors")]
public Color NormalCol;
public Color SelectedCol;
public Color DeleteCol;
private void Update()
{
@ -56,20 +54,16 @@ namespace RhythmHeavenMania.Editor
#endregion
SetColor(GetTrack());
if (selected)
{
SetColor(1);
if (Input.GetKeyDown(KeyCode.Delete))
{
Selections.instance.Deselect(this);
Timeline.instance.DestroyEventObject(entity);
}
}
else
{
SetColor(0);
}
if (Conductor.instance.NotStopped())
{
@ -137,7 +131,7 @@ namespace RhythmHeavenMania.Editor
{
entity.beat = this.transform.localPosition.x;
GameManager.instance.SortEventsList();
entity.track = (int)(this.transform.localPosition.y / 51.34f) * -1;
entity.track = GetTrack();
}
#region ClickEvents
@ -203,19 +197,27 @@ namespace RhythmHeavenMania.Editor
switch (type)
{
case 0:
c = NormalCol;
c = EditorTheme.theme.properties.Layer1Col.Hex2RGB();
break;
case 1:
c = SelectedCol;
c = EditorTheme.theme.properties.Layer2Col.Hex2RGB();
break;
case 2:
c = DeleteCol;
c = EditorTheme.theme.properties.Layer3Col.Hex2RGB();
break;
case 3:
c = EditorTheme.theme.properties.Layer4Col.Hex2RGB();
break;
}
transform.GetChild(0).GetComponent<Image>().color = c;
}
public int GetTrack()
{
return (int)(this.transform.localPosition.y / 51.34f) * -1;
}
private void OnDestroy()
{
// better safety net than canada's healthcare system

View File

@ -0,0 +1,18 @@
{
"name": "Rhythm Heaven Mania Default Editor Theme",
"properties": {
"Layer1Col": "E1F1DD",
"Layer2Col": "CDC7BE",
"Layer3Col": "87A7B3",
"Layer4Col": "766161",
"EventSelectedCol": "ffbc36",
"EventNormalCol": "FFFFFF",
"BeatMarkerCol": "ffbc36",
"CurrentTimeMarkerCol": "ffc95c",
"BoxSelectionCol": "ffd175"
}
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2764bae4979406541a0596e739f420fd
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: