快捷键重构
This commit is contained in:
27
Assets/Scripts/UI/Common/Menu/BottomMenu.Designer.cs
generated
Normal file
27
Assets/Scripts/UI/Common/Menu/BottomMenu.Designer.cs
generated
Normal file
@@ -0,0 +1,27 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class BottomMenu
|
||||
{
|
||||
public const string URL = "ui://6hgkvlau9mf1z";
|
||||
|
||||
public GList List;
|
||||
public GList LeftList;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
List = (GList)GetChild("List");
|
||||
LeftList = (GList)GetChild("LeftList");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 172ed53c6c409e04c8a993c9fae4c820
|
||||
79
Assets/Scripts/UI/Common/Menu/BottomMenu.cs
Normal file
79
Assets/Scripts/UI/Common/Menu/BottomMenu.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class BottomMenu : GComponent
|
||||
{
|
||||
public event Action OnBack;
|
||||
public event Action OnEnter;
|
||||
public event Action OnTab;
|
||||
public event Action OnUse;
|
||||
|
||||
private void OnInited()
|
||||
{
|
||||
List.onClickItem.Add(OnClickItem);
|
||||
}
|
||||
|
||||
private void OnClickItem(EventContext context)
|
||||
{
|
||||
var item = context.data as BtnTitleInputControl;
|
||||
if (item == null) return;
|
||||
item.OnAction?.Invoke();
|
||||
}
|
||||
|
||||
public void UnUse()
|
||||
{
|
||||
OnBack = null;
|
||||
OnEnter = null;
|
||||
OnTab = null;
|
||||
OnUse = null;
|
||||
|
||||
InputManager.OnUICanceled -= OnAction;
|
||||
}
|
||||
|
||||
public void Use()
|
||||
{
|
||||
List.RemoveChildrenToPool();
|
||||
LeftList.RemoveChildrenToPool();
|
||||
|
||||
InputManager.OnUICanceled += OnAction;
|
||||
|
||||
AddButtonItem(OnUse, "");
|
||||
AddButtonItem(OnTab, InputDef.UI.Tab);
|
||||
AddButtonItem(OnEnter, InputDef.UI.Enter);
|
||||
AddButtonItem(OnBack, InputDef.UI.Back);
|
||||
}
|
||||
|
||||
private void AddButtonItem(Action action, string actionName)
|
||||
{
|
||||
if (action != null)
|
||||
{
|
||||
if (List.AddItemFromPool() is BtnTitleInputControl item)
|
||||
{
|
||||
item.OnAction = action;
|
||||
item.ActionName = actionName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAction(string action)
|
||||
{
|
||||
var children = List.GetChildren();
|
||||
foreach (var child in children)
|
||||
{
|
||||
if (child is BtnTitleInputControl item)
|
||||
{
|
||||
if (action == item.ActionName)
|
||||
{
|
||||
item.OnAction?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Common/Menu/BottomMenu.cs.meta
Normal file
2
Assets/Scripts/UI/Common/Menu/BottomMenu.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94c5df4d4f05c2b40ad72c5c90008295
|
||||
31
Assets/Scripts/UI/Common/Menu/CommonMenu.Designer.cs
generated
Normal file
31
Assets/Scripts/UI/Common/Menu/CommonMenu.Designer.cs
generated
Normal file
@@ -0,0 +1,31 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class CommonMenu
|
||||
{
|
||||
public const string URL = "ui://6hgkvlaufcfggr";
|
||||
|
||||
public GList List;
|
||||
public GButton BtnUserHead;
|
||||
public BtnInputControl BtnPrev;
|
||||
public BtnInputControl BtnNext;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
List = (GList)GetChild("List");
|
||||
BtnUserHead = (GButton)GetChild("BtnUserHead");
|
||||
BtnPrev = (BtnInputControl)GetChild("BtnPrev");
|
||||
BtnNext = (BtnInputControl)GetChild("BtnNext");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 195be61b5e6ed4de4b8cec3c2ce8d003
|
||||
98
Assets/Scripts/UI/Common/Menu/CommonMenu.cs
Normal file
98
Assets/Scripts/UI/Common/Menu/CommonMenu.cs
Normal file
@@ -0,0 +1,98 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class CommonMenu : GLabel
|
||||
{
|
||||
public event Action<int> OnTabChange;
|
||||
|
||||
private void OnInited()
|
||||
{
|
||||
List.onClickItem.Add(OnClickItem);
|
||||
BtnPrev.onClick.Add(OnClickBtnPrev);
|
||||
BtnNext.onClick.Add(OnClickBtnNext);
|
||||
|
||||
InputManager.OnUICanceled += OnUICanceled;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
InputManager.OnUICanceled -= OnUICanceled;
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
private void OnUICanceled(string action)
|
||||
{
|
||||
if (action == InputDef.UI.Prev)
|
||||
{
|
||||
OnClickBtnPrev();
|
||||
}
|
||||
else if (action == InputDef.UI.Next)
|
||||
{
|
||||
OnClickBtnNext();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetTabs(List<TabListData> tabList, int selectIndex = 0)
|
||||
{
|
||||
List.RemoveChildrenToPool();
|
||||
var width = 0f;
|
||||
for (int i = 0; i < tabList.Count; i++)
|
||||
{
|
||||
var tabData = tabList[i];
|
||||
var tabItem = List.AddItemFromPool().asButton;
|
||||
tabItem.title = tabData.Tab.Name;
|
||||
width += tabItem.width;
|
||||
if (i > 0)
|
||||
{
|
||||
width += List.columnGap;
|
||||
}
|
||||
}
|
||||
|
||||
Log.Info($"Set tab index={List.selectedIndex}");
|
||||
List.selectedIndex = selectIndex;
|
||||
List.width = width;
|
||||
OnClickItem();
|
||||
}
|
||||
|
||||
|
||||
private void OnClickItem()
|
||||
{
|
||||
OnTabChange?.Invoke(List.selectedIndex);
|
||||
}
|
||||
|
||||
private void OnClickBtnPrev()
|
||||
{
|
||||
if (List.selectedIndex > 0)
|
||||
{
|
||||
List.selectedIndex -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
List.selectedIndex = List.numItems - 1;
|
||||
}
|
||||
|
||||
OnClickItem();
|
||||
}
|
||||
|
||||
private void OnClickBtnNext()
|
||||
{
|
||||
if (List.selectedIndex < List.numItems - 1)
|
||||
{
|
||||
List.selectedIndex += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
List.selectedIndex = 0;
|
||||
}
|
||||
|
||||
OnClickItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Common/Menu/CommonMenu.cs.meta
Normal file
2
Assets/Scripts/UI/Common/Menu/CommonMenu.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b18b4ca156e62462ba447a851e105615
|
||||
29
Assets/Scripts/UI/Common/Menu/CommonSubMenu.Designer.cs
generated
Normal file
29
Assets/Scripts/UI/Common/Menu/CommonSubMenu.Designer.cs
generated
Normal file
@@ -0,0 +1,29 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class CommonSubMenu
|
||||
{
|
||||
public const string URL = "ui://6hgkvlaur03us";
|
||||
|
||||
public GList List;
|
||||
public BtnInputControl BtnPrev;
|
||||
public BtnInputControl BtnNext;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
List = (GList)GetChild("List");
|
||||
BtnPrev = (BtnInputControl)GetChild("BtnPrev");
|
||||
BtnNext = (BtnInputControl)GetChild("BtnNext");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b9116bdcaaf42e4ea12741ceab85742
|
||||
98
Assets/Scripts/UI/Common/Menu/CommonSubMenu.cs
Normal file
98
Assets/Scripts/UI/Common/Menu/CommonSubMenu.cs
Normal file
@@ -0,0 +1,98 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class CommonSubMenu : GComponent
|
||||
{
|
||||
public event Action<int> OnTabChange;
|
||||
|
||||
private void OnInited()
|
||||
{
|
||||
List.onClickItem.Add(OnClickItem);
|
||||
BtnPrev.onClick.Add(OnClickBtnPrev);
|
||||
BtnNext.onClick.Add(OnClickBtnNext);
|
||||
|
||||
InputManager.OnUICanceled += OnUICanceled;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
InputManager.OnUICanceled -= OnUICanceled;
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
private void OnUICanceled(string action)
|
||||
{
|
||||
if (action == InputDef.UI.SubPrev)
|
||||
{
|
||||
OnClickBtnPrev();
|
||||
}
|
||||
else if (action == InputDef.UI.SubNext)
|
||||
{
|
||||
OnClickBtnNext();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetTabs(List<TabSubItemData> subItems, int selectIndex = 0)
|
||||
{
|
||||
List.RemoveChildrenToPool();
|
||||
var width = 0f;
|
||||
for (int i = 0; i < subItems.Count; i++)
|
||||
{
|
||||
var tabData = subItems[i];
|
||||
var tabItem = List.AddItemFromPool().asButton;
|
||||
tabItem.title = tabData.Name;
|
||||
width += tabItem.width;
|
||||
if (i > 0)
|
||||
{
|
||||
width += List.columnGap;
|
||||
}
|
||||
}
|
||||
|
||||
Log.Info($"Set tab index={List.selectedIndex}");
|
||||
List.selectedIndex = selectIndex;
|
||||
List.width = width;
|
||||
OnClickItem();
|
||||
}
|
||||
|
||||
|
||||
private void OnClickItem()
|
||||
{
|
||||
OnTabChange?.Invoke(List.selectedIndex);
|
||||
}
|
||||
|
||||
private void OnClickBtnPrev()
|
||||
{
|
||||
if (List.selectedIndex > 0)
|
||||
{
|
||||
List.selectedIndex -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
List.selectedIndex = List.numItems - 1;
|
||||
}
|
||||
|
||||
OnClickItem();
|
||||
}
|
||||
|
||||
private void OnClickBtnNext()
|
||||
{
|
||||
if (List.selectedIndex < List.numItems - 1)
|
||||
{
|
||||
List.selectedIndex += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
List.selectedIndex = 0;
|
||||
}
|
||||
|
||||
OnClickItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Common/Menu/CommonSubMenu.cs.meta
Normal file
2
Assets/Scripts/UI/Common/Menu/CommonSubMenu.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93621bc99ea075a4089f13224578d4ef
|
||||
Reference in New Issue
Block a user