示例#1
0
        public virtual void Start(StartGameParameters parameters)
        {
            Calendar = new Calendar( );

            GameRule = parameters.EnviromentSetting;

            StartMoney = parameters.StartMoney;

            GameLenth = parameters.GameTime;

            foreach (Tuple <PlayerModelProxy, PlayerConsole> item in parameters.PlayerConfig)
            {
                Player player = new Player(item.Item1.Model, StartMoney);
                player.BankruptcyEvent += OnPlayerBankruptcy;
                GamePlayers.Add(player);
                break;
            }

            Calendar = new Calendar( );

            Map = parameters.Map;

            StockMarket = new StockMarket( );

            WinningCondition = parameters.WinningCondition;

            Status = GameStatus.Playing;
        }
示例#2
0
 public void AddPlayer(Player newPlayer)
 {
     if (newPlayer != null && newPlayer.PlayerClient != null)
     {
         newPlayer.InitMap(SizeX, SizeY);
         newPlayer.PlayerClient.GiveMapSizeToClient(SizeX, SizeY);
         GamePlayers.Add(newPlayer.PlayerClient.ClientName, newPlayer);
     }
 }
示例#3
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="gameInput"></param>
        /// <returns></returns>
        public async override Task <bool> Init(GameInput gameInput)
        {
            if (!IsFullPlayer)
            {
                return(false);
            }
            if (GamePlayers.Count > 0)
            {
                return(true);
            }
            int index = 1;

            foreach (var item in BaseInfos)
            {
                GamePlayers.Add(new FiveGamePlayer()
                {
                    PlayerId = item.Id, PlayerNickName = item.Name, Number = 0, Index = index++
                });
            }
            DoPlayer = GamePlayers[this.Random.Next(0, GamePlayers.Count)] as FiveGamePlayer;

            UpdatePlayerInfo(0, 0, false, true);
            return(true);
        }
示例#4
0
 public Game(Player player1, Player player2) : this()
 {
     GamePlayers.Add(player1);
     GamePlayers.Add(player2);
 }