53 lines
1.2 KiB
C#
53 lines
1.2 KiB
C#
using System;
|
|
using Steamworks;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class WaitingPanel : MonoBehaviour
|
|
{
|
|
public TournamentManager.CTournament tournament;
|
|
|
|
public PlayerTournamentItem currentViewTournament;
|
|
|
|
[SerializeField]
|
|
private Text timerText;
|
|
|
|
[SerializeField]
|
|
private Button EndNowButton;
|
|
|
|
private bool isTournamentDone;
|
|
|
|
private void Start()
|
|
{
|
|
}
|
|
|
|
private void FixedUpdate()
|
|
{
|
|
if (tournament.timeStart == 0L)
|
|
{
|
|
float num = Mathf.Clamp(300 - tournament.timeCreate, 0, 300);
|
|
TimeSpan timeSpan = TimeSpan.FromSeconds(num);
|
|
timerText.text = $"{timeSpan.Minutes:D2}:{timeSpan.Seconds:D2}";
|
|
if (tournament.creatorPlayerId == SteamUser.GetSteamID().m_SteamID.ToString())
|
|
{
|
|
EndNowButton.gameObject.SetActive(value: true);
|
|
}
|
|
else
|
|
{
|
|
EndNowButton.gameObject.SetActive(value: false);
|
|
}
|
|
if (num == 0f && !isTournamentDone)
|
|
{
|
|
GameManager.Instance._playerData.AddSubPlayerCashValue(tournament.entryFee);
|
|
ServerManager.Instance.DeletePlayerTournament(tournament.id);
|
|
isTournamentDone = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void RemoveTournament()
|
|
{
|
|
UnityEngine.Object.FindObjectOfType<PlayerTournamentItem>().DeleteTournament();
|
|
}
|
|
}
|