Ejemplo n.º 1
0
 /// <summary>
 /// Default Constructor
 /// </summary>
 /// <param name="game">Allsrv's IAGCGame interface</param>
 public Game(IAGCGame game)
 {
     _game     = game;
     _gameID   = game.GameID;
     _gameData = new GameData(game.Name, game.GameParameters.IGCStaticFile, GameSettingsHelper.GetMapName(game),
                              game.GameParameters.IsSquadGame, game.GameParameters.IsGoalConquest,
                              game.GameParameters.IsGoalTeamKills, game.GameParameters.GoalTeamKills,
                              game.GameParameters.AllowFriendlyFire, game.GameParameters.ShowMap,
                              game.GameParameters.AllowDevelopments, game.GameParameters.AllowShipyardPath,
                              game.GameParameters.AllowDefections, game.GameParameters.InvulnerableStations,
                              game.GameParameters.ScoresCount, game.GameParameters.MaxImbalance, game.GameParameters.StartingMoney,
                              game.GameParameters.He3Density, GameSettingsHelper.GetResources(game),
                              DateTime.FromOADate(game.GameParameters.TimeStart), DateTime.FromOADate(game.GameParameters.TimeStart));
     _gameEndedMRE = new ManualResetEvent(false);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Copies all game/team parameters into this game's GameData object
        /// </summary>
        /// <param name="startTime">The time this game started</param>
        public void Start(DateTime startTime)
        {
            // Create
            _gameData.Initialize(_game.Name, _game.GameParameters.IGCStaticFile, GameSettingsHelper.GetMapName(_game),
                                 _game.GameParameters.IsSquadGame, _game.GameParameters.IsGoalConquest,
                                 _game.GameParameters.IsGoalTeamKills, _game.GameParameters.GoalTeamKills,
                                 _game.GameParameters.AllowFriendlyFire, _game.GameParameters.ShowMap,
                                 _game.GameParameters.AllowDevelopments, _game.GameParameters.AllowShipyardPath,
                                 _game.GameParameters.AllowDefections, _game.GameParameters.InvulnerableStations,
                                 _game.GameParameters.ScoresCount, _game.GameParameters.MaxImbalance, _game.GameParameters.StartingMoney,
                                 _game.GameParameters.He3Density, GameSettingsHelper.GetResources(_game),
                                 DateTime.FromOADate(_game.GameParameters.TimeStart), DateTime.FromOADate(_game.GameParameters.TimeStart));

            _gameData.InitializeTeamCount(_game.Teams.Count);
            string CommanderName = string.Empty;

            for (int i = 0; i < _game.Teams.Count; i++)
            {
                object   Index = i;
                IAGCTeam Team  = _game.Teams.get_Item(ref Index);

                CommanderName = GetCommander(Team);
                _gameData.InitializeTeam(i, Team.Name, Team.Civ, CommanderName);

                // Add team members to data
                for (int j = 0; j < Team.Ships.Count; j++)
                {
                    object   ShipIndex = j;
                    IAGCShip Ship      = Team.Ships.get_Item(ref ShipIndex);
                    if (IsHuman(Ship))
                    {
                        _gameData.AddTeamMember(Ship.Name, i, startTime);
                    }
                }
            }
        }