From c5402178f0b7b69b9e6cd233f2203172d1c55e53 Mon Sep 17 00:00:00 2001 From: Mark Joshwel Date: Sun, 17 Nov 2024 19:10:01 +0800 Subject: [PATCH] game: interim --- ColourMeOKGame/Assets/Scenes/GameScene.unity | 13 + ColourMeOKGame/Assets/Scripts/AccountUI.cs | 480 +++++++++++++----- ColourMeOKGame/Assets/Scripts/AudioManager.cs | 163 ------ ColourMeOKGame/Assets/Scripts/Backend.cs | 185 +++++-- ColourMeOKGame/Assets/Scripts/CommonMenu.cs | 122 ----- .../Assets/Scripts/CommonMenu.cs.meta | 11 - ColourMeOKGame/Assets/Scripts/GameManager.cs | 47 +- .../Assets/Scripts/LocalPlayerData.cs | 172 +++++++ .../Assets/Scripts/LocalPlayerData.cs.meta | 3 + ColourMeOKGame/Assets/Scripts/Playground.cs | 18 + .../Assets/Scripts/Playground.cs.meta | 3 + ColourMeOKGame/Assets/Scripts/SideViewUI.cs | 146 ++++++ ...udioManager.cs.meta => SideViewUI.cs.meta} | 2 +- ColourMeOKGame/Assets/UI/GameUI.uss | 1 + 14 files changed, 905 insertions(+), 461 deletions(-) delete mode 100644 ColourMeOKGame/Assets/Scripts/AudioManager.cs delete mode 100644 ColourMeOKGame/Assets/Scripts/CommonMenu.cs delete mode 100644 ColourMeOKGame/Assets/Scripts/CommonMenu.cs.meta create mode 100644 ColourMeOKGame/Assets/Scripts/LocalPlayerData.cs create mode 100644 ColourMeOKGame/Assets/Scripts/LocalPlayerData.cs.meta create mode 100644 ColourMeOKGame/Assets/Scripts/Playground.cs create mode 100644 ColourMeOKGame/Assets/Scripts/Playground.cs.meta create mode 100644 ColourMeOKGame/Assets/Scripts/SideViewUI.cs rename ColourMeOKGame/Assets/Scripts/{AudioManager.cs.meta => SideViewUI.cs.meta} (83%) diff --git a/ColourMeOKGame/Assets/Scenes/GameScene.unity b/ColourMeOKGame/Assets/Scenes/GameScene.unity index e956634..486551b 100644 --- a/ColourMeOKGame/Assets/Scenes/GameScene.unity +++ b/ColourMeOKGame/Assets/Scenes/GameScene.unity @@ -134,6 +134,7 @@ GameObject: - component: {fileID: 133964671} - component: {fileID: 133964673} - component: {fileID: 133964674} + - component: {fileID: 133964675} m_Layer: 5 m_Name: UI m_TagString: Untagged @@ -200,6 +201,18 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: state: 0 +--- !u!114 &133964675 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 133964670} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6351b7620d84e2d43bc4f59c5f3f8b5c, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &447905425 GameObject: m_ObjectHideFlags: 0 diff --git a/ColourMeOKGame/Assets/Scripts/AccountUI.cs b/ColourMeOKGame/Assets/Scripts/AccountUI.cs index dcab716..977f0ff 100644 --- a/ColourMeOKGame/Assets/Scripts/AccountUI.cs +++ b/ColourMeOKGame/Assets/Scripts/AccountUI.cs @@ -1,82 +1,90 @@ using System; using System.Net.Mail; +using Firebase.Auth; using UnityEngine; using UnityEngine.Assertions; using UnityEngine.UIElements; +using Button = UnityEngine.UIElements.Button; /// /// class to handle the account view ui /// public class AccountUI : MonoBehaviour { - /// - /// state of the account view - /// - private enum State - { - UnassociatedState, // (start) - NotSignedIn, // initial - AfterContinue, // after - SignedIn // post - } - /// /// current state of the account view /// [SerializeField] private State state = State.UnassociatedState; /// - /// account view header text + /// default text colour /// - private Label _header; - + private readonly Color _defaultInputFieldValueTextColour = new(5.88f, 5.1f, 10.59f); + /// - /// username text field + /// error text colour /// - private TextField _usernameField; - - /// - /// email text field - /// - private TextField _emailField; - - /// - /// password text field - /// - private TextField _passwordField; - - /// - /// button to update the username - /// - private Button _usernameUpdateButton; - - /// - /// button to update the email - /// - private Button _emailUpdateButton; - - /// - /// button to update the password - /// - private Button _passwordUpdateButton; - + private readonly Color _errorInputFieldValueTextColour = new(1f, 50.59f, 50.2f); + /// /// accompanying text for the account input fields, used when an error/notice is needed /// private Label _accompanyingText; - + + /// + /// email text field + /// + private TextField _emailField; + + /// + /// button to update the email + /// + private Button _emailUpdateButton; + + /// + /// account view header text + /// + private Label _header; + + /// + /// password text field + /// + private TextField _passwordField; + + /// + /// button to update the password + /// + private Button _passwordUpdateButton; + /// /// either 'continue', 'log in', or 'sign out' button /// (in order of 'initial', 'after', and 'post' states) /// private Button _primaryActionButton; - + /// /// either 'forgot password' or 'create an account' /// (in order of 'initial' and 'after' states, is hidden in 'post' state) /// private Button _secondaryActionButton; - + + /// + /// username text field + /// + private TextField _usernameField; + + /// + /// button to update the username + /// + private Button _usernameUpdateButton; + + public void Start() + { + if (state == State.UnassociatedState) throw new Exception("unreachable state"); + + // GameManager.Instance.Backend.RegisterOnSignInCallback(OnSignInCallback); + } + /// /// function to subscribe button events to their respective functions /// @@ -85,44 +93,57 @@ public void OnEnable() var ui = GetComponent().rootVisualElement; _header = ui.Q