Merge pull request #4 from SepComet/StartMenu

调整项目结构
This commit is contained in:
SepComet 2026-02-24 21:27:27 +08:00 committed by GitHub
commit b00ea1a14f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 49 additions and 247 deletions

1
.gitignore vendored
View File

@ -95,3 +95,4 @@ crashlytics-build.properties
/Release
/AssetBundles
/Android

View File

@ -2,8 +2,8 @@
<UnityGameFramework>
<ResourceBuilder>
<Settings>
<InternalResourceVersion>1</InternalResourceVersion>
<Platforms>1</Platforms>
<InternalResourceVersion>2</InternalResourceVersion>
<Platforms>33</Platforms>
<AssetBundleCompression>1</AssetBundleCompression>
<CompressionHelperTypeName>UnityGameFramework.Runtime.DefaultCompressionHelper</CompressionHelperTypeName>
<AdditionalCompressionSelected>True</AdditionalCompressionSelected>

View File

@ -7,6 +7,7 @@
101 设置 SettingForm Default False True
102 关于 AboutForm Default False True
103 组装玩法UI CombineForm Default False False
104 Mask对话UI MaskDialogForm Default False False
105 Bottom对话UI BottomBoxDialogForm Default False False
106 Bubble对话UI BubbleDialogForm Default True False
104 Mask对话UI MaskDialogForm Dialog False False
105 Bottom对话UI BottomBoxDialogForm Dialog False False
106 Bubble对话UI BubbleDialogForm Dialog True False
107 游戏场景覆盖UI MainOverlayForm Overlay False False

View File

@ -53,5 +53,7 @@ namespace UI
/// 气泡剧情对话界面。
/// </summary>
BubbleDialogForm = 106,
MainOverlayForm = 107,
}
}

View File

@ -20,51 +20,6 @@ namespace Procedure
{
#region Property
/// <summary>
/// 单局超时时间(秒)。
/// </summary>
private const float TimeoutSeconds = 180f;
/// <summary>
/// 结算后重开场景的延迟(秒)。
/// </summary>
private const float RestartDelaySeconds = 2f;
/// <summary>
/// 统一日志前缀。
/// </summary>
private const string LogPrefix = "[GameplayATest]";
/// <summary>
/// 当前局是否已开始。
/// </summary>
private bool _isStarted = false;
/// <summary>
/// 当前局是否已结束。
/// </summary>
private bool _isFinished = false;
/// <summary>
/// 当前局是否通过。
/// </summary>
private bool _isPassed = false;
/// <summary>
/// 当前局累计耗时(秒)。
/// </summary>
private float _elapsed = 0f;
/// <summary>
/// 结算后的重开倒计时(秒)。
/// </summary>
private float _restartCountdown = 0f;
/// <summary>
/// 当前局开始时的实时时间戳。
/// </summary>
private float _startTimestamp = 0f;
/// <summary>
/// 拼装玩法组件入口。
/// </summary>
@ -98,8 +53,6 @@ namespace Procedure
/// </summary>
protected override void OnLeave(ProcedureOwner procedureOwner, bool isShutdown)
{
ShutdownProcedureState();
base.OnLeave(procedureOwner, isShutdown);
}
@ -114,7 +67,6 @@ namespace Procedure
if (GameEntry.Dialog.IsInitialized)
{
}
// if (TryUpdateRound(realElapseSeconds))
// {
@ -128,123 +80,6 @@ namespace Procedure
#region Other Methods
/// <summary>
/// 初始化流程级状态并订阅事件。
/// </summary>
private void InitializeProcedureState()
{
ResetRoundState();
GameEntry.Event.Subscribe(CombineCompletedEventArgs.EventId, OnPuzzleCompleted);
_combineComponent = GameEntry.Combine;
if (_combineComponent == null)
{
Log.Warning("{0} START failed. CombineComponent is missing.", LogPrefix);
}
Log.Info("{0} START timeout={1}s restartDelay={2}s.", LogPrefix, TimeoutSeconds.ToString("F0"),
RestartDelaySeconds.ToString("F0"));
}
/// <summary>
/// 清理流程级状态并反订阅事件。
/// </summary>
private void ShutdownProcedureState()
{
GameEntry.Event.Unsubscribe(CombineCompletedEventArgs.EventId, OnPuzzleCompleted);
_combineComponent?.StopLevel();
ResetRoundState();
}
/// <summary>
/// 更新当前局状态。
/// 返回 true 表示流程仍在关卡运行阶段,不进入重开逻辑。
/// </summary>
private bool TryUpdateRound(float realElapseSeconds)
{
if (_isFinished)
{
return false;
}
if (!_isStarted)
{
TryStartPuzzle();
return true;
}
UpdateTimeout(realElapseSeconds);
return true;
}
/// <summary>
/// 启动拼装关卡并记录开始信息。
/// </summary>
private void TryStartPuzzle()
{
if (_combineComponent == null)
{
Log.Warning("{0} FAIL_NO_COMPONENT reason='CombineComponentMissing'.", LogPrefix);
FinishAndScheduleRestart(false);
return;
}
CombineFormContext context = BuildTestOpenData();
int? serialId = _combineComponent.StartLevel(context);
if (!serialId.HasValue)
{
Log.Warning("{0} FAIL_NO_CONTEXT reason='StartLevelFailed'.", LogPrefix);
FinishAndScheduleRestart(false);
return;
}
_isStarted = true;
_elapsed = 0f;
_startTimestamp = Time.realtimeSinceStartup;
Log.Info("{0} START uiFormId={1} serialId={2}.", LogPrefix, ((int)UIFormId.CombineForm).ToString(),
serialId.ToString());
}
/// <summary>
/// 更新超时计时;超时后按失败结算。
/// </summary>
private void UpdateTimeout(float realElapseSeconds)
{
_elapsed += realElapseSeconds;
if (_elapsed < TimeoutSeconds)
{
return;
}
_elapsed = TimeoutSeconds;
Log.Warning("{0} FAIL_TIMEOUT elapsed={1:F2}s timeout={2:F2}s.", LogPrefix, _elapsed, TimeoutSeconds);
FinishAndScheduleRestart(false);
}
/// <summary>
/// 结算后推进重开倒计时,到时切换到换场景流程。
/// </summary>
private void TryRestartScene(ProcedureOwner procedureOwner, float realElapseSeconds)
{
if (!_isFinished)
{
return;
}
_restartCountdown -= realElapseSeconds;
if (_restartCountdown > 0f)
{
return;
}
int nextSceneId = (int)SceneId.GameplayA;
procedureOwner.SetData<VarInt32>("NextSceneId", nextSceneId);
Log.Info("{0} RESTART result={1} nextSceneId={2}.", LogPrefix, _isPassed ? "PASS" : "FAIL",
nextSceneId.ToString());
ChangeState<ProcedureChangeScene>(procedureOwner);
}
/// <summary>
/// 构建测试用关卡上下文(槽位、部件与自动开始配置)。
/// </summary>
@ -321,50 +156,6 @@ namespace Procedure
};
}
/// <summary>
/// 拼装完成事件回调:记录耗时并按成功结算。
/// </summary>
private void OnPuzzleCompleted(object sender, GameEventArgs e)
{
if (!(e is CombineCompletedEventArgs))
{
return;
}
if (_isFinished)
{
return;
}
_elapsed = Mathf.Max(0f, Time.realtimeSinceStartup - _startTimestamp);
Log.Info("{0} PASS elapsed={1:F2}s.", LogPrefix, _elapsed);
FinishAndScheduleRestart(true);
}
/// <summary>
/// 标记当前局结束,并开始重开倒计时。
/// </summary>
private void FinishAndScheduleRestart(bool isPassed)
{
_isPassed = isPassed;
_isFinished = true;
_restartCountdown = RestartDelaySeconds;
}
/// <summary>
/// 重置局内运行态字段。
/// </summary>
private void ResetRoundState()
{
_isStarted = false;
_isFinished = false;
_isPassed = false;
_elapsed = 0f;
_restartCountdown = 0f;
_startTimestamp = 0f;
_combineComponent = null;
}
#endregion
}
}

View File

@ -6,7 +6,7 @@ namespace UI
{
public class CombineFormController : IFormController<CombineFormContext>
{
private CombineComponent _controller;
private CombineComponent _combine;
private CombineForm _combineForm;
@ -16,20 +16,20 @@ namespace UI
public CombineFormController(CombineComponent controller)
{
_controller = controller;
_combine = controller;
GameEntry.Event.Subscribe(OpenUIFormSuccessEventArgs.EventId, OpenUIFormSuccess);
GameEntry.Event.Subscribe(CloseUIFormCompleteEventArgs.EventId, CloseUIFormComplete);
GameEntry.Event.Subscribe(CloseUIFormCompleteEventArgs.EventId, CloseUIFormComplete);
}
public int? OpenUI(CombineFormContext context)
{
if (_controller == null)
if (_combine == null)
{
_controller = GameEntry.Combine;
_combine = GameEntry.Combine;
}
if (_controller == null)
if (_combine == null)
{
Log.Warning("CombineFormController open failed. Controller is null.");
return null;
@ -37,10 +37,10 @@ namespace UI
if (context != null)
{
_controller.SetFormContext(context);
_combine.SetFormContext(context);
}
_context = _controller.GetFormContext();
_context = _combine.GetFormContext();
if (_context == null)
{
Log.Warning("CombineFormController open failed. Form context is null.");
@ -68,7 +68,7 @@ namespace UI
~CombineFormController()
{
GameEntry.Event.Unsubscribe(OpenUIFormSuccessEventArgs.EventId, OpenUIFormSuccess);
GameEntry.Event.Unsubscribe(CloseUIFormCompleteEventArgs.EventId, CloseUIFormComplete);
GameEntry.Event.Unsubscribe(CloseUIFormCompleteEventArgs.EventId, CloseUIFormComplete);
}
private void OpenUIFormSuccess(object sender, GameEventArgs e)

View File

@ -44,6 +44,10 @@ namespace UI
{
_controller = context.Controller;
bool isMobilePlatform = Application.isMobilePlatform;
_screenSolution.gameObject.SetActive(!isMobilePlatform);
_screenWindow.gameObject.SetActive(!isMobilePlatform);
var setting = context.Setting;
_bgmVolumeSlider.value = setting.BGMVolume * 5;

View File

@ -593,7 +593,7 @@ PrefabInstance:
objectReference: {fileID: 934951765}
- target: {fileID: 11454530, guid: adb3eb1c35fcff14f89fba7b05c9d71c, type: 3}
propertyPath: m_UIGroups.Array.size
value: 2
value: 3
objectReference: {fileID: 0}
- target: {fileID: 11454530, guid: adb3eb1c35fcff14f89fba7b05c9d71c, type: 3}
propertyPath: m_UIGroupHelperTypeName
@ -607,6 +607,10 @@ PrefabInstance:
propertyPath: m_UIGroups.Array.data[1].m_Name
value: Dialog
objectReference: {fileID: 0}
- target: {fileID: 11454530, guid: adb3eb1c35fcff14f89fba7b05c9d71c, type: 3}
propertyPath: m_UIGroups.Array.data[2].m_Name
value: Overlay
objectReference: {fileID: 0}
- target: {fileID: 11454530, guid: adb3eb1c35fcff14f89fba7b05c9d71c, type: 3}
propertyPath: m_UIGroups.Array.data[0].m_Depth
value: 0
@ -615,6 +619,10 @@ PrefabInstance:
propertyPath: m_UIGroups.Array.data[1].m_Depth
value: 2
objectReference: {fileID: 0}
- target: {fileID: 11454530, guid: adb3eb1c35fcff14f89fba7b05c9d71c, type: 3}
propertyPath: m_UIGroups.Array.data[2].m_Depth
value: 3
objectReference: {fileID: 0}
- target: {fileID: 11461470, guid: adb3eb1c35fcff14f89fba7b05c9d71c, type: 3}
propertyPath: m_Enabled
value: 0
@ -858,7 +866,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d6174838c30e460429e5628757bbf015, type: 3}
m_Name:
m_EditorClassIdentifier:
_playingSpeed: 10
--- !u!1 &513208572
GameObject:
m_ObjectHideFlags: 0

View File

@ -3,7 +3,7 @@
--- !u!30 &1
GraphicsSettings:
m_ObjectHideFlags: 0
serializedVersion: 14
serializedVersion: 15
m_Deferred:
m_Mode: 1
m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0}
@ -13,9 +13,6 @@ GraphicsSettings:
m_ScreenSpaceShadows:
m_Mode: 1
m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0}
m_LegacyDeferred:
m_Mode: 1
m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0}
m_DepthNormals:
m_Mode: 1
m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0}
@ -37,6 +34,9 @@ GraphicsSettings:
- {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10752, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_PreloadShadersBatchTimeLimit: -1
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
@ -51,6 +51,7 @@ GraphicsSettings:
m_LightmapStripping: 0
m_FogStripping: 0
m_InstancingStripping: 0
m_BrgStripping: 0
m_LightmapKeepPlain: 1
m_LightmapKeepDirCombined: 1
m_LightmapKeepDynamicPlain: 1
@ -68,3 +69,6 @@ GraphicsSettings:
m_SRPDefaultSettings:
UnityEngine.Rendering.Universal.UniversalRenderPipeline: {fileID: 11400000, guid: 18dc0cd2c080841dea60987a38ce93fa,
type: 2}
m_LightProbeOutsideHullStrategy: 0
m_CameraRelativeLightCulling: 0
m_CameraRelativeShadowCulling: 0

View File

@ -935,7 +935,7 @@ PlayerSettings:
hmiLogStartupTiming: 0
hmiCpuConfiguration:
apiCompatibilityLevel: 6
activeInputHandler: 2
activeInputHandler: 1
windowsGamepadBackendHint: 0
cloudProjectId:
framebufferDepthMemorylessMode: 0

View File

@ -1,9 +0,0 @@
# 声音配置表
# Id AssetName Priority Loop Volume SpatialBlend MaxDistance
# int string int bool float float float
# 声音编号 策划备注 资源名称 优先级默认0128最高-128最低 是否循环 音量0~1 声音空间混合量0为2D1为3D中间值混合效果 声音最大距离
10000 玩家子弹 weapon_player 0 False 1 0 100
10001 敌人子弹 weapon_enemy 0 False 1 0 100
20000 玩家爆炸 explosion_player 0 False 1 0 100
20001 敌人爆炸 explosion_enemy 0 False 1 0 100
20002 小行星爆炸 explosion_asteroid 0 False 1 0 100

View File

@ -7,6 +7,7 @@
101 设置 SettingForm Default False True
102 关于 AboutForm Default False True
103 组装玩法UI CombineForm Default False False
104 Mask对话UI MaskDialogForm Default False False
105 Bottom对话UI BottomBoxDialogForm Default False False
106 Bubble对话UI BubbleDialogForm Default True False
104 Mask对话UI MaskDialogForm Dialog False False
105 Bottom对话UI BottomBoxDialogForm Dialog False False
106 Bubble对话UI BubbleDialogForm Dialog True False
107 游戏场景覆盖UI MainOverlayForm Overlay False False

Binary file not shown.