_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Battle_Royale/ListItem.cs

62 lines
1.6 KiB
C#
Raw Normal View History

2024-11-25 21:25:28 +08:00
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class ListItem : MonoBehaviour
{
public int list;
public TextMeshProUGUI listText;//<2F><><EFBFBD><EFBFBD>
public Image listImage;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼƬ
public Image headImage;//ͷ<><CDB7>
public TextMeshProUGUI nameText;//<2F><><EFBFBD><EFBFBD>
public TextMeshProUGUI numText;//<2F><>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public Image Bg;//<2F><><EFBFBD><EFBFBD>ͼƬ
public string headPath;//ͷ<><CDB7>·<EFBFBD><C2B7>
2024-11-25 21:25:28 +08:00
void Start()
{
SetListImage();
ListBgImage();
2024-11-25 21:25:28 +08:00
}
2024-11-26 16:28:30 +08:00
2024-11-25 21:25:28 +08:00
public void SetListImage()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD><EFBFBD>ɫ
{
if (list == 1)
{
listImage.sprite = Resources.Load<Sprite>("bgYello");
2024-11-26 16:28:30 +08:00
nameText.color = new UnityEngine.Color(246/255f, 194/255f, 146 / 255f);
2024-11-25 21:25:28 +08:00
}
else if (list == 2)
{
listImage.sprite = Resources.Load<Sprite>("bgGreen");
2024-11-26 16:28:30 +08:00
nameText.color = new UnityEngine.Color(201 / 255f, 208/255f, 144 / 255f);
2024-11-25 21:25:28 +08:00
}
else if (list == 3)
{
listImage.sprite = Resources.Load<Sprite>("bgBlue");
2024-11-26 16:28:30 +08:00
nameText.color = new UnityEngine.Color(144/255f, 206 / 255f, 208/255f);
2024-11-25 21:25:28 +08:00
}
else
{
listImage.sprite = Resources.Load<Sprite>("bgred");
}
}
public void ListBgImage()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD><EFBFBD>ɫ
{
if (list!=1&&list%2==0)//ż<><C5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
Bg.sprite = Resources.Load<Sprite>("bgbuleT");
}
else
{
Bg.sprite = Resources.Load<Sprite>("bgWhite");
}
2024-11-25 21:25:28 +08:00
}
}