コード例 #1
0
        public void InitTeams()
        {
            Teams.Clear();
            foreach (TableRecordModel rec in model.TableModels[EditorModel.TEAM_TABLE].GetRecords())
            {
                if (rec.Deleted)
                {
                    continue;
                }
                TeamRecord tr = (TeamRecord)rec;
                if (tr.TeamId == 1009 || tr.TeamId == 1010 || tr.TeamId == 1011)
                {
                    continue;
                }

                if (!Teams.ContainsKey(tr.TeamId))
                {
                    Teams.Add(tr.TeamId, new Team(tr));
                }

                Team workingteam = Teams[tr.TeamId];
            }

            UpdateTeams();
        }
コード例 #2
0
        //  To do, change player's previous team
        //  check for team min/max at position etc
        public void ChangePlayersTeam(TeamRecord newTeam)
        {
            //Don't do anything if the team is same as the current players team
            if (CurrentPlayerRecord.TeamId != newTeam.TeamId)
            {
                CurrentPlayerRecord.TeamId = newTeam.TeamId;
                //Also have to ensure we update this players injuries in the injury table
                //and remove this player from any depth charts
                foreach (TableRecordModel record in model.TableModels[EditorModel.INJURY_TABLE].GetRecords())
                {
                    if (record.Deleted)
                    {
                        continue;
                    }

                    //If this injury record is for this player then update its team field
                    InjuryRecord injRecord = (InjuryRecord)record;

                    if (injRecord.PlayerId == CurrentPlayerRecord.PlayerId)
                    {
                        injRecord.TeamId = newTeam.TeamId;
                    }
                }

                RemovePlayerFromDepthChart(CurrentPlayerRecord.PlayerId);
            }
        }
コード例 #3
0
        private void filterTeamComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!isInitialising)
            {
                if (filterTeamComboBox.SelectedIndex == 0)
                {
                    model.CoachModel.FilterCoachTeam = -1;
                }
                else if (filterTeamComboBox.Text == "Free Agents")
                {
                    model.CoachModel.FilterCoachTeam = 1009;
                }
                else if (Manager.stream_model != null)
                {
                    if (filterTeamComboBox.SelectedIndex == 1)
                    {
                        model.CoachModel.FilterCoachTeam = -2;
                    }
                    else
                    {
                        model.CoachModel.FilterCoachTeam = filterTeamComboBox.SelectedIndex - 2;
                    }
                }
                else
                {
                    TeamRecord team = (TeamRecord)filterTeamComboBox.SelectedItem;
                    model.CoachModel.FilterCoachTeam = team.TeamId;
                }

                isInitialising = true;
                InitCoachList();
                isInitialising = false;
            }
        }
コード例 #4
0
ファイル: TeamRecordHandler.cs プロジェクト: jonasah/ffstats
 public static void Add(TeamRecord teamRecord)
 {
     using (var db = new FFStatsDbContext())
     {
         db.TeamRecords.Add(teamRecord);
         db.SaveChanges();
     }
 }
コード例 #5
0
        public TeamRecord GetNextTeamRecord()
        {
            TeamRecord record = null;

            int startingindex = currentTeamRecord;

            while (true)
            {
                currentTeamRecord++;

                if (currentTeamRecord == startingindex)
                {
                    //We have looped around
                    return(null);
                }

                if (currentTeamRecord >= model.TableModels[EditorModel.TEAM_TABLE].RecordCount)
                {
                    currentTeamRecord = -1;
                    continue;
                }

                record = (TeamRecord)model.TableModels[EditorModel.TEAM_TABLE].GetRecord(currentTeamRecord);

                //If this record is marked for deletion then skip it
                if (record.Deleted)
                {
                    continue;
                }

                if (currentConferenceFilterId != -1)
                {
                    if (record.ConferenceId != currentConferenceFilterId)
                    {
                        continue;
                    }
                }
                if (currentDivisionFilterId != -1)
                {
                    if (record.DivisionId != currentDivisionFilterId)
                    {
                        continue;
                    }
                }
                if (currentLeagueFilterId != -1)
                {
                    if (record.LeagueId != currentLeagueFilterId)
                    {
                        continue;
                    }
                }

                //Found one
                break;
            }

            return(record);
        }
コード例 #6
0
 private Team CreateTeam(TeamRecord record)
 {
     return(new Team
     {
         TeamId = record.TeamId,
         Name = record.Name,
         TeamMembers = _teamMemberStore.FindTeamMembers(record.TeamId),
     });
 }
コード例 #7
0
        private void CreateTeamRecords()
        {
            teamRecords = new SortedList <int, TeamRecord>();

            foreach (TableRecordModel record in model.TableModels[EditorModel.TEAM_TABLE].GetRecords())
            {
                TeamRecord tr = (TeamRecord)record;
                teamRecords.Add(tr.TeamId, tr);
            }
        }
コード例 #8
0
        private void CreateTeamNameList()
        {
            teamNameList = new Dictionary <int, string>();

            foreach (TableRecordModel record in model.TableModels[EditorModel.TEAM_TABLE].GetRecords())
            {
                TeamRecord teamRecord = (TeamRecord)record;
                teamNameList.Add(teamRecord.TeamId, teamRecord.Name);
            }

            // adding Retired for a team name for players
            teamNameList.Add(EditorModel.RETIRED_TEAM_ID, EditorModel.RETIRED);
        }
コード例 #9
0
        private void TeamComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            isInitializing = true;
            TeamRecord team = (TeamRecord)TeamComboBox.SelectedItem;

            if (team.TeamId != currentowner.TeamID)
            {
                GetOwner(team.TeamId);
                LoadFinances();
                InitWeeklyIncome();
            }
            isInitializing = false;
        }
コード例 #10
0
        public Team(TeamRecord tr)
        {
            team     = tr;
            Players  = new List <Player>();
            Coaches  = new Dictionary <int, Coach>();
            Owner_GM = new Coach();

            Evals              = new List <Player_Ratings>();
            Rookie_Scouting    = new List <Player_Ratings>();
            CoachesInterviewed = new List <int>();
            TeamAverages       = new TeamAvg();
            SeasonStats        = new Dictionary <int, TeamSeasonStatsRecord>();
            Evals_Coaches      = new Dictionary <int, double>();
        }
コード例 #11
0
        public void ComputeCONs()
        {
            List <TeamRecord> teamsTemp = new List <TeamRecord>();

            foreach (TableRecordModel record in model.TableModels[EditorModel.TEAM_TABLE].GetRecords())
            {
                TeamRecord tr = (TeamRecord)record;
                teamsTemp.Add(tr);
            }

            teamsTemp = SortByOverall(teamsTemp);

            List <int> conCutoffs = new List <int>();

            conCutoffs.Add(teamsTemp[28].GetOverall());
            conCutoffs.Add(teamsTemp[22].GetOverall());
            conCutoffs.Add(teamsTemp[14].GetOverall());
            conCutoffs.Add(teamsTemp[6].GetOverall());

            foreach (TableRecordModel record in model.TableModels[EditorModel.TEAM_TABLE].GetRecords())
            {
                TeamRecord tr = (TeamRecord)record;

                if (tr.GetOverall() < conCutoffs[0])
                {
                    tr.CON = 1;
                }
                else if (tr.GetOverall() < conCutoffs[1])
                {
                    tr.CON = 2;
                }
                else if (tr.GetOverall() < conCutoffs[2])
                {
                    tr.CON = 3;
                }
                else if (tr.GetOverall() < conCutoffs[3])
                {
                    tr.CON = 4;
                }
                else
                {
                    tr.CON = 5;
                }

                // Should add code here that increases CON if they've got an old QB
                // who's above 90 or so and about to retire.
            }
        }
コード例 #12
0
        /// <summary>
        /// 通過答案,設定到下一題
        /// </summary>
        /// <param name="puzzleId"></param>
        /// <param name="teamId"></param>
        public Guid SetNextPuzzle(Guid puzzleId, Guid teamId)
        {
            var team        = teamService.GetByIdIncludeAll(teamId);
            var record      = team.TeamRecords.First(x => x.TourPuzzle.PuzzleId == puzzleId);
            var tourPuzzles = team.Tour.TourPuzzles.ToList();

            if (record.TourPuzzleId != team.CurrentTourPuzzleId)
            {
                // 代表已經有人觸發往下一關了
                return(team.CurrentPuzzleId.Value);
            }

            var nextTourPuzzle = tourPuzzles.FirstOrDefault(x => x.Sort == (team.CurrentTourPuzzleSort + 1));

            if (nextTourPuzzle == null)
            {
                // 沒有下一關,代表已通關
                team.IsComplete = true;
                db.SaveChanges();

                // 已通關
                return(Guid.Empty);
            }

            // 設定下一關資訊
            var newRecord = new TeamRecord();

            newRecord.Id              = Ci.Sequential.Guid.Create();
            newRecord.TeamId          = team.Id;
            newRecord.CreateTime      = DateTime.Now;
            newRecord.ModifyTime      = DateTime.Now;
            newRecord.PuzzleStartTime = DateTime.Now;
            newRecord.TourPuzzleId    = nextTourPuzzle.Id;
            newRecord.Sort            = nextTourPuzzle.Sort;
            team.TeamRecords.Add(newRecord);

            team.CurrentTourPuzzleSort = nextTourPuzzle.Sort;
            team.CurrentPuzzleId       = nextTourPuzzle.PuzzleId;
            team.CurrentTourPuzzleId   = nextTourPuzzle.Id;

            db.SaveChanges();

            return(team.CurrentPuzzleId.Value);
        }
コード例 #13
0
        private void simulateCPUMinicampsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("This tool will simulate minicamps for CPU players with less than three years of experience.  Do you want to skip human controlled teams?", "Simulate CPU Minicamps", MessageBoxButtons.YesNoCancel);

            if (dr != DialogResult.Cancel)
            {
                this.Invalidate(true);
                this.Update();
                Cursor.Current = Cursors.WaitCursor;

                List <int> toSkip = new List <int>();
                foreach (OwnerRecord team in model.TeamModel.GetTeamRecordsInOwnerTable())
                {
                    if (team.UserControlled)
                    {
                        toSkip.Add(team.TeamId);
                    }
                }

                DepthChartRepairer dcr = new DepthChartRepairer(model, null);
                dcr.ReorderDepthCharts(true, toSkip);

                if (dr == DialogResult.No)
                {
                    toSkip = new List <int>();
                }

                foreach (TableRecordModel record in model.TableModels[EditorModel.TEAM_TABLE].GetRecords())
                {
                    TeamRecord team = (TeamRecord)record;

                    if (team.TeamId < 32 && !toSkip.Contains(team.TeamId))
                    {
                        Trace.WriteLine(team.Name + ":");
                        team.SimulateMinicamp();
                        Trace.WriteLine("");
                    }
                }

                Cursor.Current = Cursors.Arrow;
            }
        }
コード例 #14
0
        public SortedList <int, UniformRecord> GetUniforms(TeamRecord team)
        {
            if (!loadedData)
            {
                return(null);
            }

            SortedList <int, UniformRecord> result = new SortedList <int, UniformRecord>();

            foreach (TableRecordModel rec in model.TableModels[EditorModel.UNIFORM_TABLE].GetRecords())
            {
                UniformRecord uniformRec = (UniformRecord)rec;

                if (uniformRec.TeamId == team.TeamId)
                {
                    result.Add(uniformRec.TeamUniformCombo, uniformRec);
                }
            }

            return(result);
        }
コード例 #15
0
        /// <summary>
        /// 設定開始 Tour 計時
        /// </summary>
        /// <param name="teamId"></param>
        public Guid SetTeamStart(Guid teamId)
        {
            var team        = GetByIdIncludeAll(teamId);
            var tourPuzzles = team.Tour.TourPuzzles;
            var records     = team.TeamRecords;

            if (team.CurrentPuzzleId.HasValue && records.Any())
            {
                return(team.CurrentPuzzleId.Value);
            }

            if (!team.CurrentPuzzleId.HasValue)
            {
                var firstTourPuzzle = tourPuzzles.OrderBy(x => x.Sort).First();
                var record          = new TeamRecord();
                record.Id              = Ci.Sequential.Guid.Create();
                record.TeamId          = team.Id;
                record.CreateTime      = DateTime.Now;
                record.ModifyTime      = DateTime.Now;
                record.PuzzleStartTime = DateTime.Now;
                record.TourPuzzleId    = firstTourPuzzle.Id;
                record.Sort            = firstTourPuzzle.Sort;
                team.TeamRecords.Add(record);

                team.CurrentPuzzleId       = tourPuzzles.First(x => x.Sort == 1).PuzzleId;
                team.CurrentTourPuzzleId   = firstTourPuzzle.Id;
                team.CurrentTourPuzzleSort = firstTourPuzzle.Sort;
            }
            else
            {
                team.CurrentPuzzleId = team.TeamRecords.OrderByDescending(x => x.Sort).First().TourPuzzle.PuzzleId;
            }

            db.SaveChanges();

            return(team.CurrentPuzzleId.Value);
        }
コード例 #16
0
        public void ApplyChanges()
        {
            // set owner table for user/cpu controlled teams
            for (int o = 0; o < teamview.RowCount; o++)
            {
                TableRecordModel t     = model.TableModels[EditorModel.OWNER_TABLE].GetRecord(o);
                OwnerRecord      owner = (OwnerRecord)t;
                if ((string)teamview.Rows[o].Cells[1].Value == "USER")
                {
                    owner.UserControlled = true;
                }
                else
                {
                    owner.UserControlled = false;
                }

                foreach (TableRecordModel trm in model.TableModels[EditorModel.COACH_TABLE].GetRecords())
                {
                    CoachRecord crec = (CoachRecord)trm;
                    if (owner.TeamId == crec.TeamId && crec.Position == 0)      // Position 0 is Head coach
                    {
                        if ((string)teamview.Rows[o].Cells[2].Value == "USER")
                        {
                            crec.UserControlled = true;
                            crec.CPUControlled  = false;                        // not sure what this does, but it needs to be set as user controlled
                        }
                        else
                        {
                            crec.UserControlled = false;
                            crec.CPUControlled  = true;                         // again this needs to be set
                        }

                        if ((string)teamview.Rows[o].Cells[3].Value == "CPU")
                        {
                            crec.CPUDraftPlayer = true;
                            owner.DraftPlayers  = true;
                        }
                        else
                        {
                            crec.CPUDraftPlayer = false;
                            owner.DraftPlayers  = false;
                        }

                        if ((string)teamview.Rows[o].Cells[4].Value == "CPU")
                        {
                            crec.CPUSignDraftPicks = true;
                            owner.SignDraftPicks   = true;
                        }
                        else
                        {
                            crec.CPUSignDraftPicks = false;
                            owner.SignDraftPicks   = false;
                        }

                        if ((string)teamview.Rows[o].Cells[5].Value == "CPU")
                        {
                            crec.CPUSignFreeAgents = true;
                            owner.SignFreeAgents   = true;
                        }
                        else
                        {
                            crec.CPUSignFreeAgents = false;
                            owner.SignFreeAgents   = false;
                        }

                        if ((string)teamview.Rows[o].Cells[6].Value == "CPU")
                        {
                            crec.CPUFillRosters = true;
                            owner.FillRosters   = true;
                        }
                        else
                        {
                            crec.CPUFillRosters = false;
                            owner.FillRosters   = false;
                        }

                        if ((string)teamview.Rows[o].Cells[7].Value == "CPU")
                        {
                            crec.CPUResignPlayers = true;
                            owner.ResignPlayers   = true;
                        }
                        else
                        {
                            crec.CPUResignPlayers = false;
                            owner.ResignPlayers   = false;
                        }

                        if ((string)teamview.Rows[o].Cells[8].Value == "CPU")
                        {
                            crec.CPUManageDepth      = true;
                            owner.ReorderDepthCharts = true;
                        }
                        else
                        {
                            crec.CPUManageDepth      = false;
                            owner.ReorderDepthCharts = false;
                        }

                        if ((string)teamview.Rows[o].Cells[9].Value == "YES" && (string)teamview.Rows[o].Cells[1].Value == "USER")
                        {
                            if (model.FranchiseStage.CurrentStage < 7)  // No schedule exists while in training camp
                            {
                                return;
                            }

                            // Fix Scheduled Games
                            foreach (TableRecordModel sch in model.TableModels[EditorModel.SCHEDULE_TABLE].GetRecords())
                            {
                                ScheduleRecord sr = (ScheduleRecord)sch;
                                if (sr.WeekType != 25 && sr.WeekType != 0)  // regular and pre season
                                {
                                    continue;
                                }
                                if (owner.TeamId == sr.AwayTeam.TeamId || owner.TeamId == sr.HomeTeam.TeamId)
                                {
                                    TeamRecord team = model.TeamModel.GetTeamRecord(owner.TeamId);

                                    if (PlayALLGames_Checkbox.Checked)
                                    {
                                        sr.HumanControlled = true;
                                    }
                                    else if (PlayAwayGames_Checkbox.Checked && sr.AwayTeam.TeamId == owner.TeamId)
                                    {
                                        sr.HumanControlled = true;
                                    }
                                    else if (PlayHomeGames_Checkbox.Checked && sr.HomeTeam.TeamId == owner.TeamId)
                                    {
                                        sr.HumanControlled = true;
                                    }
                                    else if (PlayDIVGames_Checkbox.Checked)
                                    {
                                        if (team.TeamId != sr.HomeTeam.TeamId && team.DivisionId == sr.HomeTeam.TeamId)
                                        {
                                            sr.HumanControlled = true;
                                        }
                                        else if (team.TeamId != sr.AwayTeam.TeamId && team.DivisionId == sr.AwayTeam.DivisionId)
                                        {
                                            sr.HumanControlled = true;
                                        }
                                        else
                                        {
                                            sr.HumanControlled = false;
                                        }
                                    }
                                    else
                                    {
                                        sr.HumanControlled = false;
                                    }
                                }
                                else
                                {
                                    sr.HumanControlled = false;
                                }
                            }
                        }

                        break;
                    }
                }
            }
        }
コード例 #17
0
 protected Head2HeadRecord GetHead2HeadRecord(TeamRecord teamRecord, int opponentId)
 {
     return(teamRecord.Head2HeadRecords.Where(h2h => h2h.OpponentId == opponentId).First());
 }
コード例 #18
0
        public void GetTeamList()
        {
            if (_teamlist == null)
            {
                _teamlist = new List <int>();
            }
            else
            {
                _teamlist.Clear();
            }
            if (TeamNames == null)
            {
                TeamNames = new Dictionary <int, string>();
            }
            else
            {
                TeamNames.Clear();
            }

            foreach (TeamRecord rec in model.TableModels[EditorModel.TEAM_TABLE].GetRecords())
            {
                if (rec.Deleted)
                {
                    continue;
                }
                TeamRecord tr  = (TeamRecord)rec;
                bool       add = false;

                // filters
                if (currentConferenceFilterId == -1 && currentDivisionFilterId == -1 && currentLeagueFilterId == -1)
                {
                    add = true;
                }
                else
                {
                    if (currentLeagueFilterId == -1)
                    {
                        if (currentConferenceFilterId == -1)
                        {
                            if (currentDivisionFilterId == tr.DivisionId)
                            {
                                add = true;
                            }
                        }
                        else if (currentDivisionFilterId == -1)
                        {
                            if (currentConferenceFilterId == tr.ConferenceId)
                            {
                                add = true;
                            }
                        }
                        else
                        {
                            if (currentConferenceFilterId == tr.ConferenceId && currentDivisionFilterId == tr.DivisionId)
                            {
                                add = true;
                            }
                        }
                    }
                    else if (currentConferenceFilterId == -1)
                    {
                        if (currentLeagueFilterId == -1)
                        {
                            if (currentDivisionFilterId == tr.DivisionId)
                            {
                                add = true;
                            }
                        }
                        else if (currentDivisionFilterId == -1)
                        {
                            if (currentLeagueFilterId == tr.LeagueId)
                            {
                                add = true;
                            }
                        }
                        else
                        {
                            if (currentLeagueFilterId == tr.LeagueId && currentDivisionFilterId == tr.DivisionId)
                            {
                                add = true;
                            }
                        }
                    }
                    else if (currentDivisionFilterId == -1)
                    {
                        if (currentLeagueFilterId == -1)
                        {
                            if (currentConferenceFilterId == tr.ConferenceId)
                            {
                                add = true;
                            }
                        }
                        else if (currentConferenceFilterId == -1)
                        {
                            if (currentLeagueFilterId == tr.LeagueId)
                            {
                                add = true;
                            }
                        }
                        else
                        {
                            if (currentLeagueFilterId == tr.LeagueId && currentConferenceFilterId == tr.ConferenceId)
                            {
                                add = true;
                            }
                        }
                    }
                    else
                    {
                        if (currentLeagueFilterId == tr.LeagueId && currentConferenceFilterId == tr.ConferenceId && currentDivisionFilterId == tr.DivisionId)
                        {
                            add = true;
                        }
                    }
                }

                if (add)
                {
                    _teamlist.Add(tr.RecNo);
                }
            }

            _teamlist.Sort();
            foreach (int i in _teamlist)
            {
                TeamRecord t = (TeamRecord)model.TableModels[EditorModel.TEAM_TABLE].GetRecord(i);
                TeamNames.Add(i, t.LongName);
            }
        }
コード例 #19
0
 public void Set_TeamRecord(TeamRecord rec)
 {
     teamrecord = rec;
 }
コード例 #20
0
        //  fix coach skin color
        public void InitialiseUI()
        {
            isInitialising = true;

            LegacyRatings_Panel.Visible         = false;
            coachCurrentSeason_GroupBox.Visible = false;
            coachPostSeason_Groupbox.Visible    = false;

            //  TO DO:  Coach skin color values change from 04/05 to 06-08
            //  04/05 vary from 0 to 7 and  06-08 vary from 0 to 2
            foreach (GenericRecord rec in model.CoachModel.CoachSkinColor)
            {
                cbSkinColor.Items.Add(rec);
            }

            filterTeamComboBox.Items.Add("ALL");
            if (Manager.stream_model != null)
            {
                model.CoachModel.manager = this.Manager;
                filterTeamComboBox.Items.Add("Unemployed");
            }

            foreach (TableRecordModel rec in model.TableModels[EditorModel.TEAM_TABLE].GetRecords())
            {
                // Don't add NFC/AFC Pro Bowl values here, keep free agents and use the table from streameddata if possible
                if (rec.Deleted)
                {
                    continue;
                }
                TeamRecord team = (TeamRecord)rec;

                if (team.TeamId != 1010 && team.TeamId != 1011)
                {
                    CoachTeamCombo.Items.Add(rec);
                    coachPreviousTeam.Items.Add(rec);
                    filterTeamComboBox.Items.Add(rec);
                }
            }

            filterPositionComboBox.SelectedIndex = 0;
            filterTeamComboBox.SelectedIndex     = 0;

            foreach (GenericRecord rec in model.TeamModel.DefensivePlaybookList)
            {
                coachDefensivePlaybook.Items.Add(rec);
            }
            coachDefensivePlaybook.SelectedIndex = 0;

            foreach (GenericRecord rec in model.TeamModel.OffensivePlaybookList)
            {
                coachOffensivePlaybook.Items.Add(rec);
            }
            coachOffensivePlaybook.SelectedIndex = 0;


            //Create priority controls
            int numPositions = Enum.GetNames(typeof(PlayerDraftedPositions)).Length;

            prioritySliders           = new NumericUpDown[numPositions];
            priorityTypeSliders       = new NumericUpDown[numPositions];
            priorityDescriptionLabels = new Label[numPositions];
            for (int i = 0; i < numPositions; i++)
            {
                prioritySliders[i]               = new NumericUpDown();
                prioritySliders[i].Location      = new Point(48, 22 + i * 26);
                prioritySliders[i].Size          = new Size(86, 20);
                prioritySliders[i].Minimum       = 0;
                prioritySliders[i].Maximum       = 100;
                prioritySliders[i].Visible       = true;
                prioritySliders[i].ValueChanged += new EventHandler(prioritySlider_ValueChanged);

                priorityGroupBox.Controls.Add(prioritySliders[i]);

                priorityTypeSliders[i]               = new NumericUpDown();
                priorityTypeSliders[i].Location      = new Point(140, 22 + i * 26);
                priorityTypeSliders[i].Size          = new Size(56, 20);
                priorityTypeSliders[i].Minimum       = 0;
                priorityTypeSliders[i].Maximum       = 2;
                priorityTypeSliders[i].Visible       = true;
                priorityTypeSliders[i].ValueChanged += new EventHandler(priorityTypeSlider_ValueChanged);

                priorityGroupBox.Controls.Add(priorityTypeSliders[i]);

                priorityDescriptionLabels[i]          = new Label();
                priorityDescriptionLabels[i].Location = new Point(205, 25 + i * 26);
                priorityDescriptionLabels[i].Visible  = true;

                priorityGroupBox.Controls.Add(priorityDescriptionLabels[i]);
            }

            if (Manager.CoachPortDAT.isterf)
            {
                ImportCoachPic_Button.Visible = true;
                ExportCoachPic_Button.Visible = true;
            }
            else
            {
                ImportCoachPic_Button.Visible = false;
                ExportCoachPic_Button.Visible = false;
            }

            InitCoachList();

            if (model.FileVersion == MaddenFileVersion.Ver2019)
            {
                coachName.MaxLength        = 17;
                coachAsset.Enabled         = true;
                Approval_Label.Visible     = false;
                Approval.Visible           = false;
                coachFirstName.Enabled     = true;
                coachLastName.Enabled      = true;
                CoachFaceID_UpDown.Value   = 0;
                CoachFaceID_UpDown.Enabled = false;
                CoachHeadID_UpDown.Value   = 0;
                CoachHeadID_UpDown.Enabled = false;
                coachPreviousTeam.Enabled  = false;
            }
            else
            {
                coachName.MaxLength                 = 16;
                coachAsset.Enabled                  = false;
                coachAsset.Text                     = "";
                LegacyRatings_Panel.Visible         = true;
                coachCurrentSeason_GroupBox.Visible = true;
                coachPostSeason_Groupbox.Visible    = true;
                coachFirstName.Enabled              = false;
                coachLastName.Enabled               = false;
                coachAsset.Text                     = "";
                coachAsset.Enabled                  = false;
            }

            isInitialising = false;
        }
コード例 #21
0
        public TableRecordModel ConstructRecordModel(int recno)
        {
            TableRecordModel newRecord = null;
            string           tablename = name;

            // Need to reverse the name if BE
            if (BigEndian)
            {
                string rev = ConvertBE(name);
                tablename = rev;
            }

            switch (tablename)
            {
            case EditorModel.CITY_TABLE:
                newRecord = new CityRecord(recno, this, parentModel);
                break;

            case EditorModel.COACH_TABLE:
            {
                // coch table in streameddata is different than ros/fra
                if (parentModel.FileType == MaddenFileType.Streameddata)
                {
                    newRecord = new CoachCollection(recno, this, parentModel);
                }
                else
                {
                    newRecord = new CoachRecord(recno, this, parentModel);
                }
                break;
            }

            case EditorModel.SALARY_CAP_TABLE:
                newRecord = new SalaryCapRecord(recno, this, parentModel);
                break;

            case EditorModel.COACH_SLIDER_TABLE:
                newRecord = new CoachPrioritySliderRecord(recno, this, parentModel);
                break;

            case EditorModel.TEAM_CAPTAIN_TABLE:
                newRecord = new TeamCaptainRecord(recno, this, parentModel);
                break;

            case EditorModel.OWNER_TABLE:
                newRecord = new OwnerRecord(recno, this, parentModel);
                break;

            case EditorModel.DEPTH_CHART_TABLE:
                newRecord = new DepthChartRecord(recno, this, parentModel);
                break;

            case EditorModel.INJURY_TABLE:
                newRecord = new InjuryRecord(recno, this, parentModel);
                break;

            case EditorModel.PLAYER_TABLE:
                newRecord = new PlayerRecord(recno, this, parentModel);
                break;

            case EditorModel.TEAM_TABLE:
                newRecord = new TeamRecord(recno, this, parentModel);
                break;

            case EditorModel.SCHEDULE_TABLE:
                newRecord = new ScheduleRecord(recno, this, parentModel);
                break;

            case EditorModel.STADIUM_TABLE:
                newRecord = new StadiumRecord(recno, this, parentModel);
                break;

            case EditorModel.UNIFORM_TABLE:
                newRecord = new UniformRecord(recno, this, parentModel);
                break;

            // MADDEN DRAFT EDIT
            case EditorModel.DRAFT_PICK_TABLE:
                newRecord = new DraftPickRecord(recno, this, parentModel);
                break;

            case EditorModel.DRAFTED_PLAYERS_TABLE:
                newRecord = new RookieRecord(recno, this, parentModel);
                break;

            case EditorModel.BOXSCORE_DEFENSE_TABLE:
                newRecord = new BoxScoreDefenseRecord(recno, this, parentModel);
                break;

            case EditorModel.BOXSCORE_OFFENSE_TABLE:
                newRecord = new BoxScoreOffenseRecord(recno, this, parentModel);
                break;

            case EditorModel.CAREER_STATS_DEFENSE_TABLE:
                newRecord = new CareerStatsDefenseRecord(recno, this, parentModel);
                break;

            case EditorModel.CAREER_STATS_OFFENSE_TABLE:
                newRecord = new CareerStatsOffenseRecord(recno, this, parentModel);
                break;

            case EditorModel.SEASON_STATS_DEFENSE_TABLE:
                newRecord = new SeasonStatsDefenseRecord(recno, this, parentModel);
                break;

            case EditorModel.SEASON_STATS_OFFENSE_TABLE:
                newRecord = new SeasonStatsOffenseRecord(recno, this, parentModel);
                break;

            case EditorModel.TEAM_SEASON_STATS:
                newRecord = new TeamSeasonStatsRecord(recno, this, parentModel);
                break;

            case EditorModel.FRANCHISE_TIME_TABLE:
                newRecord = new FranchiseTimeRecord(recno, this, parentModel);
                break;

            case EditorModel.BOXSCORE_TEAM_TABLE:
                newRecord = new BoxScoreTeamStats(recno, this, parentModel);
                break;

            case EditorModel.BOXSCORE_OFFENSIVE_LINE_TABLE:
                newRecord = new BoxScoreOffensiveLineRecord(recno, this, parentModel);
                break;

            case EditorModel.SEASON_STATS_OFFENSIVE_LINE_TABLE:
                newRecord = new SeasonStatsOffensiveLineRecord(recno, this, parentModel);
                break;

            case EditorModel.CAREER_STATS_OFFENSIVE_LINE_TABLE:
                newRecord = new CareerStatsOffensiveLineRecord(recno, this, parentModel);
                break;

            case EditorModel.CAREER_GAMES_PLAYED_TABLE:
                newRecord = new CareerGamesPlayedRecord(recno, this, parentModel);
                break;

            case EditorModel.SEASON_GAMES_PLAYED_TABLE:
                newRecord = new SeasonGamesPlayedRecord(recno, this, parentModel);
                break;

            case EditorModel.CAREER_STATS_KICKPUNT_TABLE:
                newRecord = new CareerPuntKickRecord(recno, this, parentModel);
                break;

            case EditorModel.SEASON_STATS_KICKPUNT_TABLE:
                newRecord = new SeasonPuntKickRecord(recno, this, parentModel);
                break;

            case EditorModel.CAREER_STATS_KICKPUNT_RETURN_TABLE:
                newRecord = new CareerPKReturnRecord(recno, this, parentModel);
                break;

            case EditorModel.SEASON_STATS_KICKPUNT_RETURN_TABLE:
                newRecord = new SeasonPKReturnRecord(recno, this, parentModel);
                break;

            case EditorModel.SCOUTING_STATE_TABLE:
                newRecord = new ScoutingStateRecord(recno, this, parentModel);
                break;

            case EditorModel.RFA_STATE_TABLE:
                newRecord = new RFAStateRecord(recno, this, parentModel);
                break;

            case EditorModel.RFA_PLAYERS:
                newRecord = new RestrictedFreeAgentPlayers(recno, this, parentModel);
                break;

            case EditorModel.RFA_SALARY_TENDERS:
                newRecord = new RestrictedFreeAgentSigningTenders(recno, this, parentModel);
                break;

            case EditorModel.RESIGN_PLAYERS_STATE_TABLE:
                newRecord = new ResignPlayersStateRecord(recno, this, parentModel);
                break;

            case EditorModel.FREE_AGENCY_STATE_TABLE:
                newRecord = new FreeAgencyStateRecord(recno, this, parentModel);
                break;

            case EditorModel.DRAFT_STATE_TABLE:
                newRecord = new DraftStateRecord(recno, this, parentModel);
                break;

            case EditorModel.FRANCHISE_STAGE_TABLE:
                newRecord = new FranchiseStageRecord(recno, this, parentModel);
                break;

            case EditorModel.GAME_OPTIONS_TABLE:
                newRecord = new GameOptionRecord(recno, this, parentModel);
                break;

            case EditorModel.PLAYER_AWARDS_TABLE:
                newRecord = new YearlyAwards(recno, this, parentModel);
                break;

            case EditorModel.FREE_AGENT_PLAYERS:
                newRecord = new FreeAgentPlayers(recno, this, parentModel);
                break;

            case EditorModel.COACHES_EXPECTED_SALARY:
                newRecord = new CoachExpectedSalary(recno, this, parentModel);
                break;

            case EditorModel.COACHING_HISTORY_TABLE:
                newRecord = new CoachHistory(recno, this, parentModel);
                break;

            case EditorModel.PROGRESSION_SCHEDULE:
                newRecord = new ProgressionSchedule(recno, this, parentModel);
                break;

            case EditorModel.USER_OPTIONS_TABLE:
                newRecord = new UserOptionRecord(recno, this, parentModel);
                break;

            case EditorModel.TEAM_RIVAL_HISTORY:
                newRecord = new TeamRivalHistory(recno, this, parentModel);
                break;

            case EditorModel.PRO_BOWL_PLAYERS:
                newRecord = new ProBowlPlayer(recno, this, parentModel);
                break;

            case EditorModel.USER_INFO_TABLE:
                newRecord = new UserInfoRecord(recno, this, parentModel);
                break;

                #region Streamed Data
            case EditorModel.COLLEGES_TABLE:
                newRecord = new CollegesRecord(recno, this, parentModel);
                break;

            case EditorModel.PLAYER_FIRST_NAMES:
                newRecord = new FirstNames(recno, this, parentModel);
                break;

            case EditorModel.PLAYER_LAST_NAMES:
                newRecord = new LastNames(recno, this, parentModel);
                break;

            case EditorModel.ROLES_DEFINE:
                newRecord = new PRDF(recno, this, parentModel);
                break;

            case EditorModel.ROLES_INFO:
                newRecord = new RoleInfo(recno, this, parentModel);
                break;

            case EditorModel.ROLES_PLAYER_EFFECTS:
                newRecord = new RolePlayerEffects(recno, this, parentModel);
                break;

            case EditorModel.ROLES_TEAM_EFFECTS:
                newRecord = new RoleTeamEffects(recno, this, parentModel);
                break;

            case EditorModel.STATS_REQUIRED:
                newRecord = new SuperStarStatsRequired(recno, this, parentModel);
                break;

            case EditorModel.PROGRESSION:
                newRecord = new PlayerProgression(recno, this, parentModel);
                break;

            case EditorModel.REGRESSION:
                newRecord = new PlayerRegression(recno, this, parentModel);
                break;

            case EditorModel.PTCB:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTCE:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTDE:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTDT:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTFB:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTFS:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTGA:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTHB:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTKI:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTKP:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTMB:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTOB:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTPU:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTQB:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTSS:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTTA:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTTE:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

            case EditorModel.PTWR:
                newRecord = new ProgressionTracking(recno, this, parentModel);
                break;

                #endregion

            case EditorModel.POSITION_SUBS:
                newRecord = new PlayerSubs(recno, this, parentModel);
                break;

            case EditorModel.DEPTH_CHART_SUBS:
                newRecord = new DepthChartSubs(recno, this, parentModel);
                break;

            case EditorModel.SALARY_CAP_INCREASE:
                newRecord = new SalaryCapIncrease(recno, this, parentModel);
                break;

            case EditorModel.PLAYER_MINIMUM_SALARY_TABLE:
                newRecord = new SalaryYearsPro(recno, this, parentModel);
                break;

            case EditorModel.PLAYER_SALARY_DEMAND_TABLE:
                newRecord = new PlayerSalaryDemands(recno, this, parentModel);
                break;

            case EditorModel.INACTIVE_TABLE:
                newRecord = new InactiveRecord(recno, this, parentModel);
                break;

            case EditorModel.LEAGUE_REVENUE_TABLE:
                newRecord = new LeagueRevenue(recno, this, parentModel);
                break;

            case EditorModel.OWNER_REVENUE_TABLE:
                newRecord = new OwnerRevenue(recno, this, parentModel);
                break;

            case EditorModel.WEEKLY_INCOME_TABLE:
                newRecord = new Income(recno, this, parentModel);
                break;

            case EditorModel.TEAM_WIN_LOSS_RECORD:
                newRecord = new TeamWinLossRecord(recno, this, parentModel);
                break;

            // DB Templates
            case EditorModel.PLAYER_OVERALL_CALC:
                newRecord = new OverallRecord(recno, this, parentModel);
                break;

            case EditorModel.PLAYBOOK_TABLE:
                newRecord = new FRAPlayBooks(recno, this, parentModel);
                break;

            default:
                newRecord = new TableRecordModel(recno, this, parentModel);
                break;
            }

            //Add the new record to our list of records
            recordList.Add(newRecord);

            return(newRecord);
        }
コード例 #22
0
        public void LoadCoachInfo(CoachRecord record)
        {
            model.CoachModel.CurrentCoachRecord = record;

            if (record == null)
            {
                MessageBox.Show("No Records available.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            isInitialising = true;

            try
            {
                //Load Coach General info
                coachName.Text = record.Name;

                // TO FIX not working right for 2007
                // Shows Unemployed coaches and lists Positions as Head Coaches etc...
                // While team field is blank.  1009 = unemployed.
                coachesPositionCombo.Text = coachesPositionCombo.Items[record.Position].ToString();;


                TeamRecord team    = model.TeamModel.GetTeamRecord(record.TeamId);
                TeamRecord prvteam = model.TeamModel.GetTeamRecord(record.LastTeamFranchise);
                if (record.TeamId == 1023)      // have to fix this
                {
                    record.TeamId = 1009;
                }
                if (record.TeamId == 1009)
                {
                    CoachTeamCombo.Text    = "Free Agents";
                    coachPreviousTeam.Text = "Free Agents";
                }
                else
                {
                    CoachTeamCombo.SelectedItem    = (object)team;
                    coachPreviousTeam.SelectedItem = (object)prvteam;
                }

                coachAge.Value = (int)record.Age;

                // this isnt right for all versions
                foreach (Object obj in model.CoachModel.CoachSkinColor)
                {
                    if (((GenericRecord)obj).Id == record.SkinColor)
                    {
                        cbSkinColor.SelectedItem = obj;
                        break;
                    }
                }

                GetCoachHeight();

                WearsGlassesCheckbox.Checked  = record.CoachGlasses;
                FormerPlayer_Checkbox.Checked = record.WasPlayer;
                coachpic.Value           = (int)record.Coachpic;
                CoachFaceID_UpDown.Value = (int)record.FaceId;
                CoachHeadID_UpDown.Value = (int)record.HeadHair;
                coachSalary.Value        = (decimal)((double)record.Salary / 100.0);
                coachyearsleft.Value     = (int)record.ContractLength;
                Approval.Value           = (int)record.ApprovalRating;
                BodySize.Value           = (int)record.BodySize;

                CoachOff.Value          = (int)record.Offense;
                CoachDef.Value          = (int)record.DefenseRating;
                CoachSafetyUpDown.Value = (int)record.CoachS;
                coachQB.Value           = (int)record.CoachQB;
                coachRB.Value           = (int)record.CoachRB;
                coachWR.Value           = (int)record.CoachWR;
                coachOL.Value           = (int)record.CoachOL;
                coachDL.Value           = (int)record.CoachDL;
                coachLB.Value           = (int)record.CoachLB;
                coachDB.Value           = (int)record.CoachDB;
                coachKS.Value           = (int)record.CoachKS;
                coachPS.Value           = (int)record.CoachPS;

                //Win-Loss Records
                coachPlayoffWins.Value    = (int)record.PlayoffWins;
                coachPlayoffLoses.Value   = (int)record.PlayoffLosses;
                coachSuperbowlWins.Value  = (int)record.SuperBowlWins;
                coachSuperBowlLoses.Value = (int)record.SuperBowlLoses;
                coachWinningSeasons.Value = (int)record.WinningSeasons;
                coachCareerWins.Value     = (int)record.CareerWins;
                coachCareerLoses.Value    = (int)record.CareerLosses;
                coachCareerTies.Value     = (int)record.CareerTies;
                PlayoffsMade.Value        = (int)record.PlayoffsMade;
                coachSeasonWins.Value     = (int)record.SeasonWins;
                coachSeasonLosses.Value   = (int)record.SeasonLosses;
                coachSeasonTies.Value     = (int)record.SeasonTies;

                threeFourButton.Checked = false;
                fourThreeButton.Checked = false;

                if (model.FileVersion != MaddenFileVersion.Ver2019)
                {
                    if (record.DefenseType == 95)
                    {
                        fourThreeButton.Checked = true;
                    }
                    else if (record.DefenseType == 5)
                    {
                        threeFourButton.Checked = true;
                    }
                    else
                    {
                        // have seen this get corrupted, change it to 4-3
                        record.DefenseType      = 95;
                        fourThreeButton.Checked = true;
                    }
                }
                else
                {
                    threeFourButton.Enabled = false;
                    fourThreeButton.Enabled = false;
                }

                //Attributes
                coachEthics.Value        = (int)record.Ethics;
                coachKnowledge.Value     = (int)record.Knowledge;
                coachMotivation.Value    = (int)record.Motivation;
                coachChemistry.Value     = (int)record.Chemistry;
                coachPassOff.Value       = (int)record.OffensiveStrategy;
                coachRunOff.Value        = (int)(100 - record.OffensiveStrategy);
                coachPassDef.Value       = (int)record.DefensiveStrategy;
                coachRunDef.Value        = (int)(100 - record.DefensiveStrategy);
                rb2.Value                = (int)(100 - record.RBCarryDist);
                rb1.Value                = (int)(record.RBCarryDist);
                coachDefAggression.Value = record.DefensiveAggression;
                coachOffAggression.Value = record.OffensiveAggression;

                SetCoachTendency(record);

                coachDefensivePlaybook.Text = model.TeamModel.GetDEFPlaybook((int)record.DefensivePlaybook);
                coachOffensivePlaybook.Text = model.TeamModel.GetOFFPlaybook((int)record.OffensivePlaybook);

                // Set slider values to 0
                for (int i = 0; i < Enum.GetNames(typeof(PlayerDraftedPositions)).Length; i++)
                {
                    prioritySliders[i].Value          = 0;
                    priorityTypeSliders[i].Value      = 0;
                    priorityDescriptionLabels[i].Text = "";
                    prioritySliders[i].Enabled        = false;
                    priorityTypeSliders[i].Enabled    = false;
                }
                //Priorities (NOTE: Madden 2007-2008 don't have coach sliders)
                if (model.FileVersion >= MaddenFileVersion.Ver2007)
                {
                    if (tabcontrol.TabPages.Contains(tabPage2))
                    {
                        tabcontrol.TabPages.Remove(tabPage2);
                    }
                }
                else
                {
                    if (!tabcontrol.TabPages.Contains(tabPage2))
                    {
                        tabcontrol.TabPages.Add(tabPage2);
                    }

                    if (!record.wasinstreamed)
                    {
                        bool priorityMatches = false;
                        SortedList <int, CoachPrioritySliderRecord> priorites = null;
                        if (model.FileVersion <= MaddenFileVersion.Ver2006)
                        {
                            priorites = model.CoachModel.GetCurrentCoachSliders();
                            int priorityCount = Enum.GetNames(typeof(PlayerDraftedPositions)).Length;
                            priorityMatches = (priorityCount != priorites.Count);
                        }

                        if (!priorityMatches)
                        {
                            int index = 0;
                            foreach (CoachPrioritySliderRecord priorRecord in priorites.Values)
                            {
                                prioritySliders[index].Value          = priorRecord.Priority;
                                priorityTypeSliders[index].Value      = priorRecord.PriorityType;
                                priorityDescriptionLabels[index].Text = DecodePriorityType((PlayerDraftedPositions)index, priorRecord.PriorityType);
                                prioritySliders[index].Enabled        = true;
                                priorityTypeSliders[index].Enabled    = true;
                                index++;
                            }
                        }
                    }
                }

                if (model.FileVersion == MaddenFileVersion.Ver2019)
                {
                    coachAsset.Text     = record.Asset;
                    coachFirstName.Text = record.FirstName;
                    coachLastName.Text  = record.LastName;
                }
            }

            catch (Exception e)
            {
                MessageBox.Show("Exception Occured loading this Coach:\r\n" + e.ToString(), "Exception Loading Coach", MessageBoxButtons.OK, MessageBoxIcon.Error);
                LoadCoachInfo(lastLoadedRecord);
                return;
            }
            finally
            {
                isInitialising = false;
            }

            lastLoadedRecord = record;
            DisplayCoachPort();
            isInitialising = false;
        }