HeavenStudioPlus/Assets/Scripts/LevelEditor/SettingsDialog/Tabs/DispAudioSettings.cs

121 lines
4.9 KiB
C#
Raw Normal View History

Game Overlays (#280) * add accuracy display * temp BG for show * separate overlays prefab make proper shader for star effects * aim shakiness display * implement testing skill star * fully functional skill star * separate section display from editor * fully separate chart section display from timeline * add section to overlays * fix nullreference issues * start game layout settings * add game settings script * fix nonfunctioning scoring * invert y position logic on timing bar * add perfect challenge functionality * fix section not showing up in editor add perfect challenge option * add timing display minimal mode * Update PerfectAndPractice.png * show gismo for minigame bounds in editor * add ability to disable overlays in editor * prepare medals add new timing display graphic * hide screen preview * per-axis camera control added per request * section medals basic functionality * add medal get animations * fix bug with perfect icons * visual enhancements * adjust look of timing display minmode address audio ducking issues(?) * prepare overlay lyt editor add viewport pan, rotate, scale adjust audio setting * add layout editor UI elements * dynamic overlay creation * fix default single timing disp * set up overlay settings controls * start UI events * runtime uuid for component reference * layout editor affects overlay elements * show overlay element previews while editing * advanced audio settings * fix bug in drop-down creation * fallback defaults for the new stuff * fix textbox & overlay visibility bugs
2023-03-11 04:51:22 +00:00
using System.Linq;
2022-07-09 02:11:55 +00:00
using System.Collections.Generic;
using UnityEngine;
2022-07-10 21:39:14 +00:00
using UnityEngine.UI;
2022-07-09 02:11:55 +00:00
using TMPro;
2023-01-25 15:28:51 +00:00
using HeavenStudio.Common;
2022-07-09 02:11:55 +00:00
namespace HeavenStudio.Editor
{
2022-09-02 00:57:47 +00:00
public class DispAudioSettings : TabsContent
2022-07-09 02:11:55 +00:00
{
public TMP_Dropdown resolutionsDropdown;
public GameObject customSetter;
public TMP_InputField widthInputField, heightInputField;
2022-07-10 21:39:14 +00:00
public Slider volSlider;
public TMP_InputField volLabel;
Game Overlays (#280) * add accuracy display * temp BG for show * separate overlays prefab make proper shader for star effects * aim shakiness display * implement testing skill star * fully functional skill star * separate section display from editor * fully separate chart section display from timeline * add section to overlays * fix nullreference issues * start game layout settings * add game settings script * fix nonfunctioning scoring * invert y position logic on timing bar * add perfect challenge functionality * fix section not showing up in editor add perfect challenge option * add timing display minimal mode * Update PerfectAndPractice.png * show gismo for minigame bounds in editor * add ability to disable overlays in editor * prepare medals add new timing display graphic * hide screen preview * per-axis camera control added per request * section medals basic functionality * add medal get animations * fix bug with perfect icons * visual enhancements * adjust look of timing display minmode address audio ducking issues(?) * prepare overlay lyt editor add viewport pan, rotate, scale adjust audio setting * add layout editor UI elements * dynamic overlay creation * fix default single timing disp * set up overlay settings controls * start UI events * runtime uuid for component reference * layout editor affects overlay elements * show overlay element previews while editing * advanced audio settings * fix bug in drop-down creation * fallback defaults for the new stuff * fix textbox & overlay visibility bugs
2023-03-11 04:51:22 +00:00
public TMP_Dropdown dspSizeDropdown;
public TMP_Dropdown sampleRateDropdown;
2022-07-10 21:39:14 +00:00
2022-07-09 02:11:55 +00:00
private void Start() {
List<TMP_Dropdown.OptionData> dropDownData = new List<TMP_Dropdown.OptionData>();
var vals = GlobalGameManager.DEFAULT_SCREEN_SIZES_STRING;
for (int i = 0; i < vals.Length; i++)
{
TMP_Dropdown.OptionData optionData = new TMP_Dropdown.OptionData();
optionData.text = vals[i];
dropDownData.Add(optionData);
}
resolutionsDropdown.AddOptions(dropDownData);
resolutionsDropdown.onValueChanged.AddListener(delegate
{
GlobalGameManager.ScreenSizeIndex = resolutionsDropdown.value;
customSetter.SetActive(resolutionsDropdown.value == GlobalGameManager.DEFAULT_SCREEN_SIZES_STRING.Length - 1);
});
widthInputField.onEndEdit.AddListener(delegate
{
GlobalGameManager.CustomScreenWidth = System.Math.Max(int.Parse(widthInputField.text), 64);
widthInputField.text = GlobalGameManager.CustomScreenWidth.ToString();
});
heightInputField.onEndEdit.AddListener(delegate
{
GlobalGameManager.CustomScreenHeight = System.Math.Max(int.Parse(heightInputField.text), 64);
heightInputField.text = GlobalGameManager.CustomScreenHeight.ToString();
});
2022-07-10 21:39:14 +00:00
2023-01-25 15:28:51 +00:00
resolutionsDropdown.value = GlobalGameManager.ScreenSizeIndex;
widthInputField.text = GlobalGameManager.CustomScreenWidth.ToString();
heightInputField.text = GlobalGameManager.CustomScreenHeight.ToString();
2022-07-10 21:39:14 +00:00
volSlider.value = GlobalGameManager.MasterVolume;
volLabel.text = System.Math.Round(volSlider.value * 100, 2).ToString();
Game Overlays (#280) * add accuracy display * temp BG for show * separate overlays prefab make proper shader for star effects * aim shakiness display * implement testing skill star * fully functional skill star * separate section display from editor * fully separate chart section display from timeline * add section to overlays * fix nullreference issues * start game layout settings * add game settings script * fix nonfunctioning scoring * invert y position logic on timing bar * add perfect challenge functionality * fix section not showing up in editor add perfect challenge option * add timing display minimal mode * Update PerfectAndPractice.png * show gismo for minigame bounds in editor * add ability to disable overlays in editor * prepare medals add new timing display graphic * hide screen preview * per-axis camera control added per request * section medals basic functionality * add medal get animations * fix bug with perfect icons * visual enhancements * adjust look of timing display minmode address audio ducking issues(?) * prepare overlay lyt editor add viewport pan, rotate, scale adjust audio setting * add layout editor UI elements * dynamic overlay creation * fix default single timing disp * set up overlay settings controls * start UI events * runtime uuid for component reference * layout editor affects overlay elements * show overlay element previews while editing * advanced audio settings * fix bug in drop-down creation * fallback defaults for the new stuff * fix textbox & overlay visibility bugs
2023-03-11 04:51:22 +00:00
dspSizeDropdown.onValueChanged.AddListener(delegate
{
GlobalGameManager.currentDspSize = GlobalGameManager.DSP_BUFFER_SIZES[dspSizeDropdown.value];
GlobalGameManager.ChangeAudioSettings(GlobalGameManager.currentDspSize, GlobalGameManager.currentSampleRate);
});
sampleRateDropdown.onValueChanged.AddListener(delegate
{
GlobalGameManager.currentSampleRate = GlobalGameManager.SAMPLE_RATES[sampleRateDropdown.value];
GlobalGameManager.ChangeAudioSettings(GlobalGameManager.currentDspSize, GlobalGameManager.currentSampleRate);
});
2022-07-09 02:11:55 +00:00
}
public void WindowFullScreen()
{
GlobalGameManager.WindowFullScreen();
Game Overlays (#280) * add accuracy display * temp BG for show * separate overlays prefab make proper shader for star effects * aim shakiness display * implement testing skill star * fully functional skill star * separate section display from editor * fully separate chart section display from timeline * add section to overlays * fix nullreference issues * start game layout settings * add game settings script * fix nonfunctioning scoring * invert y position logic on timing bar * add perfect challenge functionality * fix section not showing up in editor add perfect challenge option * add timing display minimal mode * Update PerfectAndPractice.png * show gismo for minigame bounds in editor * add ability to disable overlays in editor * prepare medals add new timing display graphic * hide screen preview * per-axis camera control added per request * section medals basic functionality * add medal get animations * fix bug with perfect icons * visual enhancements * adjust look of timing display minmode address audio ducking issues(?) * prepare overlay lyt editor add viewport pan, rotate, scale adjust audio setting * add layout editor UI elements * dynamic overlay creation * fix default single timing disp * set up overlay settings controls * start UI events * runtime uuid for component reference * layout editor affects overlay elements * show overlay element previews while editing * advanced audio settings * fix bug in drop-down creation * fallback defaults for the new stuff * fix textbox & overlay visibility bugs
2023-03-11 04:51:22 +00:00
GlobalGameManager.ResetGameRenderTexture();
2022-07-09 02:11:55 +00:00
}
public void WindowConfirmSize()
{
GlobalGameManager.ChangeScreenSize();
Game Overlays (#280) * add accuracy display * temp BG for show * separate overlays prefab make proper shader for star effects * aim shakiness display * implement testing skill star * fully functional skill star * separate section display from editor * fully separate chart section display from timeline * add section to overlays * fix nullreference issues * start game layout settings * add game settings script * fix nonfunctioning scoring * invert y position logic on timing bar * add perfect challenge functionality * fix section not showing up in editor add perfect challenge option * add timing display minimal mode * Update PerfectAndPractice.png * show gismo for minigame bounds in editor * add ability to disable overlays in editor * prepare medals add new timing display graphic * hide screen preview * per-axis camera control added per request * section medals basic functionality * add medal get animations * fix bug with perfect icons * visual enhancements * adjust look of timing display minmode address audio ducking issues(?) * prepare overlay lyt editor add viewport pan, rotate, scale adjust audio setting * add layout editor UI elements * dynamic overlay creation * fix default single timing disp * set up overlay settings controls * start UI events * runtime uuid for component reference * layout editor affects overlay elements * show overlay element previews while editing * advanced audio settings * fix bug in drop-down creation * fallback defaults for the new stuff * fix textbox & overlay visibility bugs
2023-03-11 04:51:22 +00:00
GlobalGameManager.ResetGameRenderTexture();
2022-07-09 02:11:55 +00:00
}
2022-07-10 21:39:14 +00:00
public void OnVolSliderChanged()
{
GlobalGameManager.ChangeMasterVolume(volSlider.value);
volLabel.text = System.Math.Round(volSlider.value * 100, 2).ToString();
2023-01-25 15:28:51 +00:00
PersistentDataManager.gameSettings.masterVolume = volSlider.value;
2022-07-10 21:39:14 +00:00
}
public void OnVolLabelChanged()
{
volSlider.value = (float)System.Math.Round(System.Convert.ToSingle(volLabel.text) / 100f, 2);
2022-07-10 21:39:14 +00:00
GlobalGameManager.ChangeMasterVolume(volSlider.value);
2023-01-25 15:28:51 +00:00
PersistentDataManager.gameSettings.masterVolume = volSlider.value;
2022-07-10 21:39:14 +00:00
}
2022-09-02 00:57:47 +00:00
public override void OnOpenTab()
{
2023-01-25 15:28:51 +00:00
resolutionsDropdown.value = GlobalGameManager.ScreenSizeIndex;
widthInputField.text = GlobalGameManager.CustomScreenWidth.ToString();
heightInputField.text = GlobalGameManager.CustomScreenHeight.ToString();
volSlider.value = GlobalGameManager.MasterVolume;
volLabel.text = System.Math.Round(volSlider.value * 100, 2).ToString();
Game Overlays (#280) * add accuracy display * temp BG for show * separate overlays prefab make proper shader for star effects * aim shakiness display * implement testing skill star * fully functional skill star * separate section display from editor * fully separate chart section display from timeline * add section to overlays * fix nullreference issues * start game layout settings * add game settings script * fix nonfunctioning scoring * invert y position logic on timing bar * add perfect challenge functionality * fix section not showing up in editor add perfect challenge option * add timing display minimal mode * Update PerfectAndPractice.png * show gismo for minigame bounds in editor * add ability to disable overlays in editor * prepare medals add new timing display graphic * hide screen preview * per-axis camera control added per request * section medals basic functionality * add medal get animations * fix bug with perfect icons * visual enhancements * adjust look of timing display minmode address audio ducking issues(?) * prepare overlay lyt editor add viewport pan, rotate, scale adjust audio setting * add layout editor UI elements * dynamic overlay creation * fix default single timing disp * set up overlay settings controls * start UI events * runtime uuid for component reference * layout editor affects overlay elements * show overlay element previews while editing * advanced audio settings * fix bug in drop-down creation * fallback defaults for the new stuff * fix textbox & overlay visibility bugs
2023-03-11 04:51:22 +00:00
dspSizeDropdown.ClearOptions();
sampleRateDropdown.ClearOptions();
dspSizeDropdown.AddOptions(GlobalGameManager.DSP_BUFFER_SIZES.Select(x => x.ToString()).ToList());
sampleRateDropdown.AddOptions(GlobalGameManager.SAMPLE_RATES.Select(x => x.ToString()).ToList());
dspSizeDropdown.value = GlobalGameManager.DSP_BUFFER_SIZES.ToList().IndexOf(GlobalGameManager.currentDspSize);
sampleRateDropdown.value = GlobalGameManager.SAMPLE_RATES.ToList().IndexOf(GlobalGameManager.currentSampleRate);
2022-09-02 00:57:47 +00:00
}
public override void OnCloseTab()
{
}
2022-07-09 02:11:55 +00:00
}
}