diff --git a/Assets/Scenes/AccountMenu.unity b/Assets/Scenes/AccountMenu.unity index b2290d6..3932d4f 100644 --- a/Assets/Scenes/AccountMenu.unity +++ b/Assets/Scenes/AccountMenu.unity @@ -420,7 +420,6 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 1631780389} - {fileID: 842914398} - {fileID: 707065271} m_Father: {fileID: 1880819783} @@ -1964,6 +1963,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 231961424} + - component: {fileID: 231961425} m_Layer: 5 m_Name: RegisterMenu m_TagString: Untagged @@ -1994,6 +1994,26 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 200, y: 50} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &231961425 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 231961423} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 15b428d2b1e250a4385f3a56d0b4d43e, type: 3} + m_Name: + m_EditorClassIdentifier: + registerPanelStatusText: {fileID: 1550267440} + registerUsernameInput: {fileID: 1903303677} + registerEmailInput: {fileID: 1033574375} + registerRetypeEmailInput: {fileID: 2049390253} + registerPasswordInput: {fileID: 766608009} + registerRetypePasswordInput: {fileID: 687157005} + registerBackButton: {fileID: 1132893458} + registerSubmitButton: {fileID: 2098645307} --- !u!1 &233674044 GameObject: m_ObjectHideFlags: 0 @@ -2996,6 +3016,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 425779807} + - component: {fileID: 425779808} m_Layer: 5 m_Name: ChangeUsernameMenu m_TagString: Untagged @@ -3026,6 +3047,23 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 200, y: 50} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &425779808 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 425779806} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: be362dee96ceba548be09c7fede7bf16, type: 3} + m_Name: + m_EditorClassIdentifier: + changeUsernameStatusText: {fileID: 1644648867} + changeUsernameCurrentUsernameInput: {fileID: 1027629210} + changeUsernameNewUsernameInput: {fileID: 844510832} + changeUsernameBackButton: {fileID: 1799549043} + changeUsernameSubmitButton: {fileID: 164861580} --- !u!1 &450860870 GameObject: m_ObjectHideFlags: 0 @@ -3035,6 +3073,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 450860871} + - component: {fileID: 450860872} m_Layer: 5 m_Name: RefreshLoginMenu m_TagString: Untagged @@ -3065,6 +3104,23 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 200, y: 50} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &450860872 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 450860870} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cfd036ba0d22324d8dd09b06d7bcf75, type: 3} + m_Name: + m_EditorClassIdentifier: + refreshLoginStatusText: {fileID: 1994034180} + refreshLoginUsernameInput: {fileID: 2070894486} + refreshLoginPasswordInput: {fileID: 750272025} + refreshLoginBackButton: {fileID: 1534521402} + refreshLoginSubmitButton: {fileID: 973164955} --- !u!1 &501758715 GameObject: m_ObjectHideFlags: 0 @@ -3594,127 +3650,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 561418423} m_CullTransparentMesh: 1 ---- !u!1 &631318019 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 631318020} - - component: {fileID: 631318023} - - component: {fileID: 631318022} - - component: {fileID: 631318024} - m_Layer: 5 - m_Name: LoginButton - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &631318020 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 631318019} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 1848970635} - m_Father: {fileID: 902175232} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 85, y: -25} - m_SizeDelta: {x: 150, y: 50} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &631318022 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 631318019} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} - m_Type: 1 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 ---- !u!222 &631318023 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 631318019} - m_CullTransparentMesh: 1 ---- !u!114 &631318024 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 631318019} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Navigation: - m_Mode: 3 - m_WrapAround: 0 - m_SelectOnUp: {fileID: 0} - m_SelectOnDown: {fileID: 0} - m_SelectOnLeft: {fileID: 0} - m_SelectOnRight: {fileID: 0} - m_Transition: 1 - m_Colors: - m_NormalColor: {r: 1, g: 1, b: 1, a: 1} - m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} - m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} - m_ColorMultiplier: 1 - m_FadeDuration: 0.1 - m_SpriteState: - m_HighlightedSprite: {fileID: 0} - m_PressedSprite: {fileID: 0} - m_SelectedSprite: {fileID: 0} - m_DisabledSprite: {fileID: 0} - m_AnimationTriggers: - m_NormalTrigger: Normal - m_HighlightedTrigger: Highlighted - m_PressedTrigger: Pressed - m_SelectedTrigger: Selected - m_DisabledTrigger: Disabled - m_Interactable: 1 - m_TargetGraphic: {fileID: 631318022} - m_OnClick: - m_PersistentCalls: - m_Calls: [] --- !u!1 &637228391 GameObject: m_ObjectHideFlags: 0 @@ -4557,7 +4492,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 415, y: -25} + m_AnchoredPosition: {x: 250, y: -25} m_SizeDelta: {x: 150, y: 50} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &707065273 @@ -4928,55 +4863,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1d3604e648db0614cb2265963d39721b, type: 3} m_Name: m_EditorClassIdentifier: - loggedInPanel: {fileID: 947072222} - loggedInText: {fileID: 1811333580} - loggedInChangeUsernameButton: {fileID: 1572018539} - loggedInChangePasswordButton: {fileID: 501899887} - loggedInSaveButton: {fileID: 1394498766} - loggedInLoadButton: {fileID: 2005677593} - loggedInRefreshLoginButton: {fileID: 959998370} - loggedInLogoutButton: {fileID: 1529208749} - loggedInBackButton: {fileID: 322453970} - loggedOutPanel: {fileID: 983419243} - loggedOutLoginButton: {fileID: 1842378620} - loggedOutRegisterButton: {fileID: 1888048651} - loggedOutBackButton: {fileID: 1848992338} - loginPanel: {fileID: 1880819782} - loginPanelStatusText: {fileID: 1759974816} - loginUsernameInput: {fileID: 1466613308} - loginPasswordInput: {fileID: 1993836203} - loginRegisterButton: {fileID: 1631780393} - loginBackButton: {fileID: 842914402} - loginSubmitButton: {fileID: 707065275} - registerPanel: {fileID: 231961423} - registerPanelStatusText: {fileID: 1550267440} - registerUsernameInput: {fileID: 1903303677} - registerEmailInput: {fileID: 1033574375} - registerRetypeEmailInput: {fileID: 2049390253} - registerPasswordInput: {fileID: 766608009} - registerRetypePasswordInput: {fileID: 687157005} - registerLoginButton: {fileID: 631318024} - registerBackButton: {fileID: 1132893458} - registerSubmitButton: {fileID: 2098645307} - changeUsernamePanel: {fileID: 425779806} - changeUsernameStatusText: {fileID: 1644648867} - changeUsernameCurrentUsernameInput: {fileID: 1027629210} - changeUsernameNewUsernameInput: {fileID: 844510832} - changeUsernameBackButton: {fileID: 1799549043} - changeUsernameSubmitButton: {fileID: 164861580} - changePasswordPanel: {fileID: 1181315892} - changePasswordStatusText: {fileID: 1086714076} - changePasswordCurrentPasswordInput: {fileID: 309067087} - changePasswordNewPasswordInput: {fileID: 637228393} - changePasswordRetypeNewPasswordInput: {fileID: 2035340782} - changePasswordBackButton: {fileID: 2138008519} - changePasswordSubmitButton: {fileID: 656413810} - refreshLoginPanel: {fileID: 450860870} - refreshLoginStatusText: {fileID: 1994034180} - refreshLoginUsernameInput: {fileID: 2070894486} - refreshLoginPasswordInput: {fileID: 750272025} - refreshLoginBackButton: {fileID: 1534521402} - refreshLoginSubmitButton: {fileID: 973164955} + accountLoggedIn: {fileID: 947072224} + accountLoggedOut: {fileID: 983419245} + accountLogin: {fileID: 1880819784} + accountRegister: {fileID: 231961425} + accountChangeUsername: {fileID: 425779808} + accountChangePassword: {fileID: 1181315894} + accountRefreshLogin: {fileID: 450860872} --- !u!1 &742602638 GameObject: m_ObjectHideFlags: 0 @@ -5557,7 +5450,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 250, y: -25} + m_AnchoredPosition: {x: 85, y: -25} m_SizeDelta: {x: 150, y: 50} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &842914400 @@ -6309,7 +6202,6 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 631318020} - {fileID: 1132893454} - {fileID: 2098645303} m_Father: {fileID: 231961424} @@ -6352,8 +6244,9 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 947072223} + - component: {fileID: 947072224} m_Layer: 5 - m_Name: LoggedIn + m_Name: LoggedInMenu m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -6381,6 +6274,26 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 200, y: 50} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &947072224 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 947072222} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2f7c13bcd16e34840be5ed44f70b3824, type: 3} + m_Name: + m_EditorClassIdentifier: + loggedInText: {fileID: 1811333580} + loggedInChangeUsernameButton: {fileID: 1572018539} + loggedInChangePasswordButton: {fileID: 501899887} + loggedInSaveButton: {fileID: 1394498766} + loggedInLoadButton: {fileID: 2005677593} + loggedInRefreshLoginButton: {fileID: 959998370} + loggedInLogoutButton: {fileID: 1529208749} + loggedInBackButton: {fileID: 322453970} --- !u!1 &959998368 GameObject: m_ObjectHideFlags: 0 @@ -6632,8 +6545,9 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 983419244} + - component: {fileID: 983419245} m_Layer: 5 - m_Name: LoggedOut + m_Name: LoggedOutMenu m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -6661,6 +6575,21 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 200, y: 50} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &983419245 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 983419243} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9d660b01e28b0234bb44f79e71fba5b3, type: 3} + m_Name: + m_EditorClassIdentifier: + loggedOutLoginButton: {fileID: 1842378620} + loggedOutRegisterButton: {fileID: 1888048651} + loggedOutBackButton: {fileID: 1848992338} --- !u!1 &989136372 GameObject: m_ObjectHideFlags: 0 @@ -7603,142 +7532,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1067525946} m_CullTransparentMesh: 1 ---- !u!1 &1086288457 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1086288458} - - component: {fileID: 1086288460} - - component: {fileID: 1086288459} - m_Layer: 5 - m_Name: Text (TMP) - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1086288458 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1086288457} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 1631780389} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &1086288459 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1086288457} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_text: Register - m_isRightToLeft: 0 - m_fontAsset: {fileID: 11400000, guid: 4fd546dd0900395408d2de20f5025882, type: 2} - m_sharedMaterial: {fileID: -1476194838487357290, guid: 4fd546dd0900395408d2de20f5025882, type: 2} - m_fontSharedMaterials: [] - m_fontMaterial: {fileID: 0} - m_fontMaterials: [] - m_fontColor32: - serializedVersion: 2 - rgba: 4278190080 - m_fontColor: {r: 0, g: 0, b: 0, a: 1} - m_enableVertexGradient: 0 - m_colorMode: 3 - m_fontColorGradient: - topLeft: {r: 1, g: 1, b: 1, a: 1} - topRight: {r: 1, g: 1, b: 1, a: 1} - bottomLeft: {r: 1, g: 1, b: 1, a: 1} - bottomRight: {r: 1, g: 1, b: 1, a: 1} - m_fontColorGradientPreset: {fileID: 0} - m_spriteAsset: {fileID: 0} - m_tintAllSprites: 0 - m_StyleSheet: {fileID: 0} - m_TextStyleHashCode: -1183493901 - m_overrideHtmlColors: 0 - m_faceColor: - serializedVersion: 2 - rgba: 4294967295 - m_fontSize: 24 - m_fontSizeBase: 24 - m_fontWeight: 400 - m_enableAutoSizing: 0 - m_fontSizeMin: 18 - m_fontSizeMax: 72 - m_fontStyle: 0 - m_HorizontalAlignment: 2 - m_VerticalAlignment: 512 - m_textAlignment: 65535 - m_characterSpacing: 0 - m_wordSpacing: 0 - m_lineSpacing: 0 - m_lineSpacingMax: 0 - m_paragraphSpacing: 0 - m_charWidthMaxAdj: 0 - m_TextWrappingMode: 1 - m_wordWrappingRatios: 0.4 - m_overflowMode: 0 - m_linkedTextComponent: {fileID: 0} - parentLinkedComponent: {fileID: 0} - m_enableKerning: 0 - m_ActiveFontFeatures: 6e72656b - m_enableExtraPadding: 0 - checkPaddingRequired: 0 - m_isRichText: 1 - m_EmojiFallbackSupport: 1 - m_parseCtrlCharacters: 1 - m_isOrthographic: 1 - m_isCullingEnabled: 0 - m_horizontalMapping: 0 - m_verticalMapping: 0 - m_uvLineOffset: 0 - m_geometrySortingOrder: 0 - m_IsTextObjectScaleStatic: 0 - m_VertexBufferAutoSizeReduction: 0 - m_useMaxVisibleDescender: 1 - m_pageToDisplay: 1 - m_margin: {x: 0, y: 0, z: 0, w: 0} - m_isUsingLegacyAnimationComponent: 0 - m_isVolumetricText: 0 - m_hasFontAssetChanged: 0 - m_baseMaterial: {fileID: 0} - m_maskOffset: {x: 0, y: 0, z: 0, w: 0} ---- !u!222 &1086288460 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1086288457} - m_CullTransparentMesh: 1 --- !u!1 &1086714074 GameObject: m_ObjectHideFlags: 0 @@ -7774,7 +7567,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 130} - m_SizeDelta: {x: 750, y: 50} + m_SizeDelta: {x: 500, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1086714076 MonoBehaviour: @@ -8442,7 +8235,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 250, y: -25} + m_AnchoredPosition: {x: 85, y: -25} m_SizeDelta: {x: 150, y: 50} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1132893456 @@ -8672,6 +8465,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1181315893} + - component: {fileID: 1181315894} m_Layer: 5 m_Name: ChangePasswordMenu m_TagString: Untagged @@ -8702,6 +8496,24 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 200, y: 50} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1181315894 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1181315892} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ae8dc061a6b24a14f81e1024c84f6695, type: 3} + m_Name: + m_EditorClassIdentifier: + changePasswordStatusText: {fileID: 1086714076} + changePasswordCurrentPasswordInput: {fileID: 309067087} + changePasswordNewPasswordInput: {fileID: 637228393} + changePasswordRetypeNewPasswordInput: {fileID: 2035340782} + changePasswordBackButton: {fileID: 2138008519} + changePasswordSubmitButton: {fileID: 656413810} --- !u!1 &1209766551 GameObject: m_ObjectHideFlags: 0 @@ -11244,7 +11056,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 245} - m_SizeDelta: {x: 750, y: 50} + m_SizeDelta: {x: 500, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1550267440 MonoBehaviour: @@ -11886,127 +11698,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1602600709} m_CullTransparentMesh: 1 ---- !u!1 &1631780388 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1631780389} - - component: {fileID: 1631780392} - - component: {fileID: 1631780391} - - component: {fileID: 1631780393} - m_Layer: 5 - m_Name: RegisterButton - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1631780389 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1631780388} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 1086288458} - m_Father: {fileID: 36575984} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 85, y: -25} - m_SizeDelta: {x: 150, y: 50} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &1631780391 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1631780388} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} - m_Type: 1 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 ---- !u!222 &1631780392 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1631780388} - m_CullTransparentMesh: 1 ---- !u!114 &1631780393 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1631780388} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Navigation: - m_Mode: 3 - m_WrapAround: 0 - m_SelectOnUp: {fileID: 0} - m_SelectOnDown: {fileID: 0} - m_SelectOnLeft: {fileID: 0} - m_SelectOnRight: {fileID: 0} - m_Transition: 1 - m_Colors: - m_NormalColor: {r: 1, g: 1, b: 1, a: 1} - m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} - m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} - m_ColorMultiplier: 1 - m_FadeDuration: 0.1 - m_SpriteState: - m_HighlightedSprite: {fileID: 0} - m_PressedSprite: {fileID: 0} - m_SelectedSprite: {fileID: 0} - m_DisabledSprite: {fileID: 0} - m_AnimationTriggers: - m_NormalTrigger: Normal - m_HighlightedTrigger: Highlighted - m_PressedTrigger: Pressed - m_SelectedTrigger: Selected - m_DisabledTrigger: Disabled - m_Interactable: 1 - m_TargetGraphic: {fileID: 1631780391} - m_OnClick: - m_PersistentCalls: - m_Calls: [] --- !u!1 &1644648865 GameObject: m_ObjectHideFlags: 0 @@ -12042,7 +11733,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 130} - m_SizeDelta: {x: 750, y: 50} + m_SizeDelta: {x: 500, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1644648867 MonoBehaviour: @@ -12599,7 +12290,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 150} - m_SizeDelta: {x: 750, y: 50} + m_SizeDelta: {x: 500, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1759974816 MonoBehaviour: @@ -13454,142 +13145,6 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: [] ---- !u!1 &1848970634 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1848970635} - - component: {fileID: 1848970637} - - component: {fileID: 1848970636} - m_Layer: 5 - m_Name: Text (TMP) - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1848970635 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1848970634} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 631318020} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &1848970636 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1848970634} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_text: Login - m_isRightToLeft: 0 - m_fontAsset: {fileID: 11400000, guid: 4fd546dd0900395408d2de20f5025882, type: 2} - m_sharedMaterial: {fileID: -1476194838487357290, guid: 4fd546dd0900395408d2de20f5025882, type: 2} - m_fontSharedMaterials: [] - m_fontMaterial: {fileID: 0} - m_fontMaterials: [] - m_fontColor32: - serializedVersion: 2 - rgba: 4278190080 - m_fontColor: {r: 0, g: 0, b: 0, a: 1} - m_enableVertexGradient: 0 - m_colorMode: 3 - m_fontColorGradient: - topLeft: {r: 1, g: 1, b: 1, a: 1} - topRight: {r: 1, g: 1, b: 1, a: 1} - bottomLeft: {r: 1, g: 1, b: 1, a: 1} - bottomRight: {r: 1, g: 1, b: 1, a: 1} - m_fontColorGradientPreset: {fileID: 0} - m_spriteAsset: {fileID: 0} - m_tintAllSprites: 0 - m_StyleSheet: {fileID: 0} - m_TextStyleHashCode: -1183493901 - m_overrideHtmlColors: 0 - m_faceColor: - serializedVersion: 2 - rgba: 4294967295 - m_fontSize: 24 - m_fontSizeBase: 24 - m_fontWeight: 400 - m_enableAutoSizing: 0 - m_fontSizeMin: 18 - m_fontSizeMax: 72 - m_fontStyle: 0 - m_HorizontalAlignment: 2 - m_VerticalAlignment: 512 - m_textAlignment: 65535 - m_characterSpacing: 0 - m_wordSpacing: 0 - m_lineSpacing: 0 - m_lineSpacingMax: 0 - m_paragraphSpacing: 0 - m_charWidthMaxAdj: 0 - m_TextWrappingMode: 1 - m_wordWrappingRatios: 0.4 - m_overflowMode: 0 - m_linkedTextComponent: {fileID: 0} - parentLinkedComponent: {fileID: 0} - m_enableKerning: 0 - m_ActiveFontFeatures: 6e72656b - m_enableExtraPadding: 0 - checkPaddingRequired: 0 - m_isRichText: 1 - m_EmojiFallbackSupport: 1 - m_parseCtrlCharacters: 1 - m_isOrthographic: 1 - m_isCullingEnabled: 0 - m_horizontalMapping: 0 - m_verticalMapping: 0 - m_uvLineOffset: 0 - m_geometrySortingOrder: 0 - m_IsTextObjectScaleStatic: 0 - m_VertexBufferAutoSizeReduction: 0 - m_useMaxVisibleDescender: 1 - m_pageToDisplay: 1 - m_margin: {x: 0, y: 0, z: 0, w: 0} - m_isUsingLegacyAnimationComponent: 0 - m_isVolumetricText: 0 - m_hasFontAssetChanged: 0 - m_baseMaterial: {fileID: 0} - m_maskOffset: {x: 0, y: 0, z: 0, w: 0} ---- !u!222 &1848970637 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1848970634} - m_CullTransparentMesh: 1 --- !u!1 &1848992336 GameObject: m_ObjectHideFlags: 0 @@ -13877,6 +13432,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1880819783} + - component: {fileID: 1880819784} m_Layer: 5 m_Name: LoginMenu m_TagString: Untagged @@ -13908,6 +13464,23 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 200, y: 50} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1880819784 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1880819782} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 396f21a29cb8a2844884c0daac1a67ee, type: 3} + m_Name: + m_EditorClassIdentifier: + loginPanelStatusText: {fileID: 1759974816} + loginUsernameInput: {fileID: 1466613308} + loginPasswordInput: {fileID: 1993836203} + loginBackButton: {fileID: 842914402} + loginSubmitButton: {fileID: 707065275} --- !u!1 &1888048645 GameObject: m_ObjectHideFlags: 0 @@ -15037,7 +14610,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 130} - m_SizeDelta: {x: 750, y: 50} + m_SizeDelta: {x: 500, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1994034180 MonoBehaviour: @@ -16154,7 +15727,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 415, y: -25} + m_AnchoredPosition: {x: 250, y: -25} m_SizeDelta: {x: 150, y: 50} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2098645305 diff --git a/Assets/Scripts/AccountMenu.cs b/Assets/Scripts/AccountMenu.cs deleted file mode 100644 index 303272f..0000000 --- a/Assets/Scripts/AccountMenu.cs +++ /dev/null @@ -1,558 +0,0 @@ -using System.Text.RegularExpressions; -using System; -using TMPro; -using UnityEngine; -using UnityEngine.Networking; -using UnityEngine.UI; -using UnityEngine.SceneManagement; -using System.Numerics; - -public class AccountMenu : MonoBehaviour -{ - public GameObject loggedInPanel; - public TMP_Text loggedInText; - public Button loggedInChangeUsernameButton; - public Button loggedInChangePasswordButton; - public Button loggedInSaveButton; - public Button loggedInLoadButton; - public Button loggedInRefreshLoginButton; - public Button loggedInLogoutButton; - public Button loggedInBackButton; - - public GameObject loggedOutPanel; - public Button loggedOutLoginButton; - public Button loggedOutRegisterButton; - public Button loggedOutBackButton; - - public GameObject loginPanel; - public TMP_Text loginPanelStatusText; - public TMP_InputField loginUsernameInput; - public TMP_InputField loginPasswordInput; - public Button loginRegisterButton; - public Button loginBackButton; - public Button loginSubmitButton; - - public GameObject registerPanel; - public TMP_Text registerPanelStatusText; - public TMP_InputField registerUsernameInput; - public TMP_InputField registerEmailInput; - public TMP_InputField registerRetypeEmailInput; - public TMP_InputField registerPasswordInput; - public TMP_InputField registerRetypePasswordInput; - public Button registerLoginButton; - public Button registerBackButton; - public Button registerSubmitButton; - - public GameObject changeUsernamePanel; - public TMP_Text changeUsernameStatusText; - public TMP_InputField changeUsernameCurrentUsernameInput; - public TMP_InputField changeUsernameNewUsernameInput; - public Button changeUsernameBackButton; - public Button changeUsernameSubmitButton; - - public GameObject changePasswordPanel; - public TMP_Text changePasswordStatusText; - public TMP_InputField changePasswordCurrentPasswordInput; - public TMP_InputField changePasswordNewPasswordInput; - public TMP_InputField changePasswordRetypeNewPasswordInput; - public Button changePasswordBackButton; - public Button changePasswordSubmitButton; - - public GameObject refreshLoginPanel; - public TMP_Text refreshLoginStatusText; - public TMP_InputField refreshLoginUsernameInput; - public TMP_InputField refreshLoginPasswordInput; - public Button refreshLoginBackButton; - public Button refreshLoginSubmitButton; - - void Awake() - { - if (PlayerPrefs.HasKey("gameSession") && PlayerPrefs.HasKey("userName") && PlayerPrefs.HasKey("userId")) - { - SwitchPanel(0); - } - else - { - SwitchPanel(1); - } - - loggedInChangeUsernameButton.onClick.AddListener(() => SwitchPanel(4)); - loggedInChangePasswordButton.onClick.AddListener(() => SwitchPanel(5)); - loggedInSaveButton.onClick.AddListener(() => SaveAccount()); - loggedInLoadButton.onClick.AddListener(() => LoadAccount()); - loggedInRefreshLoginButton.onClick.AddListener(() => SwitchPanel(6)); - loggedInLogoutButton.onClick.AddListener(() => SwitchPanel(1)); - loggedInBackButton.onClick.AddListener(async () => await SceneManager.LoadSceneAsync("MainMenu")); - loggedOutLoginButton.onClick.AddListener(() => SwitchPanel(2)); - loggedOutRegisterButton.onClick.AddListener(() => SwitchPanel(3)); - loggedOutBackButton.onClick = loggedInBackButton.onClick; - loginRegisterButton.onClick.AddListener(() => SwitchPanel(3)); - loginBackButton.onClick.AddListener(() => SwitchPanel(1)); - loginSubmitButton.onClick.AddListener(() => SubmitLogin()); - registerLoginButton.onClick.AddListener(() => SwitchPanel(2)); - registerBackButton.onClick.AddListener(() => SwitchPanel(1)); - registerSubmitButton.onClick.AddListener(() => SubmitRegister()); - changeUsernameBackButton.onClick.AddListener(() => SwitchPanel(0)); - changeUsernameSubmitButton.onClick.AddListener(() => ChangeUsername()); - changePasswordBackButton.onClick.AddListener(() => SwitchPanel(0)); - changePasswordSubmitButton.onClick.AddListener(() => ChangePassword()); - refreshLoginBackButton.onClick.AddListener(() => SwitchPanel(0)); - refreshLoginSubmitButton.onClick.AddListener(() => RefreshLogin()); - } - - void SwitchPanel(int panel) - { - switch (panel) - { - case 0: - loggedInSaveButton.interactable = true; - loggedInLoadButton.interactable = true; - loggedInText.text = "Logged in as: " + PlayerPrefs.GetString("userName"); - loggedInPanel.SetActive(true); - loggedOutPanel.SetActive(false); - loginPanel.SetActive(false); - registerPanel.SetActive(false); - changeUsernamePanel.SetActive(false); - changePasswordPanel.SetActive(false); - refreshLoginPanel.SetActive(false); - break; - case 1: - PlayerPrefs.DeleteKey("gameSession"); - PlayerPrefs.DeleteKey("userName"); - PlayerPrefs.DeleteKey("userId"); - PlayerPrefs.SetString("HighScoreV2", "0"); - PlayerPrefs.SetInt("icon", 1); - PlayerPrefs.SetInt("overlay", 0); - loggedInPanel.SetActive(false); - loggedOutPanel.SetActive(true); - loginPanel.SetActive(false); - registerPanel.SetActive(false); - changeUsernamePanel.SetActive(false); - changePasswordPanel.SetActive(false); - refreshLoginPanel.SetActive(false); - break; - case 2: - loginUsernameInput.text = ""; - loginPasswordInput.text = ""; - loginPanelStatusText.text = ""; - loggedInPanel.SetActive(false); - loggedOutPanel.SetActive(false); - loginPanel.SetActive(true); - registerPanel.SetActive(false); - changeUsernamePanel.SetActive(false); - changePasswordPanel.SetActive(false); - refreshLoginPanel.SetActive(false); - break; - case 3: - registerUsernameInput.text = ""; - registerEmailInput.text = ""; - registerRetypeEmailInput.text = ""; - registerPasswordInput.text = ""; - registerRetypePasswordInput.text = ""; - registerPanelStatusText.text = ""; - loggedInPanel.SetActive(false); - loggedOutPanel.SetActive(false); - loginPanel.SetActive(false); - registerPanel.SetActive(true); - changeUsernamePanel.SetActive(false); - changePasswordPanel.SetActive(false); - refreshLoginPanel.SetActive(false); - break; - case 4: - changeUsernameCurrentUsernameInput.text = ""; - changeUsernameNewUsernameInput.text = ""; - changeUsernameStatusText.text = ""; - loggedInPanel.SetActive(false); - loggedOutPanel.SetActive(false); - loginPanel.SetActive(false); - registerPanel.SetActive(false); - changeUsernamePanel.SetActive(true); - changePasswordPanel.SetActive(false); - refreshLoginPanel.SetActive(false); - break; - case 5: - changePasswordCurrentPasswordInput.text = ""; - changePasswordNewPasswordInput.text = ""; - changePasswordRetypeNewPasswordInput.text = ""; - changePasswordStatusText.text = ""; - loggedInPanel.SetActive(false); - loggedOutPanel.SetActive(false); - loginPanel.SetActive(false); - registerPanel.SetActive(false); - changeUsernamePanel.SetActive(false); - changePasswordPanel.SetActive(true); - refreshLoginPanel.SetActive(false); - break; - case 6: - refreshLoginUsernameInput.text = ""; - refreshLoginPasswordInput.text = ""; - loggedInPanel.SetActive(false); - loggedOutPanel.SetActive(false); - loginPanel.SetActive(false); - registerPanel.SetActive(false); - changeUsernamePanel.SetActive(false); - changePasswordPanel.SetActive(false); - refreshLoginPanel.SetActive(true); - break; - } - } - - async void SubmitRegister() - { - if (!registerEmailInput.text.Trim().Equals(registerRetypeEmailInput.text.Trim(), StringComparison.OrdinalIgnoreCase)) - { - UpdateStatusText(registerPanelStatusText, "Email doesn't match", Color.red); - return; - } - if (!registerPasswordInput.text.Trim().Equals(registerRetypePasswordInput.text.Trim(), StringComparison.OrdinalIgnoreCase)) - { - UpdateStatusText(registerPanelStatusText, "Password doesn't match", Color.red); - return; - } - if (!Regex.IsMatch(registerUsernameInput.text, "^[a-zA-Z0-9]{3,16}$")) - { - UpdateStatusText(registerPanelStatusText, "Username must be 3-16 characters, letters and numbers only", Color.red); - return; - } - WWWForm dataForm = new(); - dataForm.AddField("username", registerUsernameInput.text); - dataForm.AddField("email", registerEmailInput.text); - dataForm.AddField("password", registerPasswordInput.text); - using UnityWebRequest request = UnityWebRequest.Post("https://berrydash.lncvrt.xyz/database/registerAccount.php", dataForm); - request.SetRequestHeader("User-Agent", "BerryDashClient"); - request.SetRequestHeader("ClientVersion", Application.version); - request.SetRequestHeader("ClientPlatform", Application.platform.ToString()); - await request.SendWebRequest(); - if (request.result != UnityWebRequest.Result.Success) - { - UpdateStatusText(registerPanelStatusText, "Failed to make HTTP request", Color.red); - return; - } - string response = request.downloadHandler.text; - switch (response) - { - case "1": - SwitchPanel(2); - break; - case "-1": - UpdateStatusText(registerPanelStatusText, "Internal login server error", Color.red); - break; - case "-2": - UpdateStatusText(registerPanelStatusText, "Incomplete form data", Color.red); - break; - case "-3": - UpdateStatusText(registerPanelStatusText, "Username not valid", Color.red); - break; - case "-4": - UpdateStatusText(registerPanelStatusText, "Email not valid", Color.red); - break; - case "-5": - UpdateStatusText(registerPanelStatusText, "Password must have 8 characters, one number and one letter", Color.red); - break; - case "-6": - UpdateStatusText(registerPanelStatusText, "Username too long or short", Color.red); - break; - case "-7": - UpdateStatusText(registerPanelStatusText, "Username must be 3-16 characters, letters and numbers only", Color.red); - break; - case "-8": - UpdateStatusText(registerPanelStatusText, "Username or email already exists", Color.red); - break; - default: - UpdateStatusText(registerPanelStatusText, "Unknown server response", Color.red); - break; - } - } - - async void SubmitLogin() - { - WWWForm dataForm = new(); - dataForm.AddField("username", loginUsernameInput.text); - dataForm.AddField("password", loginPasswordInput.text); - dataForm.AddField("currentHighScore", PlayerPrefs.GetString("HighScoreV2", "0")); - dataForm.AddField("loginType", "0"); - using UnityWebRequest request = UnityWebRequest.Post("https://berrydash.lncvrt.xyz/database/loginAccount.php", dataForm); - request.SetRequestHeader("User-Agent", "BerryDashClient"); - request.SetRequestHeader("ClientVersion", Application.version); - request.SetRequestHeader("ClientPlatform", Application.platform.ToString()); - await request.SendWebRequest(); - if (request.result != UnityWebRequest.Result.Success) - { - UpdateStatusText(loginPanelStatusText, "Failed to make HTTP request", Color.red); - return; - } - string response = request.downloadHandler.text; - if (response != "-1") - { - if (response == "-2") - { - UpdateStatusText(loginPanelStatusText, "Incorrect username or password", Color.red); - } - else if (response.Split(":")[0] == "1") - { - string[] array = response.Split(':'); - string session = array[1]; - string userName = array[2]; - int userId = int.Parse(array[3]); - BigInteger highScore = BigInteger.Parse(array[4]); - int iconId = int.Parse(array[5]); - int overlayId = int.Parse(array[6]); - PlayerPrefs.SetString("gameSession", session); - PlayerPrefs.SetString("userName", userName); - PlayerPrefs.SetInt("userId", userId); - PlayerPrefs.SetString("HighScoreV2", highScore.ToString()); - PlayerPrefs.SetInt("icon", iconId); - PlayerPrefs.SetInt("overlay", overlayId); - SwitchPanel(0); - UpdateStatusText(loginPanelStatusText, "", Color.red); - } - else - { - UpdateStatusText(loginPanelStatusText, "Unknown server response", Color.red); - } - } - else - { - UpdateStatusText(loginPanelStatusText, "Internal login server error", Color.red); - } - } - - async void ChangeUsername() - { - WWWForm dataForm = new(); - dataForm.AddField("inputUserName", changeUsernameCurrentUsernameInput.text); - dataForm.AddField("inputNewUserName", changeUsernameNewUsernameInput.text); - dataForm.AddField("session", PlayerPrefs.GetString("gameSession")); - dataForm.AddField("userName", PlayerPrefs.GetString("userName")); - using UnityWebRequest request = UnityWebRequest.Post("https://berrydash.lncvrt.xyz/database/changeAccountUsername.php", dataForm); - request.SetRequestHeader("User-Agent", "BerryDashClient"); - request.SetRequestHeader("ClientVersion", Application.version); - request.SetRequestHeader("ClientPlatform", Application.platform.ToString()); - await request.SendWebRequest(); - if (request.result != UnityWebRequest.Result.Success) - { - UpdateStatusText(changeUsernameStatusText, "Failed to make HTTP request", Color.red); - return; - } - string response = request.downloadHandler.text; - switch (response) - { - case "1": - PlayerPrefs.SetString("userName", changeUsernameNewUsernameInput.text); - SwitchPanel(0); - UpdateStatusText(loggedInText, "Username changed successfully", Color.green); - break; - case "-1": - UpdateStatusText(changeUsernameStatusText, "Internal login server error", Color.red); - break; - case "-2": - UpdateStatusText(changeUsernameStatusText, "New Username is too short or too long", Color.red); - break; - case "-3": - UpdateStatusText(changeUsernameStatusText, "New Username does not match the required format", Color.red); - break; - case "-4": - UpdateStatusText(changeUsernameStatusText, "New username already exists", Color.red); - break; - default: - UpdateStatusText(changeUsernameStatusText, "Unknown server response", Color.red); - break; - } - } - - async void ChangePassword() - { - if (changePasswordNewPasswordInput.text != changePasswordRetypeNewPasswordInput.text) - { - UpdateStatusText(changePasswordStatusText, "Passwords do not match", Color.red); - return; - } - WWWForm dataForm = new(); - dataForm.AddField("inputPassword", changePasswordCurrentPasswordInput.text); - dataForm.AddField("inputNewPassword", changePasswordNewPasswordInput.text); - dataForm.AddField("session", PlayerPrefs.GetString("gameSession")); - dataForm.AddField("userName", PlayerPrefs.GetString("userName")); - using UnityWebRequest request = UnityWebRequest.Post("https://berrydash.lncvrt.xyz/database/changeAccountPassword.php", dataForm); - request.SetRequestHeader("User-Agent", "BerryDashClient"); - request.SetRequestHeader("ClientVersion", Application.version); - request.SetRequestHeader("ClientPlatform", Application.platform.ToString()); - await request.SendWebRequest(); - if (request.result != UnityWebRequest.Result.Success) - { - UpdateStatusText(changePasswordStatusText, "Failed to make HTTP request", Color.red); - return; - } - string response = request.downloadHandler.text; - switch (response) - { - case "-1": - UpdateStatusText(changePasswordStatusText, "Internal login server error", Color.red); - break; - case "-2": - UpdateStatusText(changePasswordStatusText, "New Password, Password, or username is empty", Color.red); - break; - case "-3": - UpdateStatusText(changePasswordStatusText, "New Password is too short or too long", Color.red); - break; - case "-4": - UpdateStatusText(changePasswordStatusText, "Username must be 3-16 characters, letters and numbers only", Color.red); - break; - case "-5": - UpdateStatusText(changePasswordStatusText, "Incorrect current password", Color.red); - break; - case "-6": - UpdateStatusText(changePasswordStatusText, "Current username is incorrect", Color.red); - break; - case "-7": - UpdateStatusText(changePasswordStatusText, "New password cannot be the same as your old password", Color.red); - break; - } - if (Regex.IsMatch(response, "^[a-zA-Z0-9]{512}$")) - { - PlayerPrefs.SetString("gameSession", response); - SwitchPanel(0); - UpdateStatusText(loggedInText, "Password changed successfully", Color.green); - } - else - { - UpdateStatusText(changePasswordStatusText, "Unknown server response " + response, Color.red); - } - } - - async void SaveAccount() - { - loggedInLoadButton.interactable = false; - loggedInSaveButton.interactable = false; - WWWForm dataForm = new(); - dataForm.AddField("userName", PlayerPrefs.GetString("userName", "")); - dataForm.AddField("gameSession", PlayerPrefs.GetString("gameSession", "")); - dataForm.AddField("highScore", PlayerPrefs.GetString("HighScoreV2", "0")); - dataForm.AddField("icon", PlayerPrefs.GetInt("icon", 1).ToString()); - dataForm.AddField("overlay", PlayerPrefs.GetInt("overlay", 0).ToString()); - using UnityWebRequest request = UnityWebRequest.Post("https://berrydash.lncvrt.xyz/database/saveAccount.php", dataForm); - request.SetRequestHeader("User-Agent", "BerryDashClient"); - request.SetRequestHeader("ClientVersion", Application.version); - request.SetRequestHeader("ClientPlatform", Application.platform.ToString()); - await request.SendWebRequest(); - if (request.result != UnityWebRequest.Result.Success) - { - UpdateStatusText(loggedInText, "Failed to make HTTP request", Color.red); - return; - } - string response = request.downloadHandler.text; - switch (response) - { - case "1": - UpdateStatusText(loggedInText, "Synced account", Color.green); - break; - case "-1": - UpdateStatusText(loggedInText, "Internal login server error", Color.red); - break; - case "-2": - SwitchPanel(0); - break; - default: - UpdateStatusText(loggedInText, "Unknown server response", Color.red); - break; - } - loggedInLoadButton.interactable = true; - loggedInSaveButton.interactable = true; - } - - async void LoadAccount() - { - loggedInLoadButton.interactable = false; - loggedInSaveButton.interactable = false; - WWWForm dataForm = new(); - dataForm.AddField("userName", PlayerPrefs.GetString("userName", "")); - dataForm.AddField("gameSession", PlayerPrefs.GetString("gameSession", "")); - using UnityWebRequest request = UnityWebRequest.Post("https://berrydash.lncvrt.xyz/database/loadAccount.php", dataForm); - request.SetRequestHeader("User-Agent", "BerryDashClient"); - request.SetRequestHeader("ClientVersion", Application.version); - request.SetRequestHeader("ClientPlatform", Application.platform.ToString()); - await request.SendWebRequest(); - if (request.result != UnityWebRequest.Result.Success) - { - UpdateStatusText(loggedInText, "Failed to make HTTP request", Color.red); - return; - } - string response = request.downloadHandler.text; - switch (response) - { - case "-1": - UpdateStatusText(loggedInText, "Internal login server error", Color.red); - break; - case "-2": - SwitchPanel(0); - break; - default: - var split = response.Split(":"); - if (split[0] == "1") - { - PlayerPrefs.SetString("HighScoreV2", split[1]); - PlayerPrefs.SetInt("icon", int.Parse(split[2])); - PlayerPrefs.SetInt("overlay", int.Parse(split[3])); - UpdateStatusText(loggedInText, "Loaded account data", Color.green); - } - else - { - UpdateStatusText(loggedInText, "Unknown server response", Color.red); - } - break; - } - loggedInLoadButton.interactable = true; - loggedInSaveButton.interactable = true; - } - - async void RefreshLogin() - { - WWWForm dataForm = new(); - dataForm.AddField("username", refreshLoginUsernameInput.text); - dataForm.AddField("password", refreshLoginPasswordInput.text); - dataForm.AddField("loginType", "1"); - using UnityWebRequest request = UnityWebRequest.Post("https://berrydash.lncvrt.xyz/database/loginAccount.php", dataForm); - request.SetRequestHeader("User-Agent", "BerryDashClient"); - request.SetRequestHeader("ClientVersion", Application.version); - request.SetRequestHeader("ClientPlatform", Application.platform.ToString()); - await request.SendWebRequest(); - if (request.result != UnityWebRequest.Result.Success) - { - UpdateStatusText(refreshLoginStatusText, "Failed to make HTTP request", Color.red); - return; - } - string response = request.downloadHandler.text; - if (response != "-1") - { - if (response == "-2") - { - UpdateStatusText(refreshLoginStatusText, "Incorrect username or password", Color.red); - } - else if (response.Split(":")[0] == "1") - { - string[] array = response.Split(':'); - string session = array[1]; - string userName = array[2]; - int userId = int.Parse(array[3]); - PlayerPrefs.SetString("gameSession", session); - PlayerPrefs.SetString("userName", userName); - PlayerPrefs.SetInt("userId", userId); - SwitchPanel(0); - UpdateStatusText(refreshLoginStatusText, "", Color.red); - } - else - { - UpdateStatusText(refreshLoginStatusText, "Unknown server response", Color.red); - } - } - else - { - UpdateStatusText(refreshLoginStatusText, "Internal login server error", Color.red); - } - } - - void UpdateStatusText(TMP_Text statusText, string message, Color color) - { - statusText.text = message; - statusText.color = color; - } -} \ No newline at end of file diff --git a/Assets/Scripts/AccountMenu.meta b/Assets/Scripts/AccountMenu.meta new file mode 100644 index 0000000..d68ebbc --- /dev/null +++ b/Assets/Scripts/AccountMenu.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f99c5ab8b366c1e45894edb89fdafbd9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/AccountMenu/AccountChangePassword.cs b/Assets/Scripts/AccountMenu/AccountChangePassword.cs new file mode 100644 index 0000000..ea94f69 --- /dev/null +++ b/Assets/Scripts/AccountMenu/AccountChangePassword.cs @@ -0,0 +1,88 @@ +using System.Text.RegularExpressions; +using TMPro; +using UnityEngine; +using UnityEngine.Networking; +using UnityEngine.UI; + +public class AccountChangePassword : MonoBehaviour +{ + public TMP_Text changePasswordStatusText; + public TMP_InputField changePasswordCurrentPasswordInput; + public TMP_InputField changePasswordNewPasswordInput; + public TMP_InputField changePasswordRetypeNewPasswordInput; + public Button changePasswordBackButton; + public Button changePasswordSubmitButton; + + void Awake() + { + changePasswordBackButton.onClick.AddListener(() => AccountHandler.instance.SwitchPanel(0)); + changePasswordSubmitButton.onClick.AddListener(() => ChangePassword()); + } + + void OnEnable() + { + changePasswordCurrentPasswordInput.text = ""; + changePasswordNewPasswordInput.text = ""; + changePasswordRetypeNewPasswordInput.text = ""; + changePasswordStatusText.text = ""; + } + + async void ChangePassword() + { + if (changePasswordNewPasswordInput.text != changePasswordRetypeNewPasswordInput.text) + { + AccountHandler.UpdateStatusText(changePasswordStatusText, "Passwords do not match", Color.red); + return; + } + WWWForm dataForm = new(); + dataForm.AddField("inputPassword", changePasswordCurrentPasswordInput.text); + dataForm.AddField("inputNewPassword", changePasswordNewPasswordInput.text); + dataForm.AddField("session", PlayerPrefs.GetString("gameSession")); + dataForm.AddField("userName", PlayerPrefs.GetString("userName")); + using UnityWebRequest request = UnityWebRequest.Post("https://berrydash.lncvrt.xyz/database/changeAccountPassword.php", dataForm); + request.SetRequestHeader("User-Agent", "BerryDashClient"); + request.SetRequestHeader("ClientVersion", Application.version); + request.SetRequestHeader("ClientPlatform", Application.platform.ToString()); + await request.SendWebRequest(); + if (request.result != UnityWebRequest.Result.Success) + { + AccountHandler.UpdateStatusText(changePasswordStatusText, "Failed to make HTTP request", Color.red); + return; + } + string response = request.downloadHandler.text; + switch (response) + { + case "-1": + AccountHandler.UpdateStatusText(changePasswordStatusText, "Internal login server error", Color.red); + break; + case "-2": + AccountHandler.UpdateStatusText(changePasswordStatusText, "New Password, Password, or username is empty", Color.red); + break; + case "-3": + AccountHandler.UpdateStatusText(changePasswordStatusText, "New Password is too short or too long", Color.red); + break; + case "-4": + AccountHandler.UpdateStatusText(changePasswordStatusText, "Username must be 3-16 characters, letters and numbers only", Color.red); + break; + case "-5": + AccountHandler.UpdateStatusText(changePasswordStatusText, "Incorrect current password", Color.red); + break; + case "-6": + AccountHandler.UpdateStatusText(changePasswordStatusText, "Current username is incorrect", Color.red); + break; + case "-7": + AccountHandler.UpdateStatusText(changePasswordStatusText, "New password cannot be the same as your old password", Color.red); + break; + } + if (Regex.IsMatch(response, "^[a-zA-Z0-9]{512}$")) + { + PlayerPrefs.SetString("gameSession", response); + AccountHandler.instance.SwitchPanel(0); + AccountHandler.UpdateStatusText(AccountHandler.instance.accountLoggedIn.loggedInText, "Password changed successfully", Color.green); + } + else + { + AccountHandler.UpdateStatusText(changePasswordStatusText, "Unknown server response " + response, Color.red); + } + } +} diff --git a/Assets/Scripts/AccountMenu/AccountChangePassword.cs.meta b/Assets/Scripts/AccountMenu/AccountChangePassword.cs.meta new file mode 100644 index 0000000..cef9e2a --- /dev/null +++ b/Assets/Scripts/AccountMenu/AccountChangePassword.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: ae8dc061a6b24a14f81e1024c84f6695 \ No newline at end of file diff --git a/Assets/Scripts/AccountMenu/AccountChangeUsername.cs b/Assets/Scripts/AccountMenu/AccountChangeUsername.cs new file mode 100644 index 0000000..242e5e4 --- /dev/null +++ b/Assets/Scripts/AccountMenu/AccountChangeUsername.cs @@ -0,0 +1,69 @@ +using TMPro; +using UnityEngine; +using UnityEngine.Networking; +using UnityEngine.UI; + +public class AccountChangeUsername : MonoBehaviour +{ + public TMP_Text changeUsernameStatusText; + public TMP_InputField changeUsernameCurrentUsernameInput; + public TMP_InputField changeUsernameNewUsernameInput; + public Button changeUsernameBackButton; + public Button changeUsernameSubmitButton; + + void Awake() + { + changeUsernameBackButton.onClick.AddListener(() => AccountHandler.instance.SwitchPanel(0)); + changeUsernameSubmitButton.onClick.AddListener(() => ChangeUsername()); + } + + void OnEnable() + { + changeUsernameCurrentUsernameInput.text = ""; + changeUsernameNewUsernameInput.text = ""; + changeUsernameStatusText.text = ""; + } + + async void ChangeUsername() + { + WWWForm dataForm = new(); + dataForm.AddField("inputUserName", changeUsernameCurrentUsernameInput.text); + dataForm.AddField("inputNewUserName", changeUsernameNewUsernameInput.text); + dataForm.AddField("session", PlayerPrefs.GetString("gameSession")); + dataForm.AddField("userName", PlayerPrefs.GetString("userName")); + using UnityWebRequest request = UnityWebRequest.Post("https://berrydash.lncvrt.xyz/database/changeAccountUsername.php", dataForm); + request.SetRequestHeader("User-Agent", "BerryDashClient"); + request.SetRequestHeader("ClientVersion", Application.version); + request.SetRequestHeader("ClientPlatform", Application.platform.ToString()); + await request.SendWebRequest(); + if (request.result != UnityWebRequest.Result.Success) + { + AccountHandler.UpdateStatusText(changeUsernameStatusText, "Failed to make HTTP request", Color.red); + return; + } + string response = request.downloadHandler.text; + switch (response) + { + case "1": + PlayerPrefs.SetString("userName", changeUsernameNewUsernameInput.text); + AccountHandler.instance.SwitchPanel(0); + AccountHandler.UpdateStatusText(AccountHandler.instance.accountLoggedIn.loggedInText, "Username changed successfully", Color.green); + break; + case "-1": + AccountHandler.UpdateStatusText(changeUsernameStatusText, "Internal login server error", Color.red); + break; + case "-2": + AccountHandler.UpdateStatusText(changeUsernameStatusText, "New Username is too short or too long", Color.red); + break; + case "-3": + AccountHandler.UpdateStatusText(changeUsernameStatusText, "New Username does not match the required format", Color.red); + break; + case "-4": + AccountHandler.UpdateStatusText(changeUsernameStatusText, "New username already exists", Color.red); + break; + default: + AccountHandler.UpdateStatusText(changeUsernameStatusText, "Unknown server response", Color.red); + break; + } + } +} diff --git a/Assets/Scripts/AccountMenu/AccountChangeUsername.cs.meta b/Assets/Scripts/AccountMenu/AccountChangeUsername.cs.meta new file mode 100644 index 0000000..14943f2 --- /dev/null +++ b/Assets/Scripts/AccountMenu/AccountChangeUsername.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: be362dee96ceba548be09c7fede7bf16 \ No newline at end of file diff --git a/Assets/Scripts/AccountMenu/AccountHandler.cs b/Assets/Scripts/AccountMenu/AccountHandler.cs new file mode 100644 index 0000000..c8475cc --- /dev/null +++ b/Assets/Scripts/AccountMenu/AccountHandler.cs @@ -0,0 +1,107 @@ +using TMPro; +using UnityEngine; + +public class AccountHandler : MonoBehaviour +{ + public static AccountHandler instance; + public AccountLoggedIn accountLoggedIn; + public AccountLoggedOut accountLoggedOut; + public AccountLogin accountLogin; + public AccountRegister accountRegister; + public AccountChangeUsername accountChangeUsername; + public AccountChangePassword accountChangePassword; + public AccountRefreshLogin accountRefreshLogin; + + void Awake() + { + instance = this; + } + + void Start() + { + if (PlayerPrefs.HasKey("gameSession") && PlayerPrefs.HasKey("userName") && PlayerPrefs.HasKey("userId")) + { + SwitchPanel(0); + } + else + { + SwitchPanel(1); + } + } + + public void SwitchPanel(int panel) + { + switch (panel) + { + case 0: + accountLoggedIn.gameObject.SetActive(true); + accountLoggedOut.gameObject.SetActive(false); + accountLogin.gameObject.SetActive(false); + accountRegister.gameObject.SetActive(false); + accountChangeUsername.gameObject.SetActive(false); + accountChangePassword.gameObject.SetActive(false); + accountRefreshLogin.gameObject.SetActive(false); + break; + case 1: + accountLoggedIn.gameObject.SetActive(false); + accountLoggedOut.gameObject.SetActive(true); + accountLogin.gameObject.SetActive(false); + accountRegister.gameObject.SetActive(false); + accountChangeUsername.gameObject.SetActive(false); + accountChangePassword.gameObject.SetActive(false); + accountRefreshLogin.gameObject.SetActive(false); + break; + case 2: + accountLoggedIn.gameObject.SetActive(false); + accountLoggedOut.gameObject.SetActive(false); + accountLogin.gameObject.SetActive(true); + accountRegister.gameObject.SetActive(false); + accountChangeUsername.gameObject.SetActive(false); + accountChangePassword.gameObject.SetActive(false); + accountRefreshLogin.gameObject.SetActive(false); + break; + case 3: + accountLoggedIn.gameObject.SetActive(false); + accountLoggedOut.gameObject.SetActive(false); + accountLogin.gameObject.SetActive(false); + accountRegister.gameObject.SetActive(true); + accountChangeUsername.gameObject.SetActive(false); + accountChangePassword.gameObject.SetActive(false); + accountRefreshLogin.gameObject.SetActive(false); + break; + case 4: + accountLoggedIn.gameObject.SetActive(false); + accountLoggedOut.gameObject.SetActive(false); + accountLogin.gameObject.SetActive(false); + accountRegister.gameObject.SetActive(false); + accountChangeUsername.gameObject.SetActive(true); + accountChangePassword.gameObject.SetActive(false); + accountRefreshLogin.gameObject.SetActive(false); + break; + case 5: + accountLoggedIn.gameObject.SetActive(false); + accountLoggedOut.gameObject.SetActive(false); + accountLogin.gameObject.SetActive(false); + accountRegister.gameObject.SetActive(false); + accountChangeUsername.gameObject.SetActive(false); + accountChangePassword.gameObject.SetActive(true); + accountRefreshLogin.gameObject.SetActive(false); + break; + case 6: + accountLoggedIn.gameObject.SetActive(false); + accountLoggedOut.gameObject.SetActive(false); + accountLogin.gameObject.SetActive(false); + accountRegister.gameObject.SetActive(false); + accountChangeUsername.gameObject.SetActive(false); + accountChangePassword.gameObject.SetActive(false); + accountRefreshLogin.gameObject.SetActive(true); + break; + } + } + + public static void UpdateStatusText(TMP_Text statusText, string message, Color color) + { + statusText.text = message; + statusText.color = color; + } +} \ No newline at end of file diff --git a/Assets/Scripts/AccountMenu.cs.meta b/Assets/Scripts/AccountMenu/AccountHandler.cs.meta similarity index 100% rename from Assets/Scripts/AccountMenu.cs.meta rename to Assets/Scripts/AccountMenu/AccountHandler.cs.meta diff --git a/Assets/Scripts/AccountMenu/AccountLoggedIn.cs b/Assets/Scripts/AccountMenu/AccountLoggedIn.cs new file mode 100644 index 0000000..162ab9b --- /dev/null +++ b/Assets/Scripts/AccountMenu/AccountLoggedIn.cs @@ -0,0 +1,120 @@ +using TMPro; +using UnityEngine; +using UnityEngine.Networking; +using UnityEngine.SceneManagement; +using UnityEngine.UI; + +public class AccountLoggedIn : MonoBehaviour +{ + public TMP_Text loggedInText; + public Button loggedInChangeUsernameButton; + public Button loggedInChangePasswordButton; + public Button loggedInSaveButton; + public Button loggedInLoadButton; + public Button loggedInRefreshLoginButton; + public Button loggedInLogoutButton; + public Button loggedInBackButton; + + void Awake() + { + loggedInChangeUsernameButton.onClick.AddListener(() => AccountHandler.instance.SwitchPanel(4)); + loggedInChangePasswordButton.onClick.AddListener(() => AccountHandler.instance.SwitchPanel(5)); + loggedInSaveButton.onClick.AddListener(() => SaveAccount()); + loggedInLoadButton.onClick.AddListener(() => LoadAccount()); + loggedInRefreshLoginButton.onClick.AddListener(() => AccountHandler.instance.SwitchPanel(6)); + loggedInLogoutButton.onClick.AddListener(() => AccountHandler.instance.SwitchPanel(1)); + loggedInBackButton.onClick.AddListener(async () => await SceneManager.LoadSceneAsync("MainMenu")); + } + + void OnEnable() + { + loggedInSaveButton.interactable = true; + loggedInLoadButton.interactable = true; + loggedInText.text = "Logged in as: " + PlayerPrefs.GetString("userName"); + } + + async void SaveAccount() + { + loggedInLoadButton.interactable = false; + loggedInSaveButton.interactable = false; + WWWForm dataForm = new(); + dataForm.AddField("userName", PlayerPrefs.GetString("userName", "")); + dataForm.AddField("gameSession", PlayerPrefs.GetString("gameSession", "")); + dataForm.AddField("highScore", PlayerPrefs.GetString("HighScoreV2", "0")); + dataForm.AddField("icon", PlayerPrefs.GetInt("icon", 1).ToString()); + dataForm.AddField("overlay", PlayerPrefs.GetInt("overlay", 0).ToString()); + using UnityWebRequest request = UnityWebRequest.Post("https://berrydash.lncvrt.xyz/database/saveAccount.php", dataForm); + request.SetRequestHeader("User-Agent", "BerryDashClient"); + request.SetRequestHeader("ClientVersion", Application.version); + request.SetRequestHeader("ClientPlatform", Application.platform.ToString()); + await request.SendWebRequest(); + if (request.result != UnityWebRequest.Result.Success) + { + AccountHandler.UpdateStatusText(loggedInText, "Failed to make HTTP request", Color.red); + return; + } + string response = request.downloadHandler.text; + switch (response) + { + case "1": + AccountHandler.UpdateStatusText(loggedInText, "Synced account", Color.green); + break; + case "-1": + AccountHandler.UpdateStatusText(loggedInText, "Internal login server error", Color.red); + break; + case "-2": + AccountHandler.instance.SwitchPanel(0); + break; + default: + AccountHandler.UpdateStatusText(loggedInText, "Unknown server response", Color.red); + break; + } + loggedInLoadButton.interactable = true; + loggedInSaveButton.interactable = true; + } + + async void LoadAccount() + { + loggedInLoadButton.interactable = false; + loggedInSaveButton.interactable = false; + WWWForm dataForm = new(); + dataForm.AddField("userName", PlayerPrefs.GetString("userName", "")); + dataForm.AddField("gameSession", PlayerPrefs.GetString("gameSession", "")); + using UnityWebRequest request = UnityWebRequest.Post("https://berrydash.lncvrt.xyz/database/loadAccount.php", dataForm); + request.SetRequestHeader("User-Agent", "BerryDashClient"); + request.SetRequestHeader("ClientVersion", Application.version); + request.SetRequestHeader("ClientPlatform", Application.platform.ToString()); + await request.SendWebRequest(); + if (request.result != UnityWebRequest.Result.Success) + { + AccountHandler.UpdateStatusText(loggedInText, "Failed to make HTTP request", Color.red); + return; + } + string response = request.downloadHandler.text; + switch (response) + { + case "-1": + AccountHandler.UpdateStatusText(loggedInText, "Internal login server error", Color.red); + break; + case "-2": + AccountHandler.instance.SwitchPanel(0); + break; + default: + var split = response.Split(":"); + if (split[0] == "1") + { + PlayerPrefs.SetString("HighScoreV2", split[1]); + PlayerPrefs.SetInt("icon", int.Parse(split[2])); + PlayerPrefs.SetInt("overlay", int.Parse(split[3])); + AccountHandler.UpdateStatusText(loggedInText, "Loaded account data", Color.green); + } + else + { + AccountHandler.UpdateStatusText(loggedInText, "Unknown server response", Color.red); + } + break; + } + loggedInLoadButton.interactable = true; + loggedInSaveButton.interactable = true; + } +} diff --git a/Assets/Scripts/AccountMenu/AccountLoggedIn.cs.meta b/Assets/Scripts/AccountMenu/AccountLoggedIn.cs.meta new file mode 100644 index 0000000..fef168a --- /dev/null +++ b/Assets/Scripts/AccountMenu/AccountLoggedIn.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 2f7c13bcd16e34840be5ed44f70b3824 \ No newline at end of file diff --git a/Assets/Scripts/AccountMenu/AccountLoggedOut.cs b/Assets/Scripts/AccountMenu/AccountLoggedOut.cs new file mode 100644 index 0000000..b2c20f8 --- /dev/null +++ b/Assets/Scripts/AccountMenu/AccountLoggedOut.cs @@ -0,0 +1,27 @@ +using UnityEngine; +using UnityEngine.SceneManagement; +using UnityEngine.UI; + +public class AccountLoggedOut : MonoBehaviour +{ + public Button loggedOutLoginButton; + public Button loggedOutRegisterButton; + public Button loggedOutBackButton; + + void Awake() + { + loggedOutLoginButton.onClick.AddListener(() => AccountHandler.instance.SwitchPanel(2)); + loggedOutRegisterButton.onClick.AddListener(() => AccountHandler.instance.SwitchPanel(3)); + loggedOutBackButton.onClick.AddListener(async () => await SceneManager.LoadSceneAsync("MainMenu")); + } + + void OnEnable() + { + PlayerPrefs.DeleteKey("gameSession"); + PlayerPrefs.DeleteKey("userName"); + PlayerPrefs.DeleteKey("userId"); + PlayerPrefs.SetString("HighScoreV2", "0"); + PlayerPrefs.SetInt("icon", 1); + PlayerPrefs.SetInt("overlay", 0); + } +} diff --git a/Assets/Scripts/AccountMenu/AccountLoggedOut.cs.meta b/Assets/Scripts/AccountMenu/AccountLoggedOut.cs.meta new file mode 100644 index 0000000..16cf03b --- /dev/null +++ b/Assets/Scripts/AccountMenu/AccountLoggedOut.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9d660b01e28b0234bb44f79e71fba5b3 \ No newline at end of file diff --git a/Assets/Scripts/AccountMenu/AccountLogin.cs b/Assets/Scripts/AccountMenu/AccountLogin.cs new file mode 100644 index 0000000..2a94763 --- /dev/null +++ b/Assets/Scripts/AccountMenu/AccountLogin.cs @@ -0,0 +1,80 @@ +using System.Numerics; +using TMPro; +using UnityEngine; +using UnityEngine.Networking; +using UnityEngine.UI; + +public class AccountLogin : MonoBehaviour +{ + public TMP_Text loginPanelStatusText; + public TMP_InputField loginUsernameInput; + public TMP_InputField loginPasswordInput; + public Button loginBackButton; + public Button loginSubmitButton; + + void Awake() + { + loginBackButton.onClick.AddListener(() => AccountHandler.instance.SwitchPanel(1)); + loginSubmitButton.onClick.AddListener(() => SubmitLogin()); + } + + void OnEnable() + { + loginUsernameInput.text = ""; + loginPasswordInput.text = ""; + loginPanelStatusText.text = ""; + } + + async void SubmitLogin() + { + WWWForm dataForm = new(); + dataForm.AddField("username", loginUsernameInput.text); + dataForm.AddField("password", loginPasswordInput.text); + dataForm.AddField("currentHighScore", PlayerPrefs.GetString("HighScoreV2", "0")); + dataForm.AddField("loginType", "0"); + using UnityWebRequest request = UnityWebRequest.Post("https://berrydash.lncvrt.xyz/database/loginAccount.php", dataForm); + request.SetRequestHeader("User-Agent", "BerryDashClient"); + request.SetRequestHeader("ClientVersion", Application.version); + request.SetRequestHeader("ClientPlatform", Application.platform.ToString()); + await request.SendWebRequest(); + if (request.result != UnityWebRequest.Result.Success) + { + AccountHandler.UpdateStatusText(loginPanelStatusText, "Failed to make HTTP request", Color.red); + return; + } + string response = request.downloadHandler.text; + if (response != "-1") + { + if (response == "-2") + { + AccountHandler.UpdateStatusText(loginPanelStatusText, "Incorrect username or password", Color.red); + } + else if (response.Split(":")[0] == "1") + { + string[] array = response.Split(':'); + string session = array[1]; + string userName = array[2]; + int userId = int.Parse(array[3]); + BigInteger highScore = BigInteger.Parse(array[4]); + int iconId = int.Parse(array[5]); + int overlayId = int.Parse(array[6]); + PlayerPrefs.SetString("gameSession", session); + PlayerPrefs.SetString("userName", userName); + PlayerPrefs.SetInt("userId", userId); + PlayerPrefs.SetString("HighScoreV2", highScore.ToString()); + PlayerPrefs.SetInt("icon", iconId); + PlayerPrefs.SetInt("overlay", overlayId); + AccountHandler.instance.SwitchPanel(0); + AccountHandler.UpdateStatusText(loginPanelStatusText, "", Color.red); + } + else + { + AccountHandler.UpdateStatusText(loginPanelStatusText, "Unknown server response", Color.red); + } + } + else + { + AccountHandler.UpdateStatusText(loginPanelStatusText, "Internal login server error", Color.red); + } + } +} diff --git a/Assets/Scripts/AccountMenu/AccountLogin.cs.meta b/Assets/Scripts/AccountMenu/AccountLogin.cs.meta new file mode 100644 index 0000000..f7f11cf --- /dev/null +++ b/Assets/Scripts/AccountMenu/AccountLogin.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 396f21a29cb8a2844884c0daac1a67ee \ No newline at end of file diff --git a/Assets/Scripts/AccountMenu/AccountRefreshLogin.cs b/Assets/Scripts/AccountMenu/AccountRefreshLogin.cs new file mode 100644 index 0000000..1e69ecb --- /dev/null +++ b/Assets/Scripts/AccountMenu/AccountRefreshLogin.cs @@ -0,0 +1,71 @@ +using TMPro; +using UnityEngine; +using UnityEngine.Networking; +using UnityEngine.UI; + +public class AccountRefreshLogin : MonoBehaviour +{ + public TMP_Text refreshLoginStatusText; + public TMP_InputField refreshLoginUsernameInput; + public TMP_InputField refreshLoginPasswordInput; + public Button refreshLoginBackButton; + public Button refreshLoginSubmitButton; + + void Awake() + { + refreshLoginBackButton.onClick.AddListener(() => AccountHandler.instance.SwitchPanel(0)); + refreshLoginSubmitButton.onClick.AddListener(() => RefreshLogin()); + } + + void OnEnable() + { + refreshLoginUsernameInput.text = ""; + refreshLoginPasswordInput.text = ""; + } + + async void RefreshLogin() + { + WWWForm dataForm = new(); + dataForm.AddField("username", refreshLoginUsernameInput.text); + dataForm.AddField("password", refreshLoginPasswordInput.text); + dataForm.AddField("loginType", "1"); + using UnityWebRequest request = UnityWebRequest.Post("https://berrydash.lncvrt.xyz/database/loginAccount.php", dataForm); + request.SetRequestHeader("User-Agent", "BerryDashClient"); + request.SetRequestHeader("ClientVersion", Application.version); + request.SetRequestHeader("ClientPlatform", Application.platform.ToString()); + await request.SendWebRequest(); + if (request.result != UnityWebRequest.Result.Success) + { + AccountHandler.UpdateStatusText(refreshLoginStatusText, "Failed to make HTTP request", Color.red); + return; + } + string response = request.downloadHandler.text; + if (response != "-1") + { + if (response == "-2") + { + AccountHandler.UpdateStatusText(refreshLoginStatusText, "Incorrect username or password", Color.red); + } + else if (response.Split(":")[0] == "1") + { + string[] array = response.Split(':'); + string session = array[1]; + string userName = array[2]; + int userId = int.Parse(array[3]); + PlayerPrefs.SetString("gameSession", session); + PlayerPrefs.SetString("userName", userName); + PlayerPrefs.SetInt("userId", userId); + AccountHandler.instance.SwitchPanel(0); + AccountHandler.UpdateStatusText(refreshLoginStatusText, "", Color.red); + } + else + { + AccountHandler.UpdateStatusText(refreshLoginStatusText, "Unknown server response", Color.red); + } + } + else + { + AccountHandler.UpdateStatusText(refreshLoginStatusText, "Internal login server error", Color.red); + } + } +} diff --git a/Assets/Scripts/AccountMenu/AccountRefreshLogin.cs.meta b/Assets/Scripts/AccountMenu/AccountRefreshLogin.cs.meta new file mode 100644 index 0000000..6d4bf9f --- /dev/null +++ b/Assets/Scripts/AccountMenu/AccountRefreshLogin.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 0cfd036ba0d22324d8dd09b06d7bcf75 \ No newline at end of file diff --git a/Assets/Scripts/AccountMenu/AccountRegister.cs b/Assets/Scripts/AccountMenu/AccountRegister.cs new file mode 100644 index 0000000..de96345 --- /dev/null +++ b/Assets/Scripts/AccountMenu/AccountRegister.cs @@ -0,0 +1,101 @@ +using System; +using System.Text.RegularExpressions; +using TMPro; +using UnityEngine; +using UnityEngine.Networking; +using UnityEngine.UI; + +public class AccountRegister : MonoBehaviour +{ + public TMP_Text registerPanelStatusText; + public TMP_InputField registerUsernameInput; + public TMP_InputField registerEmailInput; + public TMP_InputField registerRetypeEmailInput; + public TMP_InputField registerPasswordInput; + public TMP_InputField registerRetypePasswordInput; + public Button registerBackButton; + public Button registerSubmitButton; + + void Awake() + { + registerBackButton.onClick.AddListener(() => AccountHandler.instance.SwitchPanel(1)); + registerSubmitButton.onClick.AddListener(() => SubmitRegister()); + } + + void OnEnable() + { + registerUsernameInput.text = ""; + registerEmailInput.text = ""; + registerRetypeEmailInput.text = ""; + registerPasswordInput.text = ""; + registerRetypePasswordInput.text = ""; + registerPanelStatusText.text = ""; + } + + async void SubmitRegister() + { + if (!registerEmailInput.text.Trim().Equals(registerRetypeEmailInput.text.Trim(), StringComparison.OrdinalIgnoreCase)) + { + AccountHandler.UpdateStatusText(registerPanelStatusText, "Email doesn't match", Color.red); + return; + } + if (!registerPasswordInput.text.Trim().Equals(registerRetypePasswordInput.text.Trim(), StringComparison.OrdinalIgnoreCase)) + { + AccountHandler.UpdateStatusText(registerPanelStatusText, "Password doesn't match", Color.red); + return; + } + if (!Regex.IsMatch(registerUsernameInput.text, "^[a-zA-Z0-9]{3,16}$")) + { + AccountHandler.UpdateStatusText(registerPanelStatusText, "Username must be 3-16 characters, letters and numbers only", Color.red); + return; + } + WWWForm dataForm = new(); + dataForm.AddField("username", registerUsernameInput.text); + dataForm.AddField("email", registerEmailInput.text); + dataForm.AddField("password", registerPasswordInput.text); + using UnityWebRequest request = UnityWebRequest.Post("https://berrydash.lncvrt.xyz/database/registerAccount.php", dataForm); + request.SetRequestHeader("User-Agent", "BerryDashClient"); + request.SetRequestHeader("ClientVersion", Application.version); + request.SetRequestHeader("ClientPlatform", Application.platform.ToString()); + await request.SendWebRequest(); + if (request.result != UnityWebRequest.Result.Success) + { + AccountHandler.UpdateStatusText(registerPanelStatusText, "Failed to make HTTP request", Color.red); + return; + } + string response = request.downloadHandler.text; + switch (response) + { + case "1": + AccountHandler.instance.SwitchPanel(2); + break; + case "-1": + AccountHandler.UpdateStatusText(registerPanelStatusText, "Internal login server error", Color.red); + break; + case "-2": + AccountHandler.UpdateStatusText(registerPanelStatusText, "Incomplete form data", Color.red); + break; + case "-3": + AccountHandler.UpdateStatusText(registerPanelStatusText, "Username not valid", Color.red); + break; + case "-4": + AccountHandler.UpdateStatusText(registerPanelStatusText, "Email not valid", Color.red); + break; + case "-5": + AccountHandler.UpdateStatusText(registerPanelStatusText, "Password must have 8 characters, one number and one letter", Color.red); + break; + case "-6": + AccountHandler.UpdateStatusText(registerPanelStatusText, "Username too long or short", Color.red); + break; + case "-7": + AccountHandler.UpdateStatusText(registerPanelStatusText, "Username must be 3-16 characters, letters and numbers only", Color.red); + break; + case "-8": + AccountHandler.UpdateStatusText(registerPanelStatusText, "Username or email already exists", Color.red); + break; + default: + AccountHandler.UpdateStatusText(registerPanelStatusText, "Unknown server response", Color.red); + break; + } + } +} diff --git a/Assets/Scripts/AccountMenu/AccountRegister.cs.meta b/Assets/Scripts/AccountMenu/AccountRegister.cs.meta new file mode 100644 index 0000000..9359e98 --- /dev/null +++ b/Assets/Scripts/AccountMenu/AccountRegister.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 15b428d2b1e250a4385f3a56d0b4d43e \ No newline at end of file