Selaa lähdekoodia

4/9 更新

2025/4/9 初步完成重置密码页面和逻辑,待后端代码开发后测试
Jees 1 kuukausi sitten
vanhempi
commit
649d739da3

+ 8 - 0
Assets/Pictures/Login.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 6b775e0b540fa3b419fad3bd9754f6c0
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/Pictures/Login/mailbox.png


+ 143 - 0
Assets/Pictures/Login/mailbox.png.meta

@@ -0,0 +1,143 @@
+fileFormatVersion: 2
+guid: 2a15d5247bbd45e4c8ad28ecec71f99e
+TextureImporter:
+  internalIDToNameTable: []
+  externalObjects: {}
+  serializedVersion: 13
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 1
+    sRGBTexture: 1
+    linearTexture: 0
+    fadeOut: 0
+    borderMipMap: 0
+    mipMapsPreserveCoverage: 0
+    alphaTestReferenceValue: 0.5
+    mipMapFadeDistanceStart: 1
+    mipMapFadeDistanceEnd: 3
+  bumpmap:
+    convertToNormalMap: 0
+    externalNormalMap: 0
+    heightScale: 0.25
+    normalMapFilter: 0
+    flipGreenChannel: 0
+  isReadable: 0
+  streamingMipmaps: 0
+  streamingMipmapsPriority: 0
+  vTOnly: 0
+  ignoreMipmapLimit: 0
+  grayScaleToAlpha: 0
+  generateCubemap: 6
+  cubemapConvolution: 0
+  seamlessCubemap: 0
+  textureFormat: 1
+  maxTextureSize: 2048
+  textureSettings:
+    serializedVersion: 2
+    filterMode: 1
+    aniso: 1
+    mipBias: 0
+    wrapU: 0
+    wrapV: 0
+    wrapW: 0
+  nPOTScale: 1
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 0
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: 0.5, y: 0.5}
+  spritePixelsToUnits: 100
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+  spriteGenerateFallbackPhysicsShape: 1
+  alphaUsage: 1
+  alphaIsTransparency: 0
+  spriteTessellationDetail: -1
+  textureType: 0
+  textureShape: 1
+  singleChannelComponent: 0
+  flipbookRows: 1
+  flipbookColumns: 1
+  maxTextureSizeSet: 0
+  compressionQualitySet: 0
+  textureFormatSet: 0
+  ignorePngGamma: 0
+  applyGammaDecoding: 0
+  swizzle: 50462976
+  cookieLightType: 0
+  platformSettings:
+  - serializedVersion: 4
+    buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    ignorePlatformSupport: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 4
+    buildTarget: Standalone
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    ignorePlatformSupport: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 4
+    buildTarget: Android
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    ignorePlatformSupport: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 4
+    buildTarget: iOS
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    ignorePlatformSupport: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+    customData: 
+    physicsShape: []
+    bones: []
+    spriteID: 
+    internalID: 0
+    vertices: []
+    indices: 
+    edges: []
+    weights: []
+    secondaryTextures: []
+    spriteCustomMetadata:
+      entries: []
+    nameFileIdTable: {}
+  mipmapLimitGroupName: 
+  pSDRemoveMatte: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/Plugins/zxing.unity.dll


+ 2 - 0
Assets/Plugins/zxing.unity.dll.meta

@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: 179ebf0a53cf71243ad90697267e632b

+ 62 - 0
Assets/Resources/Data/languages.json

@@ -557,6 +557,68 @@
             }
         }
     },
+    "resetUI":{
+        "button": {
+            "submit": {
+                "en": "Submit",
+                "zh-cn": "提交"
+            },
+            "cancel": {
+                "en": "Cancel",
+                "zh-cn": "取消"
+            }
+        },
+        "label": {
+            "message 0": {
+                "en": "Please input your mobile Phone number.",
+                "zh-cn": "请输入手机号码。"
+            },
+            "message 1": {
+                "en": "Please input your E-mail address.",
+                "zh-cn": "请输入邮箱。"
+            },
+            "message 2": {
+                "en": "Please input the verification code you received and your new password",
+                "zh-cn": "请输入你收到的验证码和新的密码。"
+            }
+        },
+        "text_field": {
+            "mobile": {
+                "en": "Mobile Phone No.:",
+                "zh-cn": "手机号码:"
+            },
+            "email": {
+                "en": "E-mail:",
+                "zh-cn": "E-mail:"
+            },
+            "verification": {
+                "en": "Verification Code:",
+                "zh-cn": "验证码:"
+            },
+            "password": {
+                "en": "New password:",
+                "zh-cn": "新的密码:"
+            }
+        },
+        "error_msg":{
+            "password_too_short": {
+                "en": "* Password need at least 8 letters.",
+                "zh-cn": "* 密码至少8位。"
+            },
+            "cannot_find_account": {
+                "en": "* Cannot find the corresponding account.",
+                "zh-cn": "* 找不对对应的账户。"
+            },
+            "wrong_verification_code": {
+                "en": "* Verification code is wrong.",
+                "zh-cn": "* 验证码错误。"
+            },
+            "email_format_wrong": {
+                "en": "* Please use correct E-mail address.",
+                "zh-cn": "* 请输入正确的电子邮箱。"
+            }
+        }
+    },
     "InitDogUI": {
         "button": {
             "confirm": {

+ 46 - 86
Assets/Resources/MessageBox/GlassBlur.shader

@@ -3,105 +3,65 @@ Shader "Custom/GlassBlur"
     Properties
     {
         _MainTex ("Base (RGB)", 2D) = "white" {}
-        _BlurSize ("Blur Size", Range(0, 10)) = 1.0
-        _Intensity ("Intensity", Range(0, 1)) = 0.5
+        _Distortion ("Distortion", Range(0.0,1.0)) = 0.5
+        _BlurSize ("Blur Size", Range(0.0,1.0)) = 0.2
     }
-    
     SubShader
     {
-        Tags { "RenderType"="Opaque" }
+        Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
         LOD 200
-        
-        CGINCLUDE
-        #include "UnityCG.cginc"
-        
-        sampler2D _MainTex;
-        float4 _MainTex_TexelSize;
-        float _BlurSize;
-        float _Intensity;
-        
-        struct v2f
-        {
-            float4 pos : SV_POSITION;
-            float2 uv : TEXCOORD0;
-        };
-        
-        v2f vert(appdata_img v)
-        {
-            v2f o;
-            o.pos = UnityObjectToClipPos(v.vertex);
-            o.uv = v.texcoord;
-            return o;
-        }
-        
-        // 高斯模糊函数
-        float4 gaussianBlur(v2f i, float2 direction)
-        {
-            float4 color = float4(0, 0, 0, 0);
-            float2 offsets[9] = {
-                float2(-1, -1), float2(0, -1), float2(1, -1),
-                float2(-1, 0), float2(0, 0), float2(1, 0),
-                float2(-1, 1), float2(0, 1), float2(1, 1)
-            };
-            
-            float weights[9] = {
-                0.05, 0.1, 0.05,
-                0.1, 0.4, 0.1,
-                0.05, 0.1, 0.05
-            };
-            
-            for(int j = 0; j < 9; j++)
-            {
-                float2 uv = i.uv + offsets[j] * _MainTex_TexelSize.xy * _BlurSize * direction;
-                color += tex2D(_MainTex, uv) * weights[j];
-            }
-            
-            return color;
-        }
-        ENDCG
-        
-        // 水平模糊 Pass
+
+        Blend SrcAlpha OneMinusSrcAlpha
+        ZWrite Off
+        AlphaTest Greater 0.5
+        Cull Off
+
         Pass
         {
             CGPROGRAM
             #pragma vertex vert
             #pragma fragment frag
-            
-            float4 frag(v2f i) : SV_Target
+            #include "UnityCG.cginc"
+
+            struct appdata_t
             {
-                return gaussianBlur(i, float2(1, 0));
-            }
-            ENDCG
-        }
-        
-        // 垂直模糊 Pass
-        Pass
-        {
-            CGPROGRAM
-            #pragma vertex vert
-            #pragma fragment frag
-            
-            float4 frag(v2f i) : SV_Target
+                float4 vertex : POSITION;
+                float2 texcoord : TEXCOORD0;
+            };
+
+            struct v2f
             {
-                return gaussianBlur(i, float2(0, 1));
+                float2 uv : TEXCOORD0;
+                float4 pos : SV_POSITION;
+            };
+
+            sampler2D _MainTex;
+            float4 _MainTex_ST;
+            float _Distortion;
+            float _BlurSize;
+
+            v2f vert (appdata_t v)
+            {
+                v2f o;
+                o.pos = UnityObjectToClipPos(v.vertex);
+                o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
+                return o;
             }
-            ENDCG
-        }
-        
-        // 混合 Pass
-        Pass
-        {
-            CGPROGRAM
-            #pragma vertex vert
-            #pragma fragment frag
-            
-            sampler2D _BlurTex;
-            
-            float4 frag(v2f i) : SV_Target
+
+            fixed4 frag (v2f i) : SV_Target
             {
-                float4 original = tex2D(_MainTex, i.uv);
-                float4 blurred = tex2D(_BlurTex, i.uv);
-                return lerp(original, blurred, _Intensity);
+                float2 uv = i.uv;
+                float2 offset = float2(_Distortion, _Distortion) * _BlurSize;
+
+                float4 col = tex2D(_MainTex, uv);
+                col += tex2D(_MainTex, uv + float2(offset.x, offset.y));
+                col += tex2D(_MainTex, uv + float2(-offset.x, offset.y));
+                col += tex2D(_MainTex, uv + float2(offset.x, -offset.y));
+                col += tex2D(_MainTex, uv + float2(-offset.x, -offset.y));
+
+                col /= 5.0;
+
+                return col;
             }
             ENDCG
         }

+ 29 - 29
Assets/Resources/MessageBox/MessageBox.prefab

@@ -27,8 +27,8 @@ RectTransform:
   m_GameObject: {fileID: 284393600326528666}
   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_LocalScale: {x: 2.2, y: 2.2, z: 2.2}
+  m_ConstrainProportionsScale: 1
   m_Children: []
   m_Father: {fileID: 4128633789988152547}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -142,15 +142,15 @@ MonoBehaviour:
       m_Calls: []
   m_text: OK
   m_isRightToLeft: 0
-  m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
-  m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
+  m_fontAsset: {fileID: 11400000, guid: 3b4f878f4c07b5348b631779a059f866, type: 2}
+  m_sharedMaterial: {fileID: -608264934541106302, guid: 3b4f878f4c07b5348b631779a059f866, type: 2}
   m_fontSharedMaterials: []
   m_fontMaterial: {fileID: 0}
   m_fontMaterials: []
   m_fontColor32:
     serializedVersion: 2
-    rgba: 4281479730
-  m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
+    rgba: 4294967295
+  m_fontColor: {r: 1, g: 1, b: 1, a: 1}
   m_enableVertexGradient: 0
   m_colorMode: 3
   m_fontColorGradient:
@@ -167,8 +167,8 @@ MonoBehaviour:
   m_faceColor:
     serializedVersion: 2
     rgba: 4294967295
-  m_fontSize: 55
-  m_fontSizeBase: 55
+  m_fontSize: 100
+  m_fontSizeBase: 100
   m_fontWeight: 400
   m_enableAutoSizing: 0
   m_fontSizeMin: 18
@@ -268,16 +268,16 @@ MonoBehaviour:
   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: 0.078431375}
+  m_Material: {fileID: 2100000, guid: 7c8ed07ab7053ea41aab3343ce7dc0a7, type: 2}
+  m_Color: {r: 1, g: 1, b: 1, a: 0.105882354}
   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_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
+  m_Type: 1
   m_PreserveAspect: 0
   m_FillCenter: 1
   m_FillMethod: 4
@@ -323,8 +323,8 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 350, y: 80}
-  m_SizeDelta: {x: 300, y: 120}
+  m_AnchoredPosition: {x: 350, y: 90}
+  m_SizeDelta: {x: 300, y: 150}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &7955086310878262476
 CanvasRenderer:
@@ -354,7 +354,7 @@ MonoBehaviour:
   m_OnCullStateChanged:
     m_PersistentCalls:
       m_Calls: []
-  m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
+  m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0}
   m_Type: 1
   m_PreserveAspect: 0
   m_FillCenter: 1
@@ -456,8 +456,8 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 1, y: 0}
   m_AnchorMax: {x: 1, y: 0}
-  m_AnchoredPosition: {x: -220, y: 80}
-  m_SizeDelta: {x: 300, y: 120}
+  m_AnchoredPosition: {x: -220, y: 90}
+  m_SizeDelta: {x: 300, y: 150}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &2860975958448978396
 CanvasRenderer:
@@ -723,7 +723,7 @@ MonoBehaviour:
       m_Calls: []
   m_text: Y
   m_isRightToLeft: 0
-  m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
+  m_fontAsset: {fileID: 11400000, guid: 3b4f878f4c07b5348b631779a059f866, type: 2}
   m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
   m_fontSharedMaterials: []
   m_fontMaterial: {fileID: 0}
@@ -789,7 +789,7 @@ MonoBehaviour:
   m_margin: {x: 0, y: 0, z: 0, w: 0}
   m_isUsingLegacyAnimationComponent: 0
   m_isVolumetricText: 0
-  m_hasFontAssetChanged: 0
+  m_hasFontAssetChanged: 1
   m_baseMaterial: {fileID: 0}
   m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
 --- !u!1 &5859403009555917817
@@ -829,8 +829,8 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 1, y: 0}
   m_AnchorMax: {x: 1, y: 0}
-  m_AnchoredPosition: {x: -350, y: 80}
-  m_SizeDelta: {x: 300, y: 120}
+  m_AnchoredPosition: {x: -350, y: 90}
+  m_SizeDelta: {x: 300, y: 150}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &7841729400603993495
 CanvasRenderer:
@@ -860,7 +860,7 @@ MonoBehaviour:
   m_OnCullStateChanged:
     m_PersistentCalls:
       m_Calls: []
-  m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
+  m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
   m_Type: 1
   m_PreserveAspect: 0
   m_FillCenter: 1
@@ -965,7 +965,7 @@ RectTransform:
   m_AnchorMin: {x: 0.5, y: 1}
   m_AnchorMax: {x: 0.5, y: 1}
   m_AnchoredPosition: {x: 0, y: -100}
-  m_SizeDelta: {x: 1300, y: 700}
+  m_SizeDelta: {x: 1300, y: 800}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &5531893192627229921
 CanvasRenderer:
@@ -1039,8 +1039,8 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0.5, y: 1}
   m_AnchorMax: {x: 0.5, y: 1}
-  m_AnchoredPosition: {x: 99, y: -290}
-  m_SizeDelta: {x: 200, y: 60}
+  m_AnchoredPosition: {x: 99, y: -330}
+  m_SizeDelta: {x: 200, y: 65}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &2649271503232441644
 CanvasRenderer:
@@ -1208,7 +1208,7 @@ MonoBehaviour:
       m_Calls: []
   m_text: "\U0001F641\U0001F641"
   m_isRightToLeft: 0
-  m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
+  m_fontAsset: {fileID: 11400000, guid: 3b4f878f4c07b5348b631779a059f866, type: 2}
   m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
   m_fontSharedMaterials: []
   m_fontMaterial: {fileID: 0}
@@ -1274,7 +1274,7 @@ MonoBehaviour:
   m_margin: {x: 0, y: 0, z: 0, w: 0}
   m_isUsingLegacyAnimationComponent: 0
   m_isVolumetricText: 0
-  m_hasFontAssetChanged: 0
+  m_hasFontAssetChanged: 1
   m_baseMaterial: {fileID: 0}
   m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
 --- !u!1 &8936560037696320555
@@ -1304,8 +1304,8 @@ RectTransform:
   m_GameObject: {fileID: 8936560037696320555}
   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_LocalScale: {x: 2.2, y: 2.2, z: 2.2}
+  m_ConstrainProportionsScale: 1
   m_Children: []
   m_Father: {fileID: 2137355296810040006}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

+ 9 - 11
Assets/Resources/VoiceAndManu/MenuController.cs

@@ -40,24 +40,24 @@ public class MenuController : MonoBehaviour
         mainMenu = menuArea.Q<VisualElement>("mainMenu");
         var home = menuArea.Q<VisualElement>("home");       // 修改用户信息
         subMenu.Add(home);
-        var playground = menuArea.Q<VisualElement>("playground");       // 废弃
-        subMenu.Add(playground);
+        //var playground = menuArea.Q<VisualElement>("playground");       // 废弃
+        //subMenu.Add(playground);
         var shop = menuArea.Q<VisualElement>("shop");       // 商店
         subMenu.Add(shop);
         var warehouse = menuArea.Q<VisualElement>("warehouse");     // 使用道具
         subMenu.Add(warehouse);
-        var cameraBtn = menuArea.Q<VisualElement>("camera");        // AR摄像头
-        subMenu.Add(cameraBtn);
         var status = menuArea.Q<VisualElement>("status");       // 宠物状态
         subMenu.Add(status);
-        
+        var cameraBtn = menuArea.Q<VisualElement>("camera");        // AR摄像头
+        subMenu.Add(cameraBtn);
+
 
         mainMenu.RegisterCallback<ClickEvent>(e => MainMenuClick(e));
         // root加载完成后,所有element算出位置后再进行计算
         root.RegisterCallback<GeometryChangedEvent>(e => OnMainMenuClickGeometryChanged(e));
 
         // 绑定按键点击事件
-        playground.RegisterCallback<ClickEvent>(e => PlayGroundClick(e));
+        //playground.RegisterCallback<ClickEvent>(e => PlayGroundClick(e));
         shop.RegisterCallback<ClickEvent>(e => ShopClick(e));
         warehouse.RegisterCallback<ClickEvent>(e => WarehouseClick(e));
         status.RegisterCallback<ClickEvent>(e => StatusClick(e));
@@ -81,6 +81,9 @@ public class MenuController : MonoBehaviour
         {
             home.style.display = DisplayStyle.None;
         }
+
+        // 目前开发暂时隐藏camera按钮
+        cameraBtn.style.display = DisplayStyle.None;
     }
 
     private void Start()
@@ -138,13 +141,8 @@ public class MenuController : MonoBehaviour
         {
             subMenu.visible = true;
             var newPosition = CalcPosition(mainMenu.layout.position, curAngle, distance);
-            //subMenu.layout.position.Set(newPosition.x, newPosition.y);
             subMenu.style.left = newPosition.x;
             subMenu.style.top = newPosition.y;
-            //if (subMenu.name == "home")
-            //{
-            //    Debug.Log(subMenu.name + " " + newPosition.x + " " + newPosition.y);
-            //}
             curAngle += angleDelta;
         }
         mainMenu.transform.scale = new Vector2(0.8f, 0.8f);

+ 180 - 1
Assets/Scenes/Login.unity

@@ -3134,6 +3134,70 @@ CanvasRenderer:
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 1139328081}
   m_CullTransparentMesh: 1
+--- !u!1 &1183143674
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 1183143675}
+  - component: {fileID: 1183143676}
+  - component: {fileID: 1183143677}
+  m_Layer: 0
+  m_Name: Reset UIDocument
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &1183143675
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1183143674}
+  serializedVersion: 2
+  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: 1401908991}
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &1183143676
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1183143674}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_PanelSettings: {fileID: 11400000, guid: 7ca44f0cc21b574428c09a7b6ce95659, type: 2}
+  m_ParentUI: {fileID: 0}
+  sourceAsset: {fileID: 9197481963319205126, guid: 55835c6267ccc0042b0fb539c2782024, type: 3}
+  m_SortingOrder: 0
+  m_WorldSpaceSizeMode: 1
+  m_WorldSpaceWidth: 1920
+  m_WorldSpaceHeight: 1080
+--- !u!114 &1183143677
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1183143674}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 84bd515144e30814ca36e503694321bf, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
 --- !u!1 &1201848293
 GameObject:
   m_ObjectHideFlags: 3
@@ -3505,6 +3569,108 @@ PrefabInstance:
     m_AddedGameObjects: []
     m_AddedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: fd44ee5e3fce2cc49bcb46188b301e97, type: 3}
+--- !u!1 &1401908990
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 1401908991}
+  - component: {fileID: 1401908994}
+  - component: {fileID: 1401908993}
+  - component: {fileID: 1401908992}
+  m_Layer: 0
+  m_Name: Reset Pasword
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 0
+--- !u!224 &1401908991
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1401908990}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 0, y: 0, z: 0}
+  m_ConstrainProportionsScale: 0
+  m_Children:
+  - {fileID: 1183143675}
+  m_Father: {fileID: 1751824541}
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+  m_AnchorMin: {x: 0, y: 0}
+  m_AnchorMax: {x: 0, y: 0}
+  m_AnchoredPosition: {x: 0, y: 0}
+  m_SizeDelta: {x: 0, y: 0}
+  m_Pivot: {x: 0, y: 0}
+--- !u!114 &1401908992
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1401908990}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_IgnoreReversedGraphics: 1
+  m_BlockingObjects: 0
+  m_BlockingMask:
+    serializedVersion: 2
+    m_Bits: 4294967295
+--- !u!114 &1401908993
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1401908990}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_UiScaleMode: 0
+  m_ReferencePixelsPerUnit: 100
+  m_ScaleFactor: 1
+  m_ReferenceResolution: {x: 800, y: 600}
+  m_ScreenMatchMode: 0
+  m_MatchWidthOrHeight: 0
+  m_PhysicalUnit: 3
+  m_FallbackScreenDPI: 96
+  m_DefaultSpriteDPI: 96
+  m_DynamicPixelsPerUnit: 1
+  m_PresetInfoIsWorld: 0
+--- !u!223 &1401908994
+Canvas:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1401908990}
+  m_Enabled: 1
+  serializedVersion: 3
+  m_RenderMode: 0
+  m_Camera: {fileID: 0}
+  m_PlaneDistance: 100
+  m_PixelPerfect: 0
+  m_ReceivesEvents: 1
+  m_OverrideSorting: 0
+  m_OverridePixelPerfect: 0
+  m_SortingBucketNormalizedSize: 0
+  m_VertexColorAlwaysGammaSpace: 0
+  m_AdditionalShaderChannelsFlag: 0
+  m_UpdateRectTransformForStandalone: 0
+  m_SortingLayerID: 0
+  m_SortingOrder: 0
+  m_TargetDisplay: 0
 --- !u!1001 &1589749813
 PrefabInstance:
   m_ObjectHideFlags: 0
@@ -3932,6 +4098,7 @@ Transform:
   - {fileID: 540259604}
   - {fileID: 462186837}
   - {fileID: 1349309768}
+  - {fileID: 1401908991}
   m_Father: {fileID: 0}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!1 &1863178294 stripped
@@ -4021,7 +4188,19 @@ MonoBehaviour:
   m_TargetGraphic: {fileID: 1879351059}
   m_OnClick:
     m_PersistentCalls:
-      m_Calls: []
+      m_Calls:
+      - m_Target: {fileID: 1349309770}
+        m_TargetAssemblyTypeName: LoginController, Assembly-CSharp
+        m_MethodName: ResetPassword
+        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 &1879351059
 MonoBehaviour:
   m_ObjectHideFlags: 0

+ 1 - 1
Assets/Scenes/Login/RegisterUI.uxml

@@ -1,7 +1,7 @@
 <ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="True">
     <ui:Template name="confirmArea" src="project://database/Assets/UI%20Toolkit/UI%20template/confirmArea.uxml?fileID=9197481963319205126&amp;guid=030fcebdf097b964ebdb70bc2362ffa6&amp;type=3#confirmArea" />
     <Style src="project://database/Assets/UI%20Toolkit/Style/rootStyle.uss?fileID=7433441132597879392&amp;guid=b30eb17a0ca8bf64087af4e59d565fdd&amp;type=3#rootStyle" />
-    <ui:VisualElement name="root" class="rootStyle">
+    <ui:VisualElement name="root" class="rootStyle" style="background-image: url(&quot;project://database/Assets/Pictures/background.jpg?fileID=2800000&amp;guid=c8a7500d13cc10e40b0eadcdb5331d17&amp;type=3#background&quot;);">
         <ui:TextField label="Your name:" max-length="16" value="Nintendo1234567890" hide-placeholder-on-focus="false" name="name" class="TextField textField" style="height: auto; -unity-text-align: middle-left; -unity-font-definition: url(&quot;project://database/Assets/Font/MaoKenZhuYuanTi-MaokenZhuyuanTi-2.ttf?fileID=12800000&amp;guid=50a63638b44907e46a3fa871d63b7d39&amp;type=3#MaoKenZhuYuanTi-MaokenZhuyuanTi-2&quot;); margin-top: 0;" />
         <ui:TextField label="Password:" name="password" value="012345678" password="true" max-length="16" is-delayed="false" emoji-fallback-support="false" class="textField" />
         <ui:TextField label="手机号码:" max-length="16" value="13012345678" name="mobile" class="textField" style="display: flex;" />

+ 15 - 0
Assets/Scenes/Login/Reset UI.uxml

@@ -0,0 +1,15 @@
+<ui:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
+    <Style src="project://database/Assets/UI%20Toolkit/Style/rootStyle.uss?fileID=7433441132597879392&amp;guid=b30eb17a0ca8bf64087af4e59d565fdd&amp;type=3#rootStyle" />
+    <ui:VisualElement name="background" class="rootStyle" style="flex-grow: 1; background-image: url(&quot;project://database/Assets/Pictures/Login/mailbox.png?fileID=2800000&amp;guid=2a15d5247bbd45e4c8ad28ecec71f99e&amp;type=3#mailbox&quot;);">
+        <ui:TextField label="手机号码" name="mobile" class="textField" />
+        <ui:TextField label="Email" name="email" class="textField" />
+        <ui:Label text="message here" name="message" class="message" />
+        <ui:TextField label="验证码" name="verification" mask-character="*" max-length="6" class="textField" />
+        <ui:TextField label="新的密码" name="password" password="true" class="textField" />
+        <ui:Label text="message here" name="error_msg" class="message err_msg" />
+        <ui:VisualElement style="flex-grow: 1; flex-direction: row; justify-content: space-around; margin-top: 26px;">
+            <ui:Button text="Submit" name="submit" class="button" />
+            <ui:Button text="Cancel" name="cancel" class="button" style="background-color: rgba(236, 67, 37, 0.78);" />
+        </ui:VisualElement>
+    </ui:VisualElement>
+</ui:UXML>

+ 10 - 0
Assets/Scenes/Login/Reset UI.uxml.meta

@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 55835c6267ccc0042b0fb539c2782024
+ScriptedImporter:
+  internalIDToNameTable: []
+  externalObjects: {}
+  serializedVersion: 2
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
+  script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}

+ 7 - 3
Assets/Scripts/Bathroom/BathroomController.cs

@@ -29,9 +29,7 @@ public class BathroomController : MonoBehaviour
     // Start is called once before the first execution of Update after the MonoBehaviour is created
     void Start()
     {
-        Time.timeScale = 0f;
-        string msg = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "game_message", "start_bubble", EnviromentSetting.languageCode });
-        MessageBoxController.ShowMessage(msg, StartBubblePhase);
+        Invoke("StartBubbleMsg", 2f);
     }
 
     // Update is called once per frame
@@ -60,6 +58,12 @@ public class BathroomController : MonoBehaviour
 
     }
 
+    void StartBubbleMsg()
+    {
+        Time.timeScale = 0f;
+        string msg = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "game_message", "start_bubble", EnviromentSetting.languageCode });
+        MessageBoxController.ShowMessage(msg, StartBubblePhase);
+    }
 
     // 检测是否点击在狗上
     void PointerOnDog(Texture2D cursorTexture)

+ 0 - 19
Assets/Scripts/Develop Script/HomeTestScript.cs

@@ -1,19 +0,0 @@
-using UnityEngine;
-
-public class HomeTestScript : MonoBehaviour
-{
-    // Start is called once before the first execution of Update after the MonoBehaviour is created
-    void Start()
-    {
-        GameObject dog = GameObject.Find("dog");
-        Animator animator = dog.GetComponent<Animator>();
-        animator.Play("sleep2");
-        //animator.SetBool("isSleep", true);
-    }
-
-    // Update is called once per frame
-    void Update()
-    {
-        
-    }
-}

+ 0 - 2
Assets/Scripts/Develop Script/HomeTestScript.cs.meta

@@ -1,2 +0,0 @@
-fileFormatVersion: 2
-guid: 5a8d19a3324b5a147a33b60457d1b8e0

+ 2 - 2
Assets/Scripts/Develop Script/TestSetup.cs

@@ -81,8 +81,8 @@ public class TestSetup : MonoBehaviour
             //DateTime oneHourAgo = now.AddHours(-1);
             //PlayerPrefs.SetString("LoginTokenTime", oneHourAgo.ToString());
 
-            //PlayerPrefs.DeleteAll();
-            //EnviromentSetting.languageCode = "en";
+            PlayerPrefs.DeleteAll();
+            EnviromentSetting.languageCode = "en";
         }
 
         //Debug.Log("Login token" + PlayerPrefs.GetString("LoginToken"));

+ 12 - 0
Assets/Scripts/Login/LoginController.cs

@@ -236,6 +236,18 @@ public class LoginController : MonoBehaviour
         }
     }
 
+    public void ResetPassword()
+    {
+        var uiPlaceholder = GameObject.Find("Canvas Placeholder");
+        if (uiPlaceholder != null)
+        {
+            var resetUI = uiPlaceholder.transform.Find("Reset Pasword").gameObject;
+            var loginCanvas = uiPlaceholder.transform.Find("Login Canvas").gameObject;
+            resetUI.SetActive(true);
+            loginCanvas.SetActive(false);
+        }
+    }
+
     // 切换到生成狗的子场景
     void SwitchToInitDogScene()
     {

+ 3 - 5
Assets/Scripts/Login/RegisterUIController.cs

@@ -39,7 +39,7 @@ public class RegisterUIController : MonoBehaviour
         errorMsgLabel = root.Q<Label>("error_msg");
 
         confirm.clicked += ConfirmClick;
-        cancel.clicked += CancelClick;
+        cancel.clicked += SwitchToHome;
 
         InitSetting();
         ClearTextFieldValue();
@@ -99,7 +99,7 @@ public class RegisterUIController : MonoBehaviour
                 UserProperty.email = email;
             }
             string msg = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "game_message", "register_success", EnviromentSetting.languageCode });
-            MessageBoxController.ShowMessage(msg, () => CancelClick());
+            MessageBoxController.ShowMessage(msg, () => SwitchToHome());
         }
         else if (data != null && data["status"] == "error")
         {
@@ -124,14 +124,12 @@ public class RegisterUIController : MonoBehaviour
     }
 
     // 绑定取消按键
-    void CancelClick()
+    void SwitchToHome()
     {
         //SceneManager.LoadScene("Home");
         MaskTransitions.TransitionManager.Instance.LoadLevel("Home");
     }
 
-    
-
 
     // 初始化语言和显示设定
     void InitSetting()

+ 311 - 0
Assets/Scripts/Login/ResetUIController.cs

@@ -0,0 +1,311 @@
+using Newtonsoft.Json;
+using System.Collections.Generic;
+using System.Net.Mail;
+using UnityEngine;
+using UnityEngine.UIElements;
+
+/* 本文件控制Reset UI document 
+ * 1. 显示和关闭Reset UI
+ * 2. 显示和隐藏输入框
+ * 3. 提交数据到服务器
+ * 4. 显示错误信息
+ */
+
+public class ResetUIController : MonoBehaviour
+{
+    // Start is called once before the first execution of Update after the MonoBehaviour is created
+    private Label message, errMsg;
+    private TextField email, mobile, verification, password;
+    private Button submit, cancel;
+    private int condition = 0; // 0: 中文初始, 1: 其他语言初始, 2: 输入验证码和新的密码
+    private Dictionary<string, string> errorMessageDict = new();
+    private string errorText = string.Empty;      // 错误信息汇总
+    void Start()
+    {
+        var root = GetComponent<UIDocument>().rootVisualElement;
+        message = root.Q<Label>("message");
+        email = root.Q<TextField>("email");
+        mobile = root.Q<TextField>("mobile");
+        verification = root.Q<TextField>("verification");
+        password = root.Q<TextField>("password");
+        submit = root.Q<Button>("submit");
+        cancel = root.Q<Button>("cancel");
+        errMsg = root.Q<Label>("error_msg");
+
+        InitSetting();
+    }
+
+    // Update is called once per frame
+    void Update()
+    {
+        FormatCheck();
+        errMsg.text = errorText;
+    }
+
+    // 初始化语言和显示设定
+    void InitSetting()
+    {
+        // 设置 shopping UI界面里面label和按键的语言显示
+        string textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "button", "submit", EnviromentSetting.languageCode });
+        submit.text = textValue;
+        textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "button", "cancel", EnviromentSetting.languageCode });
+        cancel.text = textValue;
+        textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "text_field", "mobile", EnviromentSetting.languageCode });
+        mobile.label = textValue;
+        textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "text_field", "email", EnviromentSetting.languageCode });
+        email.label = textValue;
+        textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "text_field", "verification", EnviromentSetting.languageCode });
+        verification.label = textValue;
+        textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "text_field", "password", EnviromentSetting.languageCode });
+        password.label = textValue;
+
+        textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "error_msg", "password_too_short", EnviromentSetting.languageCode });
+        errorMessageDict.Add("password_too_short", textValue);
+        textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "error_msg", "cannot_find_account", EnviromentSetting.languageCode });
+        errorMessageDict.Add("cannot_find_account", textValue);
+        textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "error_msg", "wrong_verification_code", EnviromentSetting.languageCode });
+        errorMessageDict.Add("wrong_verification_code", textValue);
+        textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "error_msg", "email_format_wrong", EnviromentSetting.languageCode });
+        errorMessageDict.Add("email_format_wrong", textValue);
+
+        cancel.clicked += CancelClick;
+        submit.clicked += SubmitClick;
+
+        if (EnviromentSetting.languageCode == "zh-cn")
+        {
+            condition = 0;
+        }
+        else
+        {
+            condition = 1;
+        }
+        ConditionSetting(condition);
+    }
+
+    // 根据condition的值来显示不同的UI
+    void ConditionSetting(int conditionValue)
+    {
+        switch (conditionValue)
+        {
+            case 0:
+                string textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "label", "message 0", EnviromentSetting.languageCode });
+                message.text = textValue;
+                email.style.display = DisplayStyle.None;
+                mobile.style.display = DisplayStyle.Flex;
+                verification.style.display = DisplayStyle.None;
+                password.style.display = DisplayStyle.None;
+                submit.SetEnabled(false);
+                break;
+            case 1:
+                textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "label", "message 1", EnviromentSetting.languageCode });
+                message.text = textValue;
+                email.style.display = DisplayStyle.Flex;
+                mobile.style.display = DisplayStyle.None;
+                verification.style.display = DisplayStyle.None;
+                password.style.display = DisplayStyle.None;
+                submit.SetEnabled(false);
+                break;
+            case 2:
+                textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "label", "message 2", EnviromentSetting.languageCode });
+                message.text = textValue;
+                email.SetEnabled(false);
+                mobile.SetEnabled(false);
+                verification.style.display = DisplayStyle.Flex;
+                password.style.display = DisplayStyle.Flex;
+                submit.SetEnabled(false);
+                break;
+            //case 3:
+            //    textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "label", "message 3", EnviromentSetting.languageCode });
+            //    message.text = textValue;
+            //    email.SetEnabled(false);
+            //    mobile.SetEnabled(false);
+            //    verification.style.display = DisplayStyle.Flex;
+            //    password.style.display = DisplayStyle.None;
+            //    submit.SetEnabled(false);
+            //    break;
+            //case 4:
+            //    textValue = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "label", "message 4", EnviromentSetting.languageCode });
+            //    message.text = textValue;
+            //    email.SetEnabled(false);
+            //    mobile.SetEnabled(false);
+            //    verification.style.display = DisplayStyle.None;
+            //    password.style.display = DisplayStyle.Flex;
+            //    submit.SetEnabled(false);
+            //    break;
+        }
+    }
+
+    void SubmitClick()
+    {
+        if (condition <= 1)
+        {
+            // 申请验证码阶段
+            RequestVerificationCodePost();
+        }
+        else if (condition ==2)
+        {
+            // 输入验证码阶段和输入新密码阶段
+            NewPassowrdRequest();
+
+        }
+    }
+    void RequestVerificationCodePost()
+    {
+
+        // 申请验证码
+        // POST数据到服务器
+        string url = "/api/reset/password/step1/";
+        Dictionary<string, string> formData = new();
+        WWWForm form = new();
+        form.AddField("UUID", EnviromentSetting.UUID);
+        if (EnviromentSetting.languageCode == "zh-cn")
+        {
+            form.AddField("mobile", mobile.text);
+        }
+        else
+        {
+            form.AddField("email", email.text);
+        }
+        form.AddField("UUID", EnviromentSetting.UUID);
+        form.AddField("language_code", EnviromentSetting.languageCode);
+        StartCoroutine(WebController.PostRequest(url, form, callback: RequestVerificationCodeCallback));
+        errorText = string.Empty;
+    }
+
+    void RequestVerificationCodeCallback(string json)
+    {
+        var data = JsonConvert.DeserializeObject<Dictionary<string, string>>(json);
+        if (data != null && data["status"] == "success")
+        {
+            if (data["message"] == "verification sent")
+            {
+                // 发送验证码成功
+                condition = 2;
+                ConditionSetting(condition);
+            }
+        }
+        else if (data != null && data["status"] == "error")
+        {
+            // 找不到对应的账户
+            if (data["message"] == "cannot find account")
+            {
+                errorText += errorMessageDict["cannot_find_account"];
+            }
+
+        }
+    }
+
+    void NewPassowrdRequest()
+    {
+        // 检查验证码
+        string url = "/api/reset/password/step2/";
+        Dictionary<string, string> formData = new();
+        WWWForm form = new();
+        form.AddField("UUID", EnviromentSetting.UUID);
+        if (EnviromentSetting.languageCode == "zh-cn")
+        {
+            form.AddField("mobile", mobile.text);
+        }
+        else
+        {
+            form.AddField("email", email.text);
+        }
+        form.AddField("UUID", EnviromentSetting.UUID);
+        form.AddField("language_code", EnviromentSetting.languageCode);
+        form.AddField("verification_code", verification.text);
+        form.AddField("password", password.text);
+        StartCoroutine(WebController.PostRequest(url, form, callback: NewPasswordCallback));
+        errorText = string.Empty;
+    }
+
+    void NewPasswordCallback(string json)
+    {
+        var data = JsonConvert.DeserializeObject<Dictionary<string, string>>(json);
+        if (data != null && data["status"] == "success")
+        {
+            string msg = GameTool.GetValueAtPath(EnviromentSetting.languageData, new string[] { "resetUI", "label", "new_password_success", EnviromentSetting.languageCode });
+            MessageBoxController.ShowMessage(msg, () => MaskTransitions.TransitionManager.Instance.LoadLevel("Home"));
+        }
+        else if (data != null && data["status"] == "error")
+        {
+            // 验证码错误
+            if (data["message"] == "wrong verification code")
+            {
+                errorText += errorMessageDict["wrong_verification_code"];
+            }
+        }
+    }
+
+    void CancelClick()
+    {
+        var uiPlaceholder = GameObject.Find("Canvas Placeholder");
+        if (uiPlaceholder != null)
+        {
+            var resetUI = uiPlaceholder.transform.Find("Reset Pasword").gameObject;
+            var loginCanvas = uiPlaceholder.transform.Find("Login Canvas").gameObject;
+            resetUI.SetActive(false);
+            loginCanvas.SetActive(true);
+        }
+    }
+
+    // 检查输入的内容是否为空,输入不为空的时候Submit按钮可用
+
+    void FormatCheck()
+    {
+        switch (condition)
+        {
+            case 0:
+                {
+                    if (mobile.value != "")
+                    {
+                        submit.SetEnabled(true);
+                    }
+                    else
+                    {
+                        submit.SetEnabled(false);
+                    }
+                    break;
+                }
+            case 1:
+                {
+                    if (email.value != "" && IsValidEmail(email.text))
+                    {
+                        submit.SetEnabled(true);
+                    }
+                    else
+                    {
+                        submit.SetEnabled(false);
+                    }
+                    break;
+                }
+            case 2:
+                {
+                    if (verification.value != "" && password.text.Length>=8)
+                    {
+                        submit.SetEnabled(true);
+                    }
+                    else
+                    {
+                        submit.SetEnabled(false);
+                    }
+                    break;
+                }
+        }
+    }
+
+    #region 格式验证区
+    // email 格式检测
+    private bool IsValidEmail(string email)
+    {
+        try
+        {
+            var addr = new MailAddress(email);
+            return addr.Address == email;
+        }
+        catch
+        {
+            return false;
+        }
+    }
+    #endregion
+}

+ 2 - 0
Assets/Scripts/Login/ResetUIController.cs.meta

@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: 84bd515144e30814ca36e503694321bf

+ 5 - 1
Assets/UI Toolkit/Style/rootStyle.uss

@@ -1,5 +1,4 @@
 .rootStyle {
-    background-image: url("project://database/Assets/Pictures/background.jpg?fileID=2800000&guid=c8a7500d13cc10e40b0eadcdb5331d17&type=3#background");
     height: 100%;
     margin-top: 25px;
     margin-bottom: 20px;
@@ -178,3 +177,8 @@
     border-left-width: 0;
     -unity-font-definition: url("project://database/Assets/Font/MaoKenZhuYuanTi-MaokenZhuyuanTi-2.ttf?fileID=12800000&guid=50a63638b44907e46a3fa871d63b7d39&type=3#MaoKenZhuYuanTi-MaokenZhuyuanTi-2");
 }
+
+.message {
+    -unity-font-definition: url("project://database/Assets/Font/MaoKenZhuYuanTi-MaokenZhuyuanTi-2.ttf?fileID=12800000&guid=50a63638b44907e46a3fa871d63b7d39&type=3#MaoKenZhuYuanTi-MaokenZhuyuanTi-2");
+    margin-left: 4px;
+}

+ 1 - 1
Packages/manifest.json

@@ -5,7 +5,7 @@
     "com.unity.collab-proxy": "2.6.0",
     "com.unity.device-simulator.devices": "1.0.0",
     "com.unity.feature.development": "1.0.2",
-    "com.unity.inputsystem": "1.11.2",
+    "com.unity.inputsystem": "1.13.1",
     "com.unity.multiplayer.center": "1.0.0",
     "com.unity.nuget.newtonsoft-json": "3.2.1",
     "com.unity.postprocessing": "3.4.0",

+ 3 - 3
Packages/packages-lock.json

@@ -38,8 +38,8 @@
       "source": "registry",
       "dependencies": {
         "com.unity.burst": "1.8.17",
-        "com.unity.nuget.mono-cecil": "1.11.4",
         "com.unity.test-framework": "1.4.5",
+        "com.unity.nuget.mono-cecil": "1.11.4",
         "com.unity.test-framework.performance": "3.0.3"
       },
       "url": "https://packages.unity.com"
@@ -96,7 +96,7 @@
       "url": "https://packages.unity.com"
     },
     "com.unity.inputsystem": {
-      "version": "1.11.2",
+      "version": "1.13.1",
       "depth": 0,
       "source": "registry",
       "dependencies": {
@@ -232,9 +232,9 @@
       "depth": 0,
       "source": "registry",
       "dependencies": {
+        "com.unity.modules.audio": "1.0.0",
         "com.unity.modules.director": "1.0.0",
         "com.unity.modules.animation": "1.0.0",
-        "com.unity.modules.audio": "1.0.0",
         "com.unity.modules.particlesystem": "1.0.0"
       },
       "url": "https://packages.unity.com"