mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-27 12:03:00 +00:00
Editor ui improvements
This commit is contained in:
parent
8760412bb2
commit
c5b1e4a4ce
13 changed files with 8258 additions and 3575 deletions
File diff suppressed because one or more lines are too long
2789
Assets/Resources/Fonts/roboto/Roboto-Medium.asset
Normal file
2789
Assets/Resources/Fonts/roboto/Roboto-Medium.asset
Normal file
File diff suppressed because one or more lines are too long
8
Assets/Resources/Fonts/roboto/Roboto-Medium.asset.meta
Normal file
8
Assets/Resources/Fonts/roboto/Roboto-Medium.asset.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 78e7291cdeccdfc4fa61249845605144
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because one or more lines are too long
8
Assets/Resources/Sprites/Editor/ui.meta
Normal file
8
Assets/Resources/Sprites/Editor/ui.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e28be84a3c5574149a94ca08f7de9062
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load diff
|
@ -53,6 +53,23 @@ namespace RhythmHeavenMania.Editor
|
|||
GridGameSelector.GetComponent<GridGameSelector>().SelectGame("Game Manager", 1);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
// This is buggy
|
||||
/*if (Conductor.instance.isPlaying || Conductor.instance.isPaused)
|
||||
{
|
||||
GetComponent<Selections>().enabled = false;
|
||||
GetComponent<Selector>().enabled = false;
|
||||
GetComponent<BoxSelection>().enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
GetComponent<Selections>().enabled = true;
|
||||
GetComponent<Selector>().enabled = true;
|
||||
GetComponent<BoxSelection>().enabled = true;
|
||||
}*/
|
||||
}
|
||||
|
||||
public static Sprite GameIcon(string name)
|
||||
{
|
||||
return Resources.Load<Sprite>($"Sprites/Editor/GameIcons/{name}");
|
||||
|
|
|
@ -4,6 +4,9 @@ using UnityEngine;
|
|||
using UnityEngine.UI;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using TMPro;
|
||||
|
||||
using Starpelly;
|
||||
|
||||
namespace RhythmHeavenMania.Editor
|
||||
{
|
||||
|
@ -13,7 +16,9 @@ namespace RhythmHeavenMania.Editor
|
|||
public static Theme theme;
|
||||
|
||||
[Header("Components")]
|
||||
[SerializeField] private Image[] Layers;
|
||||
[SerializeField] private Image layer;
|
||||
[SerializeField] private Image tempoLayer;
|
||||
[SerializeField] private Image musicLayer;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
@ -22,11 +27,38 @@ namespace RhythmHeavenMania.Editor
|
|||
|
||||
private void Start()
|
||||
{
|
||||
tempoLayer.GetComponent<Image>().color = theme.properties.TempoLayerCol.Hex2RGB();
|
||||
musicLayer.GetComponent<Image>().color = theme.properties.MusicLayerCol.Hex2RGB();
|
||||
|
||||
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);
|
||||
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;
|
||||
}
|
||||
|
||||
layer.GetComponent<Image>().color = c;
|
||||
}
|
||||
Destroy(layer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,9 @@ namespace RhythmHeavenMania.Editor
|
|||
[Serializable]
|
||||
public class Properties
|
||||
{
|
||||
public string TempoLayerCol;
|
||||
public string MusicLayerCol;
|
||||
|
||||
public string Layer1Col;
|
||||
public string Layer2Col;
|
||||
public string Layer3Col;
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace RhythmHeavenMania.Editor
|
|||
private Vector2 lastMousePos;
|
||||
public List<TimelineEventObj> eventObjs = new List<TimelineEventObj>();
|
||||
private bool lastFrameDrag;
|
||||
public int LayerCount = 4;
|
||||
|
||||
[Header("Timeline Components")]
|
||||
[SerializeField] private RectTransform TimelineSlider;
|
||||
|
@ -26,6 +27,7 @@ namespace RhythmHeavenMania.Editor
|
|||
[SerializeField] private RectTransform TimelineContent;
|
||||
[SerializeField] private RectTransform TimelineSongPosLineRef;
|
||||
[SerializeField] private RectTransform TimelineEventObjRef;
|
||||
[SerializeField] private RectTransform LayersRect;
|
||||
private RectTransform TimelineSongPosLine;
|
||||
|
||||
public static Timeline instance { get; private set; }
|
||||
|
@ -41,7 +43,7 @@ namespace RhythmHeavenMania.Editor
|
|||
var entity = GameManager.instance.Beatmap.entities[i];
|
||||
var e = GameManager.instance.Beatmap.entities[i];
|
||||
|
||||
AddEventObject(e.datamodel, false, new Vector3(e.beat, Mathp.Round2Nearest(Random.Range(0, -205.36f), 51.34f)), i);
|
||||
AddEventObject(e.datamodel, false, new Vector3(e.beat, Mathp.Round2Nearest(Random.Range(0, -LayersRect.rect.height), LayerHeight())), i);
|
||||
}
|
||||
|
||||
TimelineSlider.GetChild(0).GetComponent<Image>().color = EditorTheme.theme.properties.BeatMarkerCol.Hex2RGB();
|
||||
|
@ -98,8 +100,8 @@ namespace RhythmHeavenMania.Editor
|
|||
|
||||
if (TimelineSongPosLine != null)
|
||||
{
|
||||
TimelineSongPosLine.transform.localPosition = new Vector3(Conductor.instance.songPositionInBeats, TimelineSlider.transform.localPosition.y);
|
||||
TimelineSongPosLine.transform.localScale = new Vector3(1f / TimelineContent.transform.localScale.x, TimelineSlider.transform.localScale.y, 1);
|
||||
TimelineSongPosLine.transform.localPosition = new Vector3(Conductor.instance.songPositionInBeats, TimelineSongPosLine.transform.localPosition.y);
|
||||
TimelineSongPosLine.transform.localScale = new Vector3(1f / TimelineContent.transform.localScale.x, TimelineSongPosLine.transform.localScale.y, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,7 +186,7 @@ namespace RhythmHeavenMania.Editor
|
|||
{
|
||||
GameObject g = Instantiate(TimelineEventObjRef.gameObject, TimelineEventObjRef.parent);
|
||||
g.transform.localPosition = pos;
|
||||
g.transform.GetChild(1).GetComponent<TMP_Text>().text = eventName.Split('/')[1];
|
||||
g.transform.GetChild(2).GetComponent<TMP_Text>().text = eventName.Split('/')[1];
|
||||
|
||||
TimelineEventObj eventObj = g.GetComponent<TimelineEventObj>();
|
||||
eventObj.Icon.sprite = Editor.GameIcon(eventName.Split(0));
|
||||
|
@ -193,7 +195,7 @@ namespace RhythmHeavenMania.Editor
|
|||
|
||||
if (gameAction != null)
|
||||
{
|
||||
g.GetComponent<RectTransform>().sizeDelta = new Vector2(gameAction.defaultLength, g.GetComponent<RectTransform>().sizeDelta.y);
|
||||
g.GetComponent<RectTransform>().sizeDelta = new Vector2(gameAction.defaultLength, LayerHeight());
|
||||
float length = gameAction.defaultLength;
|
||||
eventObj.length = length;
|
||||
}
|
||||
|
@ -222,7 +224,7 @@ namespace RhythmHeavenMania.Editor
|
|||
var e = GameManager.instance.Beatmap.entities[entityId];
|
||||
|
||||
entity.eventObj = g.GetComponent<TimelineEventObj>();
|
||||
entity.track = (int)(g.transform.localPosition.y / 51.34f * -1);
|
||||
entity.track = (int)(g.transform.localPosition.y / LayerHeight() * -1);
|
||||
}
|
||||
|
||||
Editor.EventObjs.Add(eventObj);
|
||||
|
@ -248,6 +250,17 @@ namespace RhythmHeavenMania.Editor
|
|||
return Timeline.instance.eventObjs.FindAll(c => c.isDragging == true).Count > 0;
|
||||
}
|
||||
|
||||
public float SnapToLayer(float y)
|
||||
{
|
||||
float size = LayerHeight();
|
||||
return Mathf.Clamp(Mathp.Round2Nearest(y, size), -size * 3, 0);
|
||||
}
|
||||
|
||||
public float LayerHeight()
|
||||
{
|
||||
return LayersRect.rect.height / 4;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Commands
|
||||
|
|
|
@ -105,7 +105,7 @@ namespace RhythmHeavenMania.Editor
|
|||
mousePos = Camera.main.ScreenToWorldPoint(mousePos);
|
||||
|
||||
this.transform.position = new Vector3(mousePos.x - startPosX, mousePos.y - startPosY - 0.40f, 0);
|
||||
this.transform.localPosition = new Vector3(Mathf.Clamp(Mathp.Round2Nearest(this.transform.localPosition.x, 0.25f), 0, Mathf.Infinity), Mathf.Clamp(Mathp.Round2Nearest(this.transform.localPosition.y, 51.34f), -51.34f * 3, 0));
|
||||
this.transform.localPosition = new Vector3(Mathf.Clamp(Mathp.Round2Nearest(this.transform.localPosition.x, 0.25f), 0, Mathf.Infinity), Timeline.instance.SnapToLayer(this.transform.localPosition.y));
|
||||
|
||||
if (lastPos != transform.localPosition)
|
||||
OnMove();
|
||||
|
@ -117,7 +117,7 @@ namespace RhythmHeavenMania.Editor
|
|||
|
||||
private void OnMove()
|
||||
{
|
||||
if (GameManager.instance.Beatmap.entities.FindAll(c => c.beat == this.transform.localPosition.x && c.track == (int)(this.transform.localPosition.y / 51.34f * -1)).Count > 0)
|
||||
if (GameManager.instance.Beatmap.entities.FindAll(c => c.beat == this.transform.localPosition.x && c.track == GetTrack()).Count > 0)
|
||||
{
|
||||
eligibleToMove = false;
|
||||
}
|
||||
|
@ -210,12 +210,13 @@ namespace RhythmHeavenMania.Editor
|
|||
break;
|
||||
}
|
||||
|
||||
// c = new Color(c.r, c.g, c.b, 0.85f);
|
||||
transform.GetChild(0).GetComponent<Image>().color = c;
|
||||
}
|
||||
|
||||
public int GetTrack()
|
||||
{
|
||||
return (int)(this.transform.localPosition.y / 51.34f) * -1;
|
||||
return (int)(this.transform.localPosition.y / Timeline.instance.LayerHeight()) * -1;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
// COLORS BASED ON https://coolors.co/ef476f-ffd166-06d6a0-118ab2-073b4c
|
||||
|
||||
{
|
||||
|
||||
"name": "Rhythm Heaven Mania Default Editor Theme",
|
||||
|
||||
"properties": {
|
||||
"Layer1Col": "E1F1DD",
|
||||
"Layer2Col": "CDC7BE",
|
||||
"Layer3Col": "87A7B3",
|
||||
"Layer4Col": "766161",
|
||||
"TempoLayerCol": "f8f7ff",
|
||||
"MusicLayerCol": "a663cc",
|
||||
|
||||
"Layer1Col": "ef476f",
|
||||
"Layer2Col": "ffd166",
|
||||
"Layer3Col": "06d6a0",
|
||||
"Layer4Col": "118ab2",
|
||||
|
||||
"EventSelectedCol": "ffbc36",
|
||||
"EventNormalCol": "FFFFFF",
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue