Refaktro funguje lol
This commit is contained in:
67
Editor/SettingsPanelBuilder.cs
Normal file
67
Editor/SettingsPanelBuilder.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
#if UNITY_EDITOR
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace MegaKoop.EditorTools
|
||||
{
|
||||
internal sealed class SettingsPanelBuilder
|
||||
{
|
||||
private readonly Transform _parent;
|
||||
|
||||
internal SettingsPanelBuilder(Transform parent)
|
||||
{
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
internal GameObject Build()
|
||||
{
|
||||
var panelSettings = UGUIBuilderUtils.CreatePanel(_parent, "Panel_Settings", new Vector2(900, 800));
|
||||
panelSettings.SetActive(false);
|
||||
|
||||
var settingsContainer = UGUIBuilderUtils.CreateVerticalGroup(
|
||||
panelSettings.transform,
|
||||
"Settings_VLayout",
|
||||
16f,
|
||||
TextAnchor.UpperCenter,
|
||||
new RectOffset(30, 30, 30, 30));
|
||||
|
||||
UGUIBuilderUtils.CreateText(settingsContainer.transform, "Text_SettingsTitle", "SETTINGS", 48, TextAnchor.MiddleCenter, Color.white, FontStyles.Bold);
|
||||
UGUIBuilderUtils.CreateSpacer(settingsContainer.transform, 10f);
|
||||
|
||||
var gfxGroup = UGUIBuilderUtils.CreateVerticalGroup(
|
||||
settingsContainer.transform,
|
||||
"Graphics_Group",
|
||||
10f,
|
||||
TextAnchor.UpperLeft,
|
||||
new RectOffset(10, 10, 10, 10));
|
||||
UGUIBuilderUtils.CreateText(gfxGroup.transform, "Text_Graphics", "Graphics", 24, TextAnchor.MiddleLeft, Color.white, FontStyles.Bold);
|
||||
UGUIBuilderUtils.CreateDropdown(gfxGroup.transform, "Dropdown_Quality", new[] { "Low", "Medium", "High", "Ultra" });
|
||||
UGUIBuilderUtils.CreateToggle(gfxGroup.transform, "Toggle_Fullscreen", "Fullscreen", true);
|
||||
UGUIBuilderUtils.CreateDropdown(gfxGroup.transform, "Dropdown_Resolution", new[] { "1280x720", "1920x1080", "2560x1440", "3840x2160" });
|
||||
|
||||
var audioGroup = UGUIBuilderUtils.CreateVerticalGroup(
|
||||
settingsContainer.transform,
|
||||
"Audio_Group",
|
||||
10f,
|
||||
TextAnchor.UpperLeft,
|
||||
new RectOffset(10, 10, 10, 10));
|
||||
UGUIBuilderUtils.CreateText(audioGroup.transform, "Text_Audio", "Audio", 24, TextAnchor.MiddleLeft, Color.white, FontStyles.Bold);
|
||||
UGUIBuilderUtils.CreateLabeledSlider(audioGroup.transform, "Master Volume", "Slider_MasterVolume", 0, 100, 100);
|
||||
UGUIBuilderUtils.CreateLabeledSlider(audioGroup.transform, "Music Volume", "Slider_MusicVolume", 0, 100, 80);
|
||||
UGUIBuilderUtils.CreateLabeledSlider(audioGroup.transform, "SFX Volume", "Slider_SFXVolume", 0, 100, 100);
|
||||
|
||||
var buttonsRow = UGUIBuilderUtils.CreateHorizontalGroup(
|
||||
settingsContainer.transform,
|
||||
"Settings_Buttons",
|
||||
10f,
|
||||
TextAnchor.MiddleCenter,
|
||||
new RectOffset(0, 0, 0, 0));
|
||||
UGUIBuilderUtils.CreateMenuButton(buttonsRow.transform, "Button_ApplySettings", "APPLY");
|
||||
UGUIBuilderUtils.CreateMenuButton(buttonsRow.transform, "Button_BackFromSettings", "BACK");
|
||||
|
||||
return panelSettings;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user