From 743dc769134e921bb18bccbc401c8b6f75d72439 Mon Sep 17 00:00:00 2001 From: ryan Date: Sun, 16 Feb 2025 23:00:27 +0800 Subject: [PATCH] game: bug fixed(some) --- SSLR/Assets/Scenes/LiviPlayground.unity | 418 +++++------------- SSLR/Assets/Scripts/Backend.cs | 106 ++++- SSLR/Assets/Scripts/MenuButtons.cs | 15 +- .../Scripts/PlayerDialogueInteraction.cs | 7 +- SSLR/Assets/Scripts/StampDocument.cs | 141 +++--- SSLR/Assets/Scripts/supabaseClasses.cs | 1 + SSLR/Assets/UI/Designs/My Profile Page.png | 4 +- SSLR/ProjectSettings/TagManager.asset | 1 + 8 files changed, 299 insertions(+), 394 deletions(-) diff --git a/SSLR/Assets/Scenes/LiviPlayground.unity b/SSLR/Assets/Scenes/LiviPlayground.unity index f49a9f1..35c5374 100644 --- a/SSLR/Assets/Scenes/LiviPlayground.unity +++ b/SSLR/Assets/Scenes/LiviPlayground.unity @@ -1171,14 +1171,14 @@ MonoBehaviour: m_Calls: - m_Target: {fileID: 272065569} m_TargetAssemblyTypeName: PlayerDialogueInteraction, Assembly-CSharp - m_MethodName: OnResponseSelected - m_Mode: 1 + m_MethodName: OnServiceSelected + m_Mode: 5 m_Arguments: m_ObjectArgument: {fileID: 0} m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine m_IntArgument: 0 m_FloatArgument: 0 - m_StringArgument: + m_StringArgument: Transitional Shelters m_BoolArgument: 0 m_CallState: 2 --- !u!114 &144678496 @@ -2443,13 +2443,13 @@ MonoBehaviour: serviceTick: {fileID: 972086447} takeDocumentsTick: {fileID: 675043657} giveDocumentsTick: {fileID: 201719675} - comcareServiceButton: {fileID: 0} - fscServiceButton: {fileID: 0} - peersServiceButton: {fileID: 0} - transitionalSheltersServiceButton: {fileID: 0} - cpsServiceButton: {fileID: 0} - childrenYoungHomeServiceButton: {fileID: 0} - sgEnableServiceButton: {fileID: 0} + comcareServiceButton: {fileID: 2143047714} + fscServiceButton: {fileID: 1137450851} + peersServiceButton: {fileID: 405944146} + transitionalSheltersServiceButton: {fileID: 144678493} + cpsServiceButton: {fileID: 1270430611} + sgEnableServiceButton: {fileID: 783080947} + currentDocument: {fileID: 0} --- !u!1 &278641001 GameObject: m_ObjectHideFlags: 0 @@ -3737,6 +3737,7 @@ MonoBehaviour: daysPlayedText: {fileID: 1149788710} peopleHelpedText: {fileID: 983053282} accuracyText: {fileID: 912717248} + profilePicture: {fileID: 0} --- !u!1 &387529325 GameObject: m_ObjectHideFlags: 0 @@ -4238,14 +4239,14 @@ MonoBehaviour: m_Calls: - m_Target: {fileID: 272065569} m_TargetAssemblyTypeName: PlayerDialogueInteraction, Assembly-CSharp - m_MethodName: OnResponseSelected - m_Mode: 1 + m_MethodName: OnServiceSelected + m_Mode: 5 m_Arguments: m_ObjectArgument: {fileID: 0} m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine m_IntArgument: 0 m_FloatArgument: 0 - m_StringArgument: + m_StringArgument: PEERS m_BoolArgument: 0 m_CallState: 2 --- !u!114 &405944149 @@ -5672,6 +5673,7 @@ MonoBehaviour: m_EditorClassIdentifier: url: https://fchobpauqasfebohuuam.supabase.co anonKey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZjaG9icGF1cWFzZmVib2h1dWFtIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MzczNTYyNTUsImV4cCI6MjA1MjkzMjI1NX0.LkwCnzjtf8CPLrm6OONkjyjxZW8jE05V_spbOEeAXEM + profilePicture: {fileID: 1277945301} --- !u!1 &553967502 GameObject: m_ObjectHideFlags: 0 @@ -7203,7 +7205,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: -337} + m_AnchoredPosition: {x: 0, y: -222.00002} m_SizeDelta: {x: 610, y: 106} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &783080949 @@ -7252,14 +7254,14 @@ MonoBehaviour: m_Calls: - m_Target: {fileID: 272065569} m_TargetAssemblyTypeName: PlayerDialogueInteraction, Assembly-CSharp - m_MethodName: OnResponseSelected - m_Mode: 1 + m_MethodName: OnServiceSelected + m_Mode: 5 m_Arguments: m_ObjectArgument: {fileID: 0} m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine m_IntArgument: 0 m_FloatArgument: 0 - m_StringArgument: + m_StringArgument: SG Enable m_BoolArgument: 0 m_CallState: 2 --- !u!114 &783080950 @@ -9419,140 +9421,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 970254691} m_CullTransparentMesh: 1 ---- !u!1 &971476192 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 971476193} - - component: {fileID: 971476195} - - component: {fileID: 971476194} - 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 &971476193 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 971476192} - 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: 2072489055} - 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 &971476194 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 971476192} - 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: Children and Young Persons Homes - m_isRightToLeft: 0 - m_fontAsset: {fileID: 11400000, guid: a4ec23e5e0e9fb640bdb78c6361454d8, type: 2} - m_sharedMaterial: {fileID: -8726509614590951875, guid: a4ec23e5e0e9fb640bdb78c6361454d8, type: 2} - m_fontSharedMaterials: [] - m_fontMaterial: {fileID: 0} - m_fontMaterials: [] - m_fontColor32: - serializedVersion: 2 - rgba: 4294967295 - m_fontColor: {r: 1, g: 1, b: 1, 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: 37.4 - m_fontSizeBase: 37.4 - m_fontWeight: 400 - m_enableAutoSizing: 0 - m_fontSizeMin: 40 - 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_enableWordWrapping: 1 - m_wordWrappingRatios: 0.4 - m_overflowMode: 0 - m_linkedTextComponent: {fileID: 0} - parentLinkedComponent: {fileID: 0} - m_enableKerning: 1 - m_enableExtraPadding: 0 - checkPaddingRequired: 0 - m_isRichText: 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 &971476195 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 971476192} - m_CullTransparentMesh: 1 --- !u!1 &972086447 stripped GameObject: m_CorrespondingSourceObject: {fileID: 4082152673421047575, guid: 7795d1095e0684f468f5b8231bb7705f, type: 3} @@ -11082,14 +10950,14 @@ MonoBehaviour: m_Calls: - m_Target: {fileID: 272065569} m_TargetAssemblyTypeName: PlayerDialogueInteraction, Assembly-CSharp - m_MethodName: OnResponseSelected - m_Mode: 1 + m_MethodName: OnServiceSelected + m_Mode: 5 m_Arguments: m_ObjectArgument: {fileID: 0} m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine m_IntArgument: 0 m_FloatArgument: 0 - m_StringArgument: + m_StringArgument: FSC m_BoolArgument: 0 m_CallState: 2 --- !u!114 &1137450854 @@ -11445,7 +11313,19 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1144319696} m_OnClick: m_PersistentCalls: - m_Calls: [] + m_Calls: + - m_Target: {fileID: 387192628} + m_TargetAssemblyTypeName: MenuButtons, Assembly-CSharp + m_MethodName: Logout + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 --- !u!114 &1144319696 MonoBehaviour: m_ObjectHideFlags: 0 @@ -12152,6 +12032,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 6087617128238386579, guid: e82a63e1655bf9645aba4697304f862d, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 7198325426086921740, guid: e82a63e1655bf9645aba4697304f862d, type: 3} propertyPath: m_Name value: Spawnable_Doc @@ -13237,14 +13121,14 @@ MonoBehaviour: m_Calls: - m_Target: {fileID: 272065569} m_TargetAssemblyTypeName: PlayerDialogueInteraction, Assembly-CSharp - m_MethodName: OnResponseSelected - m_Mode: 1 + m_MethodName: OnServiceSelected + m_Mode: 5 m_Arguments: m_ObjectArgument: {fileID: 0} m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine m_IntArgument: 0 m_FloatArgument: 0 - m_StringArgument: + m_StringArgument: CPS m_BoolArgument: 0 m_CallState: 2 --- !u!114 &1270430614 @@ -13360,6 +13244,81 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1271681200} m_CullTransparentMesh: 1 +--- !u!1 &1277945299 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1277945300} + - component: {fileID: 1277945302} + - component: {fileID: 1277945301} + m_Layer: 5 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1277945300 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1277945299} + 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: 1696626647} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 247.2, y: 151.5} + m_SizeDelta: {x: 200, y: 200} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1277945301 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1277945299} + 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: 0} + m_Type: 0 + 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 &1277945302 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1277945299} + m_CullTransparentMesh: 1 --- !u!1 &1284755195 GameObject: m_ObjectHideFlags: 0 @@ -16472,7 +16431,6 @@ RectTransform: - {fileID: 405944147} - {fileID: 144678494} - {fileID: 1270430612} - - {fileID: 2072489055} - {fileID: 783080948} m_Father: {fileID: 272065567} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -17366,7 +17324,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &1696626647 RectTransform: m_ObjectHideFlags: 0 @@ -17385,6 +17343,7 @@ RectTransform: - {fileID: 912717250} - {fileID: 82586052} - {fileID: 1144319694} + - {fileID: 1277945300} m_Father: {fileID: 387192626} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -20699,139 +20658,6 @@ MonoBehaviour: m_EditorClassIdentifier: m_Padding: {x: -8, y: -5, z: -8, w: -5} m_Softness: {x: 0, y: 0} ---- !u!1 &2072489054 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2072489055} - - component: {fileID: 2072489058} - - component: {fileID: 2072489057} - - component: {fileID: 2072489056} - m_Layer: 5 - m_Name: Children Young Homes - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &2072489055 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2072489054} - 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: 971476193} - m_Father: {fileID: 1617137014} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: -222} - m_SizeDelta: {x: 610, y: 106} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &2072489056 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2072489054} - 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: 2072489057} - m_OnClick: - m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 272065569} - m_TargetAssemblyTypeName: PlayerDialogueInteraction, Assembly-CSharp - m_MethodName: OnResponseSelected - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 ---- !u!114 &2072489057 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2072489054} - 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: 21300000, guid: 1f0e7468f076e134abce4a23e28b246a, type: 3} - m_Type: 0 - 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 &2072489058 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2072489054} - m_CullTransparentMesh: 1 --- !u!1 &2073566867 GameObject: m_ObjectHideFlags: 0 @@ -21341,14 +21167,14 @@ MonoBehaviour: m_Calls: - m_Target: {fileID: 272065569} m_TargetAssemblyTypeName: PlayerDialogueInteraction, Assembly-CSharp - m_MethodName: OnResponseSelected - m_Mode: 1 + m_MethodName: OnServiceSelected + m_Mode: 5 m_Arguments: m_ObjectArgument: {fileID: 0} m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine m_IntArgument: 0 m_FloatArgument: 0 - m_StringArgument: + m_StringArgument: Comcare m_BoolArgument: 0 m_CallState: 2 --- !u!114 &2143047717 diff --git a/SSLR/Assets/Scripts/Backend.cs b/SSLR/Assets/Scripts/Backend.cs index 78eb6a8..8490232 100644 --- a/SSLR/Assets/Scripts/Backend.cs +++ b/SSLR/Assets/Scripts/Backend.cs @@ -1,10 +1,13 @@ +using System.Threading.Tasks; using UnityEngine; using Supabase; using Supabase.Gotrue; using Client = Supabase.Client; -using Firebase; using Firebase.Database; using Firebase.Extensions; +using UnityEngine.Networking; +using System; +using UnityEngine.UI; public class Backend : MonoBehaviour { @@ -13,11 +16,11 @@ public class Backend : MonoBehaviour [SerializeField] private string url; [SerializeField] private string anonKey; public Client Client; - + public Session Session; public Users User; - + public Image profilePicture; private async void Start() { var options = new SupabaseOptions @@ -38,39 +41,44 @@ public class Backend : MonoBehaviour Debug.Log("Supabase Initialized"); } }); + } - public async void SendData(string uid, int score, string displayName, int daysPlayed, int customersHelpedCorrectly, + public async void SignOut() + { + User = null; + Session = null; + await Client.Auth.SignOut(); + } + + public async void SendData(string uid, string profilePictureUrl, int score, string displayName, int daysPlayed, + int customersHelpedCorrectly, int customersHelpedWrongly) { var user = new Users { uid = uid, + profilePictureUrl = profilePictureUrl, score = score, displayName = displayName, daysPlayed = daysPlayed, customersHelpedCorrectly = customersHelpedCorrectly, customersHelpedWrongly = customersHelpedWrongly, }; - await Client.From().Insert(user).ContinueWith(SendTask => - { - if (!SendTask.IsCompletedSuccessfully) + await Client.From().OnConflict(x => x.uid) + .Upsert(user).ContinueWith(SendTask => { - Debug.LogError(SendTask.Exception); - } - else - { - Debug.Log("Data Sent Sucessfully"); - } - }); + if (!SendTask.IsCompletedSuccessfully) + { + Debug.LogError(SendTask.Exception); + } + else + { + Debug.Log("Data Sent Sucessfully"); + } + }); } - public async void SignUp(string email, string password, string displayName) - { - Session = await Client.Auth.SignUp(email, password); - Debug.Log(Session.User.Id); - SendData(Session.User.Id, 0, displayName, 0, 0, 0); - } public async void SignIn(string email, string password) { @@ -87,7 +95,7 @@ public class Backend : MonoBehaviour if (User != null) { Debug.Log($"User: " + User.displayName); - + MenuButtons profilePage = FindObjectOfType(); if (profilePage != null) { @@ -108,7 +116,8 @@ public class Backend : MonoBehaviour public void FirebaseGet(NpcMovementRework target) { NpcData data = new NpcData(); - FirebaseDatabase.DefaultInstance.RootReference.Child("scenarios").Child("1").GetValueAsync() + FirebaseDatabase.DefaultInstance.RootReference.Child("scenarios").Child(UnityEngine.Random.Range(1, 8).ToString()) + .GetValueAsync() .ContinueWithOnMainThread(task => { if (task.IsFaulted) @@ -142,6 +151,59 @@ public class Backend : MonoBehaviour }); } + private async void GetProfile(string url, Image targetRenderer) + { + try + { + Texture2D texture = await GetTextureFromURL(url); + + if (texture != null) + { + if (targetRenderer != null) + { + Sprite sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero); + targetRenderer.sprite = sprite; + Debug.Log("Texture applied successfully."); + } + else + { + Debug.LogError("Target Renderer is not assigned."); + } + } + else + { + Debug.LogError("Failed to load texture."); + } + } + catch (Exception e) + { + Debug.LogError($"Error downloading texture: {e.Message}"); + } + } + + private async Task GetTextureFromURL(string url) + { + using (UnityWebRequest request = UnityWebRequestTexture.GetTexture(url)) + { + var asyncOperation = request.SendWebRequest(); + + while (!asyncOperation.isDone) + { + await Task.Yield(); // Yield until the operation is complete + } + + if (request.result == UnityWebRequest.Result.Success) + { + return DownloadHandlerTexture.GetContent(request); + } + else + { + Debug.LogError($"Error in UnityWebRequest: {request.error}"); + return null; + } + } + } + private void Awake() { if (instance == null) diff --git a/SSLR/Assets/Scripts/MenuButtons.cs b/SSLR/Assets/Scripts/MenuButtons.cs index 2f7bdc4..a17a949 100644 --- a/SSLR/Assets/Scripts/MenuButtons.cs +++ b/SSLR/Assets/Scripts/MenuButtons.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using Supabase.Gotrue; using UnityEngine; using TMPro; - +using UnityEngine.UI; public class MenuButtons : MonoBehaviour { /// @@ -16,7 +16,8 @@ public class MenuButtons : MonoBehaviour public TextMeshProUGUI daysPlayedText; public TextMeshProUGUI peopleHelpedText; public TextMeshProUGUI accuracyText; - + + public Image profilePicture; /// /// Calling backend to log player in /// @@ -64,5 +65,13 @@ public class MenuButtons : MonoBehaviour Debug.LogError("User data is null. UI not updated"); } } - + public void Logout() + { + Backend.instance.SignOut(); + } + + public void GetProfilePicture() + { + // profilePicture.sprite = Backend.instance.GetProfilePicture("https://fchobpauqasfebohuuam.supabase.co/storage/v1/object/public/Avatar//1739708594780-6156448458035283230_120.jpg"); + } } diff --git a/SSLR/Assets/Scripts/PlayerDialogueInteraction.cs b/SSLR/Assets/Scripts/PlayerDialogueInteraction.cs index 78eaac5..985e503 100644 --- a/SSLR/Assets/Scripts/PlayerDialogueInteraction.cs +++ b/SSLR/Assets/Scripts/PlayerDialogueInteraction.cs @@ -46,8 +46,8 @@ public class PlayerDialogueInteraction : MonoBehaviour public GameObject peersServiceButton; public GameObject transitionalSheltersServiceButton; public GameObject cpsServiceButton; - public GameObject childrenYoungHomeServiceButton; public GameObject sgEnableServiceButton; + public StampDocument currentDocument; void Awake() { @@ -163,4 +163,9 @@ public class PlayerDialogueInteraction : MonoBehaviour GameManager.instance.currentNPC.GetComponent().npcAnswerThreeText.gameObject.SetActive(false); GameManager.instance.currentNPC.GetComponent().npcClarifiedResponse.gameObject.SetActive(true); } + public void OnServiceSelected(string service) + { + servicesPanel.SetActive(false); + currentDocument.Sign(service); + } } diff --git a/SSLR/Assets/Scripts/StampDocument.cs b/SSLR/Assets/Scripts/StampDocument.cs index 237e156..e28ba0a 100644 --- a/SSLR/Assets/Scripts/StampDocument.cs +++ b/SSLR/Assets/Scripts/StampDocument.cs @@ -1,18 +1,19 @@ +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class StampDocument : MonoBehaviour { - [Header("Stamps")] - [SerializeField] private GameObject financialStamp; + [Header("Stamps")] [SerializeField] private GameObject financialStamp; [SerializeField] private GameObject residentialStamp; [SerializeField] private GameObject dvStamp; [SerializeField] private GameObject disabilitiesStamp; [SerializeField] private GameObject signature; - - [Header("Signatures")] - [SerializeField] private GameObject comcareSignature; + + [Header("Signatures")] [SerializeField] + private GameObject comcareSignature; + [SerializeField] private GameObject fscSignature; [SerializeField] private GameObject peersSignature; [SerializeField] private GameObject transitionalShelterSignature; @@ -24,7 +25,10 @@ public class StampDocument : MonoBehaviour public bool isSigned; public string assignedDepartment; public string assignedService; - + private string CheckFinalDepartment() + { + return $"{assignedDepartment}-{assignedService}"; + } void Start() { financialStamp.SetActive(false); @@ -32,7 +36,7 @@ public class StampDocument : MonoBehaviour dvStamp.SetActive(false); disabilitiesStamp.SetActive(false); signature.SetActive(false); - + comcareSignature.SetActive(false); fscSignature.SetActive(false); peersSignature.SetActive(false); @@ -40,32 +44,32 @@ public class StampDocument : MonoBehaviour cpsSignature.SetActive(false); childrenYoungHomeSignature.SetActive(false); sgEnableSignature.SetActive(false); - + isSigned = false; isStamped = false; } - + public void StampFinancial() { financialStamp.SetActive(true); isStamped = true; assignedDepartment = "Financial"; } - + public void StampResidential() { residentialStamp.SetActive(true); isStamped = true; assignedDepartment = "Residential"; } - + public void StampDV() { dvStamp.SetActive(true); isStamped = true; assignedDepartment = "Domestic Violence"; } - + public void StampDisabilities() { disabilitiesStamp.SetActive(true); @@ -73,66 +77,63 @@ public class StampDocument : MonoBehaviour assignedDepartment = "Disabilities"; } - public void SignComCare() + public void Sign(string service) { - comcareSignature.SetActive(true); - isSigned = true; - assignedDepartment = "ComCare"; - PlayerDialogueInteraction.instance.servicesPanel.SetActive(false); - PlayerDialogueInteraction.instance.questionPanel.SetActive(true); - } - - public void SignFSC() - { - fscSignature.SetActive(true); - isSigned = true; - assignedDepartment = "Family Service Centres"; - PlayerDialogueInteraction.instance.servicesPanel.SetActive(false); - PlayerDialogueInteraction.instance.questionPanel.SetActive(true); - } - - public void SignPEERS() - { - peersSignature.SetActive(true); - isSigned = true; - assignedDepartment = "PEERS"; - PlayerDialogueInteraction.instance.servicesPanel.SetActive(false); - PlayerDialogueInteraction.instance.questionPanel.SetActive(true); - } - - public void SignTransitionalShelters() - { - transitionalShelterSignature.SetActive(true); - isSigned = true; - assignedDepartment = "Transitional Shelters"; - PlayerDialogueInteraction.instance.servicesPanel.SetActive(false); - PlayerDialogueInteraction.instance.questionPanel.SetActive(true); - } - - public void SignCPS() - { - cpsSignature.SetActive(true); - isSigned = true; - assignedDepartment = "CPS"; - PlayerDialogueInteraction.instance.servicesPanel.SetActive(false); - PlayerDialogueInteraction.instance.questionPanel.SetActive(true); - } - - public void SignChildrenYoungHome() - { - childrenYoungHomeSignature.SetActive(true); - isSigned = true; - assignedDepartment = "Children and Young Persons Homes"; - PlayerDialogueInteraction.instance.servicesPanel.SetActive(false); - PlayerDialogueInteraction.instance.questionPanel.SetActive(true); + switch (service) + { + case "ComCare": + comcareSignature.SetActive(true); + isSigned = true; + assignedDepartment = "ComCare"; + PlayerDialogueInteraction.instance.servicesPanel.SetActive(false); + PlayerDialogueInteraction.instance.questionPanel.SetActive(true); + break; + case "FSC": + fscSignature.SetActive(true); + isSigned = true; + assignedDepartment = "Family Service Centres"; + PlayerDialogueInteraction.instance.servicesPanel.SetActive(false); + PlayerDialogueInteraction.instance.questionPanel.SetActive(true); + break; + case "PEERS": + peersSignature.SetActive(true); + isSigned = true; + assignedDepartment = "PEERS"; + PlayerDialogueInteraction.instance.servicesPanel.SetActive(false); + PlayerDialogueInteraction.instance.questionPanel.SetActive(true); + break; + case "Transitional Shelters": + transitionalShelterSignature.SetActive(true); + isSigned = true; + assignedDepartment = "Transitional Shelters"; + PlayerDialogueInteraction.instance.servicesPanel.SetActive(false); + PlayerDialogueInteraction.instance.questionPanel.SetActive(true); + break; + case "CPS": + cpsSignature.SetActive(true); + isSigned = true; + assignedDepartment = "CPS"; + PlayerDialogueInteraction.instance.servicesPanel.SetActive(false); + PlayerDialogueInteraction.instance.questionPanel.SetActive(true); + break; + case "SG Enable": + sgEnableSignature.SetActive(true); + isSigned = true; + assignedDepartment = "SG Enable"; + PlayerDialogueInteraction.instance.servicesPanel.SetActive(false); + PlayerDialogueInteraction.instance.questionPanel.SetActive(true); + break; + + } } - public void SignSGEnable() + + private void OnTriggerEnter(Collider other) { - sgEnableSignature.SetActive(true); - isSigned = true; - assignedDepartment = "SG Enable"; - PlayerDialogueInteraction.instance.servicesPanel.SetActive(false); - PlayerDialogueInteraction.instance.questionPanel.SetActive(true); + if (other.gameObject.CompareTag("Pen")) + { + PlayerDialogueInteraction.instance.servicesPanel.SetActive(true); + PlayerDialogueInteraction.instance.currentDocument = this; + } } -} +} \ No newline at end of file diff --git a/SSLR/Assets/Scripts/supabaseClasses.cs b/SSLR/Assets/Scripts/supabaseClasses.cs index a3be73c..b9285e8 100644 --- a/SSLR/Assets/Scripts/supabaseClasses.cs +++ b/SSLR/Assets/Scripts/supabaseClasses.cs @@ -12,6 +12,7 @@ public class Test : BaseModel public class Users : BaseModel { [Column()] public string uid { get; set; } + [Column()] public string profilePictureUrl { get; set; } [Column()] public int score { get; set; } [Column()] public string displayName { get; set; } [Column()] public int daysPlayed { get; set; } diff --git a/SSLR/Assets/UI/Designs/My Profile Page.png b/SSLR/Assets/UI/Designs/My Profile Page.png index 5a40d07..79c36d9 100644 --- a/SSLR/Assets/UI/Designs/My Profile Page.png +++ b/SSLR/Assets/UI/Designs/My Profile Page.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6e2a797840930145ba3c5b4d479cd0789192399e97820c08d32bf27a389f5b1f -size 220112 +oid sha256:6e6f624fa4ec3a625a1d9431176ac6cd9bae137981a4db20f8586f10c559436b +size 216035 diff --git a/SSLR/ProjectSettings/TagManager.asset b/SSLR/ProjectSettings/TagManager.asset index cc537d6..911bb73 100644 --- a/SSLR/ProjectSettings/TagManager.asset +++ b/SSLR/ProjectSettings/TagManager.asset @@ -8,6 +8,7 @@ TagManager: - NPC - Paper - PlayerHand + - Pen layers: - Default - TransparentFX