void AddCourse(Course newCourse) { //当前的课程是否已经考完? bool IsFinished = (newCourse.Deadline < Gamest.CurTurn); //课程小提示 ToolTip newCoursePlanTip = new ToolTip(); newCoursePlanTip.InitialDelay = 500; //添加一门课程的信息 CourseTablePanel.RowCount++; CourseTablePanel.Height += RowHeight; CourseTablePanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, RowHeight)); //课程名项 Label newCourseName = new Label(); newCourseName.Text = newCourse.CourseName; newCourseName.AutoSize = false; newCourseName.Font = new Font("宋体", 9, FontStyle.Bold); newCourseName.ForeColor = FontColor1; newCourseName.TextAlign = ContentAlignment.MiddleCenter; newCourseName.Dock = DockStyle.Fill; newCoursePlanTip.SetToolTip(newCourseName, newCourse.DetailedDescription); CourseTablePanel.Controls.Add(newCourseName, 0, CourseTablePanel.RowCount - 1); //课程考试日期 Label newCourseDDL = new Label(); newCourseDDL.Text = $"{GameSystem.GetDate(Gamest.GameChapter.StMonth,Gamest.GameChapter.StDay+newCourse.Deadline)} {GameSystem.TimeName[newCourse.TestPeriod]}"; newCourseDDL.AutoSize = false; newCourseDDL.Font = new Font("宋体", 9, FontStyle.Bold); newCourseDDL.ForeColor = FontColor1; newCourseDDL.TextAlign = ContentAlignment.MiddleCenter; newCourseDDL.Dock = DockStyle.Fill; CourseTablePanel.Controls.Add(newCourseDDL, 1, CourseTablePanel.RowCount - 1); //课程的能力值 Label newCourseScore = new Label(); if (IsFinished) { newCourseScore.Text = "???"; ToolTip newCourseScoreTip = new ToolTip(); newCourseScoreTip.InitialDelay = 500; newCourseScoreTip.SetToolTip(newCourseScore, "这门课已经考完了,只有等出成绩才能知道分数哦!"); } else { newCourseScore.Text = newCourse.Score.ToString(); ToolTip newCourseScoreTip = new ToolTip(); newCourseScoreTip.InitialDelay = 500; newCourseScoreTip.SetToolTip(newCourseScore, "如果现在考这门课的预计分数,实际考试分数会受到临场发挥影响!"); } newCourseScore.AutoSize = false; newCourseScore.Font = new Font("宋体", 9, FontStyle.Bold); newCourseScore.ForeColor = FontColor1; newCourseScore.TextAlign = ContentAlignment.MiddleCenter; newCourseScore.Dock = DockStyle.Fill; CourseTablePanel.Controls.Add(newCourseScore, 2, CourseTablePanel.RowCount - 1); if (IsFinished) { return; } //添加到中间区(前提是可以复习) Label newCoursePlan = new Label(); newCoursePlan.Name = newCourse.CourseName; newCoursePlan.Text = $"复习{newCourse.CourseName}"; newCoursePlan.AutoSize = false; newCoursePlan.Height = 50; newCoursePlan.Width = 100; newCoursePlan.ForeColor = FontColor1; newCoursePlan.Font = new Font("宋体", 9, FontStyle.Bold); newCoursePlan.TextAlign = ContentAlignment.MiddleCenter; newCoursePlan.Dock = DockStyle.Fill; newCoursePlanTip.SetToolTip(newCoursePlan, newCourse.DetailedDescription); SelectionTable.Controls.Add(newCoursePlan, MidCurCol, MidCurRow); MidCurCol += 1; if (MidCurCol == 3) { MidCurCol = 0; MidCurRow++; } }
public void RenderForm(Game curGame) { //全体初始化 Gamest = curGame; PlanList = new List <Course>() { new Course(), new Course(), new Course(), new Course() }; PlanLabelList = new List <Label>() { Plan0, Plan1, Plan2, Plan3 }; BtnList = new List <Button>() { ClearMorning, ClearAfternoon, ClearEvening, ClearNight }; StatusList = new bool[] { true, true, true, true }; EventList = new List <GameEventBase>(); for (int i = 0; i < 4; i++) { EventList.Add(GameSystem.GetEvent()); } MidBarFocus = new Label(); //清空原数据,表格归正 while (CourseTablePanel.RowCount > 1) { int delRow = CourseTablePanel.RowCount - 1; for (int i = 0; i < 3; i++) { CourseTablePanel.Controls.RemoveAt(3 * delRow); } CourseTablePanel.RowStyles.RemoveAt(delRow); CourseTablePanel.RowCount--; CourseTablePanel.Height = CourseTablePanel.RowCount * RowHeight; } while (SelectionTable.Controls.Count > 0) { SelectionTable.Controls.RemoveAt(0); } MidCurCol = MidCurRow = 0; //渲染日期,进度条,玩家名 UpdateDate(); UpdateBar(); PlayerName.Text = curGame.PlayerName; //添加新课程 foreach (Course course in curGame.GameChapter.CourseList) { AddCourse(course); } foreach (Label label in SelectionTable.Controls) { label.Click += new EventHandler(SetMidFocus); label.DoubleClick += new EventHandler(SetMidFocus); label.DoubleClick += new EventHandler(DoubleClickMid); } //渲染右侧计划表 foreach (Label label in PlanLabelList) { label.Click += new EventHandler(SetRightFocus); label.Text = "未安排\r\n(休息)"; } DisableLabel(3, "好好休息"); //通宵事件 if (curGame.IfNight == 2) { DisableLabel(0, "昨晚通宵,只能休息"); } //占用考试时间段: foreach (Course course in Gamest.GameChapter.CourseList) { if (course.Deadline == Gamest.CurTurn) { DisableLabel(course.TestPeriod, $"参加{course.CourseName}考试"); EventList[course.TestPeriod] = new GameEventTest(); PlanList[course.TestPeriod] = course; } } RightBarFocus = new Label(); SetRightFocus(GetRightFocus(), new EventArgs()); }
public MakePlan(Game curGame) { InitializeComponent(); GameSystem.SaveGame(1, curGame); RenderForm(curGame); }