private async Task <ClosedMatch> nextMatch(StartedTournament tournament)
        {
            OpenMatch currentMatch = await tournament.getNextMatch();

            string player1Name = (await currentMatch.player1).name;
            string player2Name = (await currentMatch.player2).name;

            FinishedDuelMatch duel = await meleeMenu
                                     .setPlayerOnPort(players.Get(new PlayerID(player1Name)).meleePlayer, 1)
                                     .setPlayerOnPort(players.Get(new PlayerID(player2Name)).meleePlayer, 2)
                                     .setRandomStage()
                                     .confirm();

            if (duel.winner.name == player1Name)
            {
                currentMatch.addScore(new Score(1, 0));
            }
            else
            {
                currentMatch.addScore(new Score(0, 1));
            }
            return(await currentMatch.close());
        }
Exemplo n.º 2
0
 // Accept a match
 public void AcceptMatch(OpenMatch m)
 {
     m.accept().async (delegate(ActionMatchAccept action) {
         GetMatchStatus(m);
     });
 }
Exemplo n.º 3
0
 private void quitMatch()
 {
     match = null;
     matchLoaded = false;
     downloadMatches();
 }
Exemplo n.º 4
0
 // Send nudge to opponents in a match
 public void SendNudge(OpenMatch m)
 {
     m.sendNudge().async (delegate(ActionMatchNudge action) {
     });
 }
Exemplo n.º 5
0
        // Send a move to a match
        public void SendMove(OpenMatch m,string move)
        {
            IDictionary<string, int> _rewardItems = new Dictionary<string,int>();
            IDictionary<string, int> _attackItems = new Dictionary<string,int>();
            IDictionary<string, int> _selectedItems = new Dictionary<string,int>();

            //
             // _rewardItems.put("bomb_01", 1); _rewardItems.put("amazing_powerup",
             //* 1);
             //
            _attackItems.Add(move, 1);
            //*
             //* _selectedItems.put("bomb_01", 1);
             //* _selectedItems.put("amazing_powerup",1);
             //

            m.sendMove(match.getMoveNum(), "test attack for move: " + m.getMoveNum(),_rewardItems, _attackItems, false, _selectedItems).async(delegate(ActionMatchMove action) {
                GetMatchStatus(m);
            });
        }
Exemplo n.º 6
0
 // Send chat message to match
 public void SendChatMessage(OpenMatch m, string chatM)
 {
     m.sendChatMessage(chatMessage).async (delegate(ActionMatchChatMessage action) {
         chatMessage = "";
         GetChatMessages(m);
     });
 }
Exemplo n.º 7
0
 // Select items to be used in a move
 public void SelectItems(OpenMatch m, IDictionary<string, int> it)
 {
     m.selectItems(it,m.getMoveNum()).async (delegate(ActionMatchSelectItems action) {
     });
 }
Exemplo n.º 8
0
 // Resign a match
 public void ResignMatch(OpenMatch m)
 {
     m.resign().async (delegate(ActionMatchResign action) {
         quitMatch();
     });
 }
Exemplo n.º 9
0
 // Reject a match
 public void RejectMatch(OpenMatch m)
 {
     m.reject().async (delegate(ActionMatchReject action) {
         quitMatch();
     });
 }
Exemplo n.º 10
0
 // Gets match status
 public void GetMatchStatus(OpenMatch m)
 {
     match = m;
     match.getStatus().async (delegate(ActionMatchGetStatus action) {
         if(action.getCode () == StatusCodes.SUCCESS) {
             match = app.getUser ().getOpenMatches()[match.getMatchId()];
             message = "Match selected: " + match.getMatchId();
             userId = app.getUser ().getId ();
             matchLoaded = true;
             // load MatchInfo now
             match.actGetMoves().async (); //TODO:chbfiv do something with results?
         } else message = "Error while loading match: " + action.getStatusMessage();
         if(match.getNudged()) message = match.getOpponent().getUserName() + " has nudged you!";
         //kumakore.user ().inventory().get ().async (GetInventoryDelegate);
     });
 }
Exemplo n.º 11
0
 public void GetChatMessages(OpenMatch m)
 {
     m.actGetChatMessages().async (delegate(ActionMatchGetChatMessage action) {
     });
 }