hahahaha
This commit is contained in:
@@ -19,6 +19,7 @@ public struct PlayerInputData : INetworkInput
|
||||
public class BasicSpawner : MonoBehaviour, INetworkRunnerCallbacks
|
||||
{
|
||||
private NetworkRunner _runner;
|
||||
private string _roomName = "Room1";
|
||||
|
||||
public LobbyManager LobbyManager;
|
||||
[SerializeField] private NetworkPrefabRef _playerPrefab;
|
||||
@@ -75,11 +76,36 @@ public class BasicSpawner : MonoBehaviour, INetworkRunnerCallbacks
|
||||
{
|
||||
if (_runner == null || !_runner.IsRunning)
|
||||
{
|
||||
if (GUI.Button(new Rect(10, 10, 250, 40), "Bắt đầu (Auto Host/Client)"))
|
||||
float width = 400;
|
||||
float height = 300;
|
||||
float x = (Screen.width - width) / 2f;
|
||||
float y = (Screen.height - height) / 2f;
|
||||
|
||||
GUI.Box(new Rect(x, y, width, height), "FUSION MULTIPLAYER");
|
||||
|
||||
float innerX = x + 20;
|
||||
float innerY = y + 40;
|
||||
float contentWidth = width - 40;
|
||||
|
||||
GUI.Label(new Rect(innerX, innerY, 100, 30), "Tên phòng:");
|
||||
_roomName = GUI.TextField(new Rect(innerX + 100, innerY, contentWidth - 100, 30), _roomName);
|
||||
|
||||
if (GUI.Button(new Rect(innerX, innerY + 50, contentWidth, 60), "VÀO PHÒNG\n(Tự động Host/Client)"))
|
||||
{
|
||||
_ = StartGame(GameMode.AutoHostOrClient);
|
||||
_ = StartGame(GameMode.AutoHostOrClient, _roomName);
|
||||
}
|
||||
GUI.Label(new Rect(10, 60, 300, 20), "Gợi ý: Mở bản Build trước, sau đó mở Unity bấm nút trên.");
|
||||
|
||||
if (GUI.Button(new Rect(innerX, innerY + 120, (contentWidth / 2) - 5, 50), "Tạo phòng\n(Host)"))
|
||||
{
|
||||
_ = StartGame(GameMode.Host, _roomName);
|
||||
}
|
||||
|
||||
if (GUI.Button(new Rect(innerX + (contentWidth / 2) + 5, innerY + 120, (contentWidth / 2) - 5, 50), "Tham gia\n(Client)"))
|
||||
{
|
||||
_ = StartGame(GameMode.Client, _roomName);
|
||||
}
|
||||
|
||||
GUI.Label(new Rect(innerX, innerY + 180, contentWidth, 50), "Gợi ý: Nhập cùng tên phòng để chơi chung.\nNếu phòng chưa có, máy sẽ tự tạo mới.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user