| | |
| | | transform.Find("Panel/Button").GetComponent<Button>().onClick.AddListener(OnClickLoginBtn); |
| | | transform.Find("Panel/Button (1)").GetComponent<Button>().onClick.AddListener(OnClickResetBtn); |
| | | |
| | | progressSlider = transform.Find("Progress").GetComponent<Slider>(); |
| | | |
| | | progressSlider.value = 0; |
| | | if (Application.platform == RuntimePlatform.Android) |
| | | { |
| | | //GetetDeviceIMEI();//获取安卓手机IMEI |
| | |
| | | |
| | | #endregion |
| | | |
| | | private void OnClickResetBtn(){ |
| | | private void OnClickResetBtn() |
| | | { |
| | | Debug.LogError("清空了所有数据"); |
| | | PlayerPrefs.DeleteAll(); |
| | | TDAA_SDKManager.Ins.Reset(); |
| | |
| | | |
| | | private void OnClickLoginBtn() |
| | | { |
| | | TDAA_SDKManager.Ins.Statistics(2);//埋点 |
| | | LoginRequest(); |
| | | if (!isLogining) |
| | | { |
| | | AudioSourceManager.Ins.Play(AudioEnum.UI); |
| | | TDAA_SDKManager.Ins.Statistics(2);//埋点 |
| | | |
| | | StartCoroutine(loginMy()); |
| | | //StartCoroutine(LoadScene()); |
| | | } |
| | | else |
| | | { |
| | | |
| | | } |
| | | |
| | | //TDAA_SDKManager.Ins.Statistics(2);//埋点 |
| | | //LoginRequest(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | Debug.Log("编辑器直接登录"); |
| | | |
| | | //TDAA_SDKManager.Ins.Login(); |
| | | TDAA_SDKManager.Ins.Statistics(3);//埋点 |
| | | //TDAA_SDKManager.Ins.Statistics(3);//埋点 |
| | | |
| | | //StartCoroutine(loginMy()); |
| | | StartCoroutine(LoadScene()); |
| | |
| | | //UserDataMsg userData = login.Userdata; |
| | | |
| | | //TDAA_SDKManager.Ins.Login(); |
| | | TDAA_SDKManager.Ins.Statistics(3);//埋点 |
| | | //TDAA_SDKManager.Ins.Statistics(3);//埋点 |
| | | |
| | | //StartCoroutine(loginMy()); |
| | | StartCoroutine(LoadScene()); |
| | |
| | | IEnumerator LoadScene() |
| | | { |
| | | async = SceneManager.LoadSceneAsync(GameConfig.NextSceneName); |
| | | async.allowSceneActivation = true; |
| | | /*while (!async.isDone) |
| | | //async.allowSceneActivation = true; |
| | | while (!async.isDone) |
| | | { |
| | | |
| | | if (async.progress < 0.9f) |
| | | progressValue = async.progress; |
| | | { |
| | | Debug.Log(async.progress); |
| | | |
| | | } |
| | | //progressValue = async.progress; |
| | | else |
| | | progressValue = 1.0f; |
| | | slider.value = progressValue; |
| | | progress.text = (int)(slider.value * 100) + " %"; |
| | | |
| | | Debug.Log("超过0.9,"); |
| | | //progressValue = 1.0f; |
| | | //slider.value = progressValue; |
| | | //progress.text = (int)(slider.value * 100) + " %"; |
| | | |
| | | if (async.progress >= 0.89) |
| | | { |
| | | Debug.Log("进展时间分别是:" + async.progress + "," + totalTime); |
| | | if( totalTime >= 3.0f ) |
| | | async.allowSceneActivation = true; |
| | | |
| | | progress.text = "按任意键继续"; |
| | | Debug.Log("进展时间分别是:" + async.progress + ","); |
| | | |
| | | //progress.text = "按任意键继续"; |
| | | if (Input.anyKeyDown) |
| | | { |
| | | async.allowSceneActivation = true; |
| | |
| | | } |
| | | |
| | | //yield return null; |
| | | }*/ |
| | | } |
| | | yield return null; |
| | | } |
| | | |
| | | |
| | | private Slider progressSlider; |
| | | IEnumerator loginMy() |
| | | { |
| | | int displayProgress = 0; |
| | |
| | | op.allowSceneActivation = false; |
| | | while (op.progress < 0.9f) //此处如果是 <= 0.9f 则会出现死循环所以必须小0.9 |
| | | { |
| | | toProgress = (int)op.progress * 100; |
| | | toProgress = (int)(op.progress * 100); |
| | | while (displayProgress < toProgress) |
| | | { |
| | | ++displayProgress; |
| | | progressSlider.value = displayProgress * 0.01f; |
| | | SetLoadingPercentage(displayProgress); |
| | | yield return new WaitForEndOfFrame();//ui渲染完成之后 |
| | | } |
| | |
| | | while (displayProgress < toProgress) |
| | | { |
| | | ++displayProgress; |
| | | progressSlider.value = displayProgress * 0.01f; |
| | | |
| | | SetLoadingPercentage(displayProgress); |
| | | yield return new WaitForEndOfFrame(); |
| | | } |