64 lines
1.6 KiB
C#
64 lines
1.6 KiB
C#
using Assets.Scenes.Ride.Scripts;
|
|
using Assets.Scripts;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
class GameRoomLoadingItem : MonoBehaviour
|
|
{
|
|
public GameObject loadingIcon;
|
|
public GameObject doneIcon;
|
|
|
|
public Text nameLoading;
|
|
public Text nameDone;
|
|
public Text nameMyself;
|
|
|
|
public RawImage headImage;
|
|
public RawImage countryImage;
|
|
|
|
public int UserId { get; set; }
|
|
public int RoomId { get; set; }
|
|
public string Name { get; set; }
|
|
public double Process { get; set; }
|
|
|
|
float timer = 0;
|
|
private void Update()
|
|
{
|
|
timer -= Time.deltaTime;
|
|
while (timer < 0)
|
|
{
|
|
var process = MapUDPService.GetRoomProcess(UserId,RoomId);
|
|
loadingIcon.SetActive(process < 100);
|
|
doneIcon.SetActive(process >= 100);
|
|
|
|
if (UserId == App.CurrentUser.Id)
|
|
{
|
|
nameMyself.gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
nameLoading.gameObject.SetActive(process < 100);
|
|
nameDone.gameObject.SetActive(process >= 100);
|
|
}
|
|
|
|
timer += 1f;
|
|
}
|
|
}
|
|
public void Init(int userId,string name,string head,string country,int roomId,double process)
|
|
{
|
|
UserId = userId;
|
|
Name = name;
|
|
RoomId = roomId;
|
|
Process = process;
|
|
|
|
nameMyself.text = Name;
|
|
nameDone.text = Name;
|
|
nameLoading.text = Name;
|
|
|
|
countryImage.texture = UIManager.Instance.loginRegOptions.GetCountryImage(country);
|
|
Utils.DisplayHead(headImage, head);
|
|
|
|
}
|
|
}
|
|
|