You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
832 B
28 lines
832 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using Unity.Services.Lobbies.Models;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class EventButton : MonoBehaviour
|
|
{
|
|
[SerializeField] private Button button;
|
|
[SerializeField] private TMP_Text eventName;
|
|
[SerializeField] private TMP_Text locationName;
|
|
[SerializeField] private TMP_Text playersCount;
|
|
[SerializeField] private TMP_Text ownerName;
|
|
|
|
public void Initialize(Lobby lobby)
|
|
{
|
|
eventName.text = lobby.Name;
|
|
locationName.text = lobby.Data["location"].Value;
|
|
playersCount.text = $"{lobby.Players.Count}/{lobby.MaxPlayers}";
|
|
ownerName.text = lobby.Data["owner"].Value;
|
|
|
|
button.onClick.AddListener(() =>
|
|
{
|
|
EventManager.Instance.JoinEvent(lobby);
|
|
});
|
|
}
|
|
}
|
|
|