完成交互逻辑
This commit is contained in:
19
Assets/Scripts/Attributes.cs
Normal file
19
Assets/Scripts/Attributes.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = true, AllowMultiple = true)]
|
||||
public class ShowIconAttribute : PropertyAttribute
|
||||
{
|
||||
public readonly string icon;
|
||||
public ShowIconAttribute(string icon) => this.icon = icon;
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = true, AllowMultiple = true)]
|
||||
public class OpCountAttribute : PropertyAttribute
|
||||
{
|
||||
public readonly int count;
|
||||
public OpCountAttribute(int count) => this.count = count;
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Attributes.cs.meta
Normal file
3
Assets/Scripts/Attributes.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 772c563e061446c18c624311c27ba9a3
|
||||
timeCreated: 1747666608
|
||||
@@ -1,8 +1,147 @@
|
||||
namespace NBF
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class InteractiveData
|
||||
{
|
||||
public UIDef.InteractiveType Type;
|
||||
public string Icon = "op-door";
|
||||
public string Name;
|
||||
public string Use1;
|
||||
public string Use2;
|
||||
public string Use1Title = "进入";
|
||||
public string Use2Title;
|
||||
}
|
||||
|
||||
public class GameDef
|
||||
{
|
||||
public const int NormalFOV = 50;
|
||||
public const int ZoomedFOV = 25;
|
||||
|
||||
public static List<InteractiveData> InteractiveDataList = new List<InteractiveData>()
|
||||
{
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.Boat,
|
||||
Name = "船",
|
||||
Icon = "op-boat",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "上船"
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.Bank,
|
||||
Name = "银行",
|
||||
Icon = "op-bank",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "进入"
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.Canteen,
|
||||
Name = "餐厅",
|
||||
Icon = "op-door",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "热饭"
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.Oven,
|
||||
Name = "烤箱",
|
||||
Icon = "op-use",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "使用"
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.Tent,
|
||||
Name = "帐篷",
|
||||
Icon = "op-tent",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "打开"
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.Drying,
|
||||
Name = "晾干器",
|
||||
Icon = "op-use",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "使用"
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.Bonfire,
|
||||
Name = "篝火",
|
||||
Icon = "op-fire",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "使用"
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.Fumigate,
|
||||
Name = "烟熏箱",
|
||||
Icon = "op-use",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "使用"
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.FoodShop,
|
||||
Name = "食品商店",
|
||||
Icon = "op-door",
|
||||
Use1 = "1,1",
|
||||
Use2 = "1,1",
|
||||
Use1Title = "进入",
|
||||
Use2Title = "退货"
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.FishingShop,
|
||||
Name = "钓鱼商店",
|
||||
Icon = "op-door",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "进入",
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.ToolsShop,
|
||||
Name = "工业品店",
|
||||
Icon = "op-door",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "进入",
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.VendingMachine,
|
||||
Name = "自动贩卖机",
|
||||
Icon = "op-use",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "进入",
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.Wharf,
|
||||
Name = "码头",
|
||||
Icon = "op-use",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "进入",
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.FishBazaar,
|
||||
Name = "鱼市",
|
||||
Icon = "op-use",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "进入",
|
||||
},
|
||||
new InteractiveData()
|
||||
{
|
||||
Type = UIDef.InteractiveType.ReserveBazaar,
|
||||
Name = "订购市场",
|
||||
Icon = "op-use",
|
||||
Use1 = "1,1",
|
||||
Use1Title = "进入",
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace NBF
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class UIDef
|
||||
{
|
||||
@@ -50,5 +52,38 @@
|
||||
/// </summary>
|
||||
public const int Max = 3100;
|
||||
}
|
||||
|
||||
public enum InteractiveType
|
||||
{
|
||||
[InspectorName("船")] Boat = 1,
|
||||
|
||||
[InspectorName("银行")] Bank = 2,
|
||||
|
||||
[InspectorName("餐厅")] Canteen = 3,
|
||||
|
||||
[InspectorName("烤箱")] Oven = 4,
|
||||
|
||||
[InspectorName("帐篷")] Tent = 5,
|
||||
|
||||
[InspectorName("晾干器")] Drying = 6,
|
||||
|
||||
[InspectorName("篝火")] Bonfire = 7,
|
||||
|
||||
[InspectorName("烟熏箱")] Fumigate = 8,
|
||||
|
||||
[InspectorName("食品商店")] FoodShop = 11,
|
||||
|
||||
[InspectorName("钓鱼商店")] FishingShop = 12,
|
||||
|
||||
[InspectorName("工业品店")] ToolsShop = 13,
|
||||
|
||||
[InspectorName("自动贩卖机")] VendingMachine = 14,
|
||||
|
||||
[InspectorName("码头")] Wharf = 15,
|
||||
|
||||
[InspectorName("鱼市")] FishBazaar = 21,
|
||||
|
||||
[InspectorName("订购市场")] ReserveBazaar = 22
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,8 @@ namespace NBF
|
||||
|
||||
public static event Action<bool> OnOp1Action;
|
||||
public static event Action<bool> OnOp2Action;
|
||||
public static event Action<bool> OnUseAction;
|
||||
public static event Action OnUseAction;
|
||||
public static event Action OnUse2Action;
|
||||
public static event Action<bool> OnSelectItemAction;
|
||||
public static event Action<bool> OnSelectBaitAction;
|
||||
public static event Action<bool> OnSelectFoodAction;
|
||||
@@ -148,6 +149,8 @@ namespace NBF
|
||||
PlayerInputControl.Normal.Op2.canceled += OnOp2;
|
||||
PlayerInputControl.Normal.Use.performed += OnUse;
|
||||
PlayerInputControl.Normal.Use.canceled += OnUse;
|
||||
PlayerInputControl.Normal.Use2.performed += OnUse2;
|
||||
PlayerInputControl.Normal.Use2.canceled += OnUse2;
|
||||
|
||||
PlayerInputControl.Normal.SelectItem.performed += OnSelectItem;
|
||||
PlayerInputControl.Normal.SelectItem.canceled += OnSelectItem;
|
||||
@@ -221,6 +224,8 @@ namespace NBF
|
||||
PlayerInputControl.Normal.Op2.canceled -= OnOp2;
|
||||
PlayerInputControl.Normal.Use.performed -= OnUse;
|
||||
PlayerInputControl.Normal.Use.canceled -= OnUse;
|
||||
PlayerInputControl.Normal.Use2.performed -= OnUse2;
|
||||
PlayerInputControl.Normal.Use2.canceled -= OnUse2;
|
||||
|
||||
PlayerInputControl.Normal.SelectItem.performed -= OnSelectItem;
|
||||
PlayerInputControl.Normal.SelectItem.canceled -= OnSelectItem;
|
||||
@@ -311,7 +316,18 @@ namespace NBF
|
||||
|
||||
private void OnUse(InputAction.CallbackContext context)
|
||||
{
|
||||
OnUseAction?.Invoke(context.performed);
|
||||
if (context.performed)
|
||||
{
|
||||
OnUseAction?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnUse2(InputAction.CallbackContext context)
|
||||
{
|
||||
if (context.performed)
|
||||
{
|
||||
OnUse2Action?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSelectItem(InputAction.CallbackContext context)
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class InteractiveObject : MonoBehaviour
|
||||
{
|
||||
[Header("交互类型")] public UIDef.InteractiveType Type;
|
||||
}
|
||||
}
|
||||
@@ -165,6 +165,15 @@ namespace NBF
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""Use2"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""45a833e1-2aaf-4907-ae1e-1d97ee260b18"",
|
||||
""expectedControlType"": """",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""SelectItem"",
|
||||
""type"": ""Button"",
|
||||
@@ -407,15 +416,6 @@ namespace NBF
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""ReUse"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""45a833e1-2aaf-4907-ae1e-1d97ee260b18"",
|
||||
""expectedControlType"": """",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
@@ -998,7 +998,7 @@ namespace NBF
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""ReUse"",
|
||||
""action"": ""Use2"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
@@ -1106,6 +1106,7 @@ namespace NBF
|
||||
m_Normal_Op1 = m_Normal.FindAction("Op1", throwIfNotFound: true);
|
||||
m_Normal_Op2 = m_Normal.FindAction("Op2", throwIfNotFound: true);
|
||||
m_Normal_Use = m_Normal.FindAction("Use", throwIfNotFound: true);
|
||||
m_Normal_Use2 = m_Normal.FindAction("Use2", throwIfNotFound: true);
|
||||
m_Normal_SelectItem = m_Normal.FindAction("SelectItem", throwIfNotFound: true);
|
||||
m_Normal_SelectBait = m_Normal.FindAction("SelectBait", throwIfNotFound: true);
|
||||
m_Normal_SelectFood = m_Normal.FindAction("SelectFood", throwIfNotFound: true);
|
||||
@@ -1133,7 +1134,6 @@ namespace NBF
|
||||
m_Normal_Quick8 = m_Normal.FindAction("Quick8", throwIfNotFound: true);
|
||||
m_Normal_Quick9 = m_Normal.FindAction("Quick9", throwIfNotFound: true);
|
||||
m_Normal_Back = m_Normal.FindAction("Back", throwIfNotFound: true);
|
||||
m_Normal_ReUse = m_Normal.FindAction("ReUse", throwIfNotFound: true);
|
||||
// UI
|
||||
m_UI = asset.FindActionMap("UI", throwIfNotFound: true);
|
||||
m_UI_Roll = m_UI.FindAction("Roll", throwIfNotFound: true);
|
||||
@@ -1226,6 +1226,7 @@ namespace NBF
|
||||
private readonly InputAction m_Normal_Op1;
|
||||
private readonly InputAction m_Normal_Op2;
|
||||
private readonly InputAction m_Normal_Use;
|
||||
private readonly InputAction m_Normal_Use2;
|
||||
private readonly InputAction m_Normal_SelectItem;
|
||||
private readonly InputAction m_Normal_SelectBait;
|
||||
private readonly InputAction m_Normal_SelectFood;
|
||||
@@ -1253,7 +1254,6 @@ namespace NBF
|
||||
private readonly InputAction m_Normal_Quick8;
|
||||
private readonly InputAction m_Normal_Quick9;
|
||||
private readonly InputAction m_Normal_Back;
|
||||
private readonly InputAction m_Normal_ReUse;
|
||||
/// <summary>
|
||||
/// Provides access to input actions defined in input action map "Normal".
|
||||
/// </summary>
|
||||
@@ -1298,6 +1298,10 @@ namespace NBF
|
||||
/// </summary>
|
||||
public InputAction @Use => m_Wrapper.m_Normal_Use;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Normal/Use2".
|
||||
/// </summary>
|
||||
public InputAction @Use2 => m_Wrapper.m_Normal_Use2;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Normal/SelectItem".
|
||||
/// </summary>
|
||||
public InputAction @SelectItem => m_Wrapper.m_Normal_SelectItem;
|
||||
@@ -1406,10 +1410,6 @@ namespace NBF
|
||||
/// </summary>
|
||||
public InputAction @Back => m_Wrapper.m_Normal_Back;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Normal/ReUse".
|
||||
/// </summary>
|
||||
public InputAction @ReUse => m_Wrapper.m_Normal_ReUse;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action map instance.
|
||||
/// </summary>
|
||||
public InputActionMap Get() { return m_Wrapper.m_Normal; }
|
||||
@@ -1459,6 +1459,9 @@ namespace NBF
|
||||
@Use.started += instance.OnUse;
|
||||
@Use.performed += instance.OnUse;
|
||||
@Use.canceled += instance.OnUse;
|
||||
@Use2.started += instance.OnUse2;
|
||||
@Use2.performed += instance.OnUse2;
|
||||
@Use2.canceled += instance.OnUse2;
|
||||
@SelectItem.started += instance.OnSelectItem;
|
||||
@SelectItem.performed += instance.OnSelectItem;
|
||||
@SelectItem.canceled += instance.OnSelectItem;
|
||||
@@ -1540,9 +1543,6 @@ namespace NBF
|
||||
@Back.started += instance.OnBack;
|
||||
@Back.performed += instance.OnBack;
|
||||
@Back.canceled += instance.OnBack;
|
||||
@ReUse.started += instance.OnReUse;
|
||||
@ReUse.performed += instance.OnReUse;
|
||||
@ReUse.canceled += instance.OnReUse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1578,6 +1578,9 @@ namespace NBF
|
||||
@Use.started -= instance.OnUse;
|
||||
@Use.performed -= instance.OnUse;
|
||||
@Use.canceled -= instance.OnUse;
|
||||
@Use2.started -= instance.OnUse2;
|
||||
@Use2.performed -= instance.OnUse2;
|
||||
@Use2.canceled -= instance.OnUse2;
|
||||
@SelectItem.started -= instance.OnSelectItem;
|
||||
@SelectItem.performed -= instance.OnSelectItem;
|
||||
@SelectItem.canceled -= instance.OnSelectItem;
|
||||
@@ -1659,9 +1662,6 @@ namespace NBF
|
||||
@Back.started -= instance.OnBack;
|
||||
@Back.performed -= instance.OnBack;
|
||||
@Back.canceled -= instance.OnBack;
|
||||
@ReUse.started -= instance.OnReUse;
|
||||
@ReUse.performed -= instance.OnReUse;
|
||||
@ReUse.canceled -= instance.OnReUse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1920,6 +1920,13 @@ namespace NBF
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnUse(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Use2" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnUse2(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "SelectItem" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
@@ -2108,13 +2115,6 @@ namespace NBF
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnBack(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "ReUse" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnReUse(InputAction.CallbackContext context);
|
||||
}
|
||||
/// <summary>
|
||||
/// Interface to implement callback methods for all input action callbacks associated with input actions defined by "UI" which allows adding and removing callbacks.
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace NBF
|
||||
{
|
||||
public static void BindAll()
|
||||
{
|
||||
UIObjectFactory.SetPackageItemExtension(FishingStateInfo.URL, typeof(FishingStateInfo));
|
||||
UIObjectFactory.SetPackageItemExtension(InteractiveTag.URL, typeof(InteractiveTag));
|
||||
UIObjectFactory.SetPackageItemExtension(FishingPower.URL, typeof(FishingPower));
|
||||
UIObjectFactory.SetPackageItemExtension(WeatherInfo.URL, typeof(WeatherInfo));
|
||||
}
|
||||
|
||||
@@ -13,12 +13,18 @@ namespace NBF
|
||||
public GObject this[string aKey] => ContentPane.GetChild(aKey);
|
||||
[AutoFind(Name = "throwCtrl")]
|
||||
public Controller throwCtrl;
|
||||
[AutoFind(Name = "fishingState")]
|
||||
public Controller fishingState;
|
||||
[AutoFind(Name = "ThrowProgress")]
|
||||
public GProgressBar ThrowProgress;
|
||||
[AutoFind(Name = "TextFPS")]
|
||||
public GTextField TextFPS;
|
||||
[AutoFind(Name = "TextTime")]
|
||||
public WeatherInfo TextTime;
|
||||
[AutoFind(Name = "FishingState")]
|
||||
public FishingStateInfo FishingState;
|
||||
[AutoFind(Name = "Interactive")]
|
||||
public InteractiveTag Interactive;
|
||||
public override string[] GetDependPackages(){ return new string[] {}; }
|
||||
|
||||
|
||||
|
||||
@@ -11,14 +11,12 @@ namespace NBF
|
||||
public override string UIPackName => "Fishing";
|
||||
public override string UIResName => "FishingPanel";
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
base.OnInit();
|
||||
}
|
||||
|
||||
protected override void OnShow()
|
||||
{
|
||||
base.OnShow();
|
||||
InputManager.OnInteractiveObjectAction += OnInteractiveObjectAction;
|
||||
InputManager.OnUseAction += OnUseAction;
|
||||
InputManager.OnUse2Action += OnUse2Action;
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
@@ -27,14 +25,41 @@ namespace NBF
|
||||
TextFPS.text = SceneSettings.Instance.FPS.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
private void OnInteractiveObjectAction(InteractiveObject interactiveObject)
|
||||
{
|
||||
if (interactiveObject != null)
|
||||
{
|
||||
Interactive.visible = true;
|
||||
Interactive.SetData(interactiveObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
Interactive.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnUseAction()
|
||||
{
|
||||
if (Interactive.visible)
|
||||
{
|
||||
Interactive.Use1();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnUse2Action()
|
||||
{
|
||||
if (Interactive.visible)
|
||||
{
|
||||
Interactive.Use2();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
base.OnHide();
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
InputManager.OnInteractiveObjectAction -= OnInteractiveObjectAction;
|
||||
InputManager.OnUseAction -= OnUseAction;
|
||||
InputManager.OnUse2Action -= OnUse2Action;
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Assets/Scripts/UI/Fishing/InteractiveTag.Designer.cs
generated
Normal file
25
Assets/Scripts/UI/Fishing/InteractiveTag.Designer.cs
generated
Normal file
@@ -0,0 +1,25 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class InteractiveTag
|
||||
{
|
||||
public const string URL = "ui://682kb9n0fcfg1p";
|
||||
|
||||
public GList List;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
List = (GList)GetChild("List");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d866f9f28bbd2d46a69e9b1bd2e9fa8
|
||||
58
Assets/Scripts/UI/Fishing/InteractiveTag.cs
Normal file
58
Assets/Scripts/UI/Fishing/InteractiveTag.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class InteractiveTag : GLabel
|
||||
{
|
||||
private InteractiveObject _interactiveObject;
|
||||
private InteractiveData _interactiveData;
|
||||
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
|
||||
public void SetData(InteractiveObject interactiveObject)
|
||||
{
|
||||
_interactiveObject = interactiveObject;
|
||||
|
||||
List.RemoveChildrenToPool();
|
||||
var interactiveType = GameDef.InteractiveDataList.Find(t => t.Type == interactiveObject.Type);
|
||||
if (interactiveType != null)
|
||||
{
|
||||
_interactiveData = interactiveType;
|
||||
if (!string.IsNullOrEmpty(interactiveType.Use1))
|
||||
{
|
||||
var item1 = List.AddItemFromPool().asLabel;
|
||||
item1.title = "E - " + interactiveType.Use1Title;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(interactiveType.Use2))
|
||||
{
|
||||
var item2 = List.AddItemFromPool().asLabel;
|
||||
item2.title = "Y - " + interactiveType.Use2Title;
|
||||
}
|
||||
|
||||
var iconUrl = UIPackage.GetItemURL("Common", interactiveType.Icon);
|
||||
icon = iconUrl;
|
||||
|
||||
title = interactiveType.Name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Use1()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_interactiveData.Use1)) return;
|
||||
}
|
||||
|
||||
public void Use2()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_interactiveData.Use2)) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Fishing/InteractiveTag.cs.meta
Normal file
2
Assets/Scripts/UI/Fishing/InteractiveTag.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 04d94697f36267345bce12ab05cbb3d2
|
||||
27
Assets/Scripts/UI/FishingStateInfo.Designer.cs
generated
Normal file
27
Assets/Scripts/UI/FishingStateInfo.Designer.cs
generated
Normal 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 FishingStateInfo
|
||||
{
|
||||
public const string URL = "ui://682kb9n0fcfg1o";
|
||||
|
||||
public FishingPower Power;
|
||||
public GTextField TextTitle;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
Power = (FishingPower)GetChild("Power");
|
||||
TextTitle = (GTextField)GetChild("TextTitle");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/FishingStateInfo.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/FishingStateInfo.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dde0fb0491131de41919399c219e6cd8
|
||||
15
Assets/Scripts/UI/FishingStateInfo.cs
Normal file
15
Assets/Scripts/UI/FishingStateInfo.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class FishingStateInfo : GLabel
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/FishingStateInfo.cs.meta
Normal file
2
Assets/Scripts/UI/FishingStateInfo.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c0786297b4fc9843a13ad5b5260936d
|
||||
Reference in New Issue
Block a user