Gonna move to server authority

This commit is contained in:
2022-01-31 17:27:38 +05:30
parent f3d21f4ec6
commit 7368968176
1354 changed files with 107808 additions and 80043 deletions

View File

@@ -1,44 +1,44 @@
using System;
using UnityEngine;
using UnityEngine.UI;
namespace Mirror.Examples.MultipleMatch
{
public class MatchGUI : MonoBehaviour
{
Guid matchId;
[Header("GUI Elements")]
public Image image;
public Toggle toggleButton;
public Text matchName;
public Text playerCount;
[Header("Diagnostics - Do Not Modify")]
public CanvasController canvasController;
public void Awake()
{
canvasController = FindObjectOfType<CanvasController>();
toggleButton.onValueChanged.AddListener(delegate { OnToggleClicked(); });
}
public void OnToggleClicked()
{
canvasController.SelectMatch(toggleButton.isOn ? matchId : Guid.Empty);
image.color = toggleButton.isOn ? new Color(0f, 1f, 0f, 0.5f) : new Color(1f, 1f, 1f, 0.2f);
}
public Guid GetMatchId()
{
return matchId;
}
public void SetMatchInfo(MatchInfo infos)
{
matchId = infos.matchId;
matchName.text = "Match " + infos.matchId.ToString().Substring(0, 8);
playerCount.text = infos.players + " / " + infos.maxPlayers;
}
}
}
using System;
using UnityEngine;
using UnityEngine.UI;
namespace Mirror.Examples.MultipleMatch
{
public class MatchGUI : MonoBehaviour
{
Guid matchId;
[Header("GUI Elements")]
public Image image;
public Toggle toggleButton;
public Text matchName;
public Text playerCount;
[Header("Diagnostics - Do Not Modify")]
public CanvasController canvasController;
public void Awake()
{
canvasController = FindObjectOfType<CanvasController>();
toggleButton.onValueChanged.AddListener(delegate { OnToggleClicked(); });
}
public void OnToggleClicked()
{
canvasController.SelectMatch(toggleButton.isOn ? matchId : Guid.Empty);
image.color = toggleButton.isOn ? new Color(0f, 1f, 0f, 0.5f) : new Color(1f, 1f, 1f, 0.2f);
}
public Guid GetMatchId()
{
return matchId;
}
public void SetMatchInfo(MatchInfo infos)
{
matchId = infos.matchId;
matchName.text = $"Match {infos.matchId.ToString().Substring(0, 8)}";
playerCount.text = $"{infos.players} / {infos.maxPlayers}";
}
}
}