2021-04-15 10:13:01 +08:00
|
|
|
|
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 SeletedPlayerScript :MonoBehaviour
|
|
|
|
|
|
{
|
|
|
|
|
|
private RawImage Head;
|
|
|
|
|
|
private Button Close;
|
|
|
|
|
|
private Text Name;
|
|
|
|
|
|
private string RankingId;
|
|
|
|
|
|
public bool isUsed = false;
|
|
|
|
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
|
|
{
|
|
|
|
|
|
Head = transform.GetComponent<RawImage>();
|
|
|
|
|
|
Name = transform.Find("Name").GetComponent<Text>();
|
|
|
|
|
|
Close = transform.Find("CloseButton").GetComponent<Button>();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
public Button GetButton()
|
|
|
|
|
|
{
|
|
|
|
|
|
return Close;
|
|
|
|
|
|
}
|
|
|
|
|
|
public string GetRankingId()
|
|
|
|
|
|
{
|
|
|
|
|
|
return RankingId;
|
|
|
|
|
|
}
|
|
|
|
|
|
public void SetName(string name)
|
|
|
|
|
|
{
|
|
|
|
|
|
Name.text = name;
|
2021-04-25 13:33:43 +08:00
|
|
|
|
Name.color = new Color(1, 1, 1, 1);
|
2021-04-15 10:13:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
public void SetRankingId(string id)
|
|
|
|
|
|
{
|
|
|
|
|
|
RankingId = id;
|
|
|
|
|
|
}
|
|
|
|
|
|
public void Reset()
|
|
|
|
|
|
{
|
|
|
|
|
|
Close.gameObject.SetActive(false);
|
|
|
|
|
|
isUsed = false;
|
|
|
|
|
|
Name.text = "New Shadow";
|
|
|
|
|
|
var defaultexture = Resources.Load<Sprite>("Images/New Account").texture;
|
|
|
|
|
|
Head.texture = defaultexture;
|
|
|
|
|
|
RankingId = string.Empty;
|
|
|
|
|
|
}
|
|
|
|
|
|
public void SetHead(Texture texture, bool select)
|
|
|
|
|
|
{
|
|
|
|
|
|
Close.gameObject.SetActive(select);
|
|
|
|
|
|
isUsed = select;
|
|
|
|
|
|
Head.texture = texture;
|
|
|
|
|
|
var rect = ((RectTransform)Head.transform).rect;
|
|
|
|
|
|
Material material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
|
|
|
|
|
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
|
|
|
|
|
|
Head.material = material;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|