DGJ 2 달 전
부모
커밋
35a1e1fe8e

+ 49 - 2
Assets/Scripts/LoginManager.cs

@@ -1,3 +1,5 @@
+using LitJson;
+using Newtonsoft.Json.Linq;
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
@@ -18,6 +20,8 @@ public class LoginManager : MonoSingleton<LoginManager>
 
     public Button loginBtn;
 
+    public LoginUPError loginUpError;
+
     private bool isShwoPasword = false;
 
    
@@ -114,7 +118,10 @@ public class LoginManager : MonoSingleton<LoginManager>
     {
         bool finish = true;
 
-        if (usernameInput.text.IsNormalized())
+        Debug.Log(usernameInput.text);
+        Debug.Log(passwordInput.text);
+
+        if (usernameInput.text==""|| usernameInput.text == "请输入用户名")
         {
             finish = false;
             usernameError.gameObject.SetActive(true);
@@ -123,7 +130,7 @@ public class LoginManager : MonoSingleton<LoginManager>
 
         }
 
-        if (passwordInput.text.IsNormalized())
+        if (passwordInput.text==""|| passwordInput.text=="请输入密码")
         {
             finish = false;
             passwordError.gameObject.SetActive(true);
@@ -142,8 +149,48 @@ public class LoginManager : MonoSingleton<LoginManager>
 
         //  密码是否符合基本要求
 
+
+        JsonData data = new JsonData();
+        data["account"] = username;
+        data["password"] = password;
+
         // 登录请求
+        HttpToolDP.Instance.Post("https://api-fat2.ghz-tech.com" + "/cmcc-endustry/v1/user/login", data.ToJson(), (msg) =>
+          {
+              Debug.Log("DGJ ===> Login " + msg);
+
+              JObject data = JObject.Parse(msg);
+
+              if (data["code"].ToString() == "200")
+              {
+                  // 登录成功
+
+              }
+              else
+              {
+                  // 根据报错做对应显示 
+
+                 
+
+                  // 已经登录
+
+
+              }
+
+              if(data["code"].ToString() == "4007")
+              {
+                  // 账号或密码错误
 
+                  if (loginUpError.gameObject.activeSelf)
+                  {
+                      loginUpError.times = 0;
+                  }
+                  else
+                  {
+                      loginUpError.gameObject.SetActive(true);
+                  }
+              }
+          });
 
     }
 }

+ 29 - 0
Assets/Scripts/LoginUPError.cs

@@ -0,0 +1,29 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class LoginUPError : MonoBehaviour
+{
+    public float times;
+    private void OnEnable()
+    {
+        times = 0;
+    }
+
+    private void Update()
+    {
+        times += Time.deltaTime;
+        if (times >= 3)
+        {
+            times = 0;
+            gameObject.SetActive(false);
+        }
+    }
+
+    private IEnumerator CloseShwo()
+    {
+        yield return new WaitForSeconds(3f);
+        gameObject.SetActive(false);
+
+    }
+}

+ 11 - 0
Assets/Scripts/LoginUPError.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 25c8dd614f96d284c9b8a1017e95d65f
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 96 - 6
Assets/ShuZiDaPing/DapingTest.unity

@@ -28755,13 +28755,13 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 881143414}
-  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
-  m_LocalPosition: {x: 0, y: 1.2, z: 0}
-  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+  m_LocalPosition: {x: -0.24654949, y: -0.26185185, z: 0}
+  m_LocalScale: {x: 0.00052083336, y: 0.0009259259, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children: []
-  m_Father: {fileID: 0}
-  m_RootOrder: 6
+  m_Father: {fileID: 1806237740}
+  m_RootOrder: 27
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!1 &882760536
 GameObject:
@@ -35263,7 +35263,7 @@ Transform:
   m_ConstrainProportionsScale: 0
   m_Children: []
   m_Father: {fileID: 0}
-  m_RootOrder: 7
+  m_RootOrder: 6
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!1 &1084815094
 GameObject:
@@ -40679,6 +40679,93 @@ CanvasRenderer:
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 1263735625}
   m_CullTransparentMesh: 1
+--- !u!1 &1270064539
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 1270064540}
+  - component: {fileID: 1270064542}
+  - component: {fileID: 1270064541}
+  - component: {fileID: 1270064543}
+  m_Layer: 5
+  m_Name: LoginUPError
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 0
+--- !u!224 &1270064540
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1270064539}
+  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: 1832003407}
+  m_RootOrder: 5
+  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: 38, y: 432}
+  m_SizeDelta: {x: 350, y: 61}
+  m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1270064541
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1270064539}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, 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_Texture: {fileID: 2800000, guid: 2f9758f7a9977b746b65a4862cef9f3b, type: 3}
+  m_UVRect:
+    serializedVersion: 2
+    x: 0
+    y: 0
+    width: 1
+    height: 1
+--- !u!222 &1270064542
+CanvasRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1270064539}
+  m_CullTransparentMesh: 1
+--- !u!114 &1270064543
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1270064539}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 25c8dd614f96d284c9b8a1017e95d65f, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  times: 0
 --- !u!1 &1272349252
 GameObject:
   m_ObjectHideFlags: 0
@@ -64261,6 +64348,7 @@ RectTransform:
   - {fileID: 319916511}
   - {fileID: 2015506463}
   - {fileID: 860230890}
+  - {fileID: 881143417}
   m_Father: {fileID: 1967666235}
   m_RootOrder: 1
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -65588,6 +65676,7 @@ RectTransform:
   - {fileID: 1679114454}
   - {fileID: 1537543611}
   - {fileID: 919601681}
+  - {fileID: 1270064540}
   m_Father: {fileID: 1967666235}
   m_RootOrder: 2
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -65652,6 +65741,7 @@ MonoBehaviour:
   passwordIconClose: {fileID: 2800000, guid: b0403780b45f43b4d943524b883ca18e, type: 3}
   paswrodIconOpen: {fileID: 2800000, guid: 5ca9f888a34004b49830187faa4e5ae2, type: 3}
   loginBtn: {fileID: 919601684}
+  loginUpError: {fileID: 1270064543}
 --- !u!1 &1835134729
 GameObject:
   m_ObjectHideFlags: 0

BIN
Assets/ShuZiDaPing/Login/密码错误提醒@3x.png


+ 147 - 0
Assets/ShuZiDaPing/Login/密码错误提醒@3x.png.meta

@@ -0,0 +1,147 @@
+fileFormatVersion: 2
+guid: 2f9758f7a9977b746b65a4862cef9f3b
+TextureImporter:
+  internalIDToNameTable: []
+  externalObjects: {}
+  serializedVersion: 12
+  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
+  isReadable: 0
+  streamingMipmaps: 0
+  streamingMipmapsPriority: 0
+  vTOnly: 0
+  ignoreMasterTextureLimit: 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
+  cookieLightType: 0
+  platformSettings:
+  - serializedVersion: 3
+    buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 3
+    buildTarget: Standalone
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 3
+    buildTarget: Server
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 3
+    buildTarget: Android
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 3
+    buildTarget: WebGL
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+    physicsShape: []
+    bones: []
+    spriteID: 
+    internalID: 0
+    vertices: []
+    indices: 
+    edges: []
+    weights: []
+    secondaryTextures: []
+    nameFileIdTable: {}
+  spritePackingTag: 
+  pSDRemoveMatte: 0
+  pSDShowRemoveMatteOption: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: