为二级UI增加左方向键返回功能,修复Room列表初始时的位置错误

This commit is contained in:
ALIENJACK\alien 2024-11-11 17:11:15 +08:00
parent a4f8a382ac
commit 45539f3b92
6 changed files with 23 additions and 4 deletions

View File

@ -826,7 +826,7 @@ GameObject:
- component: {fileID: 6055880809428073973}
- component: {fileID: 1286529697012677180}
m_Layer: 5
m_Name: RomGroup
m_Name: RoomGroup
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

View File

@ -36,6 +36,14 @@ namespace AxibugEmuOnline.Client
m_pulsInvoker_Down.Update(Time.deltaTime);
}
public void ResetPulsInvoker()
{
m_pulsInvoker_Left.DisActive();
m_pulsInvoker_Right.DisActive();
m_pulsInvoker_Up.DisActive();
m_pulsInvoker_Down.DisActive();
}
public void ExecuteCommand(EnumCommand cmd, bool cancel)
{
if (!cancel)

View File

@ -9,7 +9,6 @@ namespace AxibugEmuOnline.Client
[SerializeField]
protected Transform m_menuItemRoot;
protected List<MenuItem> m_runtimeMenuUI = new List<MenuItem>();
public override bool Enable => enabled;
protected MenuItem m_enteredItem = null;
@ -78,6 +77,8 @@ namespace AxibugEmuOnline.Client
public abstract class MenuItemController<T> : MenuItemController
{
public override bool Enable => enabled && ListenControlAction;
private bool m_listenControlAction;
public bool ListenControlAction
{
@ -90,6 +91,9 @@ namespace AxibugEmuOnline.Client
CommandDispatcher.Instance.RegistController(this);
else
CommandDispatcher.Instance.UnRegistController(this);
if(!value)
ResetPulsInvoker();
}
}

View File

@ -28,6 +28,6 @@ namespace AxibugEmuOnline.Client
protected override void GetVirtualListDatas(Action<object> datas)
{
RomLib.FetchRomCount((roms) => datas.Invoke(roms));
}
}
}
}

View File

@ -119,6 +119,12 @@ namespace AxibugEmuOnline.Client
ListenControlAction = m_selected;
}
protected override void OnCmdSelectItemLeft()
{
base.OnCmdSelectItemLeft();
OnCmdBack();
}
protected override void OnSelectMenuChanged()
{

View File

@ -12,7 +12,7 @@ namespace AxibugEmuOnline.Client
private RectTransform m_parent;
[SerializeField]
private RectTransform m_selectArrow;
private RectTransform m_selectArrow;
[SerializeField]
float ArrowOffset = 50;
[SerializeField]
@ -87,6 +87,7 @@ namespace AxibugEmuOnline.Client
void RollToIndex(int index, bool useAnim = false)
{
SyncRectToLaunchUI();
Vector2 itemPos = itemGroup.GetItemAnchorePos(index);
Vector2 targetPos = itemGroup.transform.InverseTransformPoint(m_selectArrow.position);