Main/Core/GameEngine/Launch/LaunchFadeOutTask.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Main/Main.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Main/Manager/StageManager.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Main/ResModule/BuiltInLoader.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Main/System/Launch/LaunchWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Main/System/Launch/LaunchWinData.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Main/System/Launch/LaunchWinData.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Main/System/Launch/LoadingWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Main/Core/GameEngine/Launch/LaunchFadeOutTask.cs
@@ -20,11 +20,7 @@ var launchWin = UIManager.Instance.GetUI<LaunchWin>(); if (launchWin != null) { launchWin.FadeOut(); } // try Main/Main.cs
@@ -19,7 +19,11 @@ public static void Init() { Debug.Log("Main.Init() 被调用"); var launchWin = UIManager.Instance.GetUI<LaunchWin>(); if (launchWin != null) { launchWin.FadeOut(); } SwitchToLoginScene(); } Main/Manager/StageManager.cs
@@ -18,16 +18,18 @@ public Action BeforeLoadingGameScene; // public Action OnSwitchAccount; private LaunchWinData launchWinData = null; public void Init() { UIManager.Instance.OnCloseWindow += OnCloseWindow; } public void Release() { AfterLoadingGameScene = null; BeforeLoadingGameScene = null; UIManager.Instance.OnCloseWindow -= OnCloseWindow; } public async UniTaskVoid ToLoginScene() @@ -95,6 +97,18 @@ LoadingWin loadingWin = UIManager.Instance.OpenWindow<LoadingWin>(); LaunchWin launchWin = UIManager.Instance.GetUI<LaunchWin>(); if (null != launchWin && launchWin.IsActive() && launchWinData == null) { launchWinData = launchWin.GetData(); } if (null != launchWinData) { loadingWin.SetData(launchWinData); launchWinData = null; } while (!asyncOperation.isDone) { if (asyncOperation.progress >= 0.9f) @@ -129,4 +143,12 @@ loadingWin.CloseWindow(); } private void OnCloseWindow(UIBase closeUI) { if (closeUI is LaunchWin) { launchWinData = (closeUI as LaunchWin).GetData(); } } } Main/ResModule/BuiltInLoader.cs
@@ -20,6 +20,7 @@ if (excludePngs.Contains(StringUtility.Contact(name, SPRITE_EXTENSION))) { var path = StringUtility.Contact("Assets/ResourcesOut/BuiltIn/Sprites/", name, SPRITE_EXTENSION); path = System.Text.RegularExpressions.Regex.Replace(path, @"[\p{C}]", ""); sprite = UnityEditor.AssetDatabase.LoadAssetAtPath<Sprite>(path); } else Main/System/Launch/LaunchWin.cs
@@ -13,7 +13,7 @@ public class LaunchWin : UIBase { [SerializeField] UIAlphaTween m_AlphaTween; // [SerializeField] UIAlphaTween m_AlphaTween; [SerializeField] Image m_BackGround; [SerializeField] RectTransform m_AndroidProgressContainer; [SerializeField] RectTransform m_NetworkContainer; @@ -81,7 +81,7 @@ m_TotalProgressSlider.ResetValue(0f); } m_AlphaTween.SetStartState(); // m_AlphaTween.SetStartState(); m_BuildTime.text = VersionConfig.Get().debugVersion ? VersionConfig.Get().buildTime : ""; @@ -152,7 +152,8 @@ public void FadeOut() { m_AlphaTween.Play(); // m_AlphaTween.Play(); CloseWindow(); } string GetLaunchStageDescription(LaunchStage _stage, int step) @@ -289,6 +290,16 @@ } } public LaunchWinData GetData() { return new LaunchWinData(){ backGroundTimer = backGroundTimer, backGroundIndex = backGroundIndex, sprite = m_BackGround.overrideSprite, sprites = backGrounds, }; } } Main/System/Launch/LaunchWinData.cs
New file @@ -0,0 +1,13 @@ // 采集界面数据 给LoadingWin用 做表现一致 using UnityEngine; using UnityEngine.UI; using System.Collections.Generic; public class LaunchWinData { public float backGroundTimer; public int backGroundIndex; public Sprite sprite; public List<Sprite> sprites; } Main/System/Launch/LaunchWinData.cs.meta
New file @@ -0,0 +1,11 @@ fileFormatVersion: 2 guid: 18cd9b944777de14484346d7eeca334f MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Main/System/Launch/LoadingWin.cs
@@ -9,18 +9,50 @@ protected int currentProgress = 0; protected int targetProgress = 0; protected Text titleText; protected Text tipsText; protected Image progressBar; protected Text progressText; // [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] Text m_BuildTime; [SerializeField] Text m_Version; // [SerializeField] Button m_UserHelp; protected List<Sprite> backGrounds = new List<Sprite>(); protected float backGroundTimer = 0f; protected int backGroundIndex = 0; protected override void InitComponent() { base.InitComponent(); titleText = transform.Find("Text_Loading").GetComponent<Text>(); tipsText = transform.Find("Text_Tips").GetComponent<Text>(); progressBar = transform.Find("Img_Progress/Img_Foreground").GetComponent<Image>(); progressText = transform.Find("Text_Progress").GetComponent<Text>(); if (Application.isEditor) { if (m_BackGround.overrideSprite == null) { var sprite = BuiltInLoader.LoadSprite("Launch_1"); m_BackGround.overrideSprite = sprite; } } else { if (backGrounds.Count <= 0) { for (var i = 0; i < 3; i++) { var sprite = BuiltInLoader.LoadSprite(StringUtility.Contact("Launch_", i + 1)); if (sprite != null) { backGrounds.Add(sprite); } } m_BackGround.overrideSprite = backGrounds[0]; } } } protected override void OnPreOpen() @@ -45,29 +77,71 @@ { if (directly) { currentProgress = targetProgress = (int)(value * 100); currentProgress = targetProgress = Mathf.Min((int)(value * 100), 100); UpdateProgress(); } else { currentProgress = (int)(value * 100); targetProgress = Mathf.Min((int)(value * 100), 100); } } protected void UpdateProgress() { progressText.text = currentProgress + "%"; progressBar.fillAmount = currentProgress / 100f; } protected void Update() { // Debug.LogErrorFormat("cur : {0} / target {1}", currentProgress, targetProgress); if (currentProgress < targetProgress) { currentProgress = (int)Mathf.Lerp(currentProgress, targetProgress, 0.1f); UpdateProgress(); m_TotalProgressSlider.value = currentProgress / 100f; m_PartProgressSlider.value = currentProgress / 100f; } else { m_TotalProgressSlider.value = currentProgress / 100f; m_PartProgressSlider.value = currentProgress / 100f; } CopiedLogic_UpdateProgress(); } private void CopiedLogic_UpdateProgress() { // 暂留接口 // 好像都不应该在这里写东西了 // m_TotalProgressSlider跟m_PartProgressSlider都有自己新的逻辑 // m_StageDescription有固定的文字 // iOS如果不是download那也都是隐藏的 这里肯定不会有download的 所以就不搬了 } protected void LateUpdate() { UpdateProgress(); CopiedLogic_LateUpdate(); } private void CopiedLogic_LateUpdate() { backGroundTimer += Time.deltaTime; if (backGroundTimer >= 3f) { backGroundTimer -= 3f; if (backGrounds.Count > 1) { m_BackGround.overrideSprite = backGrounds[(++backGroundIndex) % backGrounds.Count]; } // 考虑在这里做这个描述的切换 或者根据图片来做提示词 // m_StageDescription.text = ""; } } public void SetData(LaunchWinData _launchWinData) { backGroundTimer = _launchWinData.backGroundTimer; backGroundIndex = _launchWinData.backGroundIndex; m_BackGround.overrideSprite = _launchWinData.sprite; backGrounds = _launchWinData.sprites; m_StageDescription.text = Language.GetFromLocal(44);//最后Completed一定是这个 考虑要不要塞入LaunchWinData.. } }