This commit is contained in:
2026-02-20 21:03:17 +08:00
parent 6cf9b8df56
commit 27a1f9d084
920 changed files with 196579 additions and 6801 deletions

View 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 BtnInputName
{
public const string URL = "ui://6hgkvlaumnqhz2";
public Controller styleCtrl;
public Transition start;
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
styleCtrl = GetController("styleCtrl");
start = GetTransition("start");
OnInited();
UILanguage.TrySetComponentLanguage(this);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3bbc263e9355f5144b0b4a6989f72c05

View File

@@ -0,0 +1,40 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using UnityEngine;
using FairyGUI;
using NBC;
using NBF.Setting;
using UnityEngine.InputSystem;
namespace NBF
{
public partial class BtnInputName : GButton
{
// private InputAction _inputAction;
private KeyBoardOption _keyBoardOption;
private int _index;
private void OnInited()
{
}
public void SetData(int index, KeyBoardOption boardOption)
{
_index = index;
_keyBoardOption = boardOption;
// _inputAction = inputAction;
var bindings = boardOption.InputAction.bindings;
if (bindings.Count > index)
{
title = boardOption.GetDisplayString(); //boardOption.InputAction.GetBindingDisplayString(index);
}
else
{
title = "未绑定";
}
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5046c80b3e704c94886c9c81b9da0f2b

View File

@@ -11,13 +11,13 @@ namespace NBF
{
public const string URL = "ui://6hgkvlaur03uj0";
public Controller show;
public Controller style;
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
show = GetController("show");
style = GetController("style");
OnInited();
UILanguage.TrySetComponentLanguage(this);
}

View File

@@ -13,7 +13,6 @@ namespace NBF
public Controller FocusState;
public GTextInput Input;
public GImage bottomBack;
public override void ConstructFromXML(XML xml)
{
@@ -21,7 +20,6 @@ namespace NBF
FocusState = GetController("FocusState");
Input = (GTextInput)GetChild("Input");
bottomBack = (GImage)GetChild("bottomBack");
OnInited();
UILanguage.TrySetComponentLanguage(this);
}

View File

@@ -94,7 +94,7 @@ namespace NBF
}
else if (obj is ShopGearItem shopGearItem)
{
shopGearItem.SetData(itemData as GoodsConfig);
shopGearItem.SetData(itemData as ShopItemInfo);
}
}
@@ -110,7 +110,7 @@ namespace NBF
return BagItem.URL;
}
if (itemData is GoodsConfig goodsConfig)
if (itemData is ShopItemInfo shopItemInfo)
{
return ShopGearItem.URL;
}

View File

@@ -11,18 +11,14 @@ namespace NBF
{
public const string URL = "ui://6hgkvlaup1fps";
public Controller style;
public CommonMenu Menu;
public CommonSubMenu SubMenu;
public ClassifyList List;
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
style = GetController("style");
Menu = (CommonMenu)GetChild("Menu");
SubMenu = (CommonSubMenu)GetChild("SubMenu");
List = (ClassifyList)GetChild("List");
OnInited();
UILanguage.TrySetComponentLanguage(this);

View File

@@ -19,13 +19,13 @@ namespace NBF
private void OnInited()
{
Menu.OnTabChange += ChangeTab;
SubMenu.OnTabChange += ChangeSubTab;
// SubMenu.OnTabChange += ChangeSubTab;
}
public override void Dispose()
{
Menu.OnTabChange -= ChangeTab;
SubMenu.OnTabChange -= ChangeSubTab;
// SubMenu.OnTabChange -= ChangeSubTab;
base.Dispose();
}
@@ -39,11 +39,11 @@ namespace NBF
{
_tabList.Clear();
_currentTab = null;
style.selectedIndex = 0; //一级菜单
if (tabItemList.Any(tabItem => tabItem.Children.Count > 0))
{
style.selectedIndex = 1; //有二级菜单
}
// style.selectedIndex = 0; //一级菜单
// if (tabItemList.Any(tabItem => tabItem.Children.Count > 0))
// {
// style.selectedIndex = 1; //有二级菜单
// }
_tabList.AddRange(tabItemList);
@@ -75,16 +75,15 @@ namespace NBF
if (index < 0) return;
var tabListData = _tabList[index];
_currentTab = tabListData;
var id1 = this.GetHashCode();
if (style.selectedIndex == 0)
// if (style.selectedIndex == 0)
{
//只有一级菜单
List.SetListData(_currentTab.Items);
}
else
{
SubMenu.SetTabs(_currentTab.Children);
}
// else
// {
// SubMenu.SetTabs(_currentTab.Children);
// }
}
private void ChangeSubTab(int index)

View File

@@ -12,14 +12,12 @@ namespace NBF
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);
}

View File

@@ -13,7 +13,7 @@ namespace NBF
private void OnInited()
{
List.onClickItem.Add(OnClickItem);
LeftList.onClickItem.Add(OnClickItem);
// LeftList.onClickItem.Add(OnClickItem);
InputManager.OnUIInvokeChange += OnUIInvokeChange;
}
@@ -34,7 +34,7 @@ namespace NBF
private void OnUIInvokeChange()
{
List.RemoveChildrenToPool();
LeftList.RemoveChildrenToPool();
// LeftList.RemoveChildrenToPool();
var invokes = InputManager.Instance.GetUsableInvokes();
foreach (var uiInputInvoke in invokes)
{
@@ -53,20 +53,20 @@ namespace NBF
public void AddButton(string inputName, string showName = "", bool isRight = true)
{
if (isRight)
if (List.AddItemFromPool() is BtnTitleInputControl item)
{
if (List.AddItemFromPool() is BtnTitleInputControl item)
{
item.SetData(inputName, showName);
}
}
else
{
if (LeftList.AddItemFromPool() is BtnTitleInputControl item)
{
item.SetData(inputName, showName);
}
item.SetData(inputName, showName);
}
// if (isRight)
// {
// }
// else
// {
// if (LeftList.AddItemFromPool() is BtnTitleInputControl item)
// {
// item.SetData(inputName, showName);
// }
// }
}
}
}

View File

@@ -11,17 +11,17 @@ namespace NBF
{
public const string URL = "ui://6hgkvlaufcfggr";
public Controller showTitleCtrl;
public GImage back;
public GList List;
public BtnInputControl BtnPrev;
public BtnInputControl BtnNext;
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
showTitleCtrl = GetController("showTitleCtrl");
back = (GImage)GetChild("back");
List = (GList)GetChild("List");
BtnPrev = (BtnInputControl)GetChild("BtnPrev");
BtnNext = (BtnInputControl)GetChild("BtnNext");
OnInited();
UILanguage.TrySetComponentLanguage(this);
}

View File

@@ -16,8 +16,8 @@ namespace NBF
private void OnInited()
{
List.onClickItem.Add(OnClickItem);
BtnPrev.onClick.Add(OnClickBtnPrev);
BtnNext.onClick.Add(OnClickBtnNext);
// BtnPrev.onClick.Add(OnClickBtnPrev);
// BtnNext.onClick.Add(OnClickBtnNext);
}
private string _leftActionName;
@@ -27,8 +27,8 @@ namespace NBF
{
_leftActionName = leftActionName;
_rightActionName = rightActionName;
BtnPrev.SetData(leftActionName, string.Empty);
BtnNext.SetData(rightActionName, string.Empty);
// BtnPrev.SetData(leftActionName, string.Empty);
// BtnNext.SetData(rightActionName, string.Empty);
}
public void SetTabs(List<TabItemData> tabList, int selectIndex = 0)

View File

@@ -12,16 +12,12 @@ namespace NBF
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);
}

View File

@@ -19,8 +19,8 @@ namespace NBF
private void OnInited()
{
List.onClickItem.Add(OnClickItem);
BtnPrev.onClick.Add(OnClickBtnPrev);
BtnNext.onClick.Add(OnClickBtnNext);
// BtnPrev.onClick.Add(OnClickBtnPrev);
// BtnNext.onClick.Add(OnClickBtnNext);
// CommonSubMenu
}
@@ -29,8 +29,8 @@ namespace NBF
{
_leftActionName = leftActionName;
_rightActionName = rightActionName;
BtnPrev.SetData(leftActionName, string.Empty);
BtnNext.SetData(rightActionName, string.Empty);
// BtnPrev.SetData(leftActionName, string.Empty);
// BtnNext.SetData(rightActionName, string.Empty);
}
public override void Dispose()

View File

@@ -28,7 +28,8 @@ namespace NBF
// Vector3 _rotating;
const int RENDER_LAYER = 22;
const int HIDDEN_LAYER = 10;
const int HIDDEN_LAYER = 22;
public ModelViewRenderImage(GGraph holder)
{
@@ -96,37 +97,17 @@ namespace NBF
ModelViewerUtils.InitSetting(model, ViewerSettings);
}
var meshArr = _model.GetComponentsInChildren<MeshRenderer>();
foreach (var meshRenderer in meshArr)
{
// 设置物体仅接受 Layer 2 的光照
meshRenderer.renderingLayerMask = 1 << 2;
}
Review();
}
// public void LoadModel(string model, ModelViewerSettings settings)
// {
// this.UnloadModel();
// ViewerSettings = settings;
//
// Object prefab = Resources.Load(model);
// if (prefab == null) return;
// GameObject go = ((GameObject)Object.Instantiate(prefab));
// var joint = go.GetComponent<Joint>();
// if (joint != null)
// {
// Object.Destroy(joint);
// }
//
// _model = go.transform;
// _model.SetParent(this.modelRoot, false);
// _model.localPosition = Vector3.zero;
// _model.localScale = Vector3.one;
// _model.localEulerAngles = Vector3.zero;
// if (ViewerSettings == null)
// {
// ViewerSettings = new ModelViewerSettings();
// ModelViewerUtils.InitSetting(go, ViewerSettings);
// }
//
// Review();
// }
public void UnloadModel()
{
if (_model != null)
@@ -185,7 +166,9 @@ namespace NBF
if (_renderTexture != null)
return;
_renderTexture = new RenderTexture(1024, 1024, 24, RenderTextureFormat.ARGB32)
//1920
_renderTexture = new RenderTexture(_width, _height, 24, RenderTextureFormat.ARGB32)
{
antiAliasing = 8,
filterMode = FilterMode.Bilinear,

View File

@@ -21,14 +21,22 @@ namespace NBF
private void OnInited()
{
_renderImage = new ModelViewRenderImage(ModelHolder.asGraph);
TouchHolder.onRollOver.Set(OnFocusIn);
TouchHolder.onRollOut.Set(OnFocusOut);
Stage.inst.onMouseWheel.Add(OnMouseWheel);
onAddedToStage.Add(OnAddedToStage);
SetRotateListening();
}
void OnAddedToStage()
{
_renderImage = new ModelViewRenderImage(ModelHolder.asGraph);
}
public override void Dispose()
{
Stage.inst.onMouseWheel.Remove(OnMouseWheel);
@@ -39,10 +47,10 @@ namespace NBF
public void SetData(ItemInfo itemInfo)
{
_renderImage.SetModel(PrefabsHelper.CreateItem(itemInfo.Config), ModelViewerSettings.Load(itemInfo.ConfigId));
_renderImage.SetModel(PrefabsHelper.CreateItem(itemInfo.Config), ModelViewerSettings.Load((int)itemInfo.ConfigId));
}
public void SetData(ItemConfig itemConfig)
public void SetData(cfg.Item itemConfig)
{
_renderImage.SetModel(PrefabsHelper.CreateItem(itemConfig), ModelViewerSettings.Load(itemConfig.Id));
}
@@ -121,7 +129,7 @@ namespace NBF
#endregion
public void SaveRenderTextureToPNG(uint id)
public void SaveRenderTextureToPNG(int id)
{
#if UNITY_EDITOR
RenderTexture rt = RenderImage.RT;

View File

@@ -34,7 +34,7 @@ namespace NBF
public Color ambientLightColour;
public static ModelViewerSettings Load(uint id)
public static ModelViewerSettings Load(int id)
{
var configAsset = Assets.Load<TextAsset>($"Assets/ResRaw/config/Viewer/{id}");
if (configAsset != null)

View File

@@ -14,18 +14,14 @@ namespace NBF
public override string UIPackName => "Common";
public override string UIResName => "MessageBox";
[AutoFind(Name = "MessageStyle")]
public Controller MessageStyle;
[AutoFind(Name = "back")]
public GImage back;
[AutoFind(Name = "TextTitle")]
public GTextField TextTitle;
[AutoFind(Name = "TextContent")]
public GTextField TextContent;
[AutoFind(Name = "BtnCancel")]
public BtnTitleInputControl BtnCancel;
[AutoFind(Name = "BtnConfirm")]
public BtnTitleInputControl BtnConfirm;
public GButton BtnConfirm;
[AutoFind(Name = "BtnClose")]
public GButton BtnClose;
[AutoFind(Name = "t0")]
public Transition t0;
public override string[] GetDependPackages(){ return new string[] {}; }

View File

@@ -56,9 +56,9 @@ namespace NBF
{
// TextTitle.SetLanguage(_title);
BtnConfirm.SetLanguage(_confirmText);
BtnCancel.SetLanguage(_cancelText);
// BtnCancel.SetLanguage(_cancelText);
// MessageStyle.selectedIndex = _style;
TextTitle.SetLanguage(_content);
MessageStyle.selectedIndex = _style;
}
private void OnUICanceled(string action)
@@ -67,11 +67,11 @@ namespace NBF
if (!IsTop) return;
if (action == InputDef.UI.Enter)
{
OnClick(BtnConfirm);
ClosePanel(true);
}
else if (action == InputDef.UI.Back)
{
OnClick(BtnCancel);
ClosePanel(false);
}
}
@@ -84,7 +84,12 @@ namespace NBF
private void OnClick(GComponent btn)
{
_callback?.Invoke(btn == BtnConfirm);
ClosePanel(btn == BtnConfirm);
}
private void ClosePanel(bool ret)
{
_callback?.Invoke(ret);
Hide();
}
}