AlicizaX/Client/Assets/Scripts/Hotfix/GameLogic/UI/UILoadUpdate.cs

82 lines
2.0 KiB
C#
Raw Normal View History

2025-12-01 16:46:28 +08:00
using System.Collections.Generic;
2025-11-13 17:46:33 +08:00
using AlicizaX;
using AlicizaX.Resource.Runtime;
2025-12-01 16:46:28 +08:00
using AlicizaX.UI;
2025-03-04 18:40:14 +08:00
using AlicizaX.UI.Runtime;
2025-11-13 17:46:33 +08:00
using Cysharp.Threading.Tasks;
2025-11-07 20:48:24 +08:00
using Game.UI;
using GameLogic.UI;
2025-03-04 18:40:14 +08:00
using UnityEngine;
2026-03-11 11:40:00 +08:00
public class TestData : ISimpleViewData
{
public string Name;
}
2025-12-26 14:23:01 +08:00
2025-11-13 17:46:33 +08:00
[UIUpdate]
2025-12-26 14:23:01 +08:00
[Window(UILayer.UI, false, 3)]
2025-04-28 19:45:45 +08:00
public class UILoadUpdate : UITabWindow<ui_UILoadUpdateWindow>
2025-03-04 18:40:14 +08:00
{
2026-03-11 11:40:00 +08:00
private UGList<TestData> _list;
2025-12-26 14:23:01 +08:00
2025-10-14 15:42:34 +08:00
protected override void OnInitialize()
{
2026-03-27 20:56:06 +08:00
_list = UGListCreateHelper.Create<TestData>(baseui.ScrollViewTestList);
_list.RegisterItemRender<TestScrollItemRender>();
2025-11-13 17:46:33 +08:00
baseui.ImgBackGround.color = Color.gray;
baseui.BtnTest.onClick.AddListener(OnTestClick);
2026-03-31 17:26:51 +08:00
SetListAndFocusFirst(CreateTestDataList(1000000));
2025-11-13 17:46:33 +08:00
baseui.BtnQTest.onClick.AddListener(OnBtnQTestClick);
baseui.BtnEscTest.onClick.AddListener(OnBtnEscTestClick);
baseui.BtnETest.onClick.AddListener(OnBtnETestClick);
}
2025-12-26 14:23:01 +08:00
private void OnBtnETestClick()
2025-11-13 17:46:33 +08:00
{
2026-03-31 17:26:51 +08:00
SetListAndFocusFirst(CreateTestDataList(4000));
Log.Info("Btn E Click");
2025-11-13 17:46:33 +08:00
}
private void OnBtnEscTestClick()
2025-11-13 17:46:33 +08:00
{
Log.Info("Btn Esc Click");
CloseSelf();
2025-10-14 15:42:34 +08:00
}
2025-03-04 18:40:14 +08:00
private void OnBtnQTestClick()
2026-03-11 11:40:00 +08:00
{
2026-03-31 17:26:51 +08:00
SetListAndFocusFirst(CreateTestDataList(30000));
Log.Info("Btn Q Click");
}
private static List<TestData> CreateTestDataList(int count)
{
List<TestData> testDataList = new List<TestData>(count);
for (int i = 0; i < count; i++)
2026-03-27 20:56:06 +08:00
{
testDataList.Add(new TestData() { Name = $"TestProp:{i}" });
}
2026-03-31 17:26:51 +08:00
return testDataList;
}
private void SetListAndFocusFirst(List<TestData> dataList)
{
_list.Data = dataList;
FocusFirstItemAsync().Forget();
}
private async UniTaskVoid FocusFirstItemAsync()
{
await UniTask.NextFrame();
_list.RecyclerView.TryFocusIndex(0);
2026-03-11 11:40:00 +08:00
}
2025-11-17 16:56:03 +08:00
2025-10-14 15:42:34 +08:00
private void OnTestClick()
2025-12-26 14:23:01 +08:00
{
GameApp.UI.ShowUISync<UILogicTestAlert>();
2025-12-26 14:23:01 +08:00
}
2025-03-04 18:40:14 +08:00
}