合并 MenuForm 的 6 个按钮事件为 MenuButtonClickEventArgs
新增 MenuButtonId 枚举区分按钮来源,MenuController 改为单订阅 + switch 分派,删除 Menu{StartGame,File,Guide,Setting,Quit,About}EventArgs 及其 meta。MenuForm 的 OnXxxButtonClick 方法名按 prefab 反射绑定保留,仅薄薄转发到统一事件。
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
|
||||
namespace SepCore.Event
|
||||
{
|
||||
public class MenuAboutButtonClickEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(MenuAboutButtonClickEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public static MenuAboutButtonClickEventArgs Create()
|
||||
{
|
||||
return ReferencePool.Acquire<MenuAboutButtonClickEventArgs>();
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f58e49962f2db9140aaf209ca65dd2f9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
using SepCore.Definition;
|
||||
|
||||
namespace SepCore.Event
|
||||
{
|
||||
/// <summary>
|
||||
/// MenuForm 上所有按钮共用的点击事件,按 <see cref="Button"/> 区分来源。
|
||||
/// 每新增按钮请同步扩展 <see cref="MenuButtonId"/>,并在 MenuController 中处理。
|
||||
/// </summary>
|
||||
public class MenuButtonClickEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(MenuButtonClickEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public MenuButtonId Button { get; private set; }
|
||||
|
||||
public static MenuButtonClickEventArgs Create(MenuButtonId button)
|
||||
{
|
||||
var args = ReferencePool.Acquire<MenuButtonClickEventArgs>();
|
||||
args.Button = button;
|
||||
return args;
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
Button = MenuButtonId.Undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b39712010e7085f428e9ef9727bda043
|
||||
guid: dcf5c02eecc14c87afc97eb949b7c705
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,21 +0,0 @@
|
||||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
|
||||
namespace SepCore.Event
|
||||
{
|
||||
public class MenuFileButtonClickEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(MenuFileButtonClickEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public static MenuFileButtonClickEventArgs Create()
|
||||
{
|
||||
return ReferencePool.Acquire<MenuFileButtonClickEventArgs>();
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e093cff04ac83fc47ae21bd659b338ad
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,21 +0,0 @@
|
||||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
|
||||
namespace SepCore.Event
|
||||
{
|
||||
public class MenuGuideButtonClickEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(MenuGuideButtonClickEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public static MenuGuideButtonClickEventArgs Create()
|
||||
{
|
||||
return ReferencePool.Acquire<MenuGuideButtonClickEventArgs>();
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
|
||||
namespace SepCore.Event
|
||||
{
|
||||
public class MenuQuitButtonClickEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(MenuQuitButtonClickEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public static MenuQuitButtonClickEventArgs Create()
|
||||
{
|
||||
return ReferencePool.Acquire<MenuQuitButtonClickEventArgs>();
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c008a5618fa012842992de55bef3791c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,21 +0,0 @@
|
||||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
|
||||
namespace SepCore.Event
|
||||
{
|
||||
public class MenuSettingButtonClickEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(MenuSettingButtonClickEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public static MenuSettingButtonClickEventArgs Create()
|
||||
{
|
||||
return ReferencePool.Acquire<MenuSettingButtonClickEventArgs>();
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d5de2367f2bc83642bbbdc02081ae804
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,21 +0,0 @@
|
||||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
|
||||
namespace SepCore.Event
|
||||
{
|
||||
public class MenuStartGameEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(MenuStartGameEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public static MenuStartGameEventArgs Create()
|
||||
{
|
||||
return ReferencePool.Acquire<MenuStartGameEventArgs>();
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 217b0022ddd4a4545a8d8e3d8158a967
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user