首次提交

This commit is contained in:
Bob.Song
2026-03-05 18:07:55 +08:00
commit e125bb869e
4534 changed files with 563920 additions and 0 deletions

View File

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

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3958da30a5539fd40bf58bf9f7af003f

View File

@@ -0,0 +1,61 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using System;
using UnityEngine;
using FairyGUI;
using Fantasy;
using NBC;
using NBF.Utils;
namespace NBF
{
public partial class BagGearItem : GButton
{
public Action<long, long> OnCloseAction;
public ItemBindData BindData { get; private set; }
public ItemInfo ItemInfo { get; private set; }
public long RigId { get; private set; }
private void OnInited()
{
BtnClose.onClick.Set(OnClose);
}
private void OnClose(EventContext context)
{
OnCloseAction?.Invoke(ItemInfo.Id, RigId);
context.StopPropagation();
}
/// <summary>
/// 设置数据
/// </summary>
/// <param name="item">主物体</param>
/// <param name="bindData">可以装配的配件</param>
/// <param name="bind">已绑定的配件</param>
public void SetData(ItemInfo item, ItemBindData bindData, ItemInfo bind = null)
{
ItemInfo = item;
BindData = bindData;
Have.selectedIndex = bind != null ? 1 : 0;
if (bind != null)
{
RigId = bind.Id;
this.SetIcon(bind.ConfigId);
TextTitle.text = bind.ConfigId.GetName();
Quality.SetQuality(bind.Config.Quality);
// TextTitle.SetTitleQuality(bind.Config.Quality);
TextDesc.text = bind.ConfigId.GetDesc();
}
else
{
RigId = 0;
TextTitle.text = bindData.Type.ToString();
// TextTitle.SetTitleQuality(0);
TextDesc.text = bindData.Optional ? "非必要组件" : "必要组件";
}
}
}
}

View File

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

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 BagItem
{
public const string URL = "ui://hxr7rc7puq3a1h";
public GImage back;
public GImage Quality;
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
back = (GImage)GetChild("back");
Quality = (GImage)GetChild("Quality");
OnInited();
UILanguage.TrySetComponentLanguage(this);
}
}
}

View File

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

View File

@@ -0,0 +1,49 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using UnityEngine;
using FairyGUI;
using Fantasy;
using Fantasy.Async;
using NBC;
using NBF.Utils;
using Log = NBC.Log;
namespace NBF
{
public partial class BagItem : GButton
{
public ItemInfo ItemInfo;
// private string iconStr;
private void OnInited()
{
onDragStart.Add(DragStart);
// Oncl
}
private void DragStart(EventContext context)
{
context.PreventDefault();
DragDropManager.inst.StartDrag(this, this.icon, this.icon, (int)context.data);
// icon = string.Empty;
}
public virtual void SetData(ItemInfo itemInfo)
{
draggable = false;
ItemInfo = itemInfo;
title = itemInfo.ConfigId.GetName();
this.SetIcon(itemInfo.ConfigId);
Quality.SetQuality(ItemInfo.Config.Quality);
this.SetTitleQuality(ItemInfo.Config.Quality);
// iconStr = icon;
}
public void UpdateIcon()
{
this.SetIcon(ItemInfo.ConfigId);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 23a4348047aba5743b09c9d65e404a93

View File

@@ -0,0 +1,32 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址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 BagPanel
{
public GObject this[string aKey] => ContentPane.GetChild(aKey);
public override string UIPackName => "Main";
public override string UIResName => "BagPanel";
[AutoFind(Name = "back")]
public GLabel back;
[AutoFind(Name = "BottomMenu")]
public BottomMenu BottomMenu;
[AutoFind(Name = "ItemList")]
public CommonItemList ItemList;
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ UI.Inst.OpenUI<BagPanel>(param); }
public static void Hide(){ UI.Inst.HideUI<BagPanel>(); }
public static void Del(){ UI.Inst.DestroyUI<BagPanel>(); }
}
}

View File

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

View File

@@ -0,0 +1,55 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using System.Collections.Generic;
using UnityEngine;
using NBC;
using NBF.Fishing2;
namespace NBF
{
public partial class BagPanel : UIPanel
{
protected override void OnInit()
{
base.OnInit();
}
protected override void OnShow()
{
ItemList.List.OnClickItem += OnClickItem;
List<TabItemData> tabItemList = new List<TabItemData>();
var dic = RoleModel.Instance.GetItemsByType();
foreach (var (type, list) in dic)
{
TabItemData tabItem = new TabItemData
{
Key = type.ToString()
};
tabItem.Items.AddRange(list);
tabItemList.Add(tabItem);
}
ItemList.SetData(tabItemList, true, true);
}
private void OnClickItem(object item)
{
if (item is not BagItem bagItem) return;
// ItemDetailsPanel.s
ItemDetailsPanel.Show(bagItem.ItemInfo);
}
protected override void OnHide()
{
ItemList.List.OnClickItem -= OnClickItem;
}
protected override void OnDestroy()
{
base.OnDestroy();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 06f449f341e3a19438e38e1038fd25d5

View File

@@ -0,0 +1,36 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址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 BagSelectPanel
{
public GObject this[string aKey] => ContentPane.GetChild(aKey);
public override string UIPackName => "Main";
public override string UIResName => "BagSelectPanel";
[AutoFind(Name = "back")]
public GImage back;
[AutoFind(Name = "box")]
public GImage box;
[AutoFind(Name = "BtnCancel")]
public BtnTitleInputControl BtnCancel;
[AutoFind(Name = "BtnConfirm")]
public BtnTitleInputControl BtnConfirm;
[AutoFind(Name = "List")]
public ClassifyList List;
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ UI.Inst.OpenUI<BagSelectPanel>(param); }
public static void Hide(){ UI.Inst.HideUI<BagSelectPanel>(); }
public static void Del(){ UI.Inst.DestroyUI<BagSelectPanel>(); }
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 2549b4ffe371d714c8b8afe26fb555f0

View File

@@ -0,0 +1,102 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using System;
using System.Collections.Generic;
using FairyGUI;
using Fantasy;
using UnityEngine;
using NBC;
using NBF.Fishing2;
using UIPanel = NBC.UIPanel;
namespace NBF
{
public partial class BagSelectPanel : UIPanel
{
//context.data
private static Action<long> _selectCallBack;
// private static ItemType _itemType;
private static readonly List<ItemType> _itemTypes = new List<ItemType>();
private long _selectedId;
// private List<ItemInfo> _items;
// public static void Show(ItemType itemType, Action<long> callBack)
// {
// Show(new[] { itemType }, callBack);
// }
public static void Show(Action<long> callBack, params ItemType[] itemTypes)
{
_itemTypes.Clear();
_itemTypes.AddRange(itemTypes);
_selectCallBack = callBack;
// List
Show();
}
protected override void OnInit()
{
IsModal = true;
this.AutoAddClick(OnClick);
List.OnDoubleClickItem += OnDoubleClickItem;
List.OnClickItem += OnClickItem;
}
protected override void OnShow()
{
_selectedId = 0;
SetList();
}
protected override void OnDestroy()
{
List.OnClickItem -= OnClickItem;
List.OnDoubleClickItem -= OnDoubleClickItem;
}
private void OnClick(GComponent btn)
{
if (btn == BtnCancel)
{
Hide();
}
else if (btn == BtnConfirm)
{
if (_selectedId > 0)
{
_selectCallBack?.Invoke(_selectedId);
}
Hide();
}
}
private void OnClickItem(object item)
{
if (item is BagItem bagItem)
{
_selectedId = bagItem.ItemInfo.Id;
}
}
private void OnDoubleClickItem(object item)
{
if (item is BagItem bagItem)
{
_selectedId = bagItem.ItemInfo.Id;
_selectCallBack?.Invoke(bagItem.ItemInfo.Id);
Hide();
}
}
private void SetList()
{
// var role = Game.Main.GetComponent<Role>();
// var roleBag = role.GetComponent<RoleBag>();
List<object> items = RoleModel.Instance.GetItemListData(_itemTypes.ToArray());
List.SetListData(items);
}
}
}

View File

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

View File

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

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 6e8df720091e10e47a8068485beb5b1f

View File

@@ -0,0 +1,79 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using System;
using UnityEngine;
using FairyGUI;
using Fantasy;
using NBC;
using NBF.Fishing2;
using NBF.Utils;
using Log = NBC.Log;
namespace NBF
{
public partial class BagSlotItem : GButton
{
public int Index { get; private set; }
public Action<int, long> OnChangeSlot;
private void OnInited()
{
onDrop.Add(OnDrop);
BtnRemove.onClick.Set(OnRemove);
onClick.Add(OnClick);
}
private void OnClick()
{
if (showType.selectedIndex == 0)
{
// Notices.Info("拖拽放入");
}
}
private void OnRemove(EventContext context)
{
context.PreventDefault();
context.StopPropagation();
OnChangeSlot?.Invoke(Index, 0);
}
private void OnDrop(EventContext context)
{
var obj = context.initiator;
if (obj is BagItem bagItem)
{
Log.Info($"放下了:{bagItem.ItemInfo.Id}");
OnChangeSlot?.Invoke(Index, bagItem.ItemInfo.Id);
}
}
public void SetData(int index, ItemInfo itemInfo = null)
{
Index = index;
TextIndex.text = (index + 1).ToString();
if (itemInfo != null)
{
showType.selectedIndex = 1;
icon = itemInfo.ConfigId.GetIcon();
if (itemInfo.Count > 1)
{
TextCount.text = itemInfo.Count.ToString();
}
else
{
TextCount.text = string.Empty;
}
Quality.SetQuality(itemInfo.Config.Quality);
}
else
{
showType.selectedIndex = 0;
TextCount.text = string.Empty;
icon = string.Empty;
}
}
}
}

View File

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

View File

@@ -0,0 +1,38 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址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 BagSlotPanel
{
public GObject this[string aKey] => ContentPane.GetChild(aKey);
public override string UIPackName => "Main";
public override string UIResName => "BagSlotPanel";
[AutoFind(Name = "back")]
public GLabel back;
[AutoFind(Name = "SlotTitle")]
public GComponent SlotTitle;
[AutoFind(Name = "List")]
public ClassifyList List;
[AutoFind(Name = "SlotList")]
public GList SlotList;
[AutoFind(Name = "SlotSeparator")]
public GImage SlotSeparator;
[AutoFind(Name = "Test")]
public GLoader Test;
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ UI.Inst.OpenUI<BagSlotPanel>(param); }
public static void Hide(){ UI.Inst.HideUI<BagSlotPanel>(); }
public static void Del(){ UI.Inst.DestroyUI<BagSlotPanel>(); }
}
}

View File

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

View File

@@ -0,0 +1,120 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using System.Collections.Generic;
using FairyGUI;
using Fantasy;
using UnityEngine;
using NBC;
using NBF.Fishing2;
using UIPanel = NBC.UIPanel;
namespace NBF
{
public partial class BagSlotPanel : UIPanel
{
private List<ItemInfo> _items = new List<ItemInfo>();
protected override void OnInit()
{
SlotList.onClickItem.Add(OnClickSlotItem);
}
protected override void OnShow()
{
SetList();
SetSlotList();
}
#region
private void SetList()
{
_items.Clear();
foreach (var roleBagItem in RoleModel.Instance.Items)
{
if (CanShow(roleBagItem))
{
_items.Add(roleBagItem);
}
}
List<object> items = RoleModel.Instance.GetItemListData();
List.SetListData(items);
var children = List.List.GetChildren();
foreach (var gObject in children)
{
gObject.draggable = true;
}
}
// void OnRenderItem(int index, GObject obj)
// {
// var itemData = _items[index];
// if (obj is BagItem bagItem)
// {
// bagItem.SetData(itemData);
// bagItem.draggable = true;
// }
// }
#endregion
#region
private int _lastSelectedItem;
private void SetSlotList()
{
SlotList.RemoveChildrenToPool();
for (int index = 0; index < 7; index++)
{
if (SlotList.AddItemFromPool() is BagSlotItem slotItem)
{
slotItem.SetData(index, RoleModel.Instance.GetSlotItem(index));
slotItem.OnChangeSlot = OnChangeSlotItem;
}
}
}
private void OnChangeSlotItem(int index, long id)
{
RoleModel.Instance.SetSlot(index, id).OnCompleted(OnChangeSlotItemDone);
}
private void OnChangeSlotItemDone()
{
SetSlotList();
// SlotList.RefreshVirtualList();
}
private void OnClickSlotItem(EventContext context)
{
if (context.data is BagSlotItem bagSlotItem)
{
_lastSelectedItem = bagSlotItem.Index;
BagSelectPanel.Show(SelectCallback, ItemType.Rod, ItemType.Bobber, ItemType.Reel, ItemType.Bait,
ItemType.Hook, ItemType.Line, ItemType.Lure);
}
}
private void SelectCallback(long selectId)
{
if (selectId < 1) return;
RoleModel.Instance.SetSlot(_lastSelectedItem, selectId).OnCompleted(OnChangeSlotItemDone);
}
#endregion
private bool CanShow(ItemInfo itemInfo)
{
if (itemInfo.ItemType == ItemType.Rod)
{
return true;
}
return false;
}
}
}

View File

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

View 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 ItemBasicInfoTag
{
public const string URL = "ui://hxr7rc7pnzfp1p";
public GTextField TextTitle;
public GTextField TextDesc;
public GTextField TextContent;
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
TextTitle = (GTextField)GetChild("TextTitle");
TextDesc = (GTextField)GetChild("TextDesc");
TextContent = (GTextField)GetChild("TextContent");
OnInited();
UILanguage.TrySetComponentLanguage(this);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 64ece59eb75f6874b8956a0b1073c8f7

View File

@@ -0,0 +1,25 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using UnityEngine;
using FairyGUI;
using Fantasy;
using NBC;
using NBF.Utils;
namespace NBF
{
public partial class ItemBasicInfoTag : GComponent
{
private void OnInited()
{
}
public void SetInfo(ItemInfo itemInfo)
{
var itemConfig = Game.Tables.TbItem.Get((int)itemInfo.ConfigId);
TextTitle.text = itemInfo.ConfigId.GetName();
TextContent.text = itemInfo.ConfigId.GetDesc();
TextTitle.SetQuality(itemInfo.Config.Quality);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 62624753a7f37ea4c93a816a7ebac8e3

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 ItemDetailsContent
{
public const string URL = "ui://hxr7rc7pnzfp1o";
public ItemBasicInfoTag Basic;
public ItemGearInfoTag Gear;
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
Basic = (ItemBasicInfoTag)GetChild("Basic");
Gear = (ItemGearInfoTag)GetChild("Gear");
OnInited();
UILanguage.TrySetComponentLanguage(this);
}
}
}

View File

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

View File

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

View File

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

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 ItemDetailsPanel
{
public GObject this[string aKey] => ContentPane.GetChild(aKey);
public override string UIPackName => "Main";
public override string UIResName => "ItemDetailsPanel";
[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 ItemDetailsContent Content;
[AutoFind(Name = "Quality")]
public GImage Quality;
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
public static void Show(object param = null){ UI.Inst.OpenUI<ItemDetailsPanel>(param); }
public static void Hide(){ UI.Inst.HideUI<ItemDetailsPanel>(); }
public static void Del(){ UI.Inst.DestroyUI<ItemDetailsPanel>(); }
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 06f28badaa5d4c04e9d0cdfd853a5d28

View File

@@ -0,0 +1,124 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using Fantasy;
using UnityEngine;
using NBC;
using NBF.Fishing2;
namespace NBF
{
public partial class ItemDetailsPanel : UIPanel
{
public ItemInfo ItemInfo;
// public
protected override void OnInit()
{
base.OnInit();
}
protected override void OnShow()
{
InputManager.Instance.On(this);
ItemInfo = GetData() as ItemInfo;
if (ItemInfo == null || ItemInfo.Config == null)
{
Hide();
return;
}
Quality.SetQuality(ItemInfo.Config.Quality);
Content.Gear.visible = true;
Content.Basic.SetInfo(ItemInfo);
Content.Gear.SetInfo(ItemInfo);
// var model = PrefabsHelper.CreatePrefab(ItemInfo.Config.Model);
Model.SetData(ItemInfo);
// Model.SetBackground(Back);
}
#region UI事件
//
// [InputInvoke(InputDef.UI.Prev, UIInputButtonShowMode.MenuLeft)]
// private void OnPrev()
// {
// ItemList.Menu.OnClickBtnPrev();
// }
//
// [InputInvoke(InputDef.UI.Next, UIInputButtonShowMode.MenuRight)]
// private void OnNext()
// {
// ItemList.Menu.OnClickBtnNext();
// }
//
// [InputInvoke(InputDef.UI.Left, UIInputButtonShowMode.BottomLeft)]
// private void OnLeft()
// {
// ItemList.List.Selector.Left();
// }
//
// [InputInvoke(InputDef.UI.Right, UIInputButtonShowMode.BottomLeft)]
// private void OnRight()
// {
// ItemList.List.Selector.Right();
// }
//
// [InputInvoke(InputDef.UI.Up, UIInputButtonShowMode.BottomLeft)]
// private void OnUp()
// {
// ItemList.List.Selector.Up();
// // ChangeListSelected();
// }
//
// [InputInvoke(InputDef.UI.Down, UIInputButtonShowMode.BottomLeft)]
// private void OnDown()
// {
// ItemList.List.Selector.Down();
// }
//
// [InputInvoke(InputDef.UI.Enter, UIInputButtonShowMode.BottomLeft, "查看")]
// private void OnApplySettings()
// {
// var selectedItem = ItemList.List.Selector.SelectedItem;
// if (selectedItem != null)
// {
// ItemList.List.InvokeClickItem(selectedItem);
// }
// }
[InputInvoke(InputDef.UI.Back, UIInputButtonShowMode.BottomRight)]
private void OnBack()
{
Hide();
}
#endregion
// 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)
// {
// }
// }
protected override void OnHide()
{
InputManager.Instance.Off(this);
Model.UnloadModel();
}
}
}

View File

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

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

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 6210f89fdfdedcf43ad112aee8624548

View File

@@ -0,0 +1,111 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using System.Collections.Generic;
using UnityEngine;
using FairyGUI;
using Fantasy;
using Fantasy.Async;
using NBC;
using NBF.Fishing2;
using NBF.Utils;
using Log = NBC.Log;
namespace NBF
{
public partial class ItemGearInfoTag : GComponent
{
public ItemInfo Info { get; private set; }
// private RoleBag _bag;
private List<ItemInfo> _bindItems;
private void OnInited()
{
List.onClickItem.Add(OnClickItem);
}
#region
private HashSet<long> _usedItems = new HashSet<long>();
public void SetInfo(ItemInfo itemInfo)
{
_usedItems.Clear();
Info = itemInfo;
_bindItems = RoleModel.Instance.GetBindItems(Info.Id);
var types = itemInfo.GetBindConfig();
List.RemoveChildrenToPool();
if (types != null)
{
foreach (var bindData in types.Binds)
{
var item = List.AddItemFromPool() as BagGearItem;
SetItemData(item, bindData);
}
List.AutoHeight();
this.height = List.height + List.y + 10;
parent.scrollPane.touchEffect = height + y > parent.height;
parent.scrollPane.ScrollTop();
}
if (types == null || types.Binds.Count < 1)
{
visible = false;
}
}
private void SetItemData(BagGearItem item, ItemBindData bindData)
{
ItemInfo bind = null;
if (_bindItems != null && _bindItems.Count > 0)
{
bind = _bindItems.Find(t => t.ItemType == bindData.Type && !_usedItems.Contains(t.Id));
}
if (bind != null)
{
_usedItems.Add(bind.Id);
}
if (item != null)
{
item.OnCloseAction = CloseCallback;
item.SetData(Info, bindData, bind);
}
}
#endregion
#region
private BagGearItem _lastSelectedItem;
private void SelectCallback(long selectId)
{
if (_lastSelectedItem == null) return;
Log.Info($"选中id={selectId}");
RoleModel.Instance.AddRig(Info.Id, selectId, _lastSelectedItem.RigId).OnCompleted(ChangeInfo);
}
private void CloseCallback(long id, long removeId)
{
RoleModel.Instance.RemoveRig(Info.Id, removeId).OnCompleted(ChangeInfo);
}
private void ChangeInfo()
{
Log.Info("刷新安装的配件");
SetInfo(Info);
}
private void OnClickItem(EventContext context)
{
if (context.data is not BagGearItem item) return;
_lastSelectedItem = item;
BagSelectPanel.Show(SelectCallback, item.BindData.Type);
}
#endregion
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 32b242aeba14ccf4e8daab2f502128e3