调整项目结构
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -53,5 +53,7 @@ namespace UI
|
||||
/// 气泡剧情对话界面。
|
||||
/// </summary>
|
||||
BubbleDialogForm = 106,
|
||||
|
||||
MainOverlayForm = 107,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
@@ -85,10 +40,10 @@ namespace Procedure
|
||||
protected override void OnEnter(ProcedureOwner procedureOwner)
|
||||
{
|
||||
base.OnEnter(procedureOwner);
|
||||
|
||||
|
||||
//InitializeProcedureState();
|
||||
GameEntry.Dialog.Init(1);
|
||||
|
||||
|
||||
//GameEntry.Dialog.StartDialog(1001);
|
||||
GameEntry.Dialog.StartDialog(1002);
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
@@ -121,7 +125,7 @@ namespace UI
|
||||
};
|
||||
dialogParams.OnClickConfirm += SaveSettingAndReturn;
|
||||
dialogParams.OnClickCancel += _ => _controller.CloseUI();
|
||||
|
||||
|
||||
GameEntry.UI.OpenUIForm(UIFormId.DialogForm, dialogParams);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user