refactor & fix
- 将 `CombatScheduler` 的职责分散到 3 个类中
- `PhaseLoopRuntime`:负责关卡各波次的调度
- `CombatLoadSession`:负责地图与 UI 等资源的加载
- `CombatEventBridge`:负责相关事件的处理
- 统一了战斗的命名为 `Combat`
- 调整了各个地图的坐标,使其位于摄像头中心
- 新增了 CombatInfoForm 展示战斗内的信息
- 补充了循环执行 LevelPhase,手动结束战斗的逻辑
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf3ce5b1e0a94d94cbbd70bbc1ba3519
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace GeometryTD.UI
|
||||
{
|
||||
public class TestMenuFormContext : UIContext
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 63c47e5da7f79214b9430a2654d385bf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c54ad6fe1b9cbc468edcec51d2fe534
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0052e673c97ae1349bb85014431b2a55
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8fe1249a94e09e3478b142e671d272a1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6217fcd5b07f8f341a77124e269e94c4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,54 @@
|
||||
using GeometryTD.CustomEvent;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace GeometryTD.UI
|
||||
{
|
||||
public class TestMenuForm : UGuiForm
|
||||
{
|
||||
private TestMenuFormContext _context;
|
||||
|
||||
public void RefreshUI(TestMenuFormContext context)
|
||||
{
|
||||
_context = context;
|
||||
if (_context == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnCombatButtonClick()
|
||||
{
|
||||
GameEntry.Event.Fire(this, TestMenuNodeClickEventArgs.Create(TestMenuNodeType.Combat));
|
||||
}
|
||||
|
||||
public void OnEventButtonClick()
|
||||
{
|
||||
GameEntry.Event.Fire(this, TestMenuNodeClickEventArgs.Create(TestMenuNodeType.Event));
|
||||
}
|
||||
|
||||
public void OnShopButtonClick()
|
||||
{
|
||||
GameEntry.Event.Fire(this, TestMenuNodeClickEventArgs.Create(TestMenuNodeType.Shop));
|
||||
}
|
||||
|
||||
protected override void OnOpen(object userData)
|
||||
{
|
||||
base.OnOpen(userData);
|
||||
|
||||
if (userData is TestMenuFormContext context)
|
||||
{
|
||||
RefreshUI(context);
|
||||
return;
|
||||
}
|
||||
|
||||
Log.Warning("TestMenuForm requires TestMenuFormContext as userData.");
|
||||
}
|
||||
|
||||
protected override void OnClose(bool isShutdown, object userData)
|
||||
{
|
||||
_context = null;
|
||||
|
||||
base.OnClose(isShutdown, userData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d1cfd203143c34c4e853705bdc409e04
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user