106 lines
2.0 KiB
C#
106 lines
2.0 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using Animancer;
|
||
using Logic;
|
||
using Logic.Action;
|
||
using Logic.AI;
|
||
using Logic.Audio;
|
||
using Logic.Multilingual;
|
||
using ParadoxNotion;
|
||
using RuntimeData;
|
||
using Steamworks;
|
||
using TH1_Core.Events;
|
||
using TH1_Core.Managers;
|
||
using TH1_Logic.Action;
|
||
using TH1_Logic.Config;
|
||
using TH1_Logic.Core;
|
||
using TH1_Logic.Net;
|
||
using TH1_Logic.Steam;
|
||
using TH1_UI.View.Announce;
|
||
using TH1Resource;
|
||
using TMPro;
|
||
using Unity.VisualScripting;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
|
||
namespace TH1_UI.View.Outside
|
||
{
|
||
|
||
|
||
public class UIOutsideHistoryView : Base.View
|
||
{
|
||
[Header("按钮")]
|
||
//public Button CloseButton;
|
||
public Button CloseButton;
|
||
|
||
|
||
public Transform ItemList;
|
||
|
||
|
||
public GameObject ItemPrefab;
|
||
|
||
//关闭时执行的委托
|
||
public ViDelegateAssisstant.Dele OnBtnCloseClick;
|
||
|
||
private List<UIOutsideHistoryItemMono> _items = new List<UIOutsideHistoryItemMono>();
|
||
|
||
protected override void OnInit()
|
||
{
|
||
base.OnInit();
|
||
CloseButton.onClick.RemoveAllListeners();
|
||
CloseButton.onClick.AddListener(OnClose);
|
||
}
|
||
|
||
|
||
private void SetItemList()
|
||
{
|
||
var dataSize = GameRecordManager.Instance.GameRecordData.Records.Count;
|
||
var dataList = GameRecordManager.Instance.GameRecordData.Records;
|
||
if (dataSize > 100) dataSize = 100;
|
||
while (_items.Count < dataSize)
|
||
{
|
||
var obj = Instantiate(ItemPrefab, ItemList);
|
||
var cpn = obj?.GetComponent<UIOutsideHistoryItemMono>();
|
||
if (cpn == null) break;
|
||
_items.Add(cpn);
|
||
}
|
||
|
||
for (int i = 0; i < _items.Count; i++)
|
||
{
|
||
_items[i].gameObject.SetActive(i < dataSize);
|
||
_items[i].SetContent(dataList[i]);
|
||
}
|
||
}
|
||
|
||
public void SetContent(ShowUIOutsideHistory evt)
|
||
{
|
||
SetItemList();
|
||
|
||
//如果数量不够,先clone row补足
|
||
|
||
|
||
}
|
||
|
||
//在Controller 调用Close的时候,会先调用这个closeview
|
||
public void OnCloseView()
|
||
{
|
||
}
|
||
|
||
public void OnSettingClicked()
|
||
{
|
||
}
|
||
|
||
public void OnStartClicked()
|
||
{
|
||
EventManager.Publish(new ShowUIOutsideSelect());
|
||
}
|
||
|
||
|
||
public void OnClose()
|
||
{
|
||
OnBtnCloseClick.Invoke();
|
||
}
|
||
}
|
||
|
||
}
|