dedicated tempo / volume marker dialogs
This commit is contained in:
parent
0e7917e799
commit
fc3c9f82eb
|
|
@ -9,7 +9,6 @@
|
||||||
-<indent=5%>saladplainzone</indent>
|
-<indent=5%>saladplainzone</indent>
|
||||||
-<indent=5%>Pengu123</indent>
|
-<indent=5%>Pengu123</indent>
|
||||||
-<indent=5%>Krıspy Kreme</indent>
|
-<indent=5%>Krıspy Kreme</indent>
|
||||||
-<indent=5%>Demon Jake</indent>
|
|
||||||
-<indent=5%>DPS2004</indent>
|
-<indent=5%>DPS2004</indent>
|
||||||
-<indent=5%>Jellirby</indent>
|
-<indent=5%>Jellirby</indent>
|
||||||
-<indent=5%>BookwormKevin</indent>
|
-<indent=5%>BookwormKevin</indent>
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -21,7 +21,7 @@ namespace HeavenStudio.Editor
|
||||||
|
|
||||||
public static void ResetAllDialogs()
|
public static void ResetAllDialogs()
|
||||||
{
|
{
|
||||||
foreach(var dialog in FindObjectsOfType<Dialog>())
|
foreach (var dialog in FindObjectsOfType<Dialog>())
|
||||||
{
|
{
|
||||||
dialog.ForceState(false);
|
dialog.ForceState(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
using HeavenStudio;
|
||||||
|
using HeavenStudio.Editor;
|
||||||
|
using HeavenStudio.Editor.Track;
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
|
public class TempoDialog : Dialog
|
||||||
|
{
|
||||||
|
TempoTimelineObj tempoObj;
|
||||||
|
|
||||||
|
[SerializeField] Button deleteButton;
|
||||||
|
[SerializeField] TMP_InputField tempoInput;
|
||||||
|
|
||||||
|
public void SwitchTempoDialog()
|
||||||
|
{
|
||||||
|
if (dialog.activeSelf)
|
||||||
|
{
|
||||||
|
tempoObj = null;
|
||||||
|
dialog.SetActive(false);
|
||||||
|
Editor.instance.inAuthorativeMenu = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Editor.instance.inAuthorativeMenu = true;
|
||||||
|
ResetAllDialogs();
|
||||||
|
dialog.SetActive(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTempoObj(TempoTimelineObj tempoObj)
|
||||||
|
{
|
||||||
|
this.tempoObj = tempoObj;
|
||||||
|
deleteButton.interactable = !tempoObj.first;
|
||||||
|
|
||||||
|
tempoInput.text = tempoObj.chartEntity["tempo"].ToString("F");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteTempo()
|
||||||
|
{
|
||||||
|
if (tempoObj != null)
|
||||||
|
{
|
||||||
|
tempoObj.Remove();
|
||||||
|
}
|
||||||
|
if (dialog.activeSelf)
|
||||||
|
{
|
||||||
|
SwitchTempoDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTempo()
|
||||||
|
{
|
||||||
|
if (tempoObj != null)
|
||||||
|
{
|
||||||
|
float tempo = float.Parse(tempoInput.text);
|
||||||
|
tempoObj.SetTempo(tempo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DoubleTempo()
|
||||||
|
{
|
||||||
|
if (tempoObj != null)
|
||||||
|
{
|
||||||
|
tempoObj.SetTempo(tempoObj.chartEntity["tempo"] * 2);
|
||||||
|
tempoInput.text = tempoObj.chartEntity["tempo"].ToString("F");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HalveTempo()
|
||||||
|
{
|
||||||
|
if (tempoObj != null)
|
||||||
|
{
|
||||||
|
tempoObj.SetTempo(tempoObj.chartEntity["tempo"] * 0.5f);
|
||||||
|
tempoInput.text = tempoObj.chartEntity["tempo"].ToString("F");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 52f9e265c99322341afb394674cc6233
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -15,6 +15,7 @@ namespace HeavenStudio.Editor.Track
|
||||||
[Header("Components")]
|
[Header("Components")]
|
||||||
[SerializeField] private TMP_Text tempoTXT;
|
[SerializeField] private TMP_Text tempoTXT;
|
||||||
[SerializeField] private GameObject tempoLine;
|
[SerializeField] private GameObject tempoLine;
|
||||||
|
[SerializeField] private TempoDialog tempoDialog;
|
||||||
|
|
||||||
new private void Update()
|
new private void Update()
|
||||||
{
|
{
|
||||||
|
|
@ -22,28 +23,17 @@ namespace HeavenStudio.Editor.Track
|
||||||
if (hovering)
|
if (hovering)
|
||||||
{
|
{
|
||||||
SpecialTimeline.hoveringTypes |= SpecialTimeline.HoveringTypes.TempoChange;
|
SpecialTimeline.hoveringTypes |= SpecialTimeline.HoveringTypes.TempoChange;
|
||||||
if (Timeline.instance.timelineState.currentState == Timeline.CurrentTimelineState.State.TempoChange)
|
}
|
||||||
|
UpdateTempo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTempo(float tempo)
|
||||||
|
{
|
||||||
|
chartEntity["tempo"] = Mathf.Clamp(tempo, 1, 10000);
|
||||||
|
if (first)
|
||||||
{
|
{
|
||||||
float newTempo = Input.mouseScrollDelta.y;
|
|
||||||
|
|
||||||
if (Input.GetKey(KeyCode.LeftShift))
|
|
||||||
newTempo *= 5f;
|
|
||||||
if (Input.GetKey(KeyCode.LeftControl))
|
|
||||||
newTempo *= 0.01f;
|
|
||||||
|
|
||||||
chartEntity["tempo"] += newTempo;
|
|
||||||
|
|
||||||
//make sure tempo is positive
|
|
||||||
if (chartEntity["tempo"] < 1)
|
|
||||||
chartEntity["tempo"] = 1;
|
|
||||||
|
|
||||||
if (first && newTempo != 0)
|
|
||||||
Timeline.instance.UpdateStartingBPMText();
|
Timeline.instance.UpdateStartingBPMText();
|
||||||
|
|
||||||
Timeline.instance.FitToSong();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
UpdateTempo();
|
UpdateTempo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,10 +57,10 @@ namespace HeavenStudio.Editor.Track
|
||||||
|
|
||||||
public override void OnRightClick()
|
public override void OnRightClick()
|
||||||
{
|
{
|
||||||
if (first) return;
|
|
||||||
if (Timeline.instance.timelineState.currentState == Timeline.CurrentTimelineState.State.TempoChange)
|
if (Timeline.instance.timelineState.currentState == Timeline.CurrentTimelineState.State.TempoChange)
|
||||||
{
|
{
|
||||||
DeleteObj();
|
tempoDialog.SetTempoObj(this);
|
||||||
|
tempoDialog.SwitchTempoDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,5 +93,14 @@ namespace HeavenStudio.Editor.Track
|
||||||
else
|
else
|
||||||
gameObject.SetActive(false);
|
gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Remove()
|
||||||
|
{
|
||||||
|
if (first) return;
|
||||||
|
if (Timeline.instance.timelineState.currentState == Timeline.CurrentTimelineState.State.TempoChange)
|
||||||
|
{
|
||||||
|
DeleteObj();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -15,6 +15,7 @@ namespace HeavenStudio.Editor.Track
|
||||||
[Header("Components")]
|
[Header("Components")]
|
||||||
[SerializeField] private TMP_Text volumeTXT;
|
[SerializeField] private TMP_Text volumeTXT;
|
||||||
[SerializeField] private GameObject volumeLine;
|
[SerializeField] private GameObject volumeLine;
|
||||||
|
[SerializeField] private VolumeDialog volumeDialog;
|
||||||
|
|
||||||
new private void Update()
|
new private void Update()
|
||||||
{
|
{
|
||||||
|
|
@ -22,23 +23,16 @@ namespace HeavenStudio.Editor.Track
|
||||||
if (hovering)
|
if (hovering)
|
||||||
{
|
{
|
||||||
SpecialTimeline.hoveringTypes |= SpecialTimeline.HoveringTypes.VolumeChange;
|
SpecialTimeline.hoveringTypes |= SpecialTimeline.HoveringTypes.VolumeChange;
|
||||||
if (Timeline.instance.timelineState.currentState == Timeline.CurrentTimelineState.State.MusicVolume)
|
|
||||||
{
|
|
||||||
float newVolume = Input.mouseScrollDelta.y;
|
|
||||||
|
|
||||||
if (Input.GetKey(KeyCode.LeftShift))
|
|
||||||
newVolume *= 5f;
|
|
||||||
if (Input.GetKey(KeyCode.LeftControl))
|
|
||||||
newVolume *= 0.01f;
|
|
||||||
|
|
||||||
chartEntity["volume"] += newVolume;
|
|
||||||
|
|
||||||
//make sure volume is positive
|
|
||||||
chartEntity["volume"] = Mathf.Clamp(chartEntity["volume"], 0, 100);
|
|
||||||
|
|
||||||
if (first && newVolume != 0)
|
|
||||||
Timeline.instance.UpdateStartingVolText();
|
|
||||||
}
|
}
|
||||||
|
UpdateVolume();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetVolume(float volume)
|
||||||
|
{
|
||||||
|
chartEntity["volume"] = Mathf.Clamp(volume, 0, 100);
|
||||||
|
if (first)
|
||||||
|
{
|
||||||
|
Timeline.instance.UpdateStartingVolText();
|
||||||
}
|
}
|
||||||
UpdateVolume();
|
UpdateVolume();
|
||||||
}
|
}
|
||||||
|
|
@ -63,10 +57,10 @@ namespace HeavenStudio.Editor.Track
|
||||||
|
|
||||||
public override void OnRightClick()
|
public override void OnRightClick()
|
||||||
{
|
{
|
||||||
if (first) return;
|
|
||||||
if (Timeline.instance.timelineState.currentState == Timeline.CurrentTimelineState.State.MusicVolume)
|
if (Timeline.instance.timelineState.currentState == Timeline.CurrentTimelineState.State.MusicVolume)
|
||||||
{
|
{
|
||||||
DeleteObj();
|
volumeDialog.SetVolumeObj(this);
|
||||||
|
volumeDialog.SwitchVolumeDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -99,5 +93,14 @@ namespace HeavenStudio.Editor.Track
|
||||||
else
|
else
|
||||||
gameObject.SetActive(false);
|
gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Remove()
|
||||||
|
{
|
||||||
|
if (first) return;
|
||||||
|
if (Timeline.instance.timelineState.currentState == Timeline.CurrentTimelineState.State.MusicVolume)
|
||||||
|
{
|
||||||
|
DeleteObj();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
using HeavenStudio;
|
||||||
|
using HeavenStudio.Editor;
|
||||||
|
using HeavenStudio.Editor.Track;
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
|
public class VolumeDialog : Dialog
|
||||||
|
{
|
||||||
|
VolumeTimelineObj volumeObj;
|
||||||
|
|
||||||
|
[SerializeField] Button deleteButton;
|
||||||
|
[SerializeField] Slider volumeSlider;
|
||||||
|
[SerializeField] TMP_InputField volumeInput;
|
||||||
|
|
||||||
|
public void SwitchVolumeDialog()
|
||||||
|
{
|
||||||
|
if (dialog.activeSelf)
|
||||||
|
{
|
||||||
|
volumeObj = null;
|
||||||
|
dialog.SetActive(false);
|
||||||
|
Editor.instance.inAuthorativeMenu = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Editor.instance.inAuthorativeMenu = true;
|
||||||
|
ResetAllDialogs();
|
||||||
|
dialog.SetActive(true);
|
||||||
|
|
||||||
|
volumeSlider.maxValue = 100;
|
||||||
|
volumeSlider.minValue = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetVolumeObj(VolumeTimelineObj volumeObj)
|
||||||
|
{
|
||||||
|
this.volumeObj = volumeObj;
|
||||||
|
deleteButton.interactable = !volumeObj.first;
|
||||||
|
volumeSlider.value = volumeObj.chartEntity["volume"];
|
||||||
|
volumeInput.text = volumeObj.chartEntity["volume"].ToString("F");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteVolume()
|
||||||
|
{
|
||||||
|
if (volumeObj != null)
|
||||||
|
{
|
||||||
|
volumeObj.Remove();
|
||||||
|
}
|
||||||
|
if (dialog.activeSelf)
|
||||||
|
{
|
||||||
|
SwitchVolumeDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void VolumeSliderUpdate()
|
||||||
|
{
|
||||||
|
if (volumeObj != null)
|
||||||
|
{
|
||||||
|
volumeObj.SetVolume(volumeSlider.value);
|
||||||
|
volumeInput.text = volumeSlider.value.ToString("F");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetVolume()
|
||||||
|
{
|
||||||
|
if (volumeObj != null)
|
||||||
|
{
|
||||||
|
float volume = float.Parse(volumeInput.text);
|
||||||
|
volumeObj.SetVolume(volume);
|
||||||
|
volumeSlider.value = volume;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5bbf1f35c27906543b7eb55560d811e1
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Loading…
Reference in a new issue