public LeagueTeamCollection CreateLeagueTeamCollection(string leagueName, string leagueKey)
 {
     var league = new League(1, leagueName, leagueKey, 1, 16);
     var teamCollection = new TeamCollection();
     teamCollection.Add(new Team(1, "team_key", "team_name"));
     return new LeagueTeamCollection(league, teamCollection);
 }
Пример #2
0
        private void ImportButton_Click(object sender, EventArgs e)
        {
            var fileName = GetSelectedSavedGame();
            var filePath = BuildSavedGameFilePath(fileName);

            using (var savedGameConnection = new SavedGameConnection(filePath))
            {
                // Import from file
                var teams = new TeamCollection();
                for (var id = 0; id < TeamCount; id++)
                {
                    var valueMapping = new Data.ValueMapping.SavedGame.Team.Team(id);
                    var team         = new Team
                    {
                        Id   = id,
                        Name = Encoding.ASCII.GetString(savedGameConnection.ReadByteArray(valueMapping.Name, Data.ValueMapping.SavedGame.Team.Team.NameLength)),

                        Department1Motivation = savedGameConnection.ReadInteger(valueMapping.Department1Motivation),
                        Department1Happiness  = savedGameConnection.ReadInteger(valueMapping.Department1Happiness),
                        Department2Motivation = savedGameConnection.ReadInteger(valueMapping.Department2Motivation),
                        Department2Happiness  = savedGameConnection.ReadInteger(valueMapping.Department2Happiness),
                        Department3Motivation = savedGameConnection.ReadInteger(valueMapping.Department3Motivation),
                        Department3Happiness  = savedGameConnection.ReadInteger(valueMapping.Department3Happiness),
                        Department4Motivation = savedGameConnection.ReadInteger(valueMapping.Department4Motivation),
                        Department4Happiness  = savedGameConnection.ReadInteger(valueMapping.Department4Happiness),
                        Department5Motivation = savedGameConnection.ReadInteger(valueMapping.Department5Motivation),
                        Department5Happiness  = savedGameConnection.ReadInteger(valueMapping.Department5Happiness)
                    };
                    teams.Add(team);
                }

                var player1TeamId     = savedGameConnection.ReadInteger(Data.ValueMapping.SavedGame.Player.Player.GetPlayer1TeamIdOffset()) - 1;
                var player1TeamRecord = teams.Single(x => x.Id == player1TeamId);

                // Populate controls
                PopulateHeaderControls(player1TeamId, player1TeamRecord.Name);
                PopulateBasicControls(player1TeamRecord);
                PopulateAdvancedControls(teams);

                MessageBox.Show("Import complete!");
            }
        }