From 5ad15def0b0cd852a3aac835135af101122db7f6 Mon Sep 17 00:00:00 2001
From: wangguan <wangguan@kt007.com>
Date: Mon, 14 Dec 2020 16:25:54 +0800
Subject: [PATCH] 设置SDK打开 设置GameConfig.Imei = SDKManager.ins.sdk.uid

---
 Assets/Scripts/GameAnalytics_SDK/UI/LoginUI.cs |   75 +++++++++++++++++++++++++++----------
 1 files changed, 54 insertions(+), 21 deletions(-)

diff --git a/Assets/Scripts/GameAnalytics_SDK/UI/LoginUI.cs b/Assets/Scripts/GameAnalytics_SDK/UI/LoginUI.cs
index 8e577d7..fd9d0ba 100644
--- a/Assets/Scripts/GameAnalytics_SDK/UI/LoginUI.cs
+++ b/Assets/Scripts/GameAnalytics_SDK/UI/LoginUI.cs
@@ -60,23 +60,24 @@
 
         //transform.Find("Panel/Button (1)").GetComponent<Button>().onClick.AddListener(OnClickResetBtn);
 
-
-        if (Application.platform == RuntimePlatform.Android)
+        if (!GameConfig.useSDK)
         {
-            //GetetDeviceIMEI();//获取安卓手机IMEI
-            imei0 = TDAA_SDKManager.Ins.GetDeviceId();//使用设备ID
-        }
-        else if (Application.platform == RuntimePlatform.WindowsEditor)
-        {
-            imei0 = "MyTestGemBattle123";
-        }
+            if (Application.platform == RuntimePlatform.Android)
+            {
+                //GetetDeviceIMEI();//获取安卓手机IMEI
+                imei0 = TDAA_SDKManager.Ins.GetDeviceId();//使用设备ID
+            }
+            else if (Application.platform == RuntimePlatform.WindowsEditor)
+            {
+                imei0 = "MyTestGemBattle123";
+            }
 
-        GameConfig.PlayerName = imei0;
+            GameConfig.Imei = imei0;
+        }
 
         versionTxt.text = "版本号:" + Application.version;
         //resVersion.text 暂时没有使用
         transform.Find("Panel/PlayerID").GetComponent<Text>().text = "玩家ID:" + imei0;
-
 
         if (GameConfig.isFirstStart)
         {
@@ -129,6 +130,17 @@
         StartCoroutine(loginMy());
     }
 
+    /// <summary>
+    /// 使用SDK登录
+    /// </summary>
+    void SDKloginNext()
+    {
+        Debug.Log("SDK登录,修改Imei");
+        GameConfig.Imei = SDKManager.ins.sdk.uid;
+        transform.Find("Panel/PlayerID").GetComponent<Text>().text = "玩家ID:" + GameConfig.Imei;
+
+        loginNext();
+    }
 
 
     #region 获得安卓手机上的IMEI号
@@ -155,9 +167,12 @@
 
     private void OnClickResetBtn()
     {
-        Debug.LogError("清空了所有数据");
-        PlayerPrefs.DeleteAll();
-        TDAA_SDKManager.Ins.Reset();
+        if (!GameConfig.useSDK)
+        {
+            Debug.LogError("清空了所有数据");
+            PlayerPrefs.DeleteAll();
+            TDAA_SDKManager.Ins.Reset();
+        }
     }
 
 
@@ -165,18 +180,36 @@
     {
         if (!isLogining)
         {
-            // CoderM: 在这里要使用SDK来进行登录了
-            if (GameConfig.useSDK)
+            isLogining = true;
+            if (GameConfig.isFirstStart)
             {
-                //设置login的回调
-                SDKCallBack.ins.setNextAction("login", loginNext);
-                SDKManager.ins.sdk.login();
+                // CoderM: 在这里要使用SDK来进行登录了
+                if (GameConfig.useSDK)
+                {
+                    Debug.Log("使用SDK来进行登录了");
+                    //设置login的回调
+                    SDKCallBack.ins.setNextAction("login", SDKloginNext);
+                    SDKManager.ins.sdk.login();
+                }
+                else
+                {
+                    Debug.Log("没有使用SDK");
+
+                    //没有使用SDK
+                    loginNext();
+                }
             }
             else
             {
-                //没有使用SDK
-                loginNext();
+                Debug.Log("重玩");
+                progressSlider.gameObject.SetActive(true);
+                startBtn.gameObject.SetActive(false);
+
+                AudioSourceManager.Ins.Play(AudioEnum.UI);
+                TDAA_SDKManager.Ins.OnClickRestartBtn();//重玩
+                StartCoroutine(loginMy());
             }
+
         }
         else
         {

--
Gitblit v1.9.1