powerfun-unity/Assets/Scenes/Ride/Scripts/RankingItemScript.cs

52 lines
1.3 KiB
C#

using Assets.Scripts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
namespace Assets.Scenes.Ride.Scripts
{
public class RankingItemScript:MonoBehaviour
{
Text rankingText;
Text nameText;
Text timerText;
RawImage head;
RawImage country;
private void Awake()
{
rankingText = transform.Find("Ranking").GetComponent<Text>();
nameText = transform.Find("Name").GetComponent<Text>();
timerText = transform.Find("Timer").GetComponent<Text>();
head = transform.Find("Head").GetComponent<RawImage>();
country = transform.Find("Country").GetComponent<RawImage>();
}
public void SetRanking(string ranking)
{
rankingText.text = ranking.PadLeft(2,'0');
}
public void SetName(string name)
{
nameText.text = name;
}
public void SetTimer(string timer)
{
timerText.text = timer;
}
public void SetHead(string url)
{
Utils.DisplayImage(head, url);
}
public void SetCountry(Texture texture)
{
country.texture = texture;
}
}
}