修改配件item

This commit is contained in:
Bob.Song
2025-10-31 18:03:31 +08:00
parent e0b9d6cd91
commit b2cf8cdb88
92 changed files with 225 additions and 112 deletions

View File

@@ -7,7 +7,7 @@ using NBC;
namespace NBF
{
public partial class GearItem
public partial class BagGearItem
{
public const string URL = "ui://hxr7rc7pnzfp1n";

View File

@@ -0,0 +1,24 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using UnityEngine;
using FairyGUI;
using NBC;
namespace NBF
{
public partial class BagGearItem : GButton
{
private void OnInited()
{
}
/// <summary>
/// 设置数据
/// </summary>
/// <param name="item">主物体</param>
/// <param name="gearItemType">可以装配的配件</param>
public void SetData(ItemInfo item, ItemType gearItemType)
{
}
}
}

View File

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

View File

@@ -19,11 +19,17 @@ namespace NBF
protected override void OnShow()
{
ItemInfo = GetData() as ItemInfo;
if (ItemInfo == null || ItemInfo.Config == null)
{
Hide();
return;
}
Quality.SetQuality(ItemInfo.Config.Quality);
Content.Gear.visible = false;
Content.Basic.SetInfo(ItemInfo);
Content.Basic.SetInfo(ItemInfo);
Content.Gear.SetInfo(ItemInfo);
// var model = PrefabsHelper.CreatePrefab(ItemInfo.Config.Model);
Model.SetData(ItemInfo.Config);

View File

@@ -1,19 +1,79 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using System.Collections.Generic;
using UnityEngine;
using FairyGUI;
using NBC;
using NBF.Utils;
namespace NBF
{
public partial class ItemGearInfoTag : GComponent
{
public ItemInfo Info { get; private set; }
private void OnInited()
{
}
public void SetInfo(ItemInfo itemInfo)
{
Info = itemInfo;
var types = GetItemGearTypes();
List.RemoveChildrenToPool();
foreach (var itemType in types)
{
var item = List.AddItemFromPool() as BagGearItem;
item?.SetData(itemInfo, itemType);
}
List.AutoHeight();
this.height = List.height + List.y + 10;
parent.scrollPane.touchEffect = height + y > parent.height;
parent.scrollPane.ScrollTop();
if (types.Count < 1)
{
visible = false;
}
}
private List<ItemType> GetItemGearTypes()
{
List<ItemType> types = new List<ItemType>();
var itemType = Info.ItemType;
if (itemType == ItemType.Rod)
{
var subType = (RodType)Info.ItemSubType;
if (subType == RodType.Tele)
{
types.Add(ItemType.Line);
types.Add(ItemType.Bobber);
types.Add(ItemType.Weight);
types.Add(ItemType.Hook);
}
else if (subType == RodType.Spine)
{
types.Add(ItemType.Line);
types.Add(ItemType.Weight);
types.Add(ItemType.Lure);
}
else if (subType == RodType.Bolo)
{
types.Add(ItemType.Line);
types.Add(ItemType.Weight);
types.Add(ItemType.Lure);
}
}
else if (itemType == ItemType.Lure)
{
types.Add(ItemType.Hook);
types.Add(ItemType.Hook);
}
// Info.Config;
return types;
}
}
}