首次提交
This commit is contained in:
25
Assets/Scripts/UI/Common/Menu/BottomMenu.Designer.cs
generated
Normal file
25
Assets/Scripts/UI/Common/Menu/BottomMenu.Designer.cs
generated
Normal file
@@ -0,0 +1,25 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址: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 override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
List = (GList)GetChild("List");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 172ed53c6c409e04c8a993c9fae4c820
|
||||
72
Assets/Scripts/UI/Common/Menu/BottomMenu.cs
Normal file
72
Assets/Scripts/UI/Common/Menu/BottomMenu.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
using UIPanel = NBC.UIPanel;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class BottomMenu : GComponent
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
List.onClickItem.Add(OnClickItem);
|
||||
// LeftList.onClickItem.Add(OnClickItem);
|
||||
InputManager.OnUIInvokeChange += OnUIInvokeChange;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
InputManager.OnUIInvokeChange -= OnUIInvokeChange;
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
private void OnClickItem(EventContext context)
|
||||
{
|
||||
var item = context.data as BtnTitleInputControl;
|
||||
if (item == null) return;
|
||||
InputManager.Instance.SendUIInput(item.ActionName);
|
||||
Debug.Log("模拟点击===");
|
||||
}
|
||||
|
||||
private void OnUIInvokeChange()
|
||||
{
|
||||
List.RemoveChildrenToPool();
|
||||
// LeftList.RemoveChildrenToPool();
|
||||
var invokes = InputManager.Instance.GetUsableInvokes();
|
||||
foreach (var uiInputInvoke in invokes)
|
||||
{
|
||||
var invokeData = uiInputInvoke.InputInvoke;
|
||||
if (uiInputInvoke.InputInvoke.Mode == UIInputButtonShowMode.BottomLeft)
|
||||
{
|
||||
AddButton(invokeData.Name, invokeData.Key, false);
|
||||
}
|
||||
else if (uiInputInvoke.InputInvoke.Mode == UIInputButtonShowMode.BottomRight)
|
||||
{
|
||||
AddButton(invokeData.Name, invokeData.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void AddButton(string inputName, string showName = "", bool isRight = true)
|
||||
{
|
||||
if (List.AddItemFromPool() is BtnTitleInputControl item)
|
||||
{
|
||||
item.SetData(inputName, showName);
|
||||
}
|
||||
// if (isRight)
|
||||
// {
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (LeftList.AddItemFromPool() is BtnTitleInputControl item)
|
||||
// {
|
||||
// item.SetData(inputName, showName);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
29
Assets/Scripts/UI/Common/Menu/CommonMenu.Designer.cs
generated
Normal file
29
Assets/Scripts/UI/Common/Menu/CommonMenu.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 CommonMenu
|
||||
{
|
||||
public const string URL = "ui://6hgkvlaufcfggr";
|
||||
|
||||
public Controller showTitleCtrl;
|
||||
public GImage back;
|
||||
public GList List;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
showTitleCtrl = GetController("showTitleCtrl");
|
||||
back = (GImage)GetChild("back");
|
||||
List = (GList)GetChild("List");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 195be61b5e6ed4de4b8cec3c2ce8d003
|
||||
92
Assets/Scripts/UI/Common/Menu/CommonMenu.cs
Normal file
92
Assets/Scripts/UI/Common/Menu/CommonMenu.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
using UIPanel = NBC.UIPanel;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
private string _leftActionName;
|
||||
private string _rightActionName;
|
||||
|
||||
public void SetBtnActionName(string leftActionName, string rightActionName)
|
||||
{
|
||||
_leftActionName = leftActionName;
|
||||
_rightActionName = rightActionName;
|
||||
// BtnPrev.SetData(leftActionName, string.Empty);
|
||||
// BtnNext.SetData(rightActionName, string.Empty);
|
||||
}
|
||||
|
||||
public void SetTabs(List<TabItemData> tabList, int selectIndex = 0)
|
||||
{
|
||||
SetBtnActionName(InputDef.UI.Prev, InputDef.UI.Next);
|
||||
List.RemoveChildrenToPool();
|
||||
var listWidth = 0f;
|
||||
for (int i = 0; i < tabList.Count; i++)
|
||||
{
|
||||
var tabData = tabList[i];
|
||||
var tabItem = List.AddItemFromPool().asButton;
|
||||
tabItem.SetLanguage(tabData.Key);
|
||||
|
||||
listWidth += tabItem.width;
|
||||
if (i > 0)
|
||||
{
|
||||
listWidth += List.columnGap;
|
||||
}
|
||||
}
|
||||
|
||||
Log.Info($"Set tab index={List.selectedIndex}");
|
||||
List.selectedIndex = selectIndex;
|
||||
List.width = listWidth;
|
||||
OnClickItem();
|
||||
}
|
||||
|
||||
|
||||
private void OnClickItem()
|
||||
{
|
||||
OnTabChange?.Invoke(List.selectedIndex);
|
||||
}
|
||||
|
||||
public void OnClickBtnPrev()
|
||||
{
|
||||
if (List.selectedIndex > 0)
|
||||
{
|
||||
List.selectedIndex -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
List.selectedIndex = List.numItems - 1;
|
||||
}
|
||||
|
||||
OnClickItem();
|
||||
}
|
||||
|
||||
public 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
|
||||
25
Assets/Scripts/UI/Common/Menu/CommonSubMenu.Designer.cs
generated
Normal file
25
Assets/Scripts/UI/Common/Menu/CommonSubMenu.Designer.cs
generated
Normal file
@@ -0,0 +1,25 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址: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 override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
List = (GList)GetChild("List");
|
||||
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;
|
||||
using UIPanel = NBC.UIPanel;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class CommonSubMenu : GComponent
|
||||
{
|
||||
public event Action<int> OnTabChange;
|
||||
|
||||
private string _leftActionName;
|
||||
private string _rightActionName;
|
||||
|
||||
private void OnInited()
|
||||
{
|
||||
List.onClickItem.Add(OnClickItem);
|
||||
// BtnPrev.onClick.Add(OnClickBtnPrev);
|
||||
// BtnNext.onClick.Add(OnClickBtnNext);
|
||||
|
||||
// CommonSubMenu
|
||||
}
|
||||
|
||||
public void SetBtnActionName(string leftActionName, string rightActionName)
|
||||
{
|
||||
_leftActionName = leftActionName;
|
||||
_rightActionName = rightActionName;
|
||||
// BtnPrev.SetData(leftActionName, string.Empty);
|
||||
// BtnNext.SetData(rightActionName, string.Empty);
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
public void SetTabs(List<TabItemData> 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(BtnSubMenu.URL).asButton;//i == 0 ? BtnSubMenuLeft.URL :
|
||||
tabItem.SetLanguage(tabData.Key);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public void OnClickBtnPrev()
|
||||
{
|
||||
if (List.selectedIndex > 0)
|
||||
{
|
||||
List.selectedIndex -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
List.selectedIndex = List.numItems - 1;
|
||||
}
|
||||
|
||||
OnClickItem();
|
||||
}
|
||||
|
||||
public 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
|
||||
3
Assets/Scripts/UI/Common/Menu/item.meta
Normal file
3
Assets/Scripts/UI/Common/Menu/item.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21fd308a87b848d7b4a9138f06c4c5f7
|
||||
timeCreated: 1769923363
|
||||
25
Assets/Scripts/UI/Common/Menu/item/BtnSubMenu.Designer.cs
generated
Normal file
25
Assets/Scripts/UI/Common/Menu/item/BtnSubMenu.Designer.cs
generated
Normal file
@@ -0,0 +1,25 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class BtnSubMenu
|
||||
{
|
||||
public const string URL = "ui://6hgkvlauvbojxi";
|
||||
|
||||
public GImage back;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
back = (GImage)GetChild("back");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 670c4d5385c0ad741a5381d10fc7dd15
|
||||
15
Assets/Scripts/UI/Common/Menu/item/BtnSubMenu.cs
Normal file
15
Assets/Scripts/UI/Common/Menu/item/BtnSubMenu.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class BtnSubMenu : GButton
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Common/Menu/item/BtnSubMenu.cs.meta
Normal file
2
Assets/Scripts/UI/Common/Menu/item/BtnSubMenu.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b6a27e3fa4572443afc883702c768f3
|
||||
25
Assets/Scripts/UI/Common/Menu/item/BtnSubMenuLeft.Designer.cs
generated
Normal file
25
Assets/Scripts/UI/Common/Menu/item/BtnSubMenuLeft.Designer.cs
generated
Normal file
@@ -0,0 +1,25 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class BtnSubMenuLeft
|
||||
{
|
||||
public const string URL = "ui://6hgkvlaumbu9y9";
|
||||
|
||||
public GImage back;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
back = (GImage)GetChild("back");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bfb4ffee7088da54d95a349215186ba6
|
||||
15
Assets/Scripts/UI/Common/Menu/item/BtnSubMenuLeft.cs
Normal file
15
Assets/Scripts/UI/Common/Menu/item/BtnSubMenuLeft.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class BtnSubMenuLeft : GButton
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ce6cf183d4b20f4997dd9ca99797135
|
||||
Reference in New Issue
Block a user