コード例 #1
0
 private void GameUpdateBroadcast(Game game)
 {
     Dictionary<byte, object> parameter = new Dictionary<byte, object>
     {
         {(byte)MonopolyGameStatusChangeBroadcastParameterItem.GameDataString, JsonConvert.SerializeObject(game.Serialize(), new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto }) }
     };
     List<Peer> peers = new List<Peer>();
     foreach (ServerUser targetUser in (game as ServerGame).users)
     {
         peers.Add(targetUser.Peer);
     }
     server.Broadcast(peers.ToArray(), BroadcastType.MonopolyGameStatusChange, parameter);
 }
コード例 #2
0
 public override void LeaveGame()
 {
     base.LeaveGame();
     playingGame = null;
 }
コード例 #3
0
 public override void JoinGame(Game game, int startMoney)
 {
     base.JoinGame(game, startMoney);
     playingGame = game;
 }
コード例 #4
0
 public virtual void JoinGame(Game game, int startMoney)
 {
     money = startMoney;
     inGame = true;
 }
コード例 #5
0
 public void JoinGame(Game game, int startMoney)
 {
     playingGame = game;
     money = startMoney;
     inGame = true;
 }
コード例 #6
0
 static void Main(string[] args)
 {
     List<Player> players =  new List<Player>()
                             {
                                 new Player(0,"player1"),
                                 new Player(1,"player2")
                             };
     game = new Game(20000, players);
     foreach(Block block in game.map.blocks)
     {
         block.OnTokenPlaceInto += TokenInto;
         if (block is LandBlock)
         {
             block.OnTokenPlaceInto += PayForTollEventTask;
             block.OnTokenPlaceInto += UpgradeLandSelectionEventTask;
             block.OnTokenPlaceInto += BuyLandSelectionEventTask;
         }
         else if (block is StartBlock)
         {
             block.OnTokenPass += PassStartBlockEventTask;
         }
         else if (block is CardBlock)
         {
             block.OnTokenPlaceInto += DrawCardEventTask;
         }
     }
     Console.WriteLine("Game start....");
     string cmd;
     int steps;
     while(!game.gameOverFlag)
     {
         foreach(Player player in game.players)
         {
             Console.WriteLine(player.username+"'s turn. input roll to roll a dice");
             while ((cmd = Console.ReadLine()) != "roll")
             {
                 switch (cmd)
                 {
                     case "status":
                         {
                             PrintPlayerData(player);
                             break;
                         }
                     case "all":
                         {
                             PrintAllPlayer(players);
                             break;
                         }
                 }
             }
             steps = game.RollDice();
             Console.WriteLine("move {0} steps",steps);
             player.Move(steps);
         }
     }
 }
コード例 #7
0
ファイル: Map.cs プロジェクト: DSobscure/MonopolyOnlineGame
 public Map(Game game)
 {
     this.game = game;
 }