接入菜单导航并改造通用按钮交互
- 将 CommonButton 改为基于 Unity Button 实现,保留原有 pointer enter、click、pointer exit 三类事件配置,同时接入 Selectable/Button 的导航、选中和提交能力。补充 CommonButton 自定义 Inspector,保留项目自定义事件与背景配置的编辑体验。 - 同步调整菜单相关 UI,将 StartMenuForm 迁移为 MenuForm,并更新 UIForm 配置、菜单 Controller/Form 以及相关 prefab 引用。更新多个 UI prefab 和通用按钮 prefab,使菜单、商店、角色选择、道具展示等界面能够使用新的按钮选中与导航交互。
This commit is contained in:
@@ -53,7 +53,7 @@ namespace SepCore.UI
|
||||
|
||||
public override void BindUseCase(IUIUseCase useCase)
|
||||
{
|
||||
Log.Info("StartMenuForm doesn't need UseCase");
|
||||
Log.Info("MenuForm doesn't need UseCase");
|
||||
}
|
||||
|
||||
private void OnMenuStartGameButtonClick(object sender, GameEventArgs e)
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
using SepCore.Event;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace SepCore.UI
|
||||
{
|
||||
public class MenuForm : UGuiForm
|
||||
{
|
||||
[SerializeField] private GameObject _defaultButton;
|
||||
|
||||
public void RefreshUI(MenuContext context)
|
||||
{
|
||||
if (EventSystem.current.currentSelectedGameObject != _defaultButton)
|
||||
{
|
||||
EventSystem.current.SetSelectedGameObject(this._defaultButton);
|
||||
}
|
||||
}
|
||||
|
||||
#region Lifecycle
|
||||
@@ -21,7 +29,7 @@ namespace SepCore.UI
|
||||
return;
|
||||
}
|
||||
|
||||
Log.Warning("StartMenuForm requires StartMenuFormContext as userData.");
|
||||
Log.Warning("MenuForm requires MenuFormContext as userData.");
|
||||
}
|
||||
|
||||
protected override void OnClose(bool isShutdown, object userData)
|
||||
|
||||
Reference in New Issue
Block a user