Exemplo n.º 1
0
    void LobbyGUI()
    {
        GUILayout.BeginArea(new Rect(100, 50, Screen.width - 200, Screen.height - 100));
        GUILayout.BeginVertical();

        foreach (var player in comSat.players)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label(player.name);
            GUILayout.Label(player.id.ToString());

            var prevColour = GUI.backgroundColor;

            if (player.team != ComSat.spectatorTeam)
            {
                GUI.backgroundColor = Utility.TeamColour(player.team);
            }
            if (GUILayout.Button(player.team == ComSat.spectatorTeam ? "Spectate" : player.team.ToString()) &&
                (comSat.isHost || player.id == comSat.localPlayerID))
            {
                comSat.SetPlayerTeam(player, (player.team + 1) % ComSat.teamCount);
            }
            GUI.backgroundColor = prevColour;

            if (comSat.isHost && player.id != 0 && GUILayout.Button("Kick"))
            {
                comSat.Kick(player);
            }
            GUILayout.EndHorizontal();
        }

        if (comSat.isHost && GUILayout.Button("Start Game"))
        {
            comSat.StartGame();
        }
        if (GUILayout.Button(comSat.isHost ? "Close Server" : "Disconnect"))
        {
            comSat.Disconnect();
        }

        if (GUILayout.Button(comSat.enableContinuousSyncCheck ? "Continuous Sync Checking Enabled (slow)" : "Continuous Sync Checking Disabled"))
        {
            comSat.enableContinuousSyncCheck = !comSat.enableContinuousSyncCheck;
        }

        StateDumpButton();
        TraceButton();

        if (comSat.isHost)
        {
            GameSpeedButtons();
        }

        GUILayout.EndVertical();
        GUILayout.EndArea();
    }