优化热更加载进度条表现

main
yurui 2024-07-30 18:51:27 +08:00
parent e3a149e2e0
commit 8dfdd19849
4 changed files with 21 additions and 35 deletions

View File

@ -77,7 +77,7 @@ public class GameLauncher : MonoBehaviour
private async UniTask EnterGame()
{
Debug.Log("开始加载游戏场景");
GameInit();
SimulationProgress(versionUpdate.GetCurProgress());
try
{
Scene scene = await _simpleLoader.LoadSceneAsync(START_SCENE_NAME, LoadSceneMode.Additive);
@ -101,42 +101,18 @@ public class GameLauncher : MonoBehaviour
}
}
private async void GameInit()
private async void SimulationProgress(float startProgress)
{
versionUpdate.UpdateProgress(0.9f);
versionUpdate.UpdateProgressText("初始化游戏...");
versionUpdate.UpdateProgress(startProgress);
await UniTask.Delay(100);
if (loadProcess < 1f)
versionUpdate.UpdateProgress(0.91f);
await UniTask.Delay(100);
if (loadProcess < 1f)
versionUpdate.UpdateProgress(0.92f);
await UniTask.Delay(100);
if (loadProcess < 1f)
versionUpdate.UpdateProgress(0.93f);
await UniTask.Delay(100);
if (loadProcess < 1f)
versionUpdate.UpdateProgress(0.94f);
await UniTask.Delay(100);
if (loadProcess < 1f)
versionUpdate.UpdateProgress(0.95f);
await UniTask.Delay(100);
if (loadProcess < 1f)
versionUpdate.UpdateProgress(0.96f);
await UniTask.Delay(100);
if (loadProcess < 1f)
versionUpdate.UpdateProgress(0.97f);
await UniTask.Delay(100);
if (loadProcess < 1f)
versionUpdate.UpdateProgress(0.98f);
float step = (1f - startProgress) * 0.02f;
while (loadProcess < 0.99f)
{
await UniTask.Delay(20);
startProgress += step;
versionUpdate.UpdateProgress(startProgress);
}
}
private async UniTask LoadOver()

View File

@ -42,5 +42,10 @@ namespace Code.Scripts.HotUpdate.UI
TempUpdateUI.Instance.UICamera.gameObject.SetActive(false);
Object.Destroy(TempUpdateUI.Instance.gameObject);
}
public float GetCurProgress()
{
return TempUpdateUI.Instance.m_SliderProgress.value;
}
}
}

@ -1 +1 @@
Subproject commit 8d3a3c7ecf908e597b7a755cf48119c57f3b95d2
Subproject commit e49c60e07c9016890e8aa02c83642457515d8e9d

View File

@ -590,6 +590,11 @@ PrefabInstance:
propertyPath: m_Name
value: UI_LoadingInterface
objectReference: {fileID: 0}
- target: {fileID: 2983829940459906657, guid: 531831947ecb71145a8b56a494898169,
type: 3}
propertyPath: m_Value
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3001700927692156314, guid: 531831947ecb71145a8b56a494898169,
type: 3}
propertyPath: m_AnchorMax.x