Ejemplo n.º 1
0
        public void OnSnapshotReceived(JUMPCommand_Snapshot data)
        {
            WordsWar_Snapshot snap = new WordsWar_Snapshot(data.CommandData);

            GameStatus.text    = snap.Stage.ToString();
            MyScore.text       = snap.MyScore.ToString();
            OpponentScore.text = snap.OpponentScore.ToString();
            UIStage            = snap.Stage;
            if (UIStage == WordsWarGameStages.SendBoardID)
            {
                Message.text = "Receiving board .. " + snap.BoardID.ToString();
                BoardSol     = BoardManager.GetBoard(snap.BoardID);

                Board.text = BoardSol.SolvedBoard.ToString().ToUpper();  // "Playing Board: " + snap.BoardID.ToString();
                WordsWarCommand_BoardReceived ack = new WordsWarCommand_BoardReceived(JUMPMultiplayer.PlayerID, snap.BoardID);
                Singleton <JUMPGameClient> .Instance.SendCommandToServer(ack);
            }
            else if (UIStage == WordsWarGameStages.CountingDown)
            {
                TimeLeft.text = snap.CountingDownRemaining.ToString("0.");
            }
            else if (UIStage == WordsWarGameStages.Playing)
            {
                TimeLeft.text = snap.PlayTimeRemaining.ToString("0.");
            }
            else if (UIStage == WordsWarGameStages.GameOver)
            {
                Message.text = (snap.WinnerPlayerID == JUMPMultiplayer.PlayerID) ? "You Won :)" : "You Lost :(";
            }
        }
Ejemplo n.º 2
0
        public static BoardSolution GetBoard(int boardID)
        {
            string        json = jsonSample;
            BoardSolution sol  = JsonUtility.FromJson <BoardSolution>(json);

            sol.SolvedBoard.Board[0, 0] = 'n';
            sol.SolvedBoard.Board[0, 1] = 'a';
            sol.SolvedBoard.Board[0, 2] = 't';
            sol.SolvedBoard.Board[0, 3] = 'e';
            sol.SolvedBoard.Board[1, 0] = 'i';
            sol.SolvedBoard.Board[1, 1] = 'r';
            sol.SolvedBoard.Board[1, 2] = 'r';
            sol.SolvedBoard.Board[1, 3] = 'a';
            sol.SolvedBoard.Board[2, 0] = 'n';
            sol.SolvedBoard.Board[2, 1] = 'w';
            sol.SolvedBoard.Board[2, 2] = 'w';
            sol.SolvedBoard.Board[2, 3] = 's';
            sol.SolvedBoard.Board[3, 0] = 'h';
            sol.SolvedBoard.Board[3, 1] = 'n';
            sol.SolvedBoard.Board[3, 2] = 'o';
            sol.SolvedBoard.Board[3, 3] = 'd';

            return(sol);
        }