mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 13:47:38 +02:00
Feature: Textboxes and other text-related features (#90)
* Textboxes: setup prefab * Textboxes: basic functionality finished * Textbox: scaling * Textbox: open captions * Textbox: res edits * Textbox: song artist * Textbox: closed captions * Textbox: fix not being able to use multiple text events * I/O: save / load remixes using UTF-8 encoding * Textboxes: stop editor shortcuts while typing
This commit is contained in:
@ -41,6 +41,9 @@ namespace HeavenStudio
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorA;
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorB;
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorC;
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public string text1;
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public string text2;
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public string text3;
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float swing;
|
||||
public string datamodel;
|
||||
[JsonIgnore] public Editor.Track.TimelineEventObj eventObj;
|
||||
|
36
Assets/Scripts/Common/TextboxObject.cs
Normal file
36
Assets/Scripts/Common/TextboxObject.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
namespace HeavenStudio.TextboxUtilities
|
||||
{
|
||||
public class TextboxObject : MonoBehaviour
|
||||
{
|
||||
[Header("Objects")]
|
||||
public TMP_Text TextboxLabel;
|
||||
public RectTransform TextboxLabelRect;
|
||||
public SpriteRenderer UL;
|
||||
public SpriteRenderer UR;
|
||||
public SpriteRenderer DL;
|
||||
public SpriteRenderer DR;
|
||||
|
||||
static Vector2 textboxSize = new Vector2(3f, 0.75f);
|
||||
|
||||
public void Resize(float scaleX, float scaleY)
|
||||
{
|
||||
Vector2 tScale = Vector2.Scale(textboxSize, new Vector2(scaleX, scaleY));
|
||||
|
||||
UL.size = tScale;
|
||||
UR.size = tScale;
|
||||
DL.size = tScale;
|
||||
DR.size = tScale;
|
||||
TextboxLabelRect.sizeDelta = new Vector2(11.2f * scaleX, 2.2f * scaleY);
|
||||
}
|
||||
|
||||
public void SetText(string text)
|
||||
{
|
||||
TextboxLabel.text = text;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Common/TextboxObject.cs.meta
Normal file
11
Assets/Scripts/Common/TextboxObject.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d78f86ca3e8b90439552de34a61cff3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -81,13 +81,13 @@ namespace HeavenStudio
|
||||
|
||||
// this entire thing is a mess redo it later
|
||||
//pos
|
||||
positionEvents = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "move camera" });
|
||||
positionEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "move camera" });
|
||||
|
||||
//rot
|
||||
rotationEvents = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "rotate camera" });
|
||||
rotationEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "rotate camera" });
|
||||
|
||||
//scale (TODO)
|
||||
// scaleEvents = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "scale camera" });
|
||||
// scaleEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "scale camera" });
|
||||
|
||||
UpdateCameraTranslate();
|
||||
UpdateCameraRotate();
|
||||
|
@ -20,10 +20,11 @@ namespace HeavenStudio
|
||||
|
||||
[Header("Components")]
|
||||
public TextAsset txt;
|
||||
public Camera GameCamera, CursorCam;
|
||||
public Camera GameCamera, CursorCam, OverlayCamera;
|
||||
public CircleCursor CircleCursor;
|
||||
[HideInInspector] public GameObject GamesHolder;
|
||||
public Games.Global.Flash fade;
|
||||
public GameObject textbox;
|
||||
|
||||
[Header("Games")]
|
||||
public string currentGame;
|
||||
@ -88,6 +89,9 @@ namespace HeavenStudio
|
||||
Conductor.instance.SetVolume(Beatmap.musicVolume);
|
||||
Conductor.instance.firstBeatOffset = Beatmap.firstBeatOffset;
|
||||
|
||||
GameObject textbox = Instantiate(Resources.Load<GameObject>("Prefabs/Common/Textbox"));
|
||||
textbox.name = "Textbox";
|
||||
|
||||
if (playOnStart)
|
||||
{
|
||||
Play(startBeat);
|
||||
|
282
Assets/Scripts/Games/Global/Textbox.cs
Normal file
282
Assets/Scripts/Games/Global/Textbox.cs
Normal file
@ -0,0 +1,282 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
using TMPro;
|
||||
using HeavenStudio.TextboxUtilities;
|
||||
|
||||
namespace HeavenStudio.Games.Global
|
||||
{
|
||||
public class Textbox : MonoBehaviour
|
||||
{
|
||||
public enum TextboxAnchor {
|
||||
TopLeft,
|
||||
TopMiddle,
|
||||
TopRight,
|
||||
Left,
|
||||
Middle,
|
||||
Right,
|
||||
BottomLeft,
|
||||
BottomMiddle,
|
||||
BottomRight
|
||||
}
|
||||
|
||||
public enum ClosedCaptionsAnchor {
|
||||
Top,
|
||||
Bottom,
|
||||
}
|
||||
|
||||
private List<Beatmap.Entity> textboxEvents = new List<Beatmap.Entity>();
|
||||
private List<Beatmap.Entity> openCaptionsEvents = new List<Beatmap.Entity>();
|
||||
private List<Beatmap.Entity> idolEvents = new List<Beatmap.Entity>();
|
||||
private List<Beatmap.Entity> closedCaptionsEvents = new List<Beatmap.Entity>();
|
||||
|
||||
Textbox instance;
|
||||
|
||||
[Header("Objects")]
|
||||
public GameObject TextboxEnabler;
|
||||
public TextboxObject TextboxObject;
|
||||
|
||||
public GameObject OpenCaptionsEnabler;
|
||||
public TMP_Text OpenCaptionsLabel;
|
||||
public RectTransform OpenCaptionsLabelRect;
|
||||
|
||||
public GameObject IdolEnabler;
|
||||
public Animator IdolAnimator;
|
||||
public TMP_Text IdolSongLabel;
|
||||
public TMP_Text IdolArtistLabel;
|
||||
|
||||
public GameObject ClosedCaptionsEnabler;
|
||||
public TMP_Text ClosedCaptionsLabel;
|
||||
public RectTransform ClosedCaptionsLabelRect;
|
||||
public RectTransform ClosedCaptionsBgRect;
|
||||
|
||||
float XAnchor = 1.5f;
|
||||
float YAnchor = 1.75f;
|
||||
|
||||
Vector2 textboxSize = new Vector2(3f, 0.75f);
|
||||
|
||||
bool idolShown = false;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
GameManager.instance.onBeatChanged += OnBeatChanged;
|
||||
TextboxEnabler.SetActive(false);
|
||||
OpenCaptionsEnabler.SetActive(false);
|
||||
ClosedCaptionsEnabler.SetActive(false);
|
||||
UpdateTextboxDisplay();
|
||||
UpdateOpenCaptionsDisplay();
|
||||
UpdateClosedCaptionsDisplay();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
UpdateTextboxDisplay();
|
||||
UpdateOpenCaptionsDisplay();
|
||||
UpdateIdolDisplay();
|
||||
UpdateClosedCaptionsDisplay();
|
||||
}
|
||||
|
||||
public void OnBeatChanged(float beat)
|
||||
{
|
||||
TextboxEnabler.SetActive(false);
|
||||
OpenCaptionsEnabler.SetActive(false);
|
||||
ClosedCaptionsEnabler.SetActive(false);
|
||||
|
||||
textboxEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "display textbox" });
|
||||
openCaptionsEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "display open captions" });
|
||||
idolEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "display song artist" });
|
||||
closedCaptionsEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "display closed captions" });
|
||||
|
||||
UpdateTextboxDisplay();
|
||||
UpdateOpenCaptionsDisplay();
|
||||
UpdateClosedCaptionsDisplay();
|
||||
|
||||
UpdateIdolDisplay();
|
||||
if (!idolShown)
|
||||
{
|
||||
IdolAnimator.Play("NoPose", -1, 0);
|
||||
IdolAnimator.speed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateTextboxDisplay()
|
||||
{
|
||||
foreach (var e in textboxEvents)
|
||||
{
|
||||
float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
||||
if (prog >= 0f && prog <= 1f)
|
||||
{
|
||||
TextboxEnabler.SetActive(true);
|
||||
TextboxObject.SetText(e.text1);
|
||||
TextboxObject.Resize(e.valA, e.valB);
|
||||
|
||||
// ouch
|
||||
switch (e.type)
|
||||
{
|
||||
case (int) TextboxAnchor.TopLeft:
|
||||
TextboxEnabler.transform.localPosition = new Vector3(-XAnchor, YAnchor);
|
||||
break;
|
||||
case (int) TextboxAnchor.TopMiddle:
|
||||
TextboxEnabler.transform.localPosition = new Vector3(0, YAnchor);
|
||||
break;
|
||||
case (int) TextboxAnchor.TopRight:
|
||||
TextboxEnabler.transform.localPosition = new Vector3(XAnchor, YAnchor);
|
||||
break;
|
||||
case (int) TextboxAnchor.Left:
|
||||
TextboxEnabler.transform.localPosition = new Vector3(-XAnchor, 0);
|
||||
break;
|
||||
case (int) TextboxAnchor.Middle:
|
||||
TextboxEnabler.transform.localPosition = new Vector3(0, 0);
|
||||
break;
|
||||
case (int) TextboxAnchor.Right:
|
||||
TextboxEnabler.transform.localPosition = new Vector3(XAnchor, 0);
|
||||
break;
|
||||
case (int) TextboxAnchor.BottomLeft:
|
||||
TextboxEnabler.transform.localPosition = new Vector3(-XAnchor, -YAnchor);
|
||||
break;
|
||||
case (int) TextboxAnchor.BottomMiddle:
|
||||
TextboxEnabler.transform.localPosition = new Vector3(0, -YAnchor);
|
||||
break;
|
||||
case (int) TextboxAnchor.BottomRight:
|
||||
TextboxEnabler.transform.localPosition = new Vector3(XAnchor, -YAnchor);
|
||||
break;
|
||||
default:
|
||||
TextboxEnabler.transform.localPosition = new Vector3(0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (prog > 1f || prog < 0f)
|
||||
{
|
||||
TextboxEnabler.transform.localPosition = new Vector3(0, 0);
|
||||
TextboxEnabler.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateOpenCaptionsDisplay()
|
||||
{
|
||||
foreach (var e in openCaptionsEvents)
|
||||
{
|
||||
float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
||||
if (prog >= 0f && prog <= 1f)
|
||||
{
|
||||
OpenCaptionsEnabler.SetActive(true);
|
||||
OpenCaptionsLabel.text = e.text1;
|
||||
|
||||
OpenCaptionsLabelRect.sizeDelta = new Vector2(18f * e.valA, 2.5f * e.valB);
|
||||
|
||||
// ouch
|
||||
switch (e.type)
|
||||
{
|
||||
case (int) TextboxAnchor.TopLeft:
|
||||
OpenCaptionsEnabler.transform.localPosition = new Vector3(-XAnchor, YAnchor);
|
||||
break;
|
||||
case (int) TextboxAnchor.TopMiddle:
|
||||
OpenCaptionsEnabler.transform.localPosition = new Vector3(0, YAnchor);
|
||||
break;
|
||||
case (int) TextboxAnchor.TopRight:
|
||||
OpenCaptionsEnabler.transform.localPosition = new Vector3(XAnchor, YAnchor);
|
||||
break;
|
||||
case (int) TextboxAnchor.Left:
|
||||
OpenCaptionsEnabler.transform.localPosition = new Vector3(-XAnchor, 0);
|
||||
break;
|
||||
case (int) TextboxAnchor.Middle:
|
||||
OpenCaptionsEnabler.transform.localPosition = new Vector3(0, 0);
|
||||
break;
|
||||
case (int) TextboxAnchor.Right:
|
||||
OpenCaptionsEnabler.transform.localPosition = new Vector3(XAnchor, 0);
|
||||
break;
|
||||
case (int) TextboxAnchor.BottomLeft:
|
||||
OpenCaptionsEnabler.transform.localPosition = new Vector3(-XAnchor, -YAnchor);
|
||||
break;
|
||||
case (int) TextboxAnchor.BottomMiddle:
|
||||
OpenCaptionsEnabler.transform.localPosition = new Vector3(0, -YAnchor);
|
||||
break;
|
||||
case (int) TextboxAnchor.BottomRight:
|
||||
OpenCaptionsEnabler.transform.localPosition = new Vector3(XAnchor, -YAnchor);
|
||||
break;
|
||||
default:
|
||||
OpenCaptionsEnabler.transform.localPosition = new Vector3(0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (prog > 1f || prog < 0f)
|
||||
{
|
||||
OpenCaptionsEnabler.transform.localPosition = new Vector3(0, 0);
|
||||
OpenCaptionsEnabler.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateIdolDisplay()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
foreach (var e in idolEvents)
|
||||
{
|
||||
float prog = cond.GetPositionFromBeat(e.beat, e.length);
|
||||
if (prog >= 0f && prog <= 1f)
|
||||
{
|
||||
float inp = cond.GetPositionFromBeat(e.beat, 1);
|
||||
IdolSongLabel.text = e.text1;
|
||||
IdolArtistLabel.text = e.text2;
|
||||
|
||||
IdolAnimator.Play("IdolShow", -1, Mathf.Min(inp, 1));
|
||||
IdolAnimator.speed = 0;
|
||||
|
||||
idolShown = true;
|
||||
|
||||
return;
|
||||
}
|
||||
else if (idolShown)
|
||||
{
|
||||
IdolAnimator.Play("IdolHide", -1, 0);
|
||||
IdolAnimator.speed = (1f / cond.pitchedSecPerBeat) * 0.5f;
|
||||
idolShown = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateClosedCaptionsDisplay()
|
||||
{
|
||||
foreach (var e in closedCaptionsEvents)
|
||||
{
|
||||
float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
||||
if (prog >= 0f && prog <= 1f)
|
||||
{
|
||||
ClosedCaptionsEnabler.SetActive(true);
|
||||
ClosedCaptionsLabel.text = e.text1;
|
||||
|
||||
ClosedCaptionsLabelRect.sizeDelta = new Vector2(9f, e.valA);
|
||||
ClosedCaptionsBgRect.sizeDelta = new Vector2(9f, e.valA);
|
||||
|
||||
switch (e.type)
|
||||
{
|
||||
case (int) ClosedCaptionsAnchor.Bottom:
|
||||
ClosedCaptionsEnabler.transform.localPosition = new Vector3(0, -2.5f + e.valA/2);
|
||||
break;
|
||||
default:
|
||||
ClosedCaptionsEnabler.transform.localPosition = new Vector3(0, 2.5f - e.valA/2);
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (prog > 1f || prog < 0f)
|
||||
{
|
||||
ClosedCaptionsEnabler.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Games/Global/Textbox.cs.meta
Normal file
11
Assets/Scripts/Games/Global/Textbox.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 767b7295952f4a74d80b75c992061560
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -19,6 +19,7 @@ namespace HeavenStudio
|
||||
GameObject Cameras = Instantiate(Resources.Load<GameObject>("Prefabs/Cameras")); Cameras.name = "Cameras";
|
||||
GameObject MainCamera = Cameras.transform.GetChild(0).gameObject;
|
||||
GameObject CursorCamera = Cameras.transform.GetChild(1).gameObject;
|
||||
GameObject OverlayCamera = Cameras.transform.GetChild(2).gameObject;
|
||||
|
||||
GameObject Cursor = Instantiate(Resources.Load<GameObject>("Prefabs/Cursor"));
|
||||
Cursor.name = "Cursor";
|
||||
@ -36,6 +37,7 @@ namespace HeavenStudio
|
||||
gameManager.CircleCursor = Cursor.transform.GetChild(0).GetComponent<CircleCursor>();
|
||||
gameManager.GameCamera = MainCamera.GetComponent<Camera>();
|
||||
gameManager.CursorCam = CursorCamera.GetComponent<Camera>();
|
||||
gameManager.OverlayCamera = OverlayCamera.GetComponent<Camera>();
|
||||
|
||||
GameObject Profiler = Instantiate(Resources.Load<GameObject>("Prefabs/GameProfiler"));
|
||||
Profiler.name = "GameProfiler";
|
||||
|
@ -61,6 +61,7 @@ namespace HeavenStudio.Editor
|
||||
private bool fullscreen;
|
||||
public bool discordDuringTesting = false;
|
||||
public bool canSelect = true;
|
||||
public bool editingInputField = false;
|
||||
|
||||
public static Editor instance { get; private set; }
|
||||
|
||||
@ -75,6 +76,7 @@ namespace HeavenStudio.Editor
|
||||
{
|
||||
GameCamera.instance.camera.targetTexture = ScreenRenderTexture;
|
||||
GameManager.instance.CursorCam.targetTexture = ScreenRenderTexture;
|
||||
GameManager.instance.OverlayCamera.targetTexture = ScreenRenderTexture;
|
||||
Screen.texture = ScreenRenderTexture;
|
||||
|
||||
GameManager.instance.Init();
|
||||
@ -106,14 +108,18 @@ namespace HeavenStudio.Editor
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Tab))
|
||||
{
|
||||
Fullscreen();
|
||||
if (!Editor.instance.editingInputField)
|
||||
Fullscreen();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Delete))
|
||||
{
|
||||
List<TimelineEventObj> ev = new List<TimelineEventObj>();
|
||||
for (int i = 0; i < Selections.instance.eventsSelected.Count; i++) ev.Add(Selections.instance.eventsSelected[i]);
|
||||
CommandManager.instance.Execute(new Commands.Deletion(ev));
|
||||
if (!Editor.instance.editingInputField)
|
||||
{
|
||||
List<TimelineEventObj> ev = new List<TimelineEventObj>();
|
||||
for (int i = 0; i < Selections.instance.eventsSelected.Count; i++) ev.Add(Selections.instance.eventsSelected[i]);
|
||||
CommandManager.instance.Execute(new Commands.Deletion(ev));
|
||||
}
|
||||
}
|
||||
|
||||
if (CommandManager.instance.canUndo())
|
||||
@ -312,7 +318,7 @@ namespace HeavenStudio.Editor
|
||||
{
|
||||
var levelFile = archive.CreateEntry("remix.json", System.IO.Compression.CompressionLevel.NoCompression);
|
||||
using (var zipStream = levelFile.Open())
|
||||
zipStream.Write(Encoding.ASCII.GetBytes(GetJson()), 0, Encoding.ASCII.GetBytes(GetJson()).Length);
|
||||
zipStream.Write(Encoding.UTF8.GetBytes(GetJson()), 0, Encoding.UTF8.GetBytes(GetJson()).Length);
|
||||
|
||||
if (changedMusic || currentRemixPath != path)
|
||||
{
|
||||
@ -369,7 +375,7 @@ namespace HeavenStudio.Editor
|
||||
{
|
||||
stream.CopyTo(ms);
|
||||
bytes = ms.ToArray();
|
||||
string json = Encoding.Default.GetString(bytes);
|
||||
string json = Encoding.UTF8.GetString(bytes);
|
||||
LoadRemix(json);
|
||||
}
|
||||
}
|
||||
@ -413,7 +419,8 @@ namespace HeavenStudio.Editor
|
||||
MainCanvas.enabled = false;
|
||||
EditorCamera.enabled = false;
|
||||
GameCamera.instance.camera.targetTexture = null;
|
||||
GameCamera.instance.camera.transform.parent.GetChild(1).GetComponent<Camera>().enabled = false;
|
||||
GameManager.instance.CursorCam.enabled = false;
|
||||
GameManager.instance.OverlayCamera.targetTexture = null;
|
||||
fullscreen = true;
|
||||
}
|
||||
else
|
||||
@ -421,7 +428,8 @@ namespace HeavenStudio.Editor
|
||||
MainCanvas.enabled = true;
|
||||
EditorCamera.enabled = true;
|
||||
GameCamera.instance.camera.targetTexture = ScreenRenderTexture;
|
||||
GameCamera.instance.camera.transform.parent.GetChild(1).GetComponent<Camera>().enabled = true;
|
||||
GameManager.instance.CursorCam.enabled = true;
|
||||
GameManager.instance.OverlayCamera.targetTexture = ScreenRenderTexture;
|
||||
fullscreen = false;
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ namespace HeavenStudio.Editor
|
||||
[SerializeField] private GameObject BooleanP;
|
||||
[SerializeField] private GameObject DropdownP;
|
||||
[SerializeField] private GameObject ColorP;
|
||||
[SerializeField] private GameObject StringP;
|
||||
|
||||
public Beatmap.Entity entity;
|
||||
|
||||
@ -120,6 +121,10 @@ namespace HeavenStudio.Editor
|
||||
{
|
||||
prefab = ColorP;
|
||||
}
|
||||
else if(objType == typeof(string))
|
||||
{
|
||||
prefab = StringP;
|
||||
}
|
||||
|
||||
GameObject input = Instantiate(prefab);
|
||||
input.transform.SetParent(this.gameObject.transform);
|
||||
@ -137,6 +142,7 @@ namespace HeavenStudio.Editor
|
||||
|
||||
private void DestroyParams()
|
||||
{
|
||||
Editor.instance.editingInputField = false;
|
||||
active = false;
|
||||
for (int i = childCountAtStart; i < transform.childCount; i++)
|
||||
{
|
||||
|
@ -36,6 +36,10 @@ namespace HeavenStudio.Editor
|
||||
public bool colorTableActive;
|
||||
public ColorPreview colorPreview;
|
||||
|
||||
[Header("String")] //why wasn't this a thing before
|
||||
[Space(10)]
|
||||
public TMP_InputField inputFieldString;
|
||||
|
||||
private string propertyName;
|
||||
|
||||
public void SetProperties(string propertyName, object type, string caption)
|
||||
@ -61,10 +65,16 @@ namespace HeavenStudio.Editor
|
||||
parameterManager.entity[propertyName] = (int)slider.value;
|
||||
});
|
||||
|
||||
inputField.onSelect.AddListener(delegate
|
||||
{
|
||||
Editor.instance.editingInputField = true;
|
||||
});
|
||||
|
||||
inputField.onEndEdit.AddListener(delegate
|
||||
{
|
||||
slider.value = Mathf.RoundToInt(System.Convert.ToSingle(System.Convert.ToSingle(inputField.text)));
|
||||
parameterManager.entity[propertyName] = (int)slider.value;
|
||||
Editor.instance.editingInputField = false;
|
||||
});
|
||||
}
|
||||
else if (objType == typeof(EntityTypes.Float))
|
||||
@ -84,10 +94,16 @@ namespace HeavenStudio.Editor
|
||||
parameterManager.entity[propertyName] = newValue;
|
||||
});
|
||||
|
||||
inputField.onSelect.AddListener(delegate
|
||||
{
|
||||
Editor.instance.editingInputField = true;
|
||||
});
|
||||
|
||||
inputField.onEndEdit.AddListener(delegate
|
||||
{
|
||||
slider.value = (float)System.Math.Round(System.Convert.ToSingle(inputField.text), 4);
|
||||
parameterManager.entity[propertyName] = slider.value;
|
||||
Editor.instance.editingInputField = false;
|
||||
});
|
||||
}
|
||||
else if(type is bool)
|
||||
@ -143,6 +159,24 @@ namespace HeavenStudio.Editor
|
||||
colorPreview.ChangeColor(paramCol);
|
||||
ColorTable.gameObject.SetActive(false);
|
||||
}
|
||||
//why the FUCK wasn't this a thing before lmao
|
||||
else if(objType == typeof(string))
|
||||
{
|
||||
// Debug.Log("entity " + propertyName + " is: " + (string)(parameterManager.entity[propertyName]));
|
||||
inputFieldString.text = (string)(parameterManager.entity[propertyName]);
|
||||
|
||||
inputFieldString.onSelect.AddListener(delegate
|
||||
{
|
||||
Editor.instance.editingInputField = true;
|
||||
});
|
||||
|
||||
inputFieldString.onEndEdit.AddListener(delegate
|
||||
{
|
||||
// Debug.Log("setting " + propertyName + " to: " + inputFieldString.text);
|
||||
parameterManager.entity[propertyName] = inputFieldString.text;
|
||||
Editor.instance.editingInputField = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
@ -258,24 +258,29 @@ namespace HeavenStudio.Editor.Track
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
if (Input.GetKey(KeyCode.LeftShift))
|
||||
if (!Editor.instance.editingInputField)
|
||||
{
|
||||
PlayCheck(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayCheck(true);
|
||||
if (Input.GetKey(KeyCode.LeftShift))
|
||||
{
|
||||
PlayCheck(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayCheck(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.P))
|
||||
{
|
||||
AutoPlayToggle();
|
||||
if (!Editor.instance.editingInputField)
|
||||
AutoPlayToggle();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.M))
|
||||
{
|
||||
MetronomeToggle();
|
||||
if (!Editor.instance.editingInputField)
|
||||
MetronomeToggle();
|
||||
}
|
||||
|
||||
|
||||
@ -302,13 +307,16 @@ namespace HeavenStudio.Editor.Track
|
||||
float moveSpeed = 750;
|
||||
if (Input.GetKey(KeyCode.LeftShift)) moveSpeed *= 2;
|
||||
|
||||
if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A))
|
||||
if (!Editor.instance.editingInputField)
|
||||
{
|
||||
TimelineContent.transform.localPosition += new Vector3(moveSpeed * Time.deltaTime, 0);
|
||||
}
|
||||
else if (Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D))
|
||||
{
|
||||
TimelineContent.transform.localPosition += new Vector3(-moveSpeed * Time.deltaTime, 0);
|
||||
if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A))
|
||||
{
|
||||
TimelineContent.transform.localPosition += new Vector3(moveSpeed * Time.deltaTime, 0);
|
||||
}
|
||||
else if (Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D))
|
||||
{
|
||||
TimelineContent.transform.localPosition += new Vector3(-moveSpeed * Time.deltaTime, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (Conductor.instance.isPlaying)
|
||||
|
@ -150,27 +150,28 @@ namespace HeavenStudio
|
||||
new Param("toggle", true, "Enable Inputs")
|
||||
}),
|
||||
|
||||
// DEPRECATED! Now in VFX
|
||||
new GameAction("move camera", delegate
|
||||
{
|
||||
//TODO: move cam
|
||||
}, 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("valA", new EntityTypes.Float(-50, 50, 0), "Right / Left"),
|
||||
new Param("valB", new EntityTypes.Float(-50, 50, 0), "Up / Down"),
|
||||
new Param("valC", new EntityTypes.Float(-0, 250, 10), "In / Out"),
|
||||
new Param("ease", EasingFunction.Ease.Linear, "Ease Type")
|
||||
} ),
|
||||
},
|
||||
hidden: true ),
|
||||
|
||||
new GameAction("rotate camera", delegate
|
||||
{
|
||||
//TODO: rot cam
|
||||
}, 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("valA", new EntityTypes.Integer(-360, 360, 0), "Pitch"),
|
||||
new Param("valB", new EntityTypes.Integer(-360, 360, 0), "Yaw"),
|
||||
new Param("valC", new EntityTypes.Integer(-360, 360, 0), "Roll"),
|
||||
new Param("ease", EasingFunction.Ease.Linear, "Ease Type")
|
||||
} ),
|
||||
},
|
||||
hidden: true ),
|
||||
}),
|
||||
new Minigame("countIn", "Count-Ins", "", false, true, new List<GameAction>()
|
||||
{
|
||||
@ -209,8 +210,66 @@ namespace HeavenStudio
|
||||
new GameAction("four (alt)", delegate { SoundEffects.Count(3, true); }, 1f, hidden: true),
|
||||
new GameAction("go! (alt)", delegate { SoundEffects.Go(true); }, 1f, hidden: true),
|
||||
}),
|
||||
new Minigame("vfx", "Visual Effects", "", false, true, new List<GameAction>()
|
||||
{
|
||||
new GameAction("move camera", delegate
|
||||
{
|
||||
//TODO: move cam
|
||||
}, 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("valA", new EntityTypes.Float(-50, 50, 0), "Right / Left"),
|
||||
new Param("valB", new EntityTypes.Float(-50, 50, 0), "Up / Down"),
|
||||
new Param("valC", new EntityTypes.Float(-0, 250, 10), "In / Out"),
|
||||
new Param("ease", EasingFunction.Ease.Linear, "Ease Type")
|
||||
} ),
|
||||
|
||||
new GameAction("rotate camera", delegate
|
||||
{
|
||||
//TODO: rot cam
|
||||
}, 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("valA", new EntityTypes.Integer(-360, 360, 0), "Pitch"),
|
||||
new Param("valB", new EntityTypes.Integer(-360, 360, 0), "Yaw"),
|
||||
new Param("valC", new EntityTypes.Integer(-360, 360, 0), "Roll"),
|
||||
new Param("ease", EasingFunction.Ease.Linear, "Ease Type")
|
||||
} ),
|
||||
|
||||
new GameAction("display textbox", delegate
|
||||
{
|
||||
}, 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("text1", "", "Text", "The text to display in the textbox (Rich Text is supported!)"),
|
||||
new Param("type", Games.Global.Textbox.TextboxAnchor.TopMiddle, "Anchor", "Where to anchor the textbox"),
|
||||
new Param("valA", new EntityTypes.Float(0.25f, 4, 1), "Textbox Width", "Textbox width multiplier"),
|
||||
new Param("valB", new EntityTypes.Float(0.5f, 8, 1), "Textbox Height", "Textbox height multiplier")
|
||||
} ),
|
||||
new GameAction("display open captions", delegate
|
||||
{
|
||||
}, 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("text1", "", "Text", "The text to display in the captions (Rich Text is supported!)"),
|
||||
new Param("type", Games.Global.Textbox.TextboxAnchor.BottomMiddle, "Anchor", "Where to anchor the captions"),
|
||||
new Param("valA", new EntityTypes.Float(0.25f, 4, 1), "Captions Width", "Captions width multiplier"),
|
||||
new Param("valB", new EntityTypes.Float(0.5f, 8, 1), "Captions Height", "Captions height multiplier")
|
||||
} ),
|
||||
new GameAction("display closed captions", delegate
|
||||
{
|
||||
}, 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("text1", "", "Text", "The text to display in the captions (Rich Text is supported!)"),
|
||||
new Param("type", Games.Global.Textbox.ClosedCaptionsAnchor.Top, "Anchor", "Where to anchor the captions"),
|
||||
new Param("valA", new EntityTypes.Float(0.5f, 4, 1), "Captions Height", "Captions height multiplier")
|
||||
} ),
|
||||
new GameAction("display song artist", delegate
|
||||
{
|
||||
}, 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("text1", "", "Title", "Text to display in the upper label (Rich Text is supported!)"),
|
||||
new Param("text2", "", "Artist", "Text to display in the lower label (Rich Text is supported!)"),
|
||||
} ),
|
||||
}),
|
||||
};
|
||||
|
||||
|
||||
BuildLoadRunnerList();
|
||||
foreach(var load in loadRunners)
|
||||
{
|
||||
|
Reference in New Issue
Block a user