From 27fcdab4830ef0791105be6529a1dfac36b85982 Mon Sep 17 00:00:00 2001 From: hch <305670599@qq.com> Date: 星期二, 24 六月 2025 21:52:31 +0800 Subject: [PATCH] 0312 适配注释供后续根据实际情况用 --- Main/System/Launch/LoadingWin.cs | 111 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 92 insertions(+), 19 deletions(-) diff --git a/Main/System/Launch/LoadingWin.cs b/Main/System/Launch/LoadingWin.cs index c880bb3..56b946d 100644 --- a/Main/System/Launch/LoadingWin.cs +++ b/Main/System/Launch/LoadingWin.cs @@ -9,18 +9,47 @@ 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] SmoothSlider m_PartProgressSlider; + [SerializeField] SmoothSlider m_TotalProgressSlider; + [SerializeField] Text m_StageDescription; + [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() @@ -28,6 +57,8 @@ base.OnPreOpen(); currentProgress = targetProgress = 0; Refresh(); + //鎵撳寘鐗堟湰 + 鍔熻兘鐗堟湰 + 璇█ID + m_Version.text = LoginManager.Instance.GetVersionStr(); } protected override void OnPreClose() @@ -45,29 +76,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璺焟_PartProgressSlider閮芥湁鑷繁鏂扮殑閫昏緫 + // m_StageDescription鏈夊浐瀹氱殑鏂囧瓧 + + // iOS濡傛灉涓嶆槸download閭d篃閮芥槸闅愯棌鐨� 杩欓噷鑲畾涓嶄細鏈塪ownload鐨� 鎵�浠ュ氨涓嶆惉浜� + } + + 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);//鏈�鍚嶤ompleted涓�瀹氭槸杩欎釜 鑰冭檻瑕佷笉瑕佸鍏aunchWinData.. } } \ No newline at end of file -- Gitblit v1.8.0