多轮审查评估

This commit is contained in:
2026-05-13 09:19:54 +08:00
parent 458f344e83
commit 1b37297585
57 changed files with 3019 additions and 218 deletions

View File

@@ -1,6 +1,6 @@
using System.Collections;
using UnityEngine;
using UnityEngine.SceneManagement;
using BaseGames.Core.Assets;
using BaseGames.Core.Events;
namespace BaseGames.Core
@@ -28,13 +28,12 @@ namespace BaseGames.Core
[SerializeField] private SceneLoadRequestEventChannelSO _onSceneLoadRequest;
[Header("Event Channels - Raise")]
[SerializeField] private StringEventChannelSO _onSceneLoaded;
[SerializeField] private VoidEventChannelSO _onFadeInRequest;
[SerializeField] private VoidEventChannelSO _onFadeOutRequest;
[SerializeField] private VoidEventChannelSO _onFadeInRequest;
[SerializeField] private VoidEventChannelSO _onFadeOutRequest;
[SerializeField] private SceneLoader _sceneLoader;
[SerializeField] private float _fadeDuration = 0.3f;
private string _currentRoomScene;
private readonly CompositeDisposable _subscriptions = new();
private void OnEnable()
@@ -52,33 +51,25 @@ namespace BaseGames.Core
_onFadeOutRequest?.Raise();
yield return new WaitForSeconds(_fadeDuration);
if (!string.IsNullOrEmpty(_currentRoomScene))
{
var unload = SceneManager.UnloadSceneAsync(_currentRoomScene);
yield return new WaitUntil(() => unload.isDone);
}
if (_sceneLoader != null)
yield return StartCoroutine(_sceneLoader.LoadSceneCoroutine(request));
else
Debug.LogError("[SceneService] _sceneLoader 未赋值,场景加载中断。请在 Inspector 中绑定 SceneLoader 组件。");
var load = SceneManager.LoadSceneAsync(request.SceneName, LoadSceneMode.Additive);
yield return new WaitUntil(() => load.isDone);
_currentRoomScene = request.SceneName;
_onSceneLoaded?.Raise(request.SceneName);
_onFadeInRequest?.Raise();
}
public IEnumerator UnloadCurrentRoomCoroutine()
{
if (string.IsNullOrEmpty(_currentRoomScene)) yield break;
var op = SceneManager.UnloadSceneAsync(_currentRoomScene);
yield return new WaitUntil(() => op.isDone);
_currentRoomScene = null;
if (_sceneLoader != null)
yield return StartCoroutine(_sceneLoader.UnloadCurrentCoroutine());
}
public IEnumerator LoadMainMenuCoroutine()
{
yield return LoadSceneCoroutine(new SceneLoadRequest
{
SceneName = "MainMenu",
SceneName = AddressKeys.SceneMainMenu,
EntryTransitionId = null,
ShowLoadingScreen = false,
IsRespawn = false