| | |
| | | |
| | | |
| | | |
| | | public class LaunchWin : UIBase |
| | | public class LaunchWin : UIBase |
| | | { |
| | | // [SerializeField] UIAlphaTween m_AlphaTween; |
| | | // [SerializeField] Image m_BackGround; |
| | | [SerializeField] RectTransform m_AndroidProgressContainer; |
| | | [SerializeField] RectTransform m_NetworkContainer; |
| | | // [SerializeField] SmoothSlider m_PartProgressSlider; |
| | | [SerializeField] Slider m_TotalProgressSlider; |
| | | [SerializeField] Text m_StageDescription; |
| | | [SerializeField] RectTransform m_IosProgressContainer; |
| | | [SerializeField] Text m_IosProgressTip; |
| | | [SerializeField] Text m_BuildTime; |
| | | [SerializeField] Text m_Version; |
| | | |
| | | bool assetBuildTimeShowed = false; |
| | | |
| | | LaunchStage showStage = LaunchStage.None; |
| | | int showStep = 0; |
| | | string stepDescription = string.Empty; |
| | | |
| | | float backGroundTimer = 0f; |
| | | int backGroundIndex = 0; |
| | | List<Sprite> backGrounds = new List<Sprite>(); |
| | | |
| | | int AllTimes = 0; |
| | | int WaitSeconds = 0; |
| | | bool ShowCircleView = false; |
| | | float TempCheck = 0; |
| | | |
| | | |
| | | protected override void OnPreOpen() |
| | | { |
| | | // [SerializeField] UIAlphaTween m_AlphaTween; |
| | | // [SerializeField] Image m_BackGround; |
| | | [SerializeField] RectTransform m_AndroidProgressContainer; |
| | | [SerializeField] RectTransform m_NetworkContainer; |
| | | [SerializeField] SmoothSlider m_PartProgressSlider; |
| | | [SerializeField] SmoothSlider m_TotalProgressSlider; |
| | | [SerializeField] Text m_StageDescription; |
| | | [SerializeField] RectTransform m_IosProgressContainer; |
| | | [SerializeField] Text m_IosProgressTip; |
| | | [SerializeField] Text m_BuildTime; |
| | | [SerializeField] Text m_Version; |
| | | |
| | | bool assetBuildTimeShowed = false; |
| | | |
| | | LaunchStage showStage = LaunchStage.None; |
| | | int showStep = 0; |
| | | string stepDescription = string.Empty; |
| | | |
| | | float backGroundTimer = 0f; |
| | | int backGroundIndex = 0; |
| | | List<Sprite> backGrounds = new List<Sprite>(); |
| | | |
| | | int AllTimes = 0; |
| | | int WaitSeconds = 0; |
| | | bool ShowCircleView = false; |
| | | float TempCheck = 0; |
| | | protected override void InitComponent() |
| | | base.OnPreOpen(); |
| | | UIManager.Instance.OnOpenWindow += OnOpenWindow; |
| | | UIManager.Instance.OnCloseWindow += OnCloseWindow; |
| | | backGroundTimer = 0f; |
| | | backGroundIndex = 0; |
| | | if (m_TotalProgressSlider != null) |
| | | { |
| | | base.InitComponent(); |
| | | // m_BackGround.preserveAspect = true; |
| | | // if (Application.isEditor) |
| | | // { |
| | | // var sprite = BuiltInLoader.LoadSprite("Launch_1"); |
| | | // m_BackGround.overrideSprite = sprite; |
| | | // } |
| | | // else |
| | | // { |
| | | // for (var i = 0; i < 3; i++) |
| | | // { |
| | | // var sprite = BuiltInLoader.LoadSprite(StringUtility.Concat("Launch_", i + 1)); |
| | | // if (sprite != null) |
| | | // { |
| | | // backGrounds.Add(sprite); |
| | | // } |
| | | // } |
| | | |
| | | // m_BackGround.overrideSprite = backGrounds[0]; |
| | | // } |
| | | |
| | | |
| | | m_TotalProgressSlider.value = 0f; |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | // m_AlphaTween.SetStartState(); |
| | | |
| | | m_BuildTime.text = VersionConfig.Get().debugVersion ? VersionConfig.Get().buildTime : ""; |
| | | |
| | | if (m_NetworkContainer != null) |
| | | { |
| | | base.OnPreOpen(); |
| | | backGroundTimer = 0f; |
| | | backGroundIndex = 0; |
| | | if (m_TotalProgressSlider != null) |
| | | m_NetworkContainer.SetActive(false); |
| | | } |
| | | |
| | | var AppleCheck = InitialFunctionConfig.Get("CheckTime").Numerical1; |
| | | var AndroidCheck = InitialFunctionConfig.Get("CheckTime").Numerical2; |
| | | var CheckAll = InitialFunctionConfig.Get("NetworkCheck").Numerical1; |
| | | AllTimes = int.Parse(CheckAll); |
| | | var CheckTime = InitialFunctionConfig.Get("NetworkCheck").Numerical2; |
| | | WaitSeconds = int.Parse(CheckTime); |
| | | ShowCircleView = false; |
| | | if (Application.platform == RuntimePlatform.IPhonePlayer && AppleCheck == "1") |
| | | ShowCircleView = true; |
| | | if (Application.platform == RuntimePlatform.Android && AndroidCheck == "1") |
| | | ShowCircleView = true; |
| | | |
| | | if (ShowCircleView) |
| | | { |
| | | m_AndroidProgressContainer.SetActive(false); |
| | | m_IosProgressContainer.SetActive(true); |
| | | m_Version.text = string.Empty; |
| | | } |
| | | else |
| | | { |
| | | m_AndroidProgressContainer.SetActive(true); |
| | | m_IosProgressContainer.SetActive(false); |
| | | //打包版本 + 功能版本 + 语言ID |
| | | m_Version.text = LoginManager.Instance.GetVersionStr(); |
| | | } |
| | | |
| | | if (m_StageDescription != null) |
| | | { |
| | | m_StageDescription.text = GetLaunchStageDescription(showStage, showStep); |
| | | } |
| | | |
| | | UpdateProgress(); |
| | | |
| | | // if (m_TotalProgressSlider == null) |
| | | // { |
| | | // m_TotalProgressSlider = this.GetComponentInChildren<SmoothSlider>(true); |
| | | // } |
| | | } |
| | | |
| | | |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | base.OnPreClose(); |
| | | UIManager.Instance.OnOpenWindow -= OnOpenWindow; |
| | | UIManager.Instance.OnCloseWindow -= OnCloseWindow; |
| | | } |
| | | |
| | | void OnOpenWindow(UIBase win) |
| | | { |
| | | if (win is DownLoadWin) |
| | | { |
| | | m_AndroidProgressContainer.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | void OnCloseWindow(UIBase win) |
| | | { |
| | | if (win is DownLoadWin) |
| | | { |
| | | m_AndroidProgressContainer.SetActive(true); |
| | | } |
| | | } |
| | | |
| | | |
| | | public void FadeOut() |
| | | { |
| | | // m_AlphaTween.Play(); |
| | | CloseWindow(); |
| | | } |
| | | |
| | | string GetLaunchStageDescription(LaunchStage _stage, int step) |
| | | { |
| | | switch (_stage) |
| | | { |
| | | case LaunchStage.SDKInit: |
| | | return Language.GetFromLocal(36); |
| | | case LaunchStage.AssetCopy: |
| | | return StringUtility.Concat(Language.GetFromLocal(37), "(", step.ToString(), ")"); |
| | | case LaunchStage.AssetDecompress: |
| | | return StringUtility.Concat(Language.GetFromLocal(38), "(", step.ToString(), ")"); |
| | | case LaunchStage.ClientVersion: |
| | | return Language.GetFromLocal(39); |
| | | case LaunchStage.CheckAsset: |
| | | return Language.GetFromLocal(40); |
| | | case LaunchStage.DownLoad: |
| | | return Language.GetFromLocal(41); |
| | | case LaunchStage.AssetBundleInit: |
| | | return Language.GetFromLocal(42); |
| | | case LaunchStage.ConfigInit: |
| | | return StringUtility.Concat(Language.GetFromLocal(43), "(", step.ToString(), ")"); |
| | | case LaunchStage.Complete: |
| | | return Language.GetFromLocal(44); |
| | | default: |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | protected void LateUpdate() |
| | | { |
| | | UpdateProgress(); |
| | | |
| | | // backGroundTimer += Time.deltaTime; |
| | | // if (backGroundTimer >= 3f) |
| | | // { |
| | | // backGroundTimer = 0f; |
| | | // if (backGrounds.Count > 1) |
| | | // { |
| | | // m_BackGround.overrideSprite = backGrounds[(++backGroundIndex) % backGrounds.Count]; |
| | | // } |
| | | // } |
| | | |
| | | if (HttpBehaviour.ConnectAllTimes >= AllTimes && m_NetworkContainer != null) |
| | | { |
| | | TempCheck += Time.deltaTime; |
| | | m_NetworkContainer.SetActive(true); |
| | | if (TempCheck >= WaitSeconds) |
| | | { |
| | | m_TotalProgressSlider.ResetValue(0f); |
| | | } |
| | | |
| | | // m_AlphaTween.SetStartState(); |
| | | |
| | | m_BuildTime.text = VersionConfig.Get().debugVersion ? VersionConfig.Get().buildTime : ""; |
| | | |
| | | if (m_NetworkContainer != null) |
| | | { |
| | | TempCheck = 0; |
| | | m_NetworkContainer.SetActive(false); |
| | | } |
| | | HttpBehaviour.ConnectAllTimes = 0; |
| | | } |
| | | } |
| | | } |
| | | |
| | | var AppleCheck = InitialFunctionConfig.Get("CheckTime").Numerical1; |
| | | var AndroidCheck = InitialFunctionConfig.Get("CheckTime").Numerical2; |
| | | var CheckAll = InitialFunctionConfig.Get("NetworkCheck").Numerical1; |
| | | AllTimes = int.Parse(CheckAll); |
| | | var CheckTime = InitialFunctionConfig.Get("NetworkCheck").Numerical2; |
| | | WaitSeconds = int.Parse(CheckTime); |
| | | ShowCircleView = false; |
| | | if (Application.platform == RuntimePlatform.IPhonePlayer && AppleCheck == "1") |
| | | ShowCircleView = true; |
| | | if (Application.platform == RuntimePlatform.Android && AndroidCheck == "1") |
| | | ShowCircleView = true; |
| | | private void OpenUserHelp() |
| | | { |
| | | // TODO YYL |
| | | // UIManager.Instance.OpenWindow<UserHelpWin>(); |
| | | } |
| | | |
| | | private void UpdateProgress() |
| | | { |
| | | //if (Application.platform == RuntimePlatform.IPhonePlayer) |
| | | if(ShowCircleView) |
| | | { |
| | | m_IosProgressContainer.SetActive(LaunchInHot.progressInfo.stage != LaunchStage.DownLoad); |
| | | var remainder = ((int)Time.time) % 3; |
| | | var dot = remainder == 0 ? "." : remainder == 1 ? ".." : "..."; |
| | | m_IosProgressTip.text = StringUtility.Concat(Language.GetFromLocal(30), dot); |
| | | } |
| | | else |
| | | { |
| | | var progressInfo = LaunchInHot.progressInfo; |
| | | |
| | | if (ShowCircleView) |
| | | if (progressInfo.stage == LaunchStage.DownLoad) |
| | | { |
| | | m_AndroidProgressContainer.SetActive(false); |
| | | m_IosProgressContainer.SetActive(true); |
| | | m_Version.text = string.Empty; |
| | | // if (m_PartProgressSlider != null && m_PartProgressSlider.gameObject.activeInHierarchy) |
| | | // { |
| | | // m_PartProgressSlider.SetActive(false); |
| | | // } |
| | | |
| | | if (m_TotalProgressSlider != null && m_TotalProgressSlider.gameObject.activeInHierarchy) |
| | | { |
| | | m_TotalProgressSlider.SetActive(false); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | m_AndroidProgressContainer.SetActive(true); |
| | | m_IosProgressContainer.SetActive(false); |
| | | //打包版本 + 功能版本 + 语言ID |
| | | m_Version.text = LoginManager.Instance.GetVersionStr(); |
| | | } |
| | | // if (m_PartProgressSlider != null && !m_PartProgressSlider.gameObject.activeInHierarchy) |
| | | // { |
| | | // m_PartProgressSlider.SetActive(true); |
| | | // } |
| | | |
| | | if (m_StageDescription != null) |
| | | { |
| | | m_StageDescription.text = GetLaunchStageDescription(showStage, showStep); |
| | | } |
| | | |
| | | UpdateProgress(); |
| | | |
| | | if (m_TotalProgressSlider == null) |
| | | { |
| | | m_TotalProgressSlider = this.GetComponentInChildren<SmoothSlider>(true); |
| | | } |
| | | } |
| | | |
| | | protected override void OnOpen() |
| | | { |
| | | base.OnOpen(); |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | base.OnPreClose(); |
| | | } |
| | | |
| | | protected override void OnClose() |
| | | { |
| | | base.OnClose(); |
| | | } |
| | | |
| | | public void FadeOut() |
| | | { |
| | | // m_AlphaTween.Play(); |
| | | CloseWindow(); |
| | | } |
| | | |
| | | string GetLaunchStageDescription(LaunchStage _stage, int step) |
| | | { |
| | | switch (_stage) |
| | | { |
| | | case LaunchStage.SDKInit: |
| | | return Language.GetFromLocal(36); |
| | | case LaunchStage.AssetCopy: |
| | | return StringUtility.Concat(Language.GetFromLocal(37), "(", step.ToString(), ")"); |
| | | case LaunchStage.AssetDecompress: |
| | | return StringUtility.Concat(Language.GetFromLocal(38), "(", step.ToString(), ")"); |
| | | case LaunchStage.ClientVersion: |
| | | return Language.GetFromLocal(39); |
| | | case LaunchStage.CheckAsset: |
| | | return Language.GetFromLocal(40); |
| | | case LaunchStage.DownLoad: |
| | | return Language.GetFromLocal(41); |
| | | case LaunchStage.AssetBundleInit: |
| | | return Language.GetFromLocal(42); |
| | | case LaunchStage.ConfigInit: |
| | | return StringUtility.Concat(Language.GetFromLocal(43), "(", step.ToString(), ")"); |
| | | case LaunchStage.Complete: |
| | | return Language.GetFromLocal(44); |
| | | default: |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | protected void LateUpdate() |
| | | { |
| | | UpdateProgress(); |
| | | |
| | | // backGroundTimer += Time.deltaTime; |
| | | // if (backGroundTimer >= 3f) |
| | | // { |
| | | // backGroundTimer = 0f; |
| | | // if (backGrounds.Count > 1) |
| | | // { |
| | | // m_BackGround.overrideSprite = backGrounds[(++backGroundIndex) % backGrounds.Count]; |
| | | // } |
| | | // } |
| | | |
| | | if (HttpBehaviour.ConnectAllTimes >= AllTimes && m_NetworkContainer != null) |
| | | { |
| | | TempCheck += Time.deltaTime; |
| | | m_NetworkContainer.SetActive(true); |
| | | if (TempCheck >= WaitSeconds) |
| | | if (m_TotalProgressSlider != null && !m_TotalProgressSlider.gameObject.activeInHierarchy) |
| | | { |
| | | TempCheck = 0; |
| | | m_NetworkContainer.SetActive(false); |
| | | HttpBehaviour.ConnectAllTimes = 0; |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void OpenUserHelp() |
| | | { |
| | | // TODO YYL |
| | | // UIManager.Instance.OpenWindow<UserHelpWin>(); |
| | | } |
| | | |
| | | private void UpdateProgress() |
| | | { |
| | | //if (Application.platform == RuntimePlatform.IPhonePlayer) |
| | | if(ShowCircleView) |
| | | { |
| | | m_IosProgressContainer.SetActive(LaunchInHot.progressInfo.stage != LaunchStage.DownLoad); |
| | | var remainder = ((int)Time.time) % 3; |
| | | var dot = remainder == 0 ? "." : remainder == 1 ? ".." : "..."; |
| | | m_IosProgressTip.text = StringUtility.Concat(Language.GetFromLocal(30), dot); |
| | | } |
| | | else |
| | | { |
| | | var progressInfo = LaunchInHot.progressInfo; |
| | | |
| | | if (progressInfo.stage == LaunchStage.DownLoad) |
| | | { |
| | | if (m_PartProgressSlider != null && m_PartProgressSlider.gameObject.activeInHierarchy) |
| | | { |
| | | m_PartProgressSlider.SetActive(false); |
| | | } |
| | | |
| | | if (m_TotalProgressSlider != null && m_TotalProgressSlider.gameObject.activeInHierarchy) |
| | | { |
| | | m_TotalProgressSlider.SetActive(false); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (m_PartProgressSlider != null && !m_PartProgressSlider.gameObject.activeInHierarchy) |
| | | { |
| | | m_PartProgressSlider.SetActive(true); |
| | | } |
| | | |
| | | if (m_TotalProgressSlider != null && !m_TotalProgressSlider.gameObject.activeInHierarchy) |
| | | { |
| | | m_TotalProgressSlider.SetActive(true); |
| | | } |
| | | |
| | | if (m_TotalProgressSlider != null) |
| | | { |
| | | m_TotalProgressSlider.value = progressInfo.totalProgress; |
| | | } |
| | | |
| | | if (m_PartProgressSlider != null) |
| | | { |
| | | m_PartProgressSlider.value = progressInfo.partProgress; |
| | | } |
| | | m_TotalProgressSlider.SetActive(true); |
| | | } |
| | | |
| | | DisplayStageDescription(progressInfo.stage, progressInfo.step); |
| | | |
| | | //if (!assetBuildTimeShowed && AssetVersionUtility.assetsBuildTime != DateTime.MinValue) |
| | | //{ |
| | | // assetBuildTimeShowed = true; |
| | | // var totalMinute = (int)(AssetVersionUtility.assetsBuildTime - new DateTime(2018, 1, 1)).TotalMinutes; |
| | | // m_Version.text = StringUtility.Concat(VersionConfig.Get().version, "_", VersionConfig.Get().buildIndex, "_", totalMinute.ToString()); |
| | | //} |
| | | } |
| | | |
| | | } |
| | | |
| | | private void DisplayStageDescription(LaunchStage stage, int step) |
| | | { |
| | | if (showStage != stage || showStep != step) |
| | | { |
| | | showStage = stage; |
| | | showStep = step; |
| | | if (m_StageDescription != null) |
| | | if (m_TotalProgressSlider != null) |
| | | { |
| | | m_StageDescription.text = GetLaunchStageDescription(stage, step); |
| | | m_TotalProgressSlider.value = progressInfo.totalProgress; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public LaunchWinData GetData() |
| | | { |
| | | return new LaunchWinData(){ |
| | | backGroundTimer = backGroundTimer, |
| | | backGroundIndex = backGroundIndex, |
| | | // sprite = m_BackGround.overrideSprite, |
| | | sprites = backGrounds, |
| | | }; |
| | | // if (m_PartProgressSlider != null) |
| | | // { |
| | | // m_PartProgressSlider.value = progressInfo.partProgress; |
| | | // } |
| | | } |
| | | |
| | | DisplayStageDescription(progressInfo.stage, progressInfo.step); |
| | | |
| | | //if (!assetBuildTimeShowed && AssetVersionUtility.assetsBuildTime != DateTime.MinValue) |
| | | //{ |
| | | // assetBuildTimeShowed = true; |
| | | // var totalMinute = (int)(AssetVersionUtility.assetsBuildTime - new DateTime(2018, 1, 1)).TotalMinutes; |
| | | // m_Version.text = StringUtility.Concat(VersionConfig.Get().version, "_", VersionConfig.Get().buildIndex, "_", totalMinute.ToString()); |
| | | //} |
| | | } |
| | | |
| | | } |
| | | |
| | | private void DisplayStageDescription(LaunchStage stage, int step) |
| | | { |
| | | if (showStage != stage || showStep != step) |
| | | { |
| | | showStage = stage; |
| | | showStep = step; |
| | | if (m_StageDescription != null) |
| | | { |
| | | m_StageDescription.text = GetLaunchStageDescription(stage, step); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public LaunchWinData GetData() |
| | | { |
| | | return new LaunchWinData(){ |
| | | backGroundTimer = backGroundTimer, |
| | | backGroundIndex = backGroundIndex, |
| | | // sprite = m_BackGround.overrideSprite, |
| | | sprites = backGrounds, |
| | | }; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |