refactor & fix
- 将 `CombatScheduler` 的职责分散到 3 个类中
- `PhaseLoopRuntime`:负责关卡各波次的调度
- `CombatLoadSession`:负责地图与 UI 等资源的加载
- `CombatEventBridge`:负责相关事件的处理
- 统一了战斗的命名为 `Combat`
- 调整了各个地图的坐标,使其位于摄像头中心
- 新增了 CombatInfoForm 展示战斗内的信息
- 补充了循环执行 LevelPhase,手动结束战斗的逻辑
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
using GeometryTD.CustomEvent;
|
||||
using GeometryTD.Definition;
|
||||
using GameFramework.Event;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.UI
|
||||
{
|
||||
public class TestMenuFormController : UIFormControllerCommonBase<TestMenuFormContext, TestMenuForm>
|
||||
{
|
||||
protected override UIFormType UIFormTypeId => UIFormType.TestMenuForm;
|
||||
|
||||
protected override void RefreshUI(TestMenuForm form, TestMenuFormContext context)
|
||||
{
|
||||
form.RefreshUI(context);
|
||||
}
|
||||
|
||||
protected override void SubscribeCustomEvents()
|
||||
{
|
||||
GameEntry.Event.Subscribe(TestMenuNodeClickEventArgs.EventId, OnNodeClick);
|
||||
}
|
||||
|
||||
protected override void UnsubscribeCustomEvents()
|
||||
{
|
||||
GameEntry.Event.Unsubscribe(TestMenuNodeClickEventArgs.EventId, OnNodeClick);
|
||||
}
|
||||
|
||||
public override int? OpenUI(object userData = null)
|
||||
{
|
||||
if (userData is TestMenuFormContext context)
|
||||
{
|
||||
return OpenUIInternal(context);
|
||||
}
|
||||
|
||||
if (userData != null)
|
||||
{
|
||||
Log.Warning("TestMenuFormController.OpenUI() userData type is invalid.");
|
||||
return null;
|
||||
}
|
||||
|
||||
return OpenUIInternal(BuildDefaultContext());
|
||||
}
|
||||
|
||||
public override void BindUseCase(IUIUseCase useCase)
|
||||
{
|
||||
if (useCase != null)
|
||||
{
|
||||
Log.Warning("TestMenuFormController does not use a use case.");
|
||||
}
|
||||
}
|
||||
|
||||
private static TestMenuFormContext BuildDefaultContext()
|
||||
{
|
||||
return new TestMenuFormContext();
|
||||
}
|
||||
|
||||
private void OnNodeClick(object sender, GameEventArgs e)
|
||||
{
|
||||
if (!(sender is TestMenuForm form))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(e is TestMenuNodeClickEventArgs args))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (args.NodeType)
|
||||
{
|
||||
case TestMenuNodeType.Combat:
|
||||
GameEntry.CombatNode.StartCombat();
|
||||
return;
|
||||
case TestMenuNodeType.Event:
|
||||
GameEntry.EventNode.StartEvent();
|
||||
return;
|
||||
case TestMenuNodeType.Shop:
|
||||
GameEntry.ShopNode.StartShop();
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 84f4abe0ec5c55745b300177fe85fbc8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user