2026-04-25 18:20:16 +07:00
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UIElements;
|
2026-04-28 00:07:42 +07:00
|
|
|
using PrimeTween;
|
|
|
|
|
using System.Threading.Tasks;
|
2026-04-25 18:20:16 +07:00
|
|
|
|
2026-04-28 00:07:42 +07:00
|
|
|
namespace Hallucinate.UI
|
2026-04-25 18:20:16 +07:00
|
|
|
{
|
2026-04-28 00:07:42 +07:00
|
|
|
public class SettingsController : BaseUIController
|
2026-04-25 18:20:16 +07:00
|
|
|
{
|
2026-04-28 00:07:42 +07:00
|
|
|
private VisualElement _sidebar;
|
|
|
|
|
private Label _tabTitle;
|
|
|
|
|
private ScrollView _content;
|
2026-04-25 18:20:16 +07:00
|
|
|
|
2026-04-28 00:07:42 +07:00
|
|
|
public override void Initialize(VisualElement uxmlRoot, UIManager manager)
|
2026-04-25 18:20:16 +07:00
|
|
|
{
|
2026-04-28 00:07:42 +07:00
|
|
|
base.Initialize(uxmlRoot, manager);
|
2026-04-25 18:20:16 +07:00
|
|
|
|
2026-04-28 00:07:42 +07:00
|
|
|
_sidebar = root.Q<VisualElement>("Sidebar");
|
|
|
|
|
_tabTitle = root.Q<Label>("TabTitle");
|
|
|
|
|
_content = root.Q<ScrollView>("SettingsContent");
|
2026-04-25 18:20:16 +07:00
|
|
|
|
2026-04-28 00:07:42 +07:00
|
|
|
root.Q<Button>("GeneralTab").clicked += () => SwitchTab("GENERAL");
|
|
|
|
|
root.Q<Button>("VideoTab").clicked += () => SwitchTab("VIDEO");
|
|
|
|
|
root.Q<Button>("SoundTab").clicked += () => SwitchTab("SOUND");
|
|
|
|
|
root.Q<Button>("ControlTab").clicked += () => SwitchTab("CONTROL");
|
|
|
|
|
root.Q<Button>("CloseSettingsBtn").clicked += () => uiManager.Pop();
|
2026-04-25 18:20:16 +07:00
|
|
|
}
|
|
|
|
|
|
2026-04-28 00:07:42 +07:00
|
|
|
private void SwitchTab(string title)
|
2026-04-25 18:20:16 +07:00
|
|
|
{
|
2026-04-28 00:07:42 +07:00
|
|
|
_tabTitle.text = title;
|
|
|
|
|
// Clear and add specific settings content
|
|
|
|
|
_content.Clear();
|
|
|
|
|
_content.Add(new Label($"Settings for {title} coming soon..."));
|
|
|
|
|
}
|
2026-04-26 05:02:49 +07:00
|
|
|
|
2026-04-28 00:07:42 +07:00
|
|
|
public override async Task PlayTransitionIn()
|
|
|
|
|
{
|
|
|
|
|
Show();
|
|
|
|
|
_sidebar.style.translate = new StyleTranslate(new Translate(Length.Percent(-100), 0));
|
|
|
|
|
await Tween.Custom(-100f, 0f, duration: 0.4f, ease: Ease.OutQuad,
|
|
|
|
|
onValueChange: val => _sidebar.style.translate = new StyleTranslate(new Translate(Length.Percent(val), 0)));
|
|
|
|
|
}
|
2026-04-26 05:02:49 +07:00
|
|
|
|
2026-04-28 00:07:42 +07:00
|
|
|
public override async Task PlayTransitionOut()
|
|
|
|
|
{
|
|
|
|
|
await Tween.Custom(0f, -100f, duration: 0.4f, ease: Ease.InQuad,
|
|
|
|
|
onValueChange: val => _sidebar.style.translate = new StyleTranslate(new Translate(Length.Percent(val), 0)));
|
|
|
|
|
Hide();
|
2026-04-25 18:20:16 +07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|