修改配件item
This commit is contained in:
@@ -7,7 +7,7 @@ using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class GearItem
|
||||
public partial class BagGearItem
|
||||
{
|
||||
public const string URL = "ui://hxr7rc7pnzfp1n";
|
||||
|
||||
24
Assets/Scripts/UI/Bag/BagGearItem.cs
Normal file
24
Assets/Scripts/UI/Bag/BagGearItem.cs
Normal 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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class GearItem : GButton
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,10 +19,11 @@ namespace NBF
|
||||
UIObjectFactory.SetPackageItemExtension(HomeStatisticsPage.URL, typeof(HomeStatisticsPage));
|
||||
UIObjectFactory.SetPackageItemExtension(HomeButtonGroups.URL, typeof(HomeButtonGroups));
|
||||
UIObjectFactory.SetPackageItemExtension(ChatItem.URL, typeof(ChatItem));
|
||||
UIObjectFactory.SetPackageItemExtension(GearItem.URL, typeof(GearItem));
|
||||
UIObjectFactory.SetPackageItemExtension(BagGearItem.URL, typeof(BagGearItem));
|
||||
UIObjectFactory.SetPackageItemExtension(ItemDetailsContent.URL, typeof(ItemDetailsContent));
|
||||
UIObjectFactory.SetPackageItemExtension(ItemBasicInfoTag.URL, typeof(ItemBasicInfoTag));
|
||||
UIObjectFactory.SetPackageItemExtension(ItemGearInfoTag.URL, typeof(ItemGearInfoTag));
|
||||
UIObjectFactory.SetPackageItemExtension(ShopGearItem.URL, typeof(ShopGearItem));
|
||||
UIObjectFactory.SetPackageItemExtension(BagItem.URL, typeof(BagItem));
|
||||
}
|
||||
}
|
||||
|
||||
20
Assets/Scripts/UI/Common/Extensions/GListExtensions.cs
Normal file
20
Assets/Scripts/UI/Common/Extensions/GListExtensions.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using FairyGUI;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public static class GListExtensions
|
||||
{
|
||||
public static void AutoHeight(this GList list)
|
||||
{
|
||||
if (list.numItems < 1)
|
||||
{
|
||||
list.height = 100;
|
||||
return;
|
||||
}
|
||||
|
||||
var item = list.GetChildAt(0);
|
||||
var listHeight = list.numItems * item.height + list.lineGap * list.numItems;
|
||||
list.height = listHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5bb71cdaee584b00a50ea53c6023ea79
|
||||
timeCreated: 1761876194
|
||||
@@ -11,7 +11,7 @@ namespace NBF
|
||||
public partial class FishingShopPanel
|
||||
{
|
||||
public GObject this[string aKey] => ContentPane.GetChild(aKey);
|
||||
public override string UIPackName => "Shop";
|
||||
public override string UIPackName => "Main";
|
||||
public override string UIResName => "FishingShopPanel";
|
||||
|
||||
[AutoFind(Name = "Currencys")]
|
||||
|
||||
2
Assets/Scripts/UI/Shops/ShopGearItem.Designer.cs
generated
2
Assets/Scripts/UI/Shops/ShopGearItem.Designer.cs
generated
@@ -9,7 +9,7 @@ namespace NBF
|
||||
{
|
||||
public partial class ShopGearItem
|
||||
{
|
||||
public const string URL = "ui://146ra2lqoome9";
|
||||
public const string URL = "ui://hxr7rc7poome9";
|
||||
|
||||
public GImage back;
|
||||
public GImage ba;
|
||||
|
||||
Reference in New Issue
Block a user