Browse Source

大屏增加创建账号

“hujiajun” 1 month ago
parent
commit
33c8a4ef2c
33 changed files with 469 additions and 135 deletions
  1. 50 0
      Assets/ChangePass.cs
  2. 11 0
      Assets/ChangePass.cs.meta
  3. 142 16
      Assets/DataManager.cs
  4. 7 0
      Assets/LoginManager.cs
  5. 8 0
      Assets/MainCenterManager.cs
  6. 1 43
      Assets/Scenes/Main.unity
  7. 74 74
      Assets/SetWebGLText.cs
  8. 1 1
      Assets/StreamingAssets/1.txt
  9. BIN
      Assets/StreamingAssets/Main/changesuccess.png
  10. 7 0
      Assets/StreamingAssets/Main/changesuccess.png.meta
  11. BIN
      Assets/StreamingAssets/Main/cjcg.png
  12. 7 0
      Assets/StreamingAssets/Main/cjcg.png.meta
  13. BIN
      Assets/StreamingAssets/Main/cjsb.png
  14. 7 0
      Assets/StreamingAssets/Main/cjsb.png.meta
  15. BIN
      Assets/StreamingAssets/Main/passsavesuccess.png
  16. 7 0
      Assets/StreamingAssets/Main/passsavesuccess.png.meta
  17. BIN
      Assets/StreamingAssets/Main/savefail.png
  18. 7 0
      Assets/StreamingAssets/Main/savefail.png.meta
  19. 44 0
      Assets/UserInfoCheck.cs
  20. 66 0
      Assets/createzhanghao.cs
  21. 11 0
      Assets/createzhanghao.cs.meta
  22. 7 0
      Assets/zhanghaomanager.cs
  23. 11 0
      Assets/zhanghaomanager.cs.meta
  24. BIN
      test2/test/Build/test.data.unityweb
  25. BIN
      test2/test/Build/test.framework.js.unityweb
  26. BIN
      test2/test/Build/test.symbols.json.unityweb
  27. BIN
      test2/test/Build/test.wasm.unityweb
  28. 1 1
      test2/test/StreamingAssets/1.txt
  29. BIN
      test2/test/StreamingAssets/Main/changesuccess.png
  30. BIN
      test2/test/StreamingAssets/Main/cjcg.png
  31. BIN
      test2/test/StreamingAssets/Main/cjsb.png
  32. BIN
      test2/test/StreamingAssets/Main/passsavesuccess.png
  33. BIN
      test2/test/StreamingAssets/Main/savefail.png

+ 50 - 0
Assets/ChangePass.cs

@@ -0,0 +1,50 @@
+using System.Collections;
+using System.Collections.Generic;
+using LitJson;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class ChangePass : MonoBehaviour
+{
+    public GameObject savesuccess;
+    public GameObject terror;
+    public GameObject terror2;
+    public InputField inputold;
+    public InputField inputnew1;
+    public InputField inputnew2;
+    public void changepass()
+    {
+        string oldpass = AesEncryption.Encrypt(inputold.text);
+        string encrypted1 = AesEncryption.Encrypt(inputnew1.text);
+        string encrypted2 = AesEncryption.Encrypt(inputnew1.text);
+        if(encrypted1==encrypted2)
+        {
+            DataManager.Instance.setPass(oldpass,encrypted1,(msg) => {
+                JsonData d = JsonMapper.ToObject(msg);
+                if(d["data"]==null)
+                {
+                    terror.SetActive(true);
+                }
+                else
+                {
+                    terror2.SetActive(false);
+                    terror.SetActive(false);
+                    savesuccess.SetActive(true);
+                    Invoke("savecloes",2f);
+                    
+                }
+
+            });
+        }
+        else
+        {
+            terror2.SetActive(true);
+        }
+    
+    }
+    void savecloes()
+    {
+        savesuccess.SetActive(false);
+        MainCenterManager.Instance.showMain();
+    }
+}

+ 11 - 0
Assets/ChangePass.cs.meta

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

File diff suppressed because it is too large
+ 142 - 16
Assets/DataManager.cs


+ 7 - 0
Assets/LoginManager.cs

@@ -6,6 +6,7 @@ using UnityEngine.UI;
 
 public class LoginManager : MonoBehaviour
 {
+    public static bool isinit;
     public GameObject Main;
 
     public GameObject pass0;
@@ -21,6 +22,12 @@ public class LoginManager : MonoBehaviour
     public GameObject errorpass;
     private void Start()
     {
+        if(!isinit)
+        {
+            isinit=true;
+            this.gameObject.SetActive(true);
+            Main.SetActive(false);
+        }
         int i= PlayerPrefs.GetInt("remb");
         if(i==1)
         {

+ 8 - 0
Assets/MainCenterManager.cs

@@ -18,6 +18,9 @@ public class MainCenterManager : MonoBehaviour
        
         
     }
+    private void OnEnable() {
+        showMain();
+    }
 
     public void show()
     {
@@ -28,4 +31,9 @@ public class MainCenterManager : MonoBehaviour
         }
     }
 
+    public void showMain()
+    {
+       MainCenterManager.Instance.show();
+        list[0].SetActive(true);
+    }
 }

File diff suppressed because it is too large
+ 1 - 43
Assets/Scenes/Main.unity


+ 74 - 74
Assets/SetWebGLText.cs

@@ -1,7 +1,7 @@
 using System;
 using System.Collections;
 using System.Collections.Generic;
-using System.Threading.Tasks;
+using System.Threading.Tasks;
 using UnityEngine;
 using UnityEngine.Networking;
 
@@ -15,94 +15,94 @@ public class SetWebGLText : MonoBehaviour
     void Awake()
     {
         Instance = this;
-        webglfont = font;
-        //  StartCoroutine(LoadAB());
+        webglfont = font;
+        //  StartCoroutine(LoadAB());
     }
     IEnumerator Downloadip()
-    {
+    {
         Debug.Log("开始获取ip文件" + Application.streamingAssetsPath + "/1.txt");
         UnityWebRequest m_webrequest = UnityWebRequest.Get(Application.streamingAssetsPath + "/1.txt");
         yield return m_webrequest.SendWebRequest();
 
         if (m_webrequest.result != UnityWebRequest.Result.Success)
-        {
+        {
             Debug.Log("获取ip文件失败==》" + m_webrequest.downloadHandler.error);
             Debug.LogError("Failed to download image");
         }
         else
-        {
-            DataManager.ip = RemoveWhitespace(m_webrequest.downloadHandler.text);
+        {
+            DataManager.ip = RemoveWhitespace(m_webrequest.downloadHandler.text);
             Debug.Log("获取ip文件成功==》" + DataManager.ip);
 
         }
-    }
-    string RemoveWhitespace(string input)
-    {
-        // 去除回车、换行、制表符和空格等空白字符
-        return input.Replace("\r", "").Replace("\n", "").Replace("\t", "").Replace(" ", "");
-    }
+    }
+    string RemoveWhitespace(string input)
+    {
+        // 去除回车、换行、制表符和空格等空白字符
+        return input.Replace("\r", "").Replace("\n", "").Replace("\t", "").Replace(" ", "");
+    }
     IEnumerator DownloadMacIp()
-    {
-        string filePath = Application.streamingAssetsPath+"/1.txt";
-
-        Debug.Log("开始获取ip文件"+ filePath);
+    {
+        string filePath = Application.streamingAssetsPath+"/1.txt";
+
+        Debug.Log("开始获取ip文件"+ filePath);
         if (!stlist.ContainsKey(filePath))
-        {
-            if (System.IO.File.Exists(filePath))
-            {
-                Task<string> fileData = System.IO.File.ReadAllTextAsync(filePath);
-                while (!fileData.IsCompleted)
-                {
-                    yield return null;
-                }
-                DataManager.ip = RemoveWhitespace(fileData.Result);
-            }
+        {
+            if (System.IO.File.Exists(filePath))
+            {
+                Task<string> fileData = System.IO.File.ReadAllTextAsync(filePath);
+                while (!fileData.IsCompleted)
+                {
+                    yield return null;
+                }
+                DataManager.ip = RemoveWhitespace(fileData.Result);
+            }
         }
-        else
-        {
-            yield return null;
+        else
+        {
+            yield return null;
         }
-    }
-
+    }
+
     IEnumerator DownloadImageMac(callback url)
-    {
-        string filePath = url.url;
-
+    {
+        string filePath = url.url;
+
         if (!stlist.ContainsKey(url.url))
-        {
-            if (System.IO.File.Exists(filePath))
-            {
-                Task<byte[]> fileData = System.IO.File.ReadAllBytesAsync(filePath);
-                while (!fileData.IsCompleted)
-                {
-                    yield return null;
-                }
-                Texture2D texture = new Texture2D(2, 2);
-                if (texture.LoadImage(fileData.Result))
-                {
-                    stlist.Add(url.url, texture);
-                    url.msg.Invoke(texture);
-                    isload = false;
-                }
-            }
-            else
-            {
-                isload = false;
-                Debug.LogError("Failed to download image   "+ filePath);
-
-            }
+        {
+            if (System.IO.File.Exists(filePath))
+            {
+                Task<byte[]> fileData = System.IO.File.ReadAllBytesAsync(filePath);
+                while (!fileData.IsCompleted)
+                {
+                    yield return null;
+                }
+                Texture2D texture = new Texture2D(2, 2);
+                if (texture.LoadImage(fileData.Result))
+                {
+                    stlist.Add(url.url, texture);
+                    url.msg.Invoke(texture);
+                    isload = false;
+                }
+            }
+            else
+            {
+                isload = false;
+                Debug.LogError("Failed to download image   "+ filePath);
+
+            }
         }
-        else
-        {
+        else
+        {
             yield return null;
             url.msg.Invoke(stlist[url.url]);
-            isload = false;
+            isload = false;
         }
     }
 
 
     IEnumerator LoadAB()
-    {
+    {
         string filePath = System.IO.Path.Combine(Application.streamingAssetsPath, "stzhongs");
         //UnityWebRequest request = UnityWebRequest.Get(filePath);
 
@@ -123,17 +123,17 @@ public class SetWebGLText : MonoBehaviour
     Queue<callback> dl = new Queue<callback>();
     public void GetTexture(string url,Action<Texture2D> msg)
     {
-        if(stlist.ContainsKey(url))
-        {
-            msg.Invoke(stlist[url]);
-        }
-        else
-        {
-
-            callback cb = new callback();
-            cb.url = url;
-            cb.msg = msg;
-            dl.Enqueue(cb);
+        if(stlist.ContainsKey(url))
+        {
+            msg.Invoke(stlist[url]);
+        }
+        else
+        {
+
+            callback cb = new callback();
+            cb.url = url;
+            cb.msg = msg;
+            dl.Enqueue(cb);
         }
     }
     bool isload;
@@ -142,12 +142,12 @@ public class SetWebGLText : MonoBehaviour
         if(dl.Count>0&&!isload)
         {
             isload = true;
-            callback cb = dl.Dequeue();
+            callback cb = dl.Dequeue();
 #if UNITY_EDITOR
             StartCoroutine(DownloadImageMac(cb));
 #else
             StartCoroutine(DownloadImage(cb));
-#endif
+#endif
 #if UNITY_EDITOR
             StartCoroutine(DownloadMacIp());
 #else

+ 1 - 1
Assets/StreamingAssets/1.txt

@@ -1 +1 @@
-https://api-fat2.ghz-tech.com/feature-tester/v1
+http://192.168.50.14:8888/feature-tester/v1

BIN
Assets/StreamingAssets/Main/changesuccess.png


+ 7 - 0
Assets/StreamingAssets/Main/changesuccess.png.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: c31800e3ea9cd4037bc73f14e89d0a7d
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/StreamingAssets/Main/cjcg.png


+ 7 - 0
Assets/StreamingAssets/Main/cjcg.png.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 979cc1f28cae14f15aba508fa055e725
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/StreamingAssets/Main/cjsb.png


+ 7 - 0
Assets/StreamingAssets/Main/cjsb.png.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: d36cb69a206ce48819c538217db15fc0
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/StreamingAssets/Main/passsavesuccess.png


+ 7 - 0
Assets/StreamingAssets/Main/passsavesuccess.png.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: ce6d0f22e1adc4186891baf99facdc73
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/StreamingAssets/Main/savefail.png


+ 7 - 0
Assets/StreamingAssets/Main/savefail.png.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 2081382a9e2b14affb0336fb6324dfd3
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 44 - 0
Assets/UserInfoCheck.cs

@@ -1,10 +1,14 @@
 using System.Collections;
 using System.Collections.Generic;
+using LitJson;
 using UnityEngine;
 using UnityEngine.UI;
+using static Manager;
 
 public class UserInfoCheck : MonoBehaviour
 {
+    public GameObject savesuccess;
+    public GameObject savefail;
 
     public Text tacc;
     public InputField iname;
@@ -27,4 +31,44 @@ public class UserInfoCheck : MonoBehaviour
         }
         
     }
+    public void changeInfo()
+    {
+
+        UserInfo uinfo =new UserInfo();
+        uinfo.name =  iname.text;
+        uinfo.dept =  ibumen.text;
+        uinfo.position =  izhiwu.text;
+        uinfo.notes =  ibeizhu.text;
+        DataManager.Instance.setuserinfo(uinfo,(msg) => {
+            try{
+
+            JsonData d = JsonMapper.ToObject(msg);
+                if(d["data"]==null)
+                {
+                    savefail.SetActive(true);
+                    Invoke("savefailcloes",2f);
+                }
+                else
+                {
+                    savesuccess.SetActive(true);
+                    Invoke("savecloes",2f);
+                    
+                }
+            }
+            catch{
+
+                    savefail.SetActive(true);
+                    Invoke("savefailcloes",2f);
+            }
+        });
+    }
+    void savecloes()
+    {
+        savesuccess.SetActive(false);
+        MainCenterManager.Instance.showMain();
+    }
+    void savefailcloes()
+    {
+        savefail.SetActive(false);
+    }
 }

+ 66 - 0
Assets/createzhanghao.cs

@@ -0,0 +1,66 @@
+using System.Collections;
+using System.Collections.Generic;
+using LitJson;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class createzhanghao : MonoBehaviour
+{
+    public GameObject one;
+    public GameObject cg;
+    public GameObject sb;
+   public InputField accinput;
+   public InputField nameinput;
+   public InputField deptinput;
+   public InputField notesinput;
+   public InputField positioninput;
+   public InputField inputpass;
+   public Toggle admintg;
+    public void createrzh()
+    {
+        JsonData d = new JsonData();
+        d["account"] = accinput.text;
+        d["name"] = nameinput.text;
+        d["dept"] = deptinput.text;
+        d["notes"] = notesinput.text;
+        d["position"] = positioninput.text;
+        d["admin"] = admintg.isOn?1:0;
+        d["password"] =   AesEncryption.Encrypt(inputpass.text);
+        DataManager.Instance.createzh(d,(str)=>{
+            try{
+
+                JsonData j =JsonMapper.ToObject(str);
+                if(bool.Parse(j["data"]["result"].ToString()))
+                {
+                    cg.SetActive(true);
+        Invoke("cgyc",2f);
+                }
+                else
+                {
+
+        sb.SetActive(true);
+        Invoke("csbyc",2f);
+                }
+
+            }catch
+            {
+
+        sb.SetActive(true);
+        Invoke("csbyc",2f);
+            }
+
+        });
+    }
+
+    void cgyc()
+    {
+        cg.SetActive(false);
+        this.gameObject.SetActive(false);
+        one.SetActive(true);
+    }
+
+    void csbyc()
+    {
+        sb.SetActive(false);
+    }
+}

+ 11 - 0
Assets/createzhanghao.cs.meta

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

+ 7 - 0
Assets/zhanghaomanager.cs

@@ -0,0 +1,7 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class zhanghaomanager : MonoBehaviour
+{
+}

+ 11 - 0
Assets/zhanghaomanager.cs.meta

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

BIN
test2/test/Build/test.data.unityweb


BIN
test2/test/Build/test.framework.js.unityweb


BIN
test2/test/Build/test.symbols.json.unityweb


BIN
test2/test/Build/test.wasm.unityweb


+ 1 - 1
test2/test/StreamingAssets/1.txt

@@ -1 +1 @@
-http://192.168.50.13:8888/feature-tester/v1
+http://192.168.50.14:8888/feature-tester/v1

BIN
test2/test/StreamingAssets/Main/changesuccess.png


BIN
test2/test/StreamingAssets/Main/cjcg.png


BIN
test2/test/StreamingAssets/Main/cjsb.png


BIN
test2/test/StreamingAssets/Main/passsavesuccess.png


BIN
test2/test/StreamingAssets/Main/savefail.png


Some files were not shown because too many files changed in this diff