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 { private LoopAdapter typeAdapter; private UITestCardWidget _uiTestCardWidget; protected override async UniTask OnInitializeAsync() { Log.Info("OnInitlize"); typeAdapter = new LoopAdapter(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 para = new List(); 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(); } }