背包ui
This commit is contained in:
@@ -21,6 +21,7 @@ namespace NBF
|
||||
UIObjectFactory.SetPackageItemExtension(NoticeItem.URL, typeof(NoticeItem));
|
||||
UIObjectFactory.SetPackageItemExtension(CommonSubMenu.URL, typeof(CommonSubMenu));
|
||||
UIObjectFactory.SetPackageItemExtension(BtnInputControl.URL, typeof(BtnInputControl));
|
||||
UIObjectFactory.SetPackageItemExtension(ListTitleItem.URL, typeof(ListTitleItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,14 +63,17 @@ namespace NBF
|
||||
}
|
||||
}
|
||||
|
||||
public void SetListData(List<object> listData, ListSelectionMode selectionMode = ListSelectionMode.Single)
|
||||
public void SetListData(List<object> listData,
|
||||
ListSelectionMode selectionMode = ListSelectionMode.Single)
|
||||
{
|
||||
List.selectedIndex = -1;
|
||||
List.defaultItem = GetListDefaultItemResource(listData);
|
||||
List.defaultItem = ListTitleItem.URL;
|
||||
List.itemProvider = GetListItemResource;
|
||||
List.itemRenderer = OnRenderItem;
|
||||
List.onClickItem.Add(OnClickListItem);
|
||||
List.SetVirtual();
|
||||
// List.SetVirtual();
|
||||
_listData.Clear();
|
||||
|
||||
foreach (var obj in listData)
|
||||
{
|
||||
_listData.Add(obj);
|
||||
@@ -92,19 +95,30 @@ namespace NBF
|
||||
if (obj is ListItemBase item)
|
||||
{
|
||||
item.SetData(_listData[index]);
|
||||
obj.SetSize(350, 300);
|
||||
}
|
||||
else if (obj is ListTitleItem titleItem)
|
||||
{
|
||||
titleItem.SetSize(List.width, 32);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//根据索引的不同,返回不同的资源URL
|
||||
string GetListDefaultItemResource(List<object> listData)
|
||||
string GetListItemResource(int index)
|
||||
{
|
||||
var itemData = listData.Find(t => t != null);
|
||||
var itemData = _listData[index];
|
||||
|
||||
if (itemData is ShopGearData)
|
||||
{
|
||||
return ShopGearItem.URL;
|
||||
}
|
||||
|
||||
if (itemData is string title)
|
||||
{
|
||||
return ListTitleItem.URL;
|
||||
}
|
||||
|
||||
return List.defaultItem;
|
||||
}
|
||||
}
|
||||
|
||||
25
Assets/Scripts/UI/Common/Items/ListTitleItem.Designer.cs
generated
Normal file
25
Assets/Scripts/UI/Common/Items/ListTitleItem.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 ListTitleItem
|
||||
{
|
||||
public const string URL = "ui://6hgkvlaush9ymc";
|
||||
|
||||
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: f130a01ca6286e1408db0809028cf787
|
||||
15
Assets/Scripts/UI/Common/Items/ListTitleItem.cs
Normal file
15
Assets/Scripts/UI/Common/Items/ListTitleItem.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class ListTitleItem : GLabel
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Common/Items/ListTitleItem.cs.meta
Normal file
2
Assets/Scripts/UI/Common/Items/ListTitleItem.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b2881797917479b469f018a06726152d
|
||||
@@ -76,6 +76,17 @@ namespace NBF
|
||||
private async FTask OnLoginClick()
|
||||
{
|
||||
await LoginHelper.Login(InputAccount.text);
|
||||
|
||||
BagPanel.Show();
|
||||
FishingShopPanel.Show();
|
||||
|
||||
// var mapId = role.Info.MapId;
|
||||
// if (mapId == 0)
|
||||
// {
|
||||
// Log.Warning("账号没有进入过地图,进入新手引导地图");
|
||||
// mapId = 99;
|
||||
// }
|
||||
// await MapHelper.EnterMap(mapId, role.RoomCode);
|
||||
// await MapHelper.EnterMap(99);
|
||||
Del();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user