首次提交
This commit is contained in:
74
Assets/Scripts/UI/Home/Pages/HomeMainPage.cs
Normal file
74
Assets/Scripts/UI/Home/Pages/HomeMainPage.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using System.Collections.Generic;
|
||||
using FairyGUI;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class HomeMainPage : HomePageBase
|
||||
{
|
||||
private ButtonNavigate navigate;
|
||||
|
||||
private void OnInited()
|
||||
{
|
||||
List<GButton> buttons = new List<GButton>();
|
||||
var children = OpGroup.GetChildren();
|
||||
foreach (var child in children)
|
||||
{
|
||||
if (child is GButton button)
|
||||
{
|
||||
buttons.Add(button);
|
||||
}
|
||||
}
|
||||
|
||||
// buttons.Add(BtnTest);
|
||||
|
||||
navigate = new ButtonNavigate(buttons);
|
||||
}
|
||||
|
||||
protected override void OnShow()
|
||||
{
|
||||
InputManager.OnUICanceled += OnUICanceled;
|
||||
|
||||
// Model.LoadAsset(0);
|
||||
// Model.SetBackground(Panel.Back.GetChild("back"));//, Panel.Back.GetChild("icon")
|
||||
}
|
||||
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
InputManager.OnUICanceled -= OnUICanceled;
|
||||
}
|
||||
|
||||
private void OnUICanceled(string action)
|
||||
{
|
||||
if (!Panel.IsTop) return;
|
||||
if (action == InputDef.UI.SubPrev)
|
||||
{
|
||||
}
|
||||
else if (action == InputDef.UI.SubNext)
|
||||
{
|
||||
}
|
||||
else if (action == InputDef.UI.Up)
|
||||
{
|
||||
navigate.Up();
|
||||
}
|
||||
else if (action == InputDef.UI.Down)
|
||||
{
|
||||
navigate.Down();
|
||||
}
|
||||
else if (action == InputDef.UI.Right)
|
||||
{
|
||||
navigate.Right();
|
||||
}
|
||||
else if (action == InputDef.UI.Left)
|
||||
{
|
||||
navigate.Left();
|
||||
}
|
||||
else if (action == InputDef.UI.Enter)
|
||||
{
|
||||
navigate.Click();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user