diff --git a/.gemini-workspace-history/active-context.md b/.gemini-workspace-history/active-context.md index 5b572ad1..08c203ea 100644 --- a/.gemini-workspace-history/active-context.md +++ b/.gemini-workspace-history/active-context.md @@ -1 +1,21 @@ -No previous session history found for this workspace. \ No newline at end of file +# Technical Summary - HALLUCINATE Project + +## Overview +Project HALLUCINATE is a Unity-based multiplayer game utilizing **Photon Fusion** for networking and **UI Toolkit** for front-end management. Recent development has concentrated on the core networking infrastructure and the lobby system. + +## Modified Files +- `Assets/Scripts/Network/BasicSpawner.cs`: Centralized `NetworkRunner` management, handling session creation, joining, and player profile initialization. +- `Assets/Scripts/UI/LobbyController.cs`: UI logic for room management, password protection, and lounge interactions. +- `Assets/Scripts/Player Controller/PlayerStateMachine.cs`: Core player logic (referenced in memory). + +## Key Logic & Decisions +- **Network Architecture**: Singleton `BasicSpawner` manages the Fusion runner lifecycle. Session joining uses `SessionLobby.ClientServer`. +- **UI Architecture**: `LobbyController` inherits from a base UI class and uses direct `VisualElement` queries for dynamic UI updates (UXML/USS). +- **Security**: Implementation of session passwords via custom properties in Photon sessions. +- **State Sync**: Player status (Ready/Start) and lounge info are synchronized between clients, likely via `PlayerDataManager`. + +## Next Steps +- [ ] Verify RPC/SyncVar logic in `LobbyController.cs`. +- [ ] Connect `PlayerStateMachine` to the spawning flow in `BasicSpawner`. +- [ ] Implement/Finalize the chat system within the lobby lounge. +- [ ] Ensure all scene transitions (Main Scene) are robust. diff --git a/.gemini-workspace-history/session-2026-04-30-21-39.json.gz b/.gemini-workspace-history/session-2026-04-30-21-39.json.gz new file mode 100644 index 00000000..1fb4db9c Binary files /dev/null and b/.gemini-workspace-history/session-2026-04-30-21-39.json.gz differ diff --git a/Assets/Scripts/UI/SettingsController.cs b/Assets/Scripts/UI/SettingsController.cs index 5eec3f7c..9eaa4462 100644 --- a/Assets/Scripts/UI/SettingsController.cs +++ b/Assets/Scripts/UI/SettingsController.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; using OnlyScove.Scripts; using Hallucinate.Audio; +using PrimeTween; namespace Hallucinate.UI { @@ -26,6 +27,7 @@ namespace Hallucinate.UI // Hover Tracking for Arrow Key Slider Control private Slider _hoveredSlider; + private Action _hoveredOnChanged; private float _sliderMin, _sliderMax; // Osu-style Volume Overlay @@ -103,10 +105,30 @@ namespace Hallucinate.UI private void OnMouseWheel(WheelEvent evt) { // Osu style: Volume control with scroll wheel - // Only control master if not hovering a specific sound slider - if (_activeTab == "SOUND" && _hoveredSlider != null) return; + // Only apply if in the SOUND tab + if (_activeTab != "SOUND") return; - UpdateMasterVolume(-evt.delta.y * 2f); + if (_hoveredSlider != null) + { + // Adjust the hovered slider's value + float currentVal = _hoveredSlider.value; + // Determine step size: default to 1% of range, adjusted for 0-100 range. + float step = (_sliderMax - _sliderMin) / 100f; + float newVal = Mathf.Clamp(currentVal - (evt.delta.y * step * 5f), _sliderMin, _sliderMax); // Multiply by a factor to make scroll smoother + + _hoveredSlider.value = newVal; + + // Trigger the associated OnValueChanged callback to save PlayerPrefs etc. + _hoveredOnChanged?.Invoke(newVal); + + evt.StopPropagation(); // Consume the event so it doesn't affect other elements + } + else + { + // If not hovering a specific slider, control Master Volume + UpdateMasterVolume(-evt.delta.y * 2f); + evt.StopPropagation(); // Consume the event + } } private void UpdateMasterVolume(float delta) @@ -169,7 +191,9 @@ namespace Hallucinate.UI _content.Add(CreateSection("ACCOUNT")); string username = PlayerPrefs.GetString("Username", "Guest"); var userRow = new VisualElement { style = { flexDirection = FlexDirection.Row, alignItems = Align.Center, marginBottom = 10 } }; - userRow.Add(new Label("Logged in as: ") { className = "text-body" }); + var loggedInLabel = new Label("Logged in as: "); + loggedInLabel.AddToClassList("text-body"); + userRow.Add(loggedInLabel); userRow.Add(new Label(username) { style = { color = Color.cyan, marginLeft = 5, unityFontStyleAndWeight = FontStyle.Bold } }); _content.Add(userRow); @@ -185,7 +209,9 @@ namespace Hallucinate.UI _content.Add(CreateSection("UPDATES")); var versionBox = new VisualElement { style = { flexDirection = FlexDirection.Row, alignItems = Align.Center } }; - versionBox.Add(new Label($"Version: {Application.version}") { className = "text-body" }); + var versionLabel = new Label($"Version: {Application.version}"); + versionLabel.AddToClassList("text-body"); + versionBox.Add(versionLabel); var checkBtn = new Button { text = "CHECK FOR UPDATES" }; checkBtn.AddToClassList("button-spring"); checkBtn.clicked += () => checkBtn.text = "UP TO DATE"; @@ -287,7 +313,9 @@ namespace Hallucinate.UI private void RenderControlTab() { _content.Add(CreateSection("KEY BINDINGS")); - _content.Add(new Label("Controls Implementation Pending context.") { className = "text-body" }); + var pendingLabel = new Label("Controls Implementation Pending context."); + pendingLabel.AddToClassList("text-body"); + _content.Add(pendingLabel); } #endregion @@ -309,8 +337,18 @@ namespace Hallucinate.UI var input = new TextField { value = startVal.ToString("F1"), style = { width = 50, marginLeft = 10 } }; input.AddToClassList("input-field"); - slider.RegisterCallback(evt => { _hoveredSlider = slider; _sliderMin = min; _sliderMax = max; }); - slider.RegisterCallback(evt => { if (_hoveredSlider == slider) _hoveredSlider = null; }); + slider.RegisterCallback(evt => { + _hoveredSlider = slider; + _hoveredOnChanged = OnValueChanged; + _sliderMin = min; + _sliderMax = max; + }); + slider.RegisterCallback(evt => { + if (_hoveredSlider == slider) { + _hoveredSlider = null; + _hoveredOnChanged = null; + } + }); slider.RegisterValueChangedCallback(evt => { float val = Mathf.Round(evt.newValue * 10f) / 10f; @@ -352,12 +390,12 @@ namespace Hallucinate.UI { root.style.display = DisplayStyle.Flex; _sidebar.style.translate = new StyleTranslate(new Translate(Length.Percent(-100), 0)); - await Tween.Custom(-100f, 0f, duration: 0.4f, ease: Ease.OutQuad, val => _sidebar.style.translate = new StyleTranslate(new Translate(Length.Percent(val), 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))); } public override async Task PlayTransitionOut() { - await Tween.Custom(0f, -100f, duration: 0.3f, ease: Ease.InQuad, val => _sidebar.style.translate = new StyleTranslate(new Translate(Length.Percent(val), 0))); + await Tween.Custom(0f, -100f, duration: 0.3f, ease: Ease.InQuad, onValueChange: val => _sidebar.style.translate = new StyleTranslate(new Translate(Length.Percent(val), 0))); Hide(); } }