Files
plugin-library/Assets/Domain/Test/HotUpdate/Application/UIViews/UILoginView.cs
2025-09-24 15:34:24 +08:00

106 lines
3.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;
using TMPro;
using System.Collections;
namespace Stary.Evo
{
public class UITestItem : UILoopItem
{
#region
#pragma warning disable 0649
[ControlBinding] private TextMeshProUGUI Text;
[ControlBinding] private Button Button;
[ControlBinding] private GameObject Select;
#pragma warning restore 0649
#endregion
public override void OnInit()
{
base.OnInit();
Button.AddClick(() => { UIScrollView.Select(Index); });
}
public override void CheckSelect(int index)
{
base.CheckSelect(index);
Select.SetActive(index == Index);
}
protected override void OnUpdateData(IList dataList, int index, object userData)
{
base.OnUpdateData(dataList, index, userData);
Text.text = dataList[index].ToString();
}
}
public class UILoginView : UIView
{
#region
#pragma warning disable 0649
[ControlBinding] private Button ButtonStart;
[ControlBinding] private Button ButtonSetting;
[ControlBinding] private UIScrollView UIScrollView;
[ControlBinding] private GameObject Item;
[ControlBinding] private RawImage RawImage;
#pragma warning restore 0649
#endregion
public override void OnInit(UIControlData uIControlData, UIViewController controller)
{
base.OnInit(uIControlData, controller);
ButtonStart.AddClick(() =>
{
UIManager.Instance.Open<UIMessageBoxView>(ObjectPool<MessageBoxData>.Get()
.Set("提示", "测试弹窗。", () => { Debug.Log("确认"); }));
});
ButtonSetting.AddClick(() => { UIManager.Instance.Open<UITestView>(); });
UIScrollView.OnSelectChanged += (index) => { Debug.Log("选中了:" + index); };
}
public override void OnOpen(object userData)
{
base.OnOpen(userData);
// 模拟100个数据
List<int> list = new List<int>();
for (int i = 0; i < 100; i++)
{
list.Add(i);
}
UIScrollView.UpdateList(list, Item, typeof(UITestItem));
UIScrollView.Select(10);
UIModelManager.Instance.LoadModelToRawImage("Assets/UI/UISystemPackage/TestModel.prefab", RawImage,
scale: Vector3.one * 6, isOrth: false, orthSizeOrFOV: 60);
}
public override void OnAddListener()
{
base.OnAddListener();
}
public override void OnRemoveListener()
{
base.OnRemoveListener();
}
public override void OnClose()
{
base.OnClose();
UIModelManager.Instance.UnLoadModelByRawImage(RawImage);
}
}
}