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 75c98a87fb
commit bf7d7110bc
18 changed files with 539 additions and 66 deletions

View file

@ -2,9 +2,9 @@ using UnityEngine;
namespace Starpelly
{
public class Colors
public static class Colors
{
public static string Color2Hex(Color32 color)
public static string Color2Hex(this Color32 color)
{
string hex = color.r.ToString("X2") + color.g.ToString("X2") + color.b.ToString("X2");
return hex;
@ -13,7 +13,7 @@ namespace Starpelly
/// <summary>
/// Converts a Hexadecimal Color to an RGB Color.
/// </summary>
public static Color Hex2RGB(string hex)
public static Color Hex2RGB(this string hex)
{
try
{

View file

@ -648,6 +648,81 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 258006091}
m_CullTransparentMesh: 1
--- !u!1 &308927844
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 308927845}
- component: {fileID: 308927847}
- component: {fileID: 308927846}
m_Layer: 5
m_Name: Image (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &308927845
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 308927844}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1671351975}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 224, y: 51.3415}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &308927846
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 308927844}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.13207549, g: 0.13207549, b: 0.13207549, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &308927847
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 308927844}
m_CullTransparentMesh: 1
--- !u!1 &355353077
GameObject:
m_ObjectHideFlags: 0
@ -1828,6 +1903,81 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -20, y: -20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &618060599
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 618060600}
- component: {fileID: 618060602}
- component: {fileID: 618060601}
m_Layer: 5
m_Name: Image (3)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &618060600
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 618060599}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1671351975}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 224, y: 51.3415}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &618060601
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 618060599}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.13207549, g: 0.13207549, b: 0.13207549, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &618060602
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 618060599}
m_CullTransparentMesh: 1
--- !u!1 &660967736
GameObject:
m_ObjectHideFlags: 0
@ -2425,8 +2575,6 @@ MonoBehaviour:
selected: 0
mouseHovering: 0
NormalCol: {r: 0.8470589, g: 0.8470589, b: 1, a: 1}
SelectedCol: {r: 0.8470589, g: 1, b: 1, a: 1}
DeleteCol: {r: 0.89019614, g: 0.7254902, b: 0.7254902, a: 1}
--- !u!222 &798021451
CanvasRenderer:
m_ObjectHideFlags: 0
@ -3231,6 +3379,81 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Padding: {x: 0, y: 0, z: 0, w: 0}
m_Softness: {x: 0, y: 0}
--- !u!1 &1073072586
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1073072587}
- component: {fileID: 1073072589}
- component: {fileID: 1073072588}
m_Layer: 5
m_Name: Image (2)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1073072587
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1073072586}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1671351975}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 224, y: 51.3415}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1073072588
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1073072586}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.13207549, g: 0.13207549, b: 0.13207549, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1073072589
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1073072586}
m_CullTransparentMesh: 1
--- !u!1 &1110073994
GameObject:
m_ObjectHideFlags: 0
@ -3757,6 +3980,7 @@ GameObject:
- component: {fileID: 1423699436}
- component: {fileID: 1423699438}
- component: {fileID: 1423699437}
- component: {fileID: 1423699442}
- component: {fileID: 1423699439}
- component: {fileID: 1423699440}
- component: {fileID: 1423699441}
@ -3811,8 +4035,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f86858990a87c764892672104bdaef1f, type: 3}
m_Name:
m_EditorClassIdentifier:
level: {fileID: 4900000, guid: df453afcce54d5c4e9105c6829ed8f30, type: 3}
music: {fileID: 8300000, guid: 5fc457d2d31969c44a6734ce4e684ff8, type: 3}
level: {fileID: 4900000, guid: ac276edd56ab99249a2a413e6ac2783d, type: 3}
music: {fileID: 8300000, guid: d6aa7955da64b284589e923dc18c67fb, type: 3}
debugUI: 0
playOnStart: 0
editor: 1
@ -3855,6 +4079,24 @@ MonoBehaviour:
m_EditorClassIdentifier:
boxVisual: {fileID: 411779174}
selecting: 0
--- !u!114 &1423699442
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1423699435}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c6b7fb8acdd40984c8ae195548f05680, type: 3}
m_Name:
m_EditorClassIdentifier:
ThemeTXT: {fileID: 4900000, guid: 2764bae4979406541a0596e739f420fd, type: 3}
Layers:
- {fileID: 1906769994}
- {fileID: 308927846}
- {fileID: 1073072588}
- {fileID: 618060601}
--- !u!1 &1527251879
GameObject:
m_ObjectHideFlags: 0
@ -4383,6 +4625,7 @@ GameObject:
- component: {fileID: 1671351977}
- component: {fileID: 1671351976}
- component: {fileID: 1671351978}
- component: {fileID: 1671351979}
m_Layer: 5
m_Name: Layers
m_TagString: Untagged
@ -4400,14 +4643,18 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Children:
- {fileID: 1906769993}
- {fileID: 308927845}
- {fileID: 1073072587}
- {fileID: 618060600}
m_Father: {fileID: 1861169746}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -528, y: -15.808}
m_SizeDelta: {x: 224, y: 239.36}
m_AnchoredPosition: {x: -528, y: -32.802}
m_SizeDelta: {x: 224, y: 205.366}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1671351976
MonoBehaviour:
@ -4462,6 +4709,32 @@ MonoBehaviour:
m_EffectColor: {r: 1, g: 1, b: 1, a: 1}
m_EffectDistance: {x: 2, y: -2}
m_UseGraphicAlpha: 1
--- !u!114 &1671351979
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1671351974}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 0
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!1 &1671868845
GameObject:
m_ObjectHideFlags: 0
@ -4922,6 +5195,81 @@ MonoBehaviour:
TimelineContent: {fileID: 1852819573}
TimelineSongPosLineRef: {fileID: 580861938}
TimelineEventObjRef: {fileID: 798021449}
--- !u!1 &1906769992
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1906769993}
- component: {fileID: 1906769995}
- component: {fileID: 1906769994}
m_Layer: 5
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1906769993
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1906769992}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1671351975}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 224, y: 51.3415}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1906769994
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1906769992}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.13207549, g: 0.13207549, b: 0.13207549, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1906769995
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1906769992}
m_CullTransparentMesh: 1
--- !u!1 &1921041734
GameObject:
m_ObjectHideFlags: 0

View file

@ -80,7 +80,7 @@ namespace RhythmHeavenMania
musicSource.PlayScheduled(Time.time);
}
GameManager.instance.SetCurrentEventToClosest(songPositionInBeats);
// GameManager.instance.SetCurrentEventToClosest(songPositionInBeats);
}
public void Pause()

View file

@ -141,8 +141,12 @@ namespace RhythmHeavenMania
private IEnumerator PlayCo(float beat)
{
yield return null;
bool paused = Conductor.instance.isPaused;
Conductor.instance.Play(beat);
SetCurrentEventToClosest(beat);
if (!paused)
{
SetCurrentEventToClosest(beat);
}
}
public void Pause()

View file

@ -70,6 +70,8 @@ namespace RhythmHeavenMania.Games.KarateMan
private void Swing()
{
// you cant hit two pots at a time like this so i should fix this before a public build is eventually made.
var EligibleHits = KarateMan.instance.EligibleHits;
bool canHit = (EligibleHits.Count > 0) && (currentHitInList < EligibleHits.Count);

View file

@ -4,6 +4,8 @@ using UnityEngine;
using RhythmHeavenMania.Util;
using DG.Tweening;
namespace RhythmHeavenMania.Games.Spaceball
{
public class SpaceballBall : MonoBehaviour
@ -83,6 +85,34 @@ namespace RhythmHeavenMania.Games.Spaceball
Instantiate(Spaceball.instance.Dust, Spaceball.instance.Dust.transform.parent).SetActive(true);
Destroy(this.gameObject);
}
if (PlayerInput.Pressed())
{
if (e.perfect)
{
Jukebox.PlayOneShotGame("spaceball/hit");
Holder.transform.DOLocalMove(new Vector3(Random.Range(5, 18), 0, -600), 4f).SetEase(Ease.Linear);
Holder.transform.GetChild(0).gameObject.AddComponent<Rotate>().rotateSpeed = -245;
this.enabled = false;
gameObject.GetComponent<Animator>().enabled = false;
}
else if (e.late || e.early)
{
Holder.transform.GetChild(0).gameObject.AddComponent<Rotate>().rotateSpeed = -55;
this.enabled = false;
gameObject.GetComponent<Animator>().enabled = false;
Rigidbody2D rb = gameObject.AddComponent<Rigidbody2D>();
rb.bodyType = RigidbodyType2D.Dynamic;
rb.AddForce(transform.up * 1100);
rb.AddForce(transform.right * 400);
rb.gravityScale = 9;
Jukebox.PlayOneShot("miss");
}
}
}
public void MakeEligible(bool early, bool perfect, bool late)

View file

@ -58,37 +58,7 @@ namespace RhythmHeavenMania.Games.Spaceball
{
bool canHit = (EligibleHits.Count > 0) && (currentHitInList < EligibleHits.Count);
if (canHit)
{
if (EligibleHits[currentHitInList].perfect)
{
Jukebox.PlayOneShotGame("spaceball/hit");
EligibleHits[currentHitInList].gameObject.GetComponent<SpaceballBall>().Holder.transform.DOLocalMove(new Vector3(Random.Range(5, 18), 0, -600), 4f).SetEase(Ease.Linear);
EligibleHits[currentHitInList].gameObject.GetComponent<SpaceballBall>().Holder.transform.GetChild(0).gameObject.AddComponent<Rotate>().rotateSpeed = -245;
EligibleHits[currentHitInList].gameObject.GetComponent<SpaceballBall>().enabled = false;
EligibleHits[currentHitInList].gameObject.GetComponent<Animator>().enabled = false;
}
else
{
EligibleHits[currentHitInList].gameObject.GetComponent<SpaceballBall>().Holder.transform.GetChild(0).gameObject.AddComponent<Rotate>().rotateSpeed = -55;
EligibleHits[currentHitInList].gameObject.GetComponent<SpaceballBall>().enabled = false;
EligibleHits[currentHitInList].gameObject.GetComponent<Animator>().enabled = false;
Rigidbody2D rb = EligibleHits[currentHitInList].gameObject.AddComponent<Rigidbody2D>();
rb.bodyType = RigidbodyType2D.Dynamic;
rb.AddForce(transform.up * 1100);
rb.AddForce(transform.right * 400);
rb.gravityScale = 9;
Jukebox.PlayOneShot("miss");
}
RemoveBall();
}
else
Jukebox.PlayOneShotGame("spaceball/swing");
Jukebox.PlayOneShotGame("spaceball/swing");
anim.Play("Swing", 0, 0);
}
@ -97,14 +67,5 @@ namespace RhythmHeavenMania.Games.Spaceball
{
PlayerSprite.sprite = PlayerSpriteSheets[costume].sprites[id];
}
private void RemoveBall()
{
if (currentHitInList < EligibleHits.Count)
{
EligibleHits.Remove(EligibleHits[currentHitInList]);
currentHitInList++;
}
}
}
}

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: