_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/HistoryPanel.cs

76 lines
2.2 KiB
C#
Raw Normal View History

2024-11-20 02:41:39 +08:00
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class HistoryPanel : BasePanel
{
public Button returnBtn;
public List<HistoryItem> KillTimesList;//100<30>λ<EFBFBD>ɱͳ<C9B1><CDB3>
public GameObject historyItemPre;//<2F><>ƷԤ<C6B7><D4A4><EFBFBD><EFBFBD>
public Transform ItemPreGrid;//Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD>
public List<GameObject> ItemList;
public override void Start()
{
base.Start();
returnBtn.onClick.AddListener(OnClickReBtn);
}
public void OnClickReBtn()
{
HidePanel();
}
public void SetKilledText(gameEscapeRoomKillCountResponseVo gameKill)//<2F><>100<30>α<EFBFBD>ɱ<EFBFBD><C9B1>¼<EFBFBD><C2BC><EFBFBD>ı<EFBFBD><C4B1>޸ķ<DEB8><C4B7><EFBFBD>
{
for (int i=0;i<KillTimesList.Count;i++)
{
if (KillTimesList[i].roomNo == gameKill.roomNo)
{
KillTimesList[i].TextPro.text = gameKill.kill+"<22><>";//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
}
}
}
public void SetKillHouse(gameEscapeModel gameEscapeModelList)//<2F><>¼<EFBFBD><C2BC>10<31>α<EFBFBD><CEB1><EFBFBD>ɱ<EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>
{
string[] parts = gameEscapeModelList.roomNoKill.Split(","); // <20><><EFBFBD><EFBFBD> ',' <20>ָ<EFBFBD><D6B8>ַ<EFBFBD><D6B7><EFBFBD>d
Debug.Log("jiijojjiijjiijijij" + gameEscapeModelList.roomNoKill+"---------------");
foreach (string part in parts)
{
foreach (HistoryItem item in KillTimesList)
{
if (item.roomNo==int.Parse(part))
{
historyItemPre.GetComponent<HistoryItem>().nameTextPro.text = item.nameTextPro.text;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
historyItemPre.GetComponent<HistoryItem>().TextPro.text=item.TextPro.text;//<2F><>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD>
historyItemPre.GetComponent<HistoryItem>().image.sprite=item.sprite;//<2F><><EFBFBD><EFBFBD>ͼƬ
if (ItemList.Count>10)
{
for (int i=0;i<10;i++)
{
Destroy(ItemList[i]);
ItemList.Remove(ItemList[i]);
}
}
ItemList.Add(Instantiate(historyItemPre, ItemPreGrid));
//break;
}
}
}
}
}