69 lines
1.9 KiB
C#
69 lines
1.9 KiB
C#
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
|
|
|
using System;
|
|
using UnityEngine;
|
|
using FairyGUI;
|
|
using NBC;
|
|
using UIPanel = NBC.UIPanel;
|
|
|
|
namespace NBF
|
|
{
|
|
public partial class BottomMenu : GComponent
|
|
{
|
|
private UIPanel _panel;
|
|
|
|
private void OnInited()
|
|
{
|
|
List.onClickItem.Add(OnClickItem);
|
|
}
|
|
|
|
private void OnClickItem(EventContext context)
|
|
{
|
|
var item = context.data as BtnTitleInputControl;
|
|
if (item == null) return;
|
|
Game.Input.SendUIInput(item.ActionName);
|
|
Debug.Log("模拟点击===");
|
|
}
|
|
|
|
public void Use(UIPanel panel)
|
|
{
|
|
_panel = panel;
|
|
List.RemoveChildrenToPool();
|
|
LeftList.RemoveChildrenToPool();
|
|
|
|
// AddButtonItem(OnUse, "");
|
|
// AddButtonItem(OnTab, InputDef.UI.Tab);
|
|
// AddButtonItem(OnEnter, InputDef.UI.Enter);
|
|
// AddButtonItem(OnBack, InputDef.UI.Back);
|
|
}
|
|
|
|
|
|
public void AddRightButton(string inputName, string showName = "")
|
|
{
|
|
AddButton(inputName, string.Empty, true);
|
|
}
|
|
|
|
public void AddLeftButton(string inputName, string showName = "")
|
|
{
|
|
AddButton(inputName, string.Empty, false);
|
|
}
|
|
|
|
public void AddButton(string inputName, string showName = "", bool isRight = true)
|
|
{
|
|
if (isRight)
|
|
{
|
|
if (List.AddItemFromPool() is BtnTitleInputControl item)
|
|
{
|
|
item.SetData(inputName, showName);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (LeftList.AddItemFromPool() is BtnTitleInputControl item)
|
|
{
|
|
item.SetData(inputName, showName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |