feat: add BootStatusUIView for loading progress display with text feedback
- Create new BootStatusUIView MonoBehaviour component with StatusText and ProgressSlider fields - Implement SetStatus() and SetProgress() methods for updating UI elements - Replace Transform-based ProgressFill in LoadingUIView with Slider component for better UX - Integrate BootStatusUIView into LoadState with real-time status updates during loading steps - Display formatted progress text (e.g., 'Loading 50%') alongside slider updates - Add SceneTemplateSettings.json to ProjectSettings for scene template configuration
This commit is contained in:
+1066
-20
File diff suppressed because it is too large
Load Diff
@@ -16,6 +16,7 @@ namespace QuizPleaseTest.Boot.Composition
|
|||||||
[field: SerializeField] public SplashUIView SplashView { get; private set; }
|
[field: SerializeField] public SplashUIView SplashView { get; private set; }
|
||||||
[field: SerializeField] public LoadingUIView LoadingView { get; private set; }
|
[field: SerializeField] public LoadingUIView LoadingView { get; private set; }
|
||||||
[field: SerializeField] public MenuUIView MenuView { get; private set; }
|
[field: SerializeField] public MenuUIView MenuView { get; private set; }
|
||||||
|
[field: SerializeField] public BootStatusUIView BootStatusView { get; private set; }
|
||||||
|
|
||||||
protected override void Configure(IContainerBuilder builder)
|
protected override void Configure(IContainerBuilder builder)
|
||||||
{
|
{
|
||||||
@@ -24,6 +25,7 @@ namespace QuizPleaseTest.Boot.Composition
|
|||||||
builder.RegisterComponent(SplashView);
|
builder.RegisterComponent(SplashView);
|
||||||
builder.RegisterComponent(LoadingView);
|
builder.RegisterComponent(LoadingView);
|
||||||
builder.RegisterComponent(MenuView);
|
builder.RegisterComponent(MenuView);
|
||||||
|
builder.RegisterComponent(BootStatusView);
|
||||||
|
|
||||||
builder.Register<BootFlowService>(Lifetime.Singleton)
|
builder.Register<BootFlowService>(Lifetime.Singleton)
|
||||||
.As<IBootFlowService>()
|
.As<IBootFlowService>()
|
||||||
|
|||||||
@@ -5,26 +5,32 @@ using QuizPleaseTest.Boot.Settings;
|
|||||||
using QuizPleaseTest.Boot.UI;
|
using QuizPleaseTest.Boot.UI;
|
||||||
using QuizPleaseTest.Common.StateMachine;
|
using QuizPleaseTest.Common.StateMachine;
|
||||||
using UniRx;
|
using UniRx;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace QuizPleaseTest.Boot.States
|
namespace QuizPleaseTest.Boot.States
|
||||||
{
|
{
|
||||||
public class LoadState : IState
|
public class LoadState : IState
|
||||||
{
|
{
|
||||||
private readonly LoadingUIView _view;
|
private readonly LoadingUIView _view;
|
||||||
|
private readonly BootStatusUIView _statusView;
|
||||||
private readonly BootSettings _settings;
|
private readonly BootSettings _settings;
|
||||||
private readonly ReactiveProperty<float> _progress = new ReactiveProperty<float>(0f);
|
private readonly ReactiveProperty<float> _progress = new ReactiveProperty<float>(0f);
|
||||||
|
|
||||||
public IReadOnlyReactiveProperty<float> Progress => _progress;
|
public IReadOnlyReactiveProperty<float> Progress => _progress;
|
||||||
|
|
||||||
public LoadState(LoadingUIView view, BootSettings settings)
|
public LoadState(LoadingUIView view, BootStatusUIView statusView, BootSettings settings)
|
||||||
{
|
{
|
||||||
_view = view;
|
_view = view;
|
||||||
|
_statusView = statusView;
|
||||||
_settings = settings;
|
_settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async UniTask EnterAsync(CancellationToken ct)
|
public async UniTask EnterAsync(CancellationToken ct)
|
||||||
{
|
{
|
||||||
_progress.Value = 0f;
|
_progress.Value = 0f;
|
||||||
|
_statusView.SetStatus("Loading 0%");
|
||||||
|
_statusView.SetProgress(0f);
|
||||||
|
|
||||||
_view.Bind(new LoadingUIViewModel(Progress));
|
_view.Bind(new LoadingUIViewModel(Progress));
|
||||||
_view.Initialize();
|
_view.Initialize();
|
||||||
|
|
||||||
@@ -36,7 +42,10 @@ namespace QuizPleaseTest.Boot.States
|
|||||||
for (int step = 1; step <= loadSteps; step++)
|
for (int step = 1; step <= loadSteps; step++)
|
||||||
{
|
{
|
||||||
await UniTask.Delay(stepDurationMs, cancellationToken: ct);
|
await UniTask.Delay(stepDurationMs, cancellationToken: ct);
|
||||||
_progress.Value = (float)step / loadSteps;
|
float progress = (float)step / loadSteps;
|
||||||
|
_progress.Value = progress;
|
||||||
|
_statusView.SetStatus($"Loading {Mathf.RoundToInt(progress * 100f)}%");
|
||||||
|
_statusView.SetProgress(progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException) when (ct.IsCancellationRequested)
|
catch (OperationCanceledException) when (ct.IsCancellationRequested)
|
||||||
|
|||||||
@@ -10,16 +10,21 @@ namespace QuizPleaseTest.Boot.States
|
|||||||
public class MenuState : IState
|
public class MenuState : IState
|
||||||
{
|
{
|
||||||
private readonly MenuUIView _view;
|
private readonly MenuUIView _view;
|
||||||
|
private readonly BootStatusUIView _statusView;
|
||||||
private readonly IMenuRestartSignal _restartSignal;
|
private readonly IMenuRestartSignal _restartSignal;
|
||||||
|
|
||||||
public MenuState(MenuUIView view, IMenuRestartSignal restartSignal)
|
public MenuState(MenuUIView view, BootStatusUIView statusView, IMenuRestartSignal restartSignal)
|
||||||
{
|
{
|
||||||
_view = view;
|
_view = view;
|
||||||
|
_statusView = statusView;
|
||||||
_restartSignal = restartSignal;
|
_restartSignal = restartSignal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async UniTask EnterAsync(CancellationToken ct)
|
public async UniTask EnterAsync(CancellationToken ct)
|
||||||
{
|
{
|
||||||
|
_statusView.SetStatus("Menu");
|
||||||
|
_statusView.SetProgress(1f);
|
||||||
|
|
||||||
_view.Bind(new MenuUIViewModel(_restartSignal));
|
_view.Bind(new MenuUIViewModel(_restartSignal));
|
||||||
_view.Initialize();
|
_view.Initialize();
|
||||||
|
|
||||||
|
|||||||
@@ -11,16 +11,21 @@ namespace QuizPleaseTest.Boot.States
|
|||||||
public class SplashState : IState
|
public class SplashState : IState
|
||||||
{
|
{
|
||||||
private readonly SplashUIView _view;
|
private readonly SplashUIView _view;
|
||||||
|
private readonly BootStatusUIView _statusView;
|
||||||
private readonly BootSettings _settings;
|
private readonly BootSettings _settings;
|
||||||
|
|
||||||
public SplashState(SplashUIView view, BootSettings settings)
|
public SplashState(SplashUIView view, BootStatusUIView statusView, BootSettings settings)
|
||||||
{
|
{
|
||||||
_view = view;
|
_view = view;
|
||||||
|
_statusView = statusView;
|
||||||
_settings = settings;
|
_settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async UniTask EnterAsync(CancellationToken ct)
|
public async UniTask EnterAsync(CancellationToken ct)
|
||||||
{
|
{
|
||||||
|
_statusView.SetStatus("Splash");
|
||||||
|
_statusView.SetProgress(0f);
|
||||||
|
|
||||||
_view.Bind(new SplashUIViewModel());
|
_view.Bind(new SplashUIViewModel());
|
||||||
_view.Initialize();
|
_view.Initialize();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using TMPro;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
namespace QuizPleaseTest.Boot.UI
|
||||||
|
{
|
||||||
|
public class BootStatusUIView : MonoBehaviour
|
||||||
|
{
|
||||||
|
[field: SerializeField] public TMP_Text StatusText { get; private set; }
|
||||||
|
[field: SerializeField] public Slider ProgressSlider { get; private set; }
|
||||||
|
|
||||||
|
public void SetStatus(string status)
|
||||||
|
{
|
||||||
|
if (StatusText == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusText.text = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetProgress(float progress)
|
||||||
|
{
|
||||||
|
if (ProgressSlider == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProgressSlider.value = Mathf.Clamp01(progress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a7777777777777777777777777777777
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
using QuizPleaseTest.Common.UI;
|
using QuizPleaseTest.Common.UI;
|
||||||
using UniRx;
|
using UniRx;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
namespace QuizPleaseTest.Boot.UI
|
namespace QuizPleaseTest.Boot.UI
|
||||||
{
|
{
|
||||||
public class LoadingUIView : UIView<LoadingUIViewModel>
|
public class LoadingUIView : UIView<LoadingUIViewModel>
|
||||||
{
|
{
|
||||||
[field: SerializeField] public Transform ProgressFill { get; private set; }
|
[field: SerializeField] public Slider ProgressSlider { get; private set; }
|
||||||
|
|
||||||
private CompositeDisposable _disposables;
|
private CompositeDisposable _disposables;
|
||||||
|
|
||||||
@@ -32,14 +33,12 @@ namespace QuizPleaseTest.Boot.UI
|
|||||||
|
|
||||||
private void SetProgress(float progress)
|
private void SetProgress(float progress)
|
||||||
{
|
{
|
||||||
if (ProgressFill == null)
|
if (ProgressSlider == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 scale = ProgressFill.localScale;
|
ProgressSlider.value = Mathf.Clamp01(progress);
|
||||||
scale.x = Mathf.Clamp01(progress);
|
|
||||||
ProgressFill.localScale = scale;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,121 @@
|
|||||||
|
{
|
||||||
|
"templatePinStates": [],
|
||||||
|
"dependencyTypeInfos": [
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEngine.AnimationClip",
|
||||||
|
"defaultInstantiationMode": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEditor.Animations.AnimatorController",
|
||||||
|
"defaultInstantiationMode": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEngine.AnimatorOverrideController",
|
||||||
|
"defaultInstantiationMode": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEditor.Audio.AudioMixerController",
|
||||||
|
"defaultInstantiationMode": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEngine.ComputeShader",
|
||||||
|
"defaultInstantiationMode": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEngine.Cubemap",
|
||||||
|
"defaultInstantiationMode": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEngine.GameObject",
|
||||||
|
"defaultInstantiationMode": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEditor.LightingDataAsset",
|
||||||
|
"defaultInstantiationMode": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEngine.LightingSettings",
|
||||||
|
"defaultInstantiationMode": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEngine.Material",
|
||||||
|
"defaultInstantiationMode": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEditor.MonoScript",
|
||||||
|
"defaultInstantiationMode": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEngine.PhysicMaterial",
|
||||||
|
"defaultInstantiationMode": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEngine.PhysicsMaterial2D",
|
||||||
|
"defaultInstantiationMode": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile",
|
||||||
|
"defaultInstantiationMode": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEngine.Rendering.PostProcessing.PostProcessResources",
|
||||||
|
"defaultInstantiationMode": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEngine.Rendering.VolumeProfile",
|
||||||
|
"defaultInstantiationMode": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEditor.SceneAsset",
|
||||||
|
"defaultInstantiationMode": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEngine.Shader",
|
||||||
|
"defaultInstantiationMode": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEngine.ShaderVariantCollection",
|
||||||
|
"defaultInstantiationMode": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEngine.Texture",
|
||||||
|
"defaultInstantiationMode": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEngine.Texture2D",
|
||||||
|
"defaultInstantiationMode": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "UnityEngine.Timeline.TimelineAsset",
|
||||||
|
"defaultInstantiationMode": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"defaultDependencyTypeInfo": {
|
||||||
|
"userAdded": false,
|
||||||
|
"type": "<default_scene_template_dependencies>",
|
||||||
|
"defaultInstantiationMode": 1
|
||||||
|
},
|
||||||
|
"newSceneOverride": 0
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user