修改配件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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user