AlicizaX/Client/Assets/Scripts/Hotfix/GameLogic/UILoadUpdate.cs
2025-07-11 21:00:00 +08:00

79 lines
2.0 KiB
C#

using System;
using System.Collections.Generic;
using AlicizaX;
using AlicizaX.Event.Runtime;
using AlicizaX.Resource.Runtime;
using AlicizaX.UI.RecyclerView;
using AlicizaX.UI.Runtime;
using Cysharp.Threading.Tasks;
using GameLogic.UI;
using UnityEngine;
[Window(UILayer.UI, false)]
public class UILoadUpdate : UITabWindow<ui_UILoadUpdateWindow>
{
private LoopAdapter<string> typeAdapter;
private UITestCardWidget _uiTestCardWidget;
protected override async UniTask OnInitializeAsync()
{
Log.Info("OnInitlize");
typeAdapter = new LoopAdapter<string>(baseui.ScrollViewTestList);
typeAdapter.SetOnItemClick(OnItemClick);
baseui.ScrollViewTestList.SetAdapter(typeAdapter);
baseui.ScrollViewTestList.OnIndexChanged += index => { Debug.Log("Index Changed"); };
baseui.ScrollViewTestList.OnMoveingChanged += () => { Debug.Log("Scroll Changed"); };
}
private void OnItemClick(string obj)
{
var index = 100 + ((typeAdapter.ChoiceIndex + 1) * 10) + typeAdapter.ChoiceIndex;
baseui.ScrollViewTestList.ScrollTo(index, true);
}
protected override void OnRegisterEvent(EventListenerProxy proxy)
{
base.OnRegisterEvent(proxy);
// proxy.Subscribe(AssetPatchStatesChangeEventArgs.EventId, SetPatchStates);
}
private void SetPatchStates(object sender, GameEventArgs e)
{
Debug.Log("收到信息");
}
protected override void OnOpen()
{
base.OnOpen();
List<string> para = new List<string>();
int count = 5;
for (var i = 0; i < count; i++)
{
para.Add(i.ToString());
}
typeAdapter.SetList(para);
baseui.ScrollViewTestList.ScrollTo(100 * typeAdapter.GetRealCount());
}
protected override void OnClose()
{
base.OnClose();
Log.Info("OnClose");
}
protected override void OnDestroy()
{
base.OnDestroy();
Log.Info("OnDestroy");
}
protected override void OnUpdate()
{
base.OnUpdate();
}
}