From 52aa4f486f772f9aaf52eb6e7729eed8bbc298aa Mon Sep 17 00:00:00 2001
From: wangguan <wangguan@kt007.com>
Date: Fri, 04 Dec 2020 16:55:59 +0800
Subject: [PATCH] 修改结算页面

---
 Assets/Scripts/UI/FinalPanel/FinalHttp.cs |   71 ++++++++++++++++++++++++++---------
 1 files changed, 53 insertions(+), 18 deletions(-)

diff --git a/Assets/Scripts/UI/FinalPanel/FinalHttp.cs b/Assets/Scripts/UI/FinalPanel/FinalHttp.cs
index 81a9370..ea4ab63 100644
--- a/Assets/Scripts/UI/FinalPanel/FinalHttp.cs
+++ b/Assets/Scripts/UI/FinalPanel/FinalHttp.cs
@@ -7,9 +7,9 @@
 
 public class FinalHttp : MonoBehaviour
 {
-    Action<List<HttpGetInfo>, int> callBack;
+    Action<List<HttpGetInfo>, int, HttpGetInfo> callBack;
     int _limit;
-    public void Init(Action<List<HttpGetInfo>, int> ac, int limit)
+    public void Init(Action<List<HttpGetInfo>, int, HttpGetInfo> ac, int limit)
     {
         isSending = false;
         callBack = ac;
@@ -27,7 +27,9 @@
         }
         else if (Application.platform == RuntimePlatform.WindowsEditor)
         {
-            GameConfig.Imei = "MyTestGemBattle1233333";
+            //GameConfig.Imei = "MyTestGemBattle1233333";
+            GameConfig.Imei = "MyTestRank2";
+
         }
         Debug.Log("设置imei0:" + GameConfig.Imei);
     }
@@ -43,6 +45,7 @@
     {
         LoadImei();
         Debug.Log("开始Post" + nickname);
+
         string url = "http://9377-big-data.sbk-h5.com:8600/users/addrank";
         Dictionary<string, object> keyValues = new Dictionary<string, object>();
         keyValues.Add("username", GameConfig.Imei);
@@ -59,7 +62,7 @@
             else
             {
                 Debug.LogError("连接错误");
-                callBack?.Invoke(null, 0);
+                callBack?.Invoke(null, 0, null);
             }
 
         }, HttpHelper.DownloadHanlderType.kHttpTEXT);
@@ -98,7 +101,7 @@
             else
             {
                 Debug.LogError("连接错误");
-                callBack?.Invoke(null, 0);
+                callBack?.Invoke(null, 0, null);
             }
         }, HttpHelper.DownloadHanlderType.kHttpTEXT);
 
@@ -110,32 +113,64 @@
         int myrank = int.Parse(getData["myrank"].ToString());
         Debug.Log("当前排名:" + myrank);
 
+        JsonData mydata = getData["mydata"];
+        HttpGetInfo mydataHttpInfo = new HttpGetInfo(mydata);
+
         JsonData rank = getData["rank"];
         List<HttpGetInfo> allHttpGetInfoLis = new List<HttpGetInfo>();
         HttpGetInfo info;
-        string tmpStr;
+        //string tmpStr;
         foreach (JsonData item in rank)
         {
-            info = new HttpGetInfo();
-            info.id = int.Parse(item["id"].ToString());
-            info.username = item["username"].ToString();
-            info.nickname = item["nickname"].ToString();
-            info.score = int.Parse(item["score"].ToString());
-            info.level = int.Parse(item["level"].ToString());
+            info = new HttpGetInfo(item);
+            // info.id = int.Parse(item["id"].ToString());
+            // info.username = item["username"].ToString();
+            // info.nickname = item["nickname"].ToString();
+            // info.score = int.Parse(item["score"].ToString());
+            // info.level = int.Parse(item["level"].ToString());
 
-            tmpStr = item["extra"].ToString();
-            tmpStr = tmpStr.Remove(0, 1);
-            tmpStr = tmpStr.Remove(tmpStr.Length - 1, 1);
+            // tmpStr = item["extra"].ToString();
+            // tmpStr = tmpStr.Remove(0, 1);
+            // tmpStr = tmpStr.Remove(tmpStr.Length - 1, 1);
 
-            info.waveInfo = tmpStr;
-            info.create_time = int.Parse(item["create_time"].ToString());
+            // info.waveInfo = tmpStr;
+            // info.create_time = int.Parse(item["create_time"].ToString());
             allHttpGetInfoLis.Add(info);
         }
 
         if (callBack != null)
         {
-            callBack(allHttpGetInfoLis, myrank);
+            callBack(allHttpGetInfoLis, myrank, mydataHttpInfo);
         }
     }
 
 }
+
+public class HttpGetInfo
+{
+    public int id;
+    public string username;
+    public string nickname;
+    public int score;
+    public int level;
+    public JsonData extra;
+    public string waveInfo;
+    public int create_time;
+
+    public HttpGetInfo(JsonData data)
+    {
+        string tmpStr;
+        id = int.Parse(data["id"].ToString());
+        username = data["username"].ToString();
+        nickname = data["nickname"].ToString();
+        score = int.Parse(data["score"].ToString());
+        level = int.Parse(data["level"].ToString());
+
+        tmpStr = data["extra"].ToString();
+        tmpStr = tmpStr.Remove(0, 1);
+        tmpStr = tmpStr.Remove(tmpStr.Length - 1, 1);
+
+        waveInfo = tmpStr;
+        create_time = int.Parse(data["create_time"].ToString());
+    }
+}

--
Gitblit v1.9.1