Esempio n. 1
0
 public static PreGameSpecs tournamentInfoToGameSpecs(TournamentInfoMsg info)
 {
     PreGameSpecs specs = generateGameSpecs(info.type, "Admin", false, false);
     specs.isInTournament = true;
     specs.tournamentID = info.tournamentID;
     return specs;
 }
Esempio n. 2
0
 private static void handleTournamentStarted(IIncommingMessage rawMsg)
 {
     storedUpdates.Clear();
     ClientUIStateManager.requestGotoState(ClientUIStates.PlayingTournament, () => {
         storedInitMsg = rawMsg.Deserialize <TournamentInfoMsg>();
         initCurrentTree(storedInitMsg);
     });
 }
        public static void onTournamentStarted(TournamentInfoMsg tournamentInfo)
        {
            singleton.tournamentInfo = tournamentInfo;
            singleton.allUpdates.Clear();
            singleton.runningTournament = true;

            initVisualTree(tournamentInfo);
        }
        public void updateAdmin()
        {
            TournamentInfoMsg infoMsg = new TournamentInfoMsg()
            {
                players = gameInfo.players.Select(p => p.info).ToArray()
            };

            gameInfo.admin.SendMessage((short)CustomMasterServerMSG.preTournamentUpdate, infoMsg);
        }
 private static void initVisualTree(TournamentInfoMsg tournamentInfo)
 {
     singleton.currentTree = GameObject.FindGameObjectWithTag("GameController").GetComponent <VisualTournamentTree>();
     singleton.currentTree.init(tournamentInfo.players, ServerUtils.tournamentInfoToGameSpecs(tournamentInfo), tournamentInfo.doubleElimination);
     foreach (TournamentTreeUpdate u in singleton.allUpdates)
     {
         singleton.currentTree.updateRounds(u.rounds, false);
     }
     singleton.currentTree.renderVisualTree();
 }
 public PreTournamentGame(TournamentInfoMsg specs, IPeer admin, string roomID)
 {
     specs.tournamentID = roomID;
     gameInfo           = new TournamentGameInfo()
     {
         admin             = admin, roomID = roomID, specs = specs,
         connectedPeers    = new List <IPeer>(),
         players           = new List <TournamentPlayer>(),
         hostName          = "Admin",
         doubleElimination = specs.doubleElimination
     };
 }
        private void handleTournamentStarted(ResponseStatus status, IIncommingMessage msg)
        {
            if (status != ResponseStatus.Success)
            {
                Debug.LogError(msg.AsString());
                return;
            }

            TournamentInfoMsg specMsg = msg.Deserialize <TournamentInfoMsg>();

            AdminUIManager.requestGotoState(ClientUI.ClientUIStates.PlayingTournament, () => {
                AdminRunningTournamentManager.onTournamentStarted(specMsg);
            });
        }
        public void createButtonPressed()
        {
            if (waitingForResponse)
            {
                return;
            }
            TournamentInfoMsg msg = new TournamentInfoMsg()
            {
                type = Game.GameType.Snake, maxPlayers = 128, doubleElimination = true
            };

            Msf.Connection.SendMessage((short)CustomMasterServerMSG.createTournament, msg, handleTournamentCreated);
            waitingForResponse = true;
        }
        public void handleCreateTournament(IIncommingMessage rawMsg)
        {
            IPeer peer = rawMsg.Peer;

            if (SpectatorAuthModule.existsAdmin(peer) == false)
            {
                rawMsg.Respond("You don't have admin permission", ResponseStatus.Failed);
                return;
            }

            TournamentInfoMsg msg           = rawMsg.Deserialize <TournamentInfoMsg>();
            string            key           = generateGameKey();
            PreTournamentGame newTournament = new PreTournamentGame(msg, peer, key);

            currentPreTournaments.Add(key, newTournament);
            addPlayerToPeerToTournaments(rawMsg.Peer, newTournament);
            rawMsg.Respond(key, ResponseStatus.Success);
            newTournament.updateAdmin();
            Debug.LogError("Created Tournament: " + key + " With admin: " + rawMsg.Peer.Id);
        }
        public void handlePreTournamentUpdate(IIncommingMessage rawMsg)
        {
            TournamentInfoMsg info = rawMsg.Deserialize <TournamentInfoMsg>();

            showList(info.players);
        }
Esempio n. 11
0
 private static void initCurrentTree(TournamentInfoMsg infoMsg)
 {
     currentTree = GameObject.FindGameObjectWithTag("GameController").GetComponent <VisualTournamentTree>();
     currentTree.init(infoMsg.players, ServerUtils.tournamentInfoToGameSpecs(infoMsg), infoMsg.doubleElimination);
     isInTournament = true;
 }
 public static void gotTournamentUpdate(TournamentInfoMsg msg)
 {
     singleton.tournamentInfo = msg;
 }