mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 10:37:37 +02:00
add cursor toggle, master volume
This commit is contained in:
@ -28,6 +28,8 @@ namespace HeavenStudio
|
||||
public static readonly string[] DEFAULT_SCREEN_SIZES_STRING = new[] { "1280x720", "1920x1080", "2560x1440", "3840x2160", "Custom" };
|
||||
public static int ScreenSizeIndex = 0;
|
||||
|
||||
public static float MasterVolume = 0.8f;
|
||||
|
||||
public enum Scenes : int
|
||||
{
|
||||
SplashScreen = 0,
|
||||
@ -133,5 +135,11 @@ namespace HeavenStudio
|
||||
Screen.SetResolution(DEFAULT_SCREEN_SIZES[ScreenSizeIndex].width, DEFAULT_SCREEN_SIZES[ScreenSizeIndex].height, mode);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ChangeMasterVolume(float value)
|
||||
{
|
||||
MasterVolume = value;
|
||||
AudioListener.volume = MasterVolume;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ using TMPro;
|
||||
using Starpelly;
|
||||
using SFB;
|
||||
|
||||
using HeavenStudio.Editor;
|
||||
using HeavenStudio.Editor.Track;
|
||||
using HeavenStudio.Util;
|
||||
|
||||
@ -63,10 +64,11 @@ namespace HeavenStudio.Editor
|
||||
private bool loadedMusic = false;
|
||||
private string currentRemixPath = "";
|
||||
private string remixName = "";
|
||||
private bool fullscreen;
|
||||
public bool fullscreen;
|
||||
public bool discordDuringTesting = false;
|
||||
public bool canSelect = true;
|
||||
public bool editingInputField = false;
|
||||
public bool isCursorEnabled = true;
|
||||
|
||||
public static Editor instance { get; private set; }
|
||||
|
||||
@ -456,7 +458,7 @@ namespace HeavenStudio.Editor
|
||||
MainCanvas.enabled = true;
|
||||
EditorCamera.enabled = true;
|
||||
GameCamera.instance.camera.targetTexture = ScreenRenderTexture;
|
||||
GameManager.instance.CursorCam.enabled = true;
|
||||
GameManager.instance.CursorCam.enabled = true && isCursorEnabled;
|
||||
GameManager.instance.OverlayCamera.targetTexture = ScreenRenderTexture;
|
||||
fullscreen = false;
|
||||
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using HeavenStudio.Editor.Track;
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.StudioDance;
|
||||
|
||||
using TMPro;
|
||||
|
||||
@ -11,8 +12,9 @@ namespace HeavenStudio.Editor
|
||||
public class CreditsLegalSettings : MonoBehaviour
|
||||
{
|
||||
private int SecretCounter = 0;
|
||||
private static bool SecretActive = false;
|
||||
private bool SecretActive = false;
|
||||
[SerializeField] private GameObject secretObject;
|
||||
[SerializeField] private StudioDanceManager secretContent;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@ -37,6 +39,16 @@ namespace HeavenStudio.Editor
|
||||
SecretActive = true;
|
||||
Jukebox.PlayOneShot("applause");
|
||||
Debug.Log("Activating Studio Dance...");
|
||||
|
||||
secretContent.OpenDanceWindow();
|
||||
}
|
||||
|
||||
public void MakeSecretInactive()
|
||||
{
|
||||
SecretCounter = 0;
|
||||
secretObject.SetActive(false);
|
||||
SecretActive = false;
|
||||
secretContent.CloseDanceWindow();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using HeavenStudio.Editor.Track;
|
||||
using UnityEngine.UI;
|
||||
|
||||
using TMPro;
|
||||
|
||||
@ -13,6 +12,10 @@ namespace HeavenStudio.Editor
|
||||
public GameObject customSetter;
|
||||
public TMP_InputField widthInputField, heightInputField;
|
||||
|
||||
|
||||
public Slider volSlider;
|
||||
public TMP_InputField volLabel;
|
||||
|
||||
private void Start() {
|
||||
List<TMP_Dropdown.OptionData> dropDownData = new List<TMP_Dropdown.OptionData>();
|
||||
var vals = GlobalGameManager.DEFAULT_SCREEN_SIZES_STRING;
|
||||
@ -42,6 +45,9 @@ namespace HeavenStudio.Editor
|
||||
GlobalGameManager.CustomScreenHeight = System.Math.Max(int.Parse(heightInputField.text), 64);
|
||||
heightInputField.text = GlobalGameManager.CustomScreenHeight.ToString();
|
||||
});
|
||||
|
||||
volSlider.value = GlobalGameManager.MasterVolume;
|
||||
volLabel.text = System.Math.Round(volSlider.value * 100, 2).ToString();
|
||||
}
|
||||
|
||||
public void WindowFullScreen()
|
||||
@ -53,5 +59,17 @@ namespace HeavenStudio.Editor
|
||||
{
|
||||
GlobalGameManager.ChangeScreenSize();
|
||||
}
|
||||
|
||||
public void OnVolSliderChanged()
|
||||
{
|
||||
GlobalGameManager.ChangeMasterVolume(volSlider.value);
|
||||
volLabel.text = System.Math.Round(volSlider.value * 100, 2).ToString();
|
||||
}
|
||||
|
||||
public void OnVolLabelChanged()
|
||||
{
|
||||
volSlider.value = (float)System.Math.Round(System.Convert.ToSingle(volLabel.text), 2);
|
||||
GlobalGameManager.ChangeMasterVolume(volSlider.value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
namespace HeavenStudio.Editor
|
||||
{
|
||||
public class EditorSettings : MonoBehaviour
|
||||
{
|
||||
public Toggle cursorCheckbox;
|
||||
|
||||
public void OnCursorCheckboxChanged()
|
||||
{
|
||||
Editor.instance.isCursorEnabled = cursorCheckbox.isOn;
|
||||
if (!Editor.instance.fullscreen)
|
||||
{
|
||||
GameManager.instance.CursorCam.enabled = Editor.instance.isCursorEnabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4dcd15958462e4e488a04ef094e7ffcb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Scripts/StudioDance.meta
Normal file
8
Assets/Scripts/StudioDance.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 865b25422d0ff654cacdd7387de6873c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
57
Assets/Scripts/StudioDance/Dancer.cs
Normal file
57
Assets/Scripts/StudioDance/Dancer.cs
Normal file
@ -0,0 +1,57 @@
|
||||
using UnityEngine;
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.StudioDance
|
||||
{
|
||||
public class Dancer : MonoBehaviour
|
||||
{
|
||||
private Animator animator;
|
||||
private float lastReportedBeat = 0f;
|
||||
private float currentBeat = 0f;
|
||||
|
||||
private bool isDance = false;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
animator = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
if (cond == null || !cond.isPlaying)
|
||||
{
|
||||
if (!isDance) return;
|
||||
if (currentBeat % 2 != 0)
|
||||
{
|
||||
animator.DoScaledAnimationAsync("PoseL");
|
||||
}
|
||||
else
|
||||
{
|
||||
animator.DoScaledAnimationAsync("PoseR");
|
||||
}
|
||||
isDance = false;
|
||||
return;
|
||||
}
|
||||
isDance = true;
|
||||
|
||||
if (cond.ReportBeat(ref lastReportedBeat))
|
||||
{
|
||||
currentBeat = lastReportedBeat;
|
||||
}
|
||||
else if (cond.songPositionInBeats < lastReportedBeat)
|
||||
{
|
||||
lastReportedBeat = Mathf.Round(cond.songPositionInBeats);
|
||||
}
|
||||
|
||||
if (currentBeat % 2 != 0)
|
||||
{
|
||||
animator.DoScaledAnimation("DanceL", currentBeat);
|
||||
}
|
||||
else
|
||||
{
|
||||
animator.DoScaledAnimation("DanceR", currentBeat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/StudioDance/Dancer.cs.meta
Normal file
11
Assets/Scripts/StudioDance/Dancer.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e57f95bd19852bc46a88eb6f67404fce
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
26
Assets/Scripts/StudioDance/StudioDanceManager.cs
Normal file
26
Assets/Scripts/StudioDance/StudioDanceManager.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using HeavenStudio;
|
||||
|
||||
namespace HeavenStudio.StudioDance
|
||||
{
|
||||
public class StudioDanceManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject windowBase;
|
||||
[SerializeField] private Transform windowHolder;
|
||||
[SerializeField] private GameObject content;
|
||||
|
||||
public void OpenDanceWindow()
|
||||
{
|
||||
var mobj = GameObject.Instantiate(windowBase, windowHolder);
|
||||
mobj.SetActive(true);
|
||||
content.SetActive(true);
|
||||
}
|
||||
|
||||
public void CloseDanceWindow()
|
||||
{
|
||||
content.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/StudioDance/StudioDanceManager.cs.meta
Normal file
11
Assets/Scripts/StudioDance/StudioDanceManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f906c9e16af974d409dd19d0836bb9c6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user