Spaceball camera and more entity parameters. (ugly UI)

This commit is contained in:
Braedon
2022-02-03 22:25:18 -05:00
parent e0db2a446e
commit 9722ce7122
9 changed files with 97 additions and 46 deletions

View File

@ -2,18 +2,23 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using RhythmHeavenMania.Editor.Track;
namespace RhythmHeavenMania.Editor
{
public class EventParameterManager : MonoBehaviour
{
[Header("General References")]
[SerializeField] private GameObject eventSelector;
[SerializeField] private GridGameSelector gridGameSelector;
[Header("Property Prefabs")]
[SerializeField] private GameObject IntegerP;
public Beatmap.Entity entity;
private bool active;
public static EventParameterManager instance { get; set; }
private void Awake()
@ -21,8 +26,29 @@ namespace RhythmHeavenMania.Editor
instance = this;
}
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
if (!Timeline.instance.MouseInRectTransform(Editor.instance.eventSelectorBG) && active)
{
Disable();
}
}
}
public void Disable()
{
active = false;
eventSelector.SetActive(true);
DestroyParams();
Editor.instance.SetGameEventTitle($"Select game event for {gridGameSelector.SelectedMinigame}");
}
public void StartParams(Beatmap.Entity entity)
{
active = true;
AddParams(entity);
}
@ -39,10 +65,7 @@ namespace RhythmHeavenMania.Editor
Editor.instance.SetGameEventTitle($"Properties for {entity.datamodel}");
for (int i = 1; i < transform.childCount; i++)
{
Destroy(transform.GetChild(i).gameObject);
}
DestroyParams();
for (int i = 0; i < action.parameters.Count; i++)
{
@ -52,6 +75,8 @@ namespace RhythmHeavenMania.Editor
AddParam(propertyName, param, caption);
}
active = true;
}
}
@ -72,5 +97,14 @@ namespace RhythmHeavenMania.Editor
var property = input.GetComponent<EventPropertyPrefab>();
property.SetProperties(propertyName, type, caption);
}
private void DestroyParams()
{
active = false;
for (int i = 1; i < transform.childCount; i++)
{
Destroy(transform.GetChild(i).gameObject);
}
}
}
}