From 6f328e27fd7106b6fd4b77ecdae585e7ef4429eb Mon Sep 17 00:00:00 2001
From: wangguan <wangguan@kt007.com>
Date: Fri, 11 Dec 2020 20:23:15 +0800
Subject: [PATCH] Merge branch 'master' of http://172.16.1.52:8090/r/GemBattle

---
 Assets/Scripts/GameAnalytics_SDK/UI/LoginUI.cs |   84 ++++++++++++++++++++++++++++++------------
 1 files changed, 60 insertions(+), 24 deletions(-)

diff --git a/Assets/Scripts/GameAnalytics_SDK/UI/LoginUI.cs b/Assets/Scripts/GameAnalytics_SDK/UI/LoginUI.cs
index 948d0b1..9d7168b 100644
--- a/Assets/Scripts/GameAnalytics_SDK/UI/LoginUI.cs
+++ b/Assets/Scripts/GameAnalytics_SDK/UI/LoginUI.cs
@@ -22,8 +22,16 @@
 
     private Text versionTxt;//版本号
     private Text resVersion;//资源版本号
+    float waitTime;//切换场景等待时间
 
-    float waitTime;//加载等待时间
+    [SerializeField]
+    private Sprite nextSprite;
+
+    [SerializeField]
+    private Image bg;
+
+    [SerializeField]
+    private GameObject other;
 
     // Start is called before the first frame update
     void Start()
@@ -33,14 +41,12 @@
 
         isLogining = false;
 
-        repairBtn = transform.Find("Panel/RepairBtn").GetComponent<Button>();
-        noticeBtn = transform.Find("Panel/NoticeBtn").GetComponent<Button>();
+        repairBtn = transform.Find("Panel/Other/RepairBtn").GetComponent<Button>();
         startBtn = transform.Find("Panel/StartBtn").GetComponent<Button>();
 
-        versionTxt = transform.Find("Panel/Version").GetComponent<Text>();
-        resVersion = transform.Find("Panel/ResVersion").GetComponent<Text>();
+        versionTxt = transform.Find("Panel/Other/Version").GetComponent<Text>();
 
-        progressSlider = transform.Find("Panel/Progress").GetComponent<Slider>();
+        progressSlider = transform.Find("Panel/Other/Progress").GetComponent<Slider>();
         progressSlider.value = 0;
         progressSlider.gameObject.SetActive(false);
 
@@ -52,13 +58,27 @@
             OnClickResetBtn();
         });
 
-        if (!GameConfig.isFirstStart)//后续直接加载
-        {
-            waitTime = 2f;
+        //transform.Find("Panel/Button (1)").GetComponent<Button>().onClick.AddListener(OnClickResetBtn);
 
-            LoadNextScene();
+
+        if (Application.platform == RuntimePlatform.Android)
+        {
+            //GetetDeviceIMEI();//获取安卓手机IMEI
+            imei0 = TDAA_SDKManager.Ins.GetDeviceId();//使用设备ID
         }
-        else
+        else if (Application.platform == RuntimePlatform.WindowsEditor)
+        {
+            imei0 = "MyTestGemBattle123";
+        }
+
+        GameConfig.PlayerName = imei0;
+
+        versionTxt.text = "版本号:" + Application.version;
+        //resVersion.text 暂时没有使用
+        transform.Find("Panel/Other/PlayerID").GetComponent<Text>().text = "玩家ID:" + imei0;
+
+
+        if (GameConfig.isFirstStart)
         {
             waitTime = 0f;
             //第一次启动,初始化并且埋点
@@ -67,22 +87,34 @@
                 TDAA_SDKManager.Ins.SDKInit(ChannelID.Gm.ToString());
                 TDAA_SDKManager.Ins.Statistics(1);//成功加载登陆界面的人数
             }
+        }
 
+        SetStart();
+    }
+
+    /// <summary>
+    /// 设置开始状态
+    /// </summary>
+    private void SetStart()
+    {
+        startBtn.gameObject.SetActive(true);
+        int resId = Mathf.FloorToInt(Mathf.Clamp01(GameConfig.GameCompletedCount));
+        Image img = startBtn.transform.GetChild(0).GetComponent<Image>();
+        img.sprite = Resources.Load<Sprite>($"UI/Loading/{resId}");
+        img.SetNativeSize();
+
+        if (GameConfig.GameCompletedCount > 0)
+        {
+            other.SetActive(false);
+            bg.sprite = nextSprite;
+            bg.SetNativeSize();
         }
     }
 
+    /// <summary>
+    /// 开始游戏
+    /// </summary>
     void loginNext()
-    {
-        GameConfig.PlayerName = SDKManager.ins.sdk.uid;
-
-        versionTxt.text = "版本号:" + Application.version;
-        //resVersion.text 暂时没有使用
-        transform.Find("Panel/PlayerID").GetComponent<Text>().text = "玩家ID:" + SDKManager.ins.sdk.uid;
-
-        LoadNextScene();
-    }
-
-    private void LoadNextScene()
     {
         progressSlider.gameObject.SetActive(true);
         startBtn.gameObject.SetActive(false);
@@ -93,6 +125,8 @@
         GameConfig.isFirstStart = false;
         StartCoroutine(loginMy());
     }
+
+
 
     #region 获得安卓手机上的IMEI号
     public string imei0 = "";
@@ -128,15 +162,17 @@
     {
         if (!isLogining)
         {
+            // CoderM: 在这里要使用SDK来进行登录了
             if (GameConfig.useSDK)
             {
-                // CoderM: 在这里要使用SDK来进行登录了
+                //设置login的回调
                 SDKCallBack.ins.setNextAction("login", loginNext);
                 SDKManager.ins.sdk.login();
             }
             else
             {
-                LoadNextScene();
+                //没有使用SDK
+                loginNext();
             }
         }
         else

--
Gitblit v1.9.1