From 7f17bafe6d18d2d7725c8beb9c30a154d7183996 Mon Sep 17 00:00:00 2001 From: liuzhiwei <liuzhiwei@qq.com> Date: Tue, 22 Dec 2020 21:01:11 +0800 Subject: [PATCH] 塔buff --- Assets/Scripts/GameAnalytics_SDK/UI/LoginUI.cs | 113 +++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 74 insertions(+), 39 deletions(-) diff --git a/Assets/Scripts/GameAnalytics_SDK/UI/LoginUI.cs b/Assets/Scripts/GameAnalytics_SDK/UI/LoginUI.cs index 9d7168b..523e847 100644 --- a/Assets/Scripts/GameAnalytics_SDK/UI/LoginUI.cs +++ b/Assets/Scripts/GameAnalytics_SDK/UI/LoginUI.cs @@ -15,8 +15,8 @@ bool isLogining; private JsonData loginData; - private Button repairBtn;//修复 - private Button noticeBtn;//公告 + //private Button repairBtn;//修复 + //private Button noticeBtn;//公告 private Button startBtn;//开始游戏 private Slider progressSlider;//进度条 @@ -31,62 +31,62 @@ private Image bg; [SerializeField] - private GameObject other; + private List<GameObject> other; // Start is called before the first frame update void Start() { AudioSourceManager.Ins.Play(AudioEnum.BGM1); + EventCenter.Ins.RemoveAllListener(); + TDAA_SDKManager.Ins.AddListener(); isLogining = false; - repairBtn = transform.Find("Panel/Other/RepairBtn").GetComponent<Button>(); + //repairBtn = transform.Find("Panel/RepairBtn").GetComponent<Button>(); startBtn = transform.Find("Panel/StartBtn").GetComponent<Button>(); - versionTxt = transform.Find("Panel/Other/Version").GetComponent<Text>(); + versionTxt = transform.Find("Panel/Version").GetComponent<Text>(); - progressSlider = transform.Find("Panel/Other/Progress").GetComponent<Slider>(); + progressSlider = transform.Find("Panel/Progress").GetComponent<Slider>(); progressSlider.value = 0; progressSlider.gameObject.SetActive(false); startBtn.onClick.AddListener(OnClickLoginBtn); startBtn.gameObject.SetActive(true); - repairBtn.onClick.AddListener(() => - { - OnClickResetBtn(); - }); + // repairBtn.onClick.AddListener(() => + // { + // OnClickResetBtn(); + // }); //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/Other/PlayerID").GetComponent<Text>().text = "玩家ID:" + imei0; - + transform.Find("Panel/PlayerID").GetComponent<Text>().text = "玩家ID:" + imei0; if (GameConfig.isFirstStart) { waitTime = 0f; - //第一次启动,初始化并且埋点 - if (!GameConfig.useSDK) - { - TDAA_SDKManager.Ins.SDKInit(ChannelID.Gm.ToString()); - TDAA_SDKManager.Ins.Statistics(1);//成功加载登陆界面的人数 - } + Debug.Log("初始化TDAA_SDKManager"); + TDAA_SDKManager.Ins.SDKInit(ChannelID.Gm.ToString()); + TDAA_SDKManager.Ins.Statistics(1);//成功加载登陆界面的人数 } SetStart(); @@ -105,7 +105,10 @@ if (GameConfig.GameCompletedCount > 0) { - other.SetActive(false); + for (int i = 0; i < other.Count; ++i) + { + other[i].SetActive(false); + } bg.sprite = nextSprite; bg.SetNativeSize(); } @@ -126,6 +129,17 @@ StartCoroutine(loginMy()); } + /// <summary> + /// 使用SDK登录 + /// </summary> + void SDKloginNext() + { + GameConfig.Imei = SDKManager.ins.sdk.uid; + Debug.Log("SDK登录,修改Imei:" + GameConfig.Imei); + transform.Find("Panel/PlayerID").GetComponent<Text>().text = "玩家ID:" + GameConfig.Imei; + + loginNext(); + } #region 获得安卓手机上的IMEI号 @@ -152,9 +166,12 @@ private void OnClickResetBtn() { - Debug.LogError("清空了所有数据"); - PlayerPrefs.DeleteAll(); - TDAA_SDKManager.Ins.Reset(); + if (!GameConfig.useSDK) + { + Debug.LogError("清空了所有数据"); + PlayerPrefs.DeleteAll(); + TDAA_SDKManager.Ins.Reset(); + } } @@ -162,18 +179,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