浮漂脚本

This commit is contained in:
2025-11-26 14:28:55 +08:00
parent 293890c649
commit 6b5e43d813
110 changed files with 1659 additions and 12039 deletions

View File

@@ -12,7 +12,6 @@ namespace NBF
public const string URL = "ui://hxr7rc7puq3a1h";
public GImage back;
public GImage Quality2;
public GImage Quality;
public override void ConstructFromXML(XML xml)
@@ -20,7 +19,6 @@ namespace NBF
base.ConstructFromXML(xml);
back = (GImage)GetChild("back");
Quality2 = (GImage)GetChild("Quality2");
Quality = (GImage)GetChild("Quality");
OnInited();
UILanguage.TrySetComponentLanguage(this);

View File

@@ -20,7 +20,7 @@ namespace NBF
public BottomMenu BottomMenu;
[AutoFind(Name = "ItemList")]
public CommonItemList ItemList;
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ App.UI.OpenUI<BagPanel>(param); }

View File

@@ -38,7 +38,6 @@ namespace NBF
ItemList.SetPanel(this);
ItemList.SetData(tabItemList, true, true);
BagSlotPanel.Show();
}
private void OnUICanceled(string action)

View File

@@ -24,7 +24,7 @@ namespace NBF
public BtnTitleInputControl BtnConfirm;
[AutoFind(Name = "List")]
public ClassifyList List;
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ App.UI.OpenUI<BagSelectPanel>(param); }

View File

@@ -26,7 +26,7 @@ namespace NBF
public GImage SlotSeparator;
[AutoFind(Name = "Test")]
public GLoader Test;
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ App.UI.OpenUI<BagSlotPanel>(param); }

View File

@@ -28,7 +28,7 @@ namespace NBF
public ItemDetailsContent Content;
[AutoFind(Name = "Quality")]
public GImage Quality;
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ App.UI.OpenUI<ItemDetailsPanel>(param); }

View File

@@ -8,7 +8,6 @@
CommonBinder.BindAll();
FishingBinder.BindAll();
MainBinder.BindAll();
ShopBinder.BindAll();
}
}
}

View File

@@ -1,15 +0,0 @@
/**注册组件绑定关系。本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
using FairyGUI;
namespace NBF
{
public static class ShopBinder
{
[UIExtensionAutoBind]
public static void BindAll()
{
UIObjectFactory.SetPackageItemExtension(ShopItem.URL, typeof(ShopItem));
}
}
}

View File

@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: f579b85674067d740ba424bcc5da406d

View File

@@ -34,7 +34,7 @@ namespace NBF
public GButton BtnSendWorld;
[AutoFind(Name = "ChatList")]
public GList ChatList;
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ App.UI.OpenUI<ChatTestPanel>(param); }

View File

@@ -121,6 +121,10 @@ namespace NBF
titleItem.SetData(itemData);
titleItem.SetSize(List.width, 32);
}
else if (obj is ShopGearItem shopGearItem)
{
shopGearItem.SetData(itemData as GoodsConfig);
}
}
@@ -128,17 +132,18 @@ namespace NBF
string GetListItemResource(int index)
{
var itemData = _listData[index];
if (itemData is ShopItemInfo)
{
return ShopItem.URL;
}
if (itemData is ItemInfo itemInfo)
{
return BagItem.URL;
}
if (itemData is GoodsConfig goodsConfig)
{
return ShopGearItem.URL;
}
if (itemData is ClassifyListTitleData titleData)
{
return ListTitleItem.URL;

View File

@@ -50,7 +50,6 @@ namespace NBF
style.selectedIndex = 1; //有二级菜单
}
_tabList.AddRange(tabItemList);
if (showListTitle)

View File

@@ -11,9 +11,7 @@ namespace NBF
{
public const string URL = "ui://6hgkvlaufcfggr";
public Controller showType;
public GList List;
public GButton BtnUserHead;
public BtnInputControl BtnPrev;
public BtnInputControl BtnNext;
@@ -21,9 +19,7 @@ namespace NBF
{
base.ConstructFromXML(xml);
showType = GetController("showType");
List = (GList)GetChild("List");
BtnUserHead = (GButton)GetChild("BtnUserHead");
BtnPrev = (BtnInputControl)GetChild("BtnPrev");
BtnNext = (BtnInputControl)GetChild("BtnNext");
OnInited();

View File

@@ -39,7 +39,12 @@ namespace NBF
public void SetData(ItemInfo itemInfo)
{
_renderImage.SetModel(PrefabsHelper.CreateItem(itemInfo), ModelViewerSettings.Load(itemInfo.ConfigId));
_renderImage.SetModel(PrefabsHelper.CreateItem(itemInfo.Config), ModelViewerSettings.Load(itemInfo.ConfigId));
}
public void SetData(ItemConfig itemConfig)
{
_renderImage.SetModel(PrefabsHelper.CreateItem(itemConfig), ModelViewerSettings.Load(itemConfig.Id));
}

View File

@@ -18,7 +18,7 @@ namespace NBF
public GImage back;
[AutoFind(Name = "BottomMenu")]
public BottomMenu BottomMenu;
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ App.UI.OpenUI<FishBagPanel>(param); }

View File

@@ -20,7 +20,7 @@ namespace NBF
public GComponent Pages;
[AutoFind(Name = "Menu")]
public CommonMenu Menu;
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ App.UI.OpenUI<HomePanel>(param); }

View File

@@ -20,7 +20,7 @@ namespace NBF
public CommonInput InputAccount;
[AutoFind(Name = "BtnLogin")]
public GButton BtnLogin;
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ App.UI.OpenUI<LoginPanel>(param); }

View File

@@ -20,7 +20,7 @@ namespace NBF
public CommonMenu Menu;
[AutoFind(Name = "BottomMenu")]
public BottomMenu BottomMenu;
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ App.UI.OpenUI<MakePanel>(param); }

View File

@@ -18,7 +18,7 @@ namespace NBF
public GImage back;
[AutoFind(Name = "BottomMenu")]
public BottomMenu BottomMenu;
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ App.UI.OpenUI<MapPanel>(param); }

View File

@@ -28,7 +28,7 @@ namespace NBF
public GLabel Mask;
[AutoFind(Name = "InputWait")]
public GComponent InputWait;
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ App.UI.OpenUI<SettingPanel>(param); }

View File

@@ -1,15 +0,0 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using UnityEngine;
using FairyGUI;
using NBC;
namespace NBF
{
public partial class ShopGearItem : GButton
{
private void OnInited()
{
}
}
}

View File

@@ -14,13 +14,17 @@ namespace NBF
public override string UIPackName => "Main";
public override string UIResName => "FishingShopPanel";
[AutoFind(Name = "Currencys")]
public GComponent Currencys;
[AutoFind(Name = "BottomMenu")]
public BottomMenu BottomMenu;
[AutoFind(Name = "ItemList")]
public CommonItemList ItemList;
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
[AutoFind(Name = "Currencys")]
public GComponent Currencys;
[AutoFind(Name = "Loading")]
public GLabel Loading;
[AutoFind(Name = "Head")]
public GButton Head;
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ App.UI.OpenUI<FishingShopPanel>(param); }

View File

@@ -14,42 +14,44 @@ namespace NBF
protected override void OnInit()
{
base.OnInit();
this.AutoAddClick(OnClick);
IsShowCursor = true;
// List<TabItemData> tabItemList = new List<TabItemData>();
// for (int i = 0; i < 10; i++)
// {
// TabItemData tabItem = new TabItemData();
// tabItem.Key = $"Tab_{i}";
// for (int j = 0; j < 5; j++)
// {
// TabItemData tabSubItem = new TabItemData();
// tabSubItem.Key = $"SubTab_{j}";
// var count = Random.Range(2, 5);
// for (int k = 0; k < count; k++)
// {
// var item = new ShopGearData
// {
// title = $"Item:{i}-{j}-{k}"
// };
// tabSubItem.Items.Add(item);
// }
//
// tabItem.Children.Add(tabSubItem);
// }
//
// tabItemList.Add(tabItem);
// }
//
// ItemList.SetPanel(this);
// ItemList.SetData(tabItemList, true, true);
GoodsConfigHelper.Init();
}
protected override void OnShow()
{
base.OnShow();
ItemList.List.OnClickItem += OnClickItem;
Game.Input.OnUICanceled += OnUICanceled;
UseBottomMenu();
List<TabItemData> tabItemList = GoodsConfigHelper.TabItemList;
ItemList.SetPanel(this);
ItemList.SetData(tabItemList, true, true);
}
private void OnUICanceled(string action)
{
if (!IsTop) return;
if (action == InputDef.UI.SubPrev)
{
}
else if (action == InputDef.UI.SubNext)
{
}
else if (action == InputDef.UI.Up)
{
}
else if (action == InputDef.UI.Down)
{
}
}
private void OnClickItem(object item)
{
if (item is not ShopGearItem gearItem) return;
// ItemDetailsPanel.s
// ItemDetailsPanel.Show(bagItem.ItemInfo);
ShopDetailsPanel.Show(gearItem.Config);
}
private void UseBottomMenu()
@@ -57,19 +59,10 @@ namespace NBF
BottomMenu.Use(this);
}
private void OnClickItem(object item)
protected override void OnHide()
{
if (item is not ShopItem shopGearItem) return;
// Log.Info($"click item ={shopGearItem.GearData.title}");
}
private void OnClick(GComponent btn)
{
// if (btn == BtnClose)
// {
// Hide();
// }
Game.Input.OnUICanceled -= OnUICanceled;
ItemList.List.OnClickItem -= OnClickItem;
}
protected override void OnDestroy()

View File

@@ -0,0 +1,74 @@
using System.Collections.Generic;
using System.Linq;
using NBF.Utils;
namespace NBF
{
public static class GoodsConfigHelper
{
public static readonly List<TabItemData> TabItemList = new List<TabItemData>();
/// <summary>
/// 组合和id映射关系
/// </summary>
private static readonly Dictionary<uint, List<uint>> _group2Id = new Dictionary<uint, List<uint>>();
private static readonly Dictionary<uint, GoodsConfig> _googs = new Dictionary<uint, GoodsConfig>();
// private static readonly Dictionary<>
public static void Init()
{
var listGoods = GoodsConfig.GetList();
TabItemList.Clear();
foreach (var goodsConfig in listGoods)
{
if (goodsConfig.Group < 1)
{
goodsConfig.Group = goodsConfig.Id;
}
if (!_group2Id.TryGetValue(goodsConfig.Group, out List<uint> ids))
{
ids = new List<uint>();
_group2Id.Add(goodsConfig.Group, ids);
}
ids.Add(goodsConfig.Id);
_googs[goodsConfig.Id] = goodsConfig;
}
Dictionary<ItemType, List<GoodsConfig>> tabDic = new Dictionary<ItemType, List<GoodsConfig>>();
foreach (var goodsId in _group2Id.Keys)
{
var good = _googs[goodsId];
var awards = good.Awards;
var type = awards.First().Id.GetItemType();
if (!tabDic.ContainsKey(type))
{
tabDic.Add(type, new List<GoodsConfig>());
}
tabDic[type].Add(good);
}
foreach (var (key, list) in tabDic)
{
list.Sort((x, y) => (int)(y.Price1 - x.Price1));
}
foreach (var (type, list) in tabDic)
{
TabItemData tabItem = new TabItemData
{
Key = type.ToString()
};
tabItem.Items.AddRange(list);
TabItemList.Add(tabItem);
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 488efa1c587a4dc7a08fb18550e6f470
timeCreated: 1763867799

View File

@@ -0,0 +1,40 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
using FairyGUI;
using FairyGUI.Utils;
using NBC;
using System.Collections.Generic;
namespace NBF
{
/// <summary> </summary>
public partial class ShopDetailsPanel
{
public GObject this[string aKey] => ContentPane.GetChild(aKey);
public override string UIPackName => "Main";
public override string UIResName => "ShopDetailsPanel";
[AutoFind(Name = "back")]
public GLabel back;
[AutoFind(Name = "BottomMenu")]
public BottomMenu BottomMenu;
[AutoFind(Name = "title")]
public GComponent title;
[AutoFind(Name = "modelBack")]
public GImage modelBack;
[AutoFind(Name = "Model")]
public ModelViewer Model;
[AutoFind(Name = "Content")]
public GComponent Content;
[AutoFind(Name = "Quality")]
public GImage Quality;
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ App.UI.OpenUI<ShopDetailsPanel>(param); }
public static void Hide(){ App.UI.HideUI<ShopDetailsPanel>(); }
public static void Del(){ App.UI.DestroyUI<ShopDetailsPanel>(); }
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 05068004b176c354aa41b3db4f299fce

View File

@@ -0,0 +1,15 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using UnityEngine;
using NBC;
namespace NBF
{
public partial class ShopDetailsPanel : UIPanel
{
protected override void OnShow()
{
// Model.SetData(ItemInfo);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b94c59d346c7a1d458f0bbdd72e12768

View File

@@ -12,14 +12,18 @@ namespace NBF
public const string URL = "ui://hxr7rc7poome9";
public GImage back;
public GImage ba;
public GTextField TextPrice;
public GImage Quality;
public GTextField TextAmount;
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
back = (GImage)GetChild("back");
ba = (GImage)GetChild("ba");
TextPrice = (GTextField)GetChild("TextPrice");
Quality = (GImage)GetChild("Quality");
TextAmount = (GTextField)GetChild("TextAmount");
OnInited();
UILanguage.TrySetComponentLanguage(this);
}

View File

@@ -0,0 +1,35 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using System.Linq;
using UnityEngine;
using FairyGUI;
using Fantasy;
using NBC;
using NBF.Utils;
namespace NBF
{
public partial class ShopGearItem : GButton
{
public GoodsConfig Config;
private void OnInited()
{
}
public virtual void SetData(GoodsConfig goodsConfig)
{
Config = goodsConfig;
var award = goodsConfig.Awards.First();
title = award.Id.GetName();
this.SetIcon(award.Id);
var cfg = ItemConfig.Get(award.Id);
Quality.SetQuality(cfg.Quality);
this.SetTitleQuality(cfg.Quality);
TextAmount.text = $"个数:{award.Amount}";
TextPrice.text = goodsConfig.Price1.ToString();
}
}
}

View File

@@ -1,33 +0,0 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
using FairyGUI;
using FairyGUI.Utils;
using NBC;
namespace NBF
{
public partial class ShopItem
{
public const string URL = "ui://hxr7rc7poome9";
public GImage back;
public GImage Quality;
public GTextField TextCoin;
public GLoader CoinIcon;
public GTextField TextCoin_2;
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
back = (GImage)GetChild("back");
Quality = (GImage)GetChild("Quality");
TextCoin = (GTextField)GetChild("TextCoin");
CoinIcon = (GLoader)GetChild("CoinIcon");
TextCoin_2 = (GTextField)GetChild("TextCoin");
OnInited();
UILanguage.TrySetComponentLanguage(this);
}
}
}

View File

@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: f1c9e707edc525b419a4d8469675a653

View File

@@ -1,23 +0,0 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using UnityEngine;
using FairyGUI;
using NBC;
namespace NBF
{
public partial class ShopItem : ListItemBase
{
// public ShopGearData GearData;
private void OnInited()
{
}
protected override void OnSetData(object showData)
{
// GearData = showData as ShopGearData;
// if(GearData == null) return;
// title = GearData.title;
}
}
}

View File

@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 88f8461d076edc549bc841c01f0e42a3