首次提交
This commit is contained in:
3
Assets/Scripts/UI/Bag.meta
Normal file
3
Assets/Scripts/UI/Bag.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5592fb43d74d441cad5b1867e7e5b373
|
||||
timeCreated: 1748922642
|
||||
35
Assets/Scripts/UI/Bag/BagGearItem.Designer.cs
generated
Normal file
35
Assets/Scripts/UI/Bag/BagGearItem.Designer.cs
generated
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/BagGearItem.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/BagGearItem.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3958da30a5539fd40bf58bf9f7af003f
|
||||
61
Assets/Scripts/UI/Bag/BagGearItem.cs
Normal file
61
Assets/Scripts/UI/Bag/BagGearItem.cs
Normal 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 ? "非必要组件" : "必要组件";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/BagGearItem.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/BagGearItem.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a5f9858996c9ba4797aa38de40bb8b7
|
||||
27
Assets/Scripts/UI/Bag/BagItem.Designer.cs
generated
Normal file
27
Assets/Scripts/UI/Bag/BagItem.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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/BagItem.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/BagItem.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3fa85a75ea9865f438ee246e23aefc66
|
||||
49
Assets/Scripts/UI/Bag/BagItem.cs
Normal file
49
Assets/Scripts/UI/Bag/BagItem.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/BagItem.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/BagItem.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23a4348047aba5743b09c9d65e404a93
|
||||
32
Assets/Scripts/UI/Bag/BagPanel.Designer.cs
generated
Normal file
32
Assets/Scripts/UI/Bag/BagPanel.Designer.cs
generated
Normal 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>(); }
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/BagPanel.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/BagPanel.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2bbe340594e28d34b914c388db26d526
|
||||
55
Assets/Scripts/UI/Bag/BagPanel.cs
Normal file
55
Assets/Scripts/UI/Bag/BagPanel.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/BagPanel.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/BagPanel.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 06f449f341e3a19438e38e1038fd25d5
|
||||
36
Assets/Scripts/UI/Bag/BagSelectPanel.Designer.cs
generated
Normal file
36
Assets/Scripts/UI/Bag/BagSelectPanel.Designer.cs
generated
Normal 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>(); }
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/BagSelectPanel.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/BagSelectPanel.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2549b4ffe371d714c8b8afe26fb555f0
|
||||
102
Assets/Scripts/UI/Bag/BagSelectPanel.cs
Normal file
102
Assets/Scripts/UI/Bag/BagSelectPanel.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/BagSelectPanel.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/BagSelectPanel.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec33fb0138e8760429c8968c8da8a997
|
||||
37
Assets/Scripts/UI/Bag/BagSlotItem.Designer.cs
generated
Normal file
37
Assets/Scripts/UI/Bag/BagSlotItem.Designer.cs
generated
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/BagSlotItem.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/BagSlotItem.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e8df720091e10e47a8068485beb5b1f
|
||||
79
Assets/Scripts/UI/Bag/BagSlotItem.cs
Normal file
79
Assets/Scripts/UI/Bag/BagSlotItem.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/BagSlotItem.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/BagSlotItem.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fbdf8a7405939fd4180c9480ff529c25
|
||||
38
Assets/Scripts/UI/Bag/BagSlotPanel.Designer.cs
generated
Normal file
38
Assets/Scripts/UI/Bag/BagSlotPanel.Designer.cs
generated
Normal 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>(); }
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/BagSlotPanel.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/BagSlotPanel.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b20e20ff411c89e42a2bf35a499a5aed
|
||||
120
Assets/Scripts/UI/Bag/BagSlotPanel.cs
Normal file
120
Assets/Scripts/UI/Bag/BagSlotPanel.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/BagSlotPanel.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/BagSlotPanel.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d010d83455eca34ab24068d41400c1d
|
||||
29
Assets/Scripts/UI/Bag/ItemBasicInfoTag.Designer.cs
generated
Normal file
29
Assets/Scripts/UI/Bag/ItemBasicInfoTag.Designer.cs
generated
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/ItemBasicInfoTag.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/ItemBasicInfoTag.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64ece59eb75f6874b8956a0b1073c8f7
|
||||
25
Assets/Scripts/UI/Bag/ItemBasicInfoTag.cs
Normal file
25
Assets/Scripts/UI/Bag/ItemBasicInfoTag.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/ItemBasicInfoTag.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/ItemBasicInfoTag.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 62624753a7f37ea4c93a816a7ebac8e3
|
||||
27
Assets/Scripts/UI/Bag/ItemDetailsContent.Designer.cs
generated
Normal file
27
Assets/Scripts/UI/Bag/ItemDetailsContent.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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0fb2c8c8c6c52d048bdad6ad20707b5d
|
||||
16
Assets/Scripts/UI/Bag/ItemDetailsContent.cs
Normal file
16
Assets/Scripts/UI/Bag/ItemDetailsContent.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class ItemDetailsContent : GComponent
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/ItemDetailsContent.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/ItemDetailsContent.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0671f09b0678a3449478f263ea01748
|
||||
40
Assets/Scripts/UI/Bag/ItemDetailsPanel.Designer.cs
generated
Normal file
40
Assets/Scripts/UI/Bag/ItemDetailsPanel.Designer.cs
generated
Normal 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>(); }
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/ItemDetailsPanel.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/ItemDetailsPanel.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 06f28badaa5d4c04e9d0cdfd853a5d28
|
||||
124
Assets/Scripts/UI/Bag/ItemDetailsPanel.cs
Normal file
124
Assets/Scripts/UI/Bag/ItemDetailsPanel.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/ItemDetailsPanel.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/ItemDetailsPanel.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f0d31d3946529c3428cf34f1c1ee7488
|
||||
29
Assets/Scripts/UI/Bag/ItemGearInfoTag.Designer.cs
generated
Normal file
29
Assets/Scripts/UI/Bag/ItemGearInfoTag.Designer.cs
generated
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/ItemGearInfoTag.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/ItemGearInfoTag.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6210f89fdfdedcf43ad112aee8624548
|
||||
111
Assets/Scripts/UI/Bag/ItemGearInfoTag.cs
Normal file
111
Assets/Scripts/UI/Bag/ItemGearInfoTag.cs
Normal 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
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Bag/ItemGearInfoTag.cs.meta
Normal file
2
Assets/Scripts/UI/Bag/ItemGearInfoTag.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32b242aeba14ccf4e8daab2f502128e3
|
||||
3
Assets/Scripts/UI/Binders.meta
Normal file
3
Assets/Scripts/UI/Binders.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c35a1a9b6e64ca89559e3ab5e1f573a
|
||||
timeCreated: 1742307540
|
||||
14
Assets/Scripts/UI/Binders/Binder.cs
Normal file
14
Assets/Scripts/UI/Binders/Binder.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace NBF
|
||||
{
|
||||
public static class Binder
|
||||
{
|
||||
public static void BindAll()
|
||||
{
|
||||
LoadBinder.BindAll();
|
||||
CommonBinder.BindAll();
|
||||
FishingBinder.BindAll();
|
||||
MainBinder.BindAll();
|
||||
Common2Binder.BindAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/UI/Binders/Binder.cs.meta
Normal file
3
Assets/Scripts/UI/Binders/Binder.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb892dbf3939417daa9cba25e1282204
|
||||
timeCreated: 1742307543
|
||||
31
Assets/Scripts/UI/Binders/CommonBinder.cs
Normal file
31
Assets/Scripts/UI/Binders/CommonBinder.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
/**注册组件绑定关系。本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using FairyGUI;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public static class CommonBinder
|
||||
{
|
||||
[UIExtensionAutoBind]
|
||||
public static void BindAll()
|
||||
{
|
||||
UIObjectFactory.SetPackageItemExtension(SelectPages.URL, typeof(SelectPages));
|
||||
UIObjectFactory.SetPackageItemExtension(UIBlurBackground.URL, typeof(UIBlurBackground));
|
||||
UIObjectFactory.SetPackageItemExtension(BottomMenu.URL, typeof(BottomMenu));
|
||||
UIObjectFactory.SetPackageItemExtension(CommonInput.URL, typeof(CommonInput));
|
||||
UIObjectFactory.SetPackageItemExtension(CommonMenuRight.URL, typeof(CommonMenuRight));
|
||||
UIObjectFactory.SetPackageItemExtension(ClassifyList.URL, typeof(ClassifyList));
|
||||
UIObjectFactory.SetPackageItemExtension(CommonMenu.URL, typeof(CommonMenu));
|
||||
UIObjectFactory.SetPackageItemExtension(MarqueeTag.URL, typeof(MarqueeTag));
|
||||
UIObjectFactory.SetPackageItemExtension(BtnInputName.URL, typeof(BtnInputName));
|
||||
UIObjectFactory.SetPackageItemExtension(BtnTextInputControl.URL, typeof(BtnTextInputControl));
|
||||
UIObjectFactory.SetPackageItemExtension(UserMenuInfo.URL, typeof(UserMenuInfo));
|
||||
UIObjectFactory.SetPackageItemExtension(CommonItemList.URL, typeof(CommonItemList));
|
||||
UIObjectFactory.SetPackageItemExtension(NoticeItem.URL, typeof(NoticeItem));
|
||||
UIObjectFactory.SetPackageItemExtension(BtnInputControl.URL, typeof(BtnInputControl));
|
||||
UIObjectFactory.SetPackageItemExtension(ListTitleItem.URL, typeof(ListTitleItem));
|
||||
UIObjectFactory.SetPackageItemExtension(BtnSubMenu.URL, typeof(BtnSubMenu));
|
||||
UIObjectFactory.SetPackageItemExtension(ModelViewer.URL, typeof(ModelViewer));
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Binders/CommonBinder.cs.meta
Normal file
2
Assets/Scripts/UI/Binders/CommonBinder.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 107fd5f7b9848f84e97553e8ae375fd2
|
||||
19
Assets/Scripts/UI/Binders/FishingBinder.cs
Normal file
19
Assets/Scripts/UI/Binders/FishingBinder.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
/**注册组件绑定关系。本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using FairyGUI;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public static class FishingBinder
|
||||
{
|
||||
[UIExtensionAutoBind]
|
||||
public static void BindAll()
|
||||
{
|
||||
UIObjectFactory.SetPackageItemExtension(FishingStateInfo.URL, typeof(FishingStateInfo));
|
||||
UIObjectFactory.SetPackageItemExtension(InteractiveTag.URL, typeof(InteractiveTag));
|
||||
UIObjectFactory.SetPackageItemExtension(FishingPower.URL, typeof(FishingPower));
|
||||
UIObjectFactory.SetPackageItemExtension(FishingTeam.URL, typeof(FishingTeam));
|
||||
UIObjectFactory.SetPackageItemExtension(TeamItem.URL, typeof(TeamItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Binders/FishingBinder.cs.meta
Normal file
2
Assets/Scripts/UI/Binders/FishingBinder.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6581fd723f3e9646915957ef7220ef1
|
||||
14
Assets/Scripts/UI/Binders/LoadBinder.cs
Normal file
14
Assets/Scripts/UI/Binders/LoadBinder.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
/**注册组件绑定关系。本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using FairyGUI;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public static class LoadBinder
|
||||
{
|
||||
[UIExtensionAutoBind]
|
||||
public static void BindAll()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Binders/LoadBinder.cs.meta
Normal file
2
Assets/Scripts/UI/Binders/LoadBinder.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65652bb4062dc474da741144adcbc374
|
||||
29
Assets/Scripts/UI/Binders/MainBinder.cs
Normal file
29
Assets/Scripts/UI/Binders/MainBinder.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
/**注册组件绑定关系。本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using FairyGUI;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public static class MainBinder
|
||||
{
|
||||
[UIExtensionAutoBind]
|
||||
public static void BindAll()
|
||||
{
|
||||
UIObjectFactory.SetPackageItemExtension(IntroduceTag.URL, typeof(IntroduceTag));
|
||||
UIObjectFactory.SetPackageItemExtension(HomeMainPage.URL, typeof(HomeMainPage));
|
||||
UIObjectFactory.SetPackageItemExtension(HomeActivityPage.URL, typeof(HomeActivityPage));
|
||||
UIObjectFactory.SetPackageItemExtension(HomeRankPage.URL, typeof(HomeRankPage));
|
||||
UIObjectFactory.SetPackageItemExtension(HomeStatisticsPage.URL, typeof(HomeStatisticsPage));
|
||||
UIObjectFactory.SetPackageItemExtension(HomeButtonGroups.URL, typeof(HomeButtonGroups));
|
||||
UIObjectFactory.SetPackageItemExtension(SettingItem.URL, typeof(SettingItem));
|
||||
UIObjectFactory.SetPackageItemExtension(ChatItem.URL, typeof(ChatItem));
|
||||
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(BagSlotItem.URL, typeof(BagSlotItem));
|
||||
UIObjectFactory.SetPackageItemExtension(BagItem.URL, typeof(BagItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Binders/MainBinder.cs.meta
Normal file
2
Assets/Scripts/UI/Binders/MainBinder.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4fe646b07a0a063408987dddff556c7d
|
||||
3
Assets/Scripts/UI/Chat.meta
Normal file
3
Assets/Scripts/UI/Chat.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6169cecd85b9472e989a7ef14fc83964
|
||||
timeCreated: 1772694660
|
||||
52
Assets/Scripts/UI/Chat/ChatChannelType.cs
Normal file
52
Assets/Scripts/UI/Chat/ChatChannelType.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary>
|
||||
/// 聊天频道类型
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ChatChannelType
|
||||
{
|
||||
None = 0,
|
||||
World = 1 << 1, // 世界频道
|
||||
Private = 1 << 2, // 私聊频道
|
||||
System = 1 << 3, // 系统频道
|
||||
Broadcast = 1 << 4, // 广播频道
|
||||
Notice = 1 << 5, // 公告频道
|
||||
Team = 1 << 6, // 队伍频道
|
||||
Near = 1 << 7, // 附近频道
|
||||
CurrentMap = 1 << 8, // 当前地图频道
|
||||
|
||||
// 所有频道
|
||||
All = World | Private | System | Broadcast | Notice | Team | Near,
|
||||
// 其他聊天栏显示的频道
|
||||
Display = World | Private | System | Broadcast | Notice | Team | Near | CurrentMap
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 聊天节点类型
|
||||
/// </summary>
|
||||
public enum ChatNodeType
|
||||
{
|
||||
None = 0,
|
||||
Position = 1, // 位置节点
|
||||
OpenUI = 2, // 打开UI节点
|
||||
Link = 3, // 链接节点
|
||||
Item = 4, // 物品节点
|
||||
Text = 5, // 文本节点
|
||||
Image = 6, // 图片节点
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 聊天节点事件类型
|
||||
/// </summary>
|
||||
public enum ChatNodeEvent
|
||||
{
|
||||
None = 0,
|
||||
OpenUI = 1, // 打开UI节点
|
||||
ClickLink = 2, // 点击链接节点
|
||||
UseItem = 3, // 使用物品节点
|
||||
Position = 4, // 位置节点
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/UI/Chat/ChatChannelType.cs.meta
Normal file
3
Assets/Scripts/UI/Chat/ChatChannelType.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ec94d1a6ab744c4bdcff56d8da8e6ea
|
||||
timeCreated: 1772694755
|
||||
16
Assets/Scripts/UI/Chat/ChatInfoTree.cs
Normal file
16
Assets/Scripts/UI/Chat/ChatInfoTree.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Runtime.Serialization;
|
||||
using LightProto;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Fantasy
|
||||
{
|
||||
public partial class ChatInfoTree
|
||||
{
|
||||
[BsonIgnore]
|
||||
[JsonIgnore]
|
||||
[ProtoIgnore]
|
||||
[IgnoreDataMember]
|
||||
public Scene Scene { get; set; }
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/UI/Chat/ChatInfoTree.cs.meta
Normal file
3
Assets/Scripts/UI/Chat/ChatInfoTree.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73e6060aebcd46eca52cd4086e193fb3
|
||||
timeCreated: 1772694724
|
||||
82
Assets/Scripts/UI/Chat/ChatNodeEventHelper.cs
Normal file
82
Assets/Scripts/UI/Chat/ChatNodeEventHelper.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using Fantasy.Serialize;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public static class ChatNodeEventHelper
|
||||
{
|
||||
public static void Handler(Scene scene, ChatInfoNode node)
|
||||
{
|
||||
switch ((ChatNodeEvent)node.ChatNodeEvent)
|
||||
{
|
||||
case ChatNodeEvent.ClickLink:
|
||||
{
|
||||
ClickLinkHandler(scene, node);
|
||||
return;
|
||||
}
|
||||
case ChatNodeEvent.OpenUI:
|
||||
{
|
||||
OpenUIHandler(scene, node);
|
||||
return;
|
||||
}
|
||||
case ChatNodeEvent.Position:
|
||||
{
|
||||
PositionHandler(scene, node);
|
||||
return;
|
||||
}
|
||||
case ChatNodeEvent.UseItem:
|
||||
{
|
||||
UseItemHandler(scene, node);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void ClickLinkHandler(Scene scene, ChatInfoNode node)
|
||||
{
|
||||
if (node.Data == null || node.Data.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var chatLinkNode = SerializerManager.ProtoBufHelper.Deserialize<ChatLinkNode>(node.Data);
|
||||
// var chatLinkNode = scene.GetComponent<SerializerComponent>().Deserialize<ChatLinkNode>(node.Data);
|
||||
// 拿到这个之后,就可以为所欲为了。
|
||||
// 根据自己的逻辑和UI设计,做出相应的处理。
|
||||
Log.Debug($"ClickLinkHandler Link:{chatLinkNode.Link}");
|
||||
}
|
||||
|
||||
private static void OpenUIHandler(Scene scene, ChatInfoNode node)
|
||||
{
|
||||
if (node.Data == null || node.Data.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var chatOpenUINode = SerializerManager.ProtoBufHelper.Deserialize<ChatOpenUINode>(node.Data);
|
||||
// 拿到这个之后,就可以为所欲为了。
|
||||
// 根据自己的逻辑和UI设计,做出相应的处理。
|
||||
Log.Debug($"OpenUIHandler UIName:{chatOpenUINode.UIName}");
|
||||
}
|
||||
|
||||
private static void PositionHandler(Scene scene, ChatInfoNode node)
|
||||
{
|
||||
if (node.Data == null || node.Data.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var chatPositionNode = SerializerManager.ProtoBufHelper.Deserialize<ChatPositionNode>(node.Data);
|
||||
// 拿到这个之后,就可以为所欲为了。
|
||||
// 根据自己的逻辑和UI设计,做出相应的处理。
|
||||
Log.Debug(
|
||||
$"PositionHandler MapName:{chatPositionNode.MapName} X:{chatPositionNode.PosX} Y:{chatPositionNode.PosY} Z:{chatPositionNode.PosZ}");
|
||||
}
|
||||
|
||||
private static void UseItemHandler(Scene scene, ChatInfoNode node)
|
||||
{
|
||||
// TODO: Implement UseItemHandler
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/UI/Chat/ChatNodeEventHelper.cs.meta
Normal file
3
Assets/Scripts/UI/Chat/ChatNodeEventHelper.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7bcf5d11cea04d86a8a9c5c3fce31ed8
|
||||
timeCreated: 1772694878
|
||||
130
Assets/Scripts/UI/Chat/ChatNodeFactory.cs
Normal file
130
Assets/Scripts/UI/Chat/ChatNodeFactory.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
using Fantasy;
|
||||
using Fantasy.Network;
|
||||
using Fantasy.Serialize;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary>
|
||||
/// 聊天信息节点
|
||||
/// </summary>
|
||||
public static class ChatNodeFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// 添加文本节点
|
||||
/// </summary>
|
||||
/// <param name="chatInfoTree"></param>
|
||||
/// <param name="content"></param>
|
||||
/// <returns></returns>
|
||||
public static ChatInfoTree AddendTextNode(this ChatInfoTree chatInfoTree, string content)
|
||||
{
|
||||
var chatInfoNode = new ChatInfoNode()
|
||||
{
|
||||
ChatNodeType = (int)ChatNodeType.Text,
|
||||
Content = content
|
||||
};
|
||||
chatInfoTree.Node.Add(chatInfoNode);
|
||||
return chatInfoTree;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加链接节点
|
||||
/// </summary>
|
||||
/// <param name="chatInfoTree"></param>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="link"></param>
|
||||
/// <returns></returns>
|
||||
public static ChatInfoTree AddendLinkNode(this ChatInfoTree chatInfoTree, string content,string link)
|
||||
{
|
||||
var chatLinkNode = new ChatLinkNode()
|
||||
{
|
||||
Link = link
|
||||
};
|
||||
// var serializerComponent = chatInfoTree.Scene.GetComponent<SerializerComponent>();
|
||||
var chatInfoNode = new ChatInfoNode()
|
||||
{
|
||||
ChatNodeType = (int)ChatNodeType.Link,
|
||||
ChatNodeEvent = (int)ChatNodeEvent.ClickLink,
|
||||
Content = content,
|
||||
Data = SerializerManager.ProtoBufHelper.Serialize(chatLinkNode)
|
||||
};
|
||||
chatInfoTree.Node.Add(chatInfoNode);
|
||||
return chatInfoTree;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加图片节点
|
||||
/// </summary>
|
||||
/// <param name="chatInfoTree"></param>
|
||||
/// <param name="content"></param>
|
||||
/// <returns></returns>
|
||||
public static ChatInfoTree AddendImageNode(this ChatInfoTree chatInfoTree, string content)
|
||||
{
|
||||
var chatInfoNode = new ChatInfoNode()
|
||||
{
|
||||
ChatNodeType = (int)ChatNodeType.Image,
|
||||
Content = content
|
||||
};
|
||||
chatInfoTree.Node.Add(chatInfoNode);
|
||||
return chatInfoTree;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加打开UI节点
|
||||
/// </summary>
|
||||
/// <param name="chatInfoTree"></param>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="uiName"></param>
|
||||
/// <returns></returns>
|
||||
public static ChatInfoTree AddendOpenUINode(this ChatInfoTree chatInfoTree, string content,string uiName)
|
||||
{
|
||||
var chatOpenUINode = new ChatOpenUINode()
|
||||
{
|
||||
UIName = uiName
|
||||
};
|
||||
|
||||
var chatInfoNode = new ChatInfoNode()
|
||||
{
|
||||
ChatNodeType = (int)ChatNodeType.OpenUI,
|
||||
ChatNodeEvent = (int)ChatNodeEvent.OpenUI,
|
||||
Content = content,
|
||||
Data = SerializerManager.ProtoBufHelper.Serialize(chatOpenUINode)
|
||||
};
|
||||
chatInfoTree.Node.Add(chatInfoNode);
|
||||
return chatInfoTree;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加位置节点
|
||||
/// </summary>
|
||||
/// <param name="chatInfoTree"></param>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="mapName"></param>
|
||||
/// <param name="mapX"></param>
|
||||
/// <param name="mapY"></param>
|
||||
/// <param name="mapZ"></param>
|
||||
/// <returns></returns>
|
||||
public static ChatInfoTree AddendPositionNode(this ChatInfoTree chatInfoTree, string content, string mapName,
|
||||
float mapX, float mapY, float mapZ)
|
||||
{
|
||||
var chatPositionNode = new ChatPositionNode()
|
||||
{
|
||||
MapName = mapName,
|
||||
PosX = mapX,
|
||||
PosY = mapY,
|
||||
PosZ = mapZ,
|
||||
};
|
||||
|
||||
// var serializerComponent = chatInfoTree.Scene.GetComponent<SerializerComponent>();
|
||||
var chatInfoNode = new ChatInfoNode()
|
||||
{
|
||||
ChatNodeType = (int)ChatNodeType.Position,
|
||||
ChatNodeEvent = (int)ChatNodeEvent.Position,
|
||||
Content = content,
|
||||
Data = SerializerManager.ProtoBufHelper.Serialize(chatPositionNode)
|
||||
};
|
||||
|
||||
chatInfoTree.Node.Add(chatInfoNode);
|
||||
return chatInfoTree;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/UI/Chat/ChatNodeFactory.cs.meta
Normal file
3
Assets/Scripts/UI/Chat/ChatNodeFactory.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bbf26a0aef9841f89db6182475f50e59
|
||||
timeCreated: 1772694930
|
||||
40
Assets/Scripts/UI/Chat/ChatTestPanel.Designer.cs
generated
Normal file
40
Assets/Scripts/UI/Chat/ChatTestPanel.Designer.cs
generated
Normal 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 ChatTestPanel
|
||||
{
|
||||
public GObject this[string aKey] => ContentPane.GetChild(aKey);
|
||||
public override string UIPackName => "Main";
|
||||
public override string UIResName => "ChatTestPanel";
|
||||
|
||||
[AutoFind(Name = "back")]
|
||||
public GImage back;
|
||||
[AutoFind(Name = "InputMessage")]
|
||||
public GLabel InputMessage;
|
||||
[AutoFind(Name = "BtnSendMessage")]
|
||||
public GButton BtnSendMessage;
|
||||
[AutoFind(Name = "BtnSendFriend")]
|
||||
public GButton BtnSendFriend;
|
||||
[AutoFind(Name = "BtnSendWorld")]
|
||||
public GButton BtnSendWorld;
|
||||
[AutoFind(Name = "ChatList")]
|
||||
public GList ChatList;
|
||||
[AutoFind(Name = "InputFriendId")]
|
||||
public GLabel InputFriendId;
|
||||
public override string[] GetDependPackages(){ return new string[] {"Common","CommonNew"}; }
|
||||
|
||||
public static void Show(object param = null){ UI.Inst.OpenUI<ChatTestPanel>(param); }
|
||||
|
||||
public static void Hide(){ UI.Inst.HideUI<ChatTestPanel>(); }
|
||||
|
||||
public static void Del(){ UI.Inst.DestroyUI<ChatTestPanel>(); }
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Chat/ChatTestPanel.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/Chat/ChatTestPanel.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9910a4bd1e1d3b4a8c580bcc2cc34e7
|
||||
115
Assets/Scripts/UI/Chat/ChatTestPanel.cs
Normal file
115
Assets/Scripts/UI/Chat/ChatTestPanel.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using FairyGUI;
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network;
|
||||
using NBC;
|
||||
using UnityEngine;
|
||||
using Log = NBC.Log;
|
||||
using UIPanel = NBC.UIPanel;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class ChatTestPanel : UIPanel
|
||||
{
|
||||
private List<string> _messages = new List<string>();
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
this.AutoAddClick(OnClick);
|
||||
}
|
||||
|
||||
protected override void OnShow()
|
||||
{
|
||||
}
|
||||
|
||||
private void RefreshList()
|
||||
{
|
||||
ChatList.RemoveChildrenToPool();
|
||||
foreach (var item in _messages)
|
||||
{
|
||||
if (ChatList.AddItemFromPool() is ChatItem chatItem)
|
||||
{
|
||||
chatItem.InitData(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClick(GComponent btn)
|
||||
{
|
||||
if (btn == BtnSendWorld)
|
||||
{
|
||||
OnSendMessage(InputMessage.title).Coroutine();
|
||||
}
|
||||
else if (btn == BtnSendFriend)
|
||||
{
|
||||
OnSendFriendMessage().Coroutine();
|
||||
}
|
||||
}
|
||||
|
||||
#region 发生消息测试
|
||||
|
||||
private async FTask OnSendMessage(string message)
|
||||
{
|
||||
var tree = ChatTreeFactory.Broadcast(Game.Main);
|
||||
tree = tree.AddendPositionNode(message, "勇者大陆", 121, 131, 111);
|
||||
|
||||
var response = (Chat2C_SendMessageResponse)await Net.Call(new C2Chat_SendMessageRequest()
|
||||
{
|
||||
ChatInfoTree = tree
|
||||
});
|
||||
if (response.ErrorCode != 0)
|
||||
{
|
||||
Log.Error($"发送聊天消息失败 ErrorCode:{response.ErrorCode}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Info("发送消息成功");
|
||||
}
|
||||
}
|
||||
|
||||
private async FTask OnSendFriendMessage()
|
||||
{
|
||||
var tree = ChatTreeFactory.Private();
|
||||
tree.Target.Add(Convert.ToInt64(InputFriendId.text));
|
||||
tree.AddendTextNode("你好,欢迎来到Fantasy Chat!")
|
||||
.AddendLinkNode("点击这里http://www.fantasy.com.cn", "http://www.fantasy.com.cn");
|
||||
|
||||
var response = (Chat2C_SendMessageResponse)await Net.Call(new C2Chat_SendMessageRequest()
|
||||
{
|
||||
ChatInfoTree = tree
|
||||
});
|
||||
if (response.ErrorCode != 0)
|
||||
{
|
||||
Log.Error($"发送私聊消息失败 ErrorCode:{response.ErrorCode}");
|
||||
}
|
||||
}
|
||||
|
||||
public void Message(ChatInfoTree tree)
|
||||
{
|
||||
// _messages.Add(message);
|
||||
|
||||
var sb = new StringBuilder();
|
||||
foreach (var chatInfoNode in tree.Node)
|
||||
{
|
||||
// 这里只是演示一下处理事件的效果,实际使用时,需要根据实际情况处理事件
|
||||
// 明显我现在这样做的方式不是对的,应该是自己拼接一个聊天信息,然后调用这个接口来处理事件
|
||||
// entryComponent.Entry.ChatNodeEventButton.onClick.RemoveAllListeners();
|
||||
// entryComponent.Entry.ChatNodeEventButton.onClick.AddListener(() =>
|
||||
// {
|
||||
// ChatNodeEventHelper.Handler(scene, chatInfoNode);
|
||||
// });
|
||||
sb.Append(chatInfoNode.Content);
|
||||
}
|
||||
|
||||
_messages.Add(sb.ToString());
|
||||
RefreshList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Chat/ChatTestPanel.cs.meta
Normal file
2
Assets/Scripts/UI/Chat/ChatTestPanel.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f05d713b2557a945b45a81473963207
|
||||
121
Assets/Scripts/UI/Chat/ChatTreeFactory.cs
Normal file
121
Assets/Scripts/UI/Chat/ChatTreeFactory.cs
Normal file
@@ -0,0 +1,121 @@
|
||||
using Fantasy;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建聊天树的总入口
|
||||
/// </summary>
|
||||
public static class ChatTreeFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建世界聊天树
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <returns></returns>
|
||||
public static ChatInfoTree World()
|
||||
{
|
||||
return new ChatInfoTree()
|
||||
{
|
||||
Scene = Game.Main,
|
||||
ChatChannelType = (int)ChatChannelType.World,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建私聊聊天树
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ChatInfoTree Private()
|
||||
{
|
||||
return new ChatInfoTree()
|
||||
{
|
||||
Scene = Game.Main,
|
||||
ChatChannelType = (int)ChatChannelType.Private,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建系统聊天树
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <returns></returns>
|
||||
public static ChatInfoTree System(Scene scene)
|
||||
{
|
||||
return new ChatInfoTree()
|
||||
{
|
||||
Scene = scene,
|
||||
ChatChannelType = (int)ChatChannelType.System,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建公广播聊天树
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <returns></returns>
|
||||
public static ChatInfoTree Broadcast(Scene scene)
|
||||
{
|
||||
return new ChatInfoTree()
|
||||
{
|
||||
Scene = scene,
|
||||
ChatChannelType = (int)ChatChannelType.Broadcast,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建公告聊天树
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <returns></returns>
|
||||
public static ChatInfoTree Notice(Scene scene)
|
||||
{
|
||||
return new ChatInfoTree()
|
||||
{
|
||||
Scene = scene,
|
||||
ChatChannelType = (int)ChatChannelType.Notice,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建队伍聊天树
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <returns></returns>
|
||||
public static ChatInfoTree Team(Scene scene)
|
||||
{
|
||||
return new ChatInfoTree()
|
||||
{
|
||||
Scene = scene,
|
||||
ChatChannelType = (int)ChatChannelType.Team,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建附近人聊天树
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <returns></returns>
|
||||
public static ChatInfoTree Near(Scene scene)
|
||||
{
|
||||
return new ChatInfoTree()
|
||||
{
|
||||
Scene = scene,
|
||||
ChatChannelType = (int)ChatChannelType.Near,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建当前地图聊天树
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <returns></returns>
|
||||
public static ChatInfoTree CurrentMap(Scene scene)
|
||||
{
|
||||
return new ChatInfoTree()
|
||||
{
|
||||
Scene = scene,
|
||||
ChatChannelType = (int)ChatChannelType.CurrentMap,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/UI/Chat/ChatTreeFactory.cs.meta
Normal file
3
Assets/Scripts/UI/Chat/ChatTreeFactory.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f028a29029d74cbf8c264a7d4a245ecf
|
||||
timeCreated: 1772694684
|
||||
29
Assets/Scripts/UI/ChatItem.Designer.cs
generated
Normal file
29
Assets/Scripts/UI/ChatItem.Designer.cs
generated
Normal 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 ChatItem
|
||||
{
|
||||
public const string URL = "ui://hxr7rc7pn5ne1f";
|
||||
|
||||
public GTextField TextType;
|
||||
public GTextField TextUser;
|
||||
public GTextField TextMessage;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
TextType = (GTextField)GetChild("TextType");
|
||||
TextUser = (GTextField)GetChild("TextUser");
|
||||
TextMessage = (GTextField)GetChild("TextMessage");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/ChatItem.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/ChatItem.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8383cf682d2c39f41bc83ea027894ec6
|
||||
20
Assets/Scripts/UI/ChatItem.cs
Normal file
20
Assets/Scripts/UI/ChatItem.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class ChatItem : GComponent
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
|
||||
public void InitData(string message)
|
||||
{
|
||||
TextMessage.text = message;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/ChatItem.cs.meta
Normal file
2
Assets/Scripts/UI/ChatItem.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e369e839256e8464fbdd0922424f36e3
|
||||
3
Assets/Scripts/UI/Common.meta
Normal file
3
Assets/Scripts/UI/Common.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 366af0b4163d458d907bdb2b1b5a1936
|
||||
timeCreated: 1742309868
|
||||
27
Assets/Scripts/UI/Common/BtnTextInputControl.Designer.cs
generated
Normal file
27
Assets/Scripts/UI/Common/BtnTextInputControl.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 BtnTextInputControl
|
||||
{
|
||||
public const string URL = "ui://6hgkvlaunmzbk6";
|
||||
|
||||
public Controller show;
|
||||
public GTextField TextInput;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
show = GetController("show");
|
||||
TextInput = (GTextField)GetChild("TextInput");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e99f131a7321e8e42bf9eb6bfe452c8b
|
||||
15
Assets/Scripts/UI/Common/BtnTextInputControl.cs
Normal file
15
Assets/Scripts/UI/Common/BtnTextInputControl.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class BtnTextInputControl : GButton
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Common/BtnTextInputControl.cs.meta
Normal file
2
Assets/Scripts/UI/Common/BtnTextInputControl.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba21874e88e12e347a543e98c6dc286f
|
||||
3
Assets/Scripts/UI/Common/Button.meta
Normal file
3
Assets/Scripts/UI/Common/Button.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e421fb97db2b48ccb37e75b8766265de
|
||||
timeCreated: 1748071593
|
||||
25
Assets/Scripts/UI/Common/Button/BtnInputControl.Designer.cs
generated
Normal file
25
Assets/Scripts/UI/Common/Button/BtnInputControl.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 BtnInputControl
|
||||
{
|
||||
public const string URL = "ui://6hgkvlaur03ut";
|
||||
|
||||
public Controller show;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
show = GetController("show");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dfab5a485e648254dad616e988d7a17e
|
||||
15
Assets/Scripts/UI/Common/Button/BtnInputControl.cs
Normal file
15
Assets/Scripts/UI/Common/Button/BtnInputControl.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class BtnInputControl : BtnInputControlBase
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Common/Button/BtnInputControl.cs.meta
Normal file
2
Assets/Scripts/UI/Common/Button/BtnInputControl.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9bc3045114c90ef4888ae8cd51aa1e2e
|
||||
28
Assets/Scripts/UI/Common/Button/BtnInputControlBase.cs
Normal file
28
Assets/Scripts/UI/Common/Button/BtnInputControlBase.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public abstract class BtnInputControlBase : GButton
|
||||
{
|
||||
public string ActionName;
|
||||
public string ShowName;
|
||||
|
||||
public virtual void SetData(string actionName, string showName, string map = InputManager.InputMapUI)
|
||||
{
|
||||
this.ActionName = actionName;
|
||||
this.ShowName = showName;
|
||||
if (!string.IsNullOrEmpty(showName))
|
||||
{
|
||||
title = Lan.Get(showName);
|
||||
}
|
||||
else
|
||||
{
|
||||
title = Lan.Get(actionName);
|
||||
}
|
||||
|
||||
var iconName = InputManager.Instance.GetInputIcon(map, ActionName);
|
||||
icon = UIPackage.GetItemURL(UIDef.Pack.Common, iconName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4da865139cbb401a91f63bcf30d233c4
|
||||
timeCreated: 1769960386
|
||||
27
Assets/Scripts/UI/Common/Button/BtnInputName.Designer.cs
generated
Normal file
27
Assets/Scripts/UI/Common/Button/BtnInputName.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 BtnInputName
|
||||
{
|
||||
public const string URL = "ui://6hgkvlaumnqhz2";
|
||||
|
||||
public Controller styleCtrl;
|
||||
public Transition start;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
styleCtrl = GetController("styleCtrl");
|
||||
start = GetTransition("start");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3bbc263e9355f5144b0b4a6989f72c05
|
||||
40
Assets/Scripts/UI/Common/Button/BtnInputName.cs
Normal file
40
Assets/Scripts/UI/Common/Button/BtnInputName.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
using NBF.Setting;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class BtnInputName : GButton
|
||||
{
|
||||
// private InputAction _inputAction;
|
||||
private KeyBoardOption _keyBoardOption;
|
||||
private int _index;
|
||||
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
|
||||
public void SetData(int index, KeyBoardOption boardOption)
|
||||
{
|
||||
_index = index;
|
||||
_keyBoardOption = boardOption;
|
||||
// _inputAction = inputAction;
|
||||
|
||||
|
||||
var bindings = boardOption.InputAction.bindings;
|
||||
|
||||
if (bindings.Count > index)
|
||||
{
|
||||
title = boardOption.GetDisplayString(); //boardOption.InputAction.GetBindingDisplayString(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
title = "未绑定";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Common/Button/BtnInputName.cs.meta
Normal file
2
Assets/Scripts/UI/Common/Button/BtnInputName.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5046c80b3e704c94886c9c81b9da0f2b
|
||||
25
Assets/Scripts/UI/Common/Button/BtnTitleInputControl.Designer.cs
generated
Normal file
25
Assets/Scripts/UI/Common/Button/BtnTitleInputControl.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 BtnTitleInputControl
|
||||
{
|
||||
public const string URL = "ui://6hgkvlaur03uj0";
|
||||
|
||||
public Controller style;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
style = GetController("style");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3a4cdcb09978fcd47b043fa05e53e433
|
||||
16
Assets/Scripts/UI/Common/Button/BtnTitleInputControl.cs
Normal file
16
Assets/Scripts/UI/Common/Button/BtnTitleInputControl.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class BtnTitleInputControl : BtnInputControlBase
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 15ebd24da667f9146bc2cfbfec56a512
|
||||
27
Assets/Scripts/UI/Common/CommonInput.Designer.cs
generated
Normal file
27
Assets/Scripts/UI/Common/CommonInput.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 CommonInput
|
||||
{
|
||||
public const string URL = "ui://6hgkvlau9zboma";
|
||||
|
||||
public Controller FocusState;
|
||||
public GTextInput Input;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
FocusState = GetController("FocusState");
|
||||
Input = (GTextInput)GetChild("Input");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Common/CommonInput.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/Common/CommonInput.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb776407f4f25e64a8e803ba135bddef
|
||||
47
Assets/Scripts/UI/Common/CommonInput.cs
Normal file
47
Assets/Scripts/UI/Common/CommonInput.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class CommonInput : GComponent
|
||||
{
|
||||
public EventListener onChanged => Input.onChanged;
|
||||
|
||||
public override string text
|
||||
{
|
||||
get => Input.text;
|
||||
set => Input.text = value;
|
||||
}
|
||||
|
||||
public string title
|
||||
{
|
||||
get => text;
|
||||
set => text = value;
|
||||
}
|
||||
|
||||
public string promptText
|
||||
{
|
||||
get => Input.promptText;
|
||||
set => Input.promptText = value;
|
||||
}
|
||||
|
||||
private void OnInited()
|
||||
{
|
||||
onFocusIn.Add(OnInputFocusIn);
|
||||
onFocusOut.Add(OnInputFocusOut);
|
||||
}
|
||||
|
||||
private void OnInputFocusIn()
|
||||
{
|
||||
FocusState.selectedIndex = 1;
|
||||
}
|
||||
|
||||
private void OnInputFocusOut()
|
||||
{
|
||||
FocusState.selectedIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Common/CommonInput.cs.meta
Normal file
2
Assets/Scripts/UI/Common/CommonInput.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7adc7972d1d401489dc796fb27d1eaa
|
||||
3
Assets/Scripts/UI/Common/Extensions.meta
Normal file
3
Assets/Scripts/UI/Common/Extensions.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 688374f241004942b3ef3af4086c983e
|
||||
timeCreated: 1760344663
|
||||
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
|
||||
89
Assets/Scripts/UI/Common/Extensions/TabItemDataExtensions.cs
Normal file
89
Assets/Scripts/UI/Common/Extensions/TabItemDataExtensions.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public static class TabItemDataExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 为TabItemData列表添加"全部"选项卡
|
||||
/// </summary>
|
||||
/// <param name="tabItems">原始选项卡列表</param>
|
||||
/// <returns>包含"全部"选项卡的新列表</returns>
|
||||
public static void AddAllTabItem(this List<TabItemData> tabItems)
|
||||
{
|
||||
//判断是否存在二级目录,有二级目录则只在二级目录有"全部"选项卡
|
||||
if (tabItems.Any(tabItem => tabItem.Children.Count > 0))
|
||||
{
|
||||
foreach (var tabItemData in tabItems)
|
||||
{
|
||||
if (tabItemData.Children.Count > 0)
|
||||
{
|
||||
var allTab = new TabItemData
|
||||
{
|
||||
Id = 0,
|
||||
Key = "All",
|
||||
Icon = "All",
|
||||
IsAll = true,
|
||||
Items = GetAllItemsFromTabs(tabItemData.Children)
|
||||
};
|
||||
tabItemData.Children.Insert(0, allTab);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var allTab = new TabItemData
|
||||
{
|
||||
Id = 0,
|
||||
Key = "All",
|
||||
Icon = "All",
|
||||
IsAll = true,
|
||||
Items = GetAllItemsFromTabs(tabItems)
|
||||
};
|
||||
tabItems.Insert(0, allTab);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 递归获取所有选项卡中的项目(去重)
|
||||
/// </summary>
|
||||
private static List<object> GetAllItemsFromTabs(List<TabItemData> tabs)
|
||||
{
|
||||
var allItems = new List<object>();
|
||||
|
||||
foreach (var tab in tabs)
|
||||
{
|
||||
// if (addListTitle)
|
||||
// {
|
||||
// allItems.Add(new ClassifyListTitleData()
|
||||
// {
|
||||
// Title = tab.Key
|
||||
// });
|
||||
// }
|
||||
|
||||
// 添加当前选项卡的项目
|
||||
if (tab.Items != null)
|
||||
{
|
||||
allItems.AddRange(tab.Items);
|
||||
}
|
||||
}
|
||||
|
||||
// 去重处理(基于引用相等,如果需要基于内容去重需要重写Equals方法)
|
||||
return allItems.Distinct().ToList();
|
||||
}
|
||||
|
||||
public static void TabItemDataAddListTitle(this TabItemData tabItem)
|
||||
{
|
||||
if (tabItem.Items == null || tabItem.Items.Count < 1) return;
|
||||
var hasListTitle = tabItem.Items.OfType<ClassifyListTitleData>().Any();
|
||||
if (!hasListTitle)
|
||||
{
|
||||
tabItem.Items.Insert(0, new ClassifyListTitleData()
|
||||
{
|
||||
Title = tabItem.Key
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab38f91a1c10449ea1d908bdffc5111a
|
||||
timeCreated: 1760344665
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user