多语言设置界面逻辑

This commit is contained in:
bob
2025-06-12 16:18:55 +08:00
parent 15eaa0e666
commit 07e7715be8
20 changed files with 212 additions and 111 deletions

View 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 SelectPages
{
public const string URL = "ui://6hgkvlau5dtx1a";
public GList List;
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
List = (GList)GetChild("List");
OnInited();
UILanguage.TrySetComponentLanguage(this);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8e05d47a4fe9d174db57d8e523b1d53b

View File

@@ -0,0 +1,36 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using UnityEngine;
using FairyGUI;
using NBC;
namespace NBF
{
public partial class SelectPages : GComponent
{
public int TotalPages { get; private set; }
public int CurrentPage { get; private set; }
private void OnInited()
{
}
public void SetTotal(int totalPage)
{
TotalPages = totalPage;
List.RemoveChildrenToPool();
for (var i = 0; i < totalPage; i++)
{
List.AddItemFromPool();
}
}
public void SetCurrent(int currentPage)
{
if (currentPage < 0 || currentPage >= TotalPages) return;
CurrentPage = currentPage;
List.selectedIndex = CurrentPage;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 405973384bfed8e409a629849e3cef2e