private void cancelCourse(ActiveCourse course) { DialogGUIBase[] options = new DialogGUIBase[3]; options[0] = new DialogGUIFlexibleSpace(); options[1] = new DialogGUIButton("Yes", () => { /* We "complete" the course but we didn't mark it as Completed, so it just releases the students and doesn't apply rewards */ course.CompleteCourse(); }); options[2] = new DialogGUIButton("No", () => { }); StringBuilder msg = new StringBuilder("Are you sure you want to cancel this course? The following students will cease study:"); foreach (ProtoCrewMember stud in course.Students) { msg.AppendLine(); msg.Append(stud.name); } MultiOptionDialog diag = new MultiOptionDialog("ConfirmCancelCourse", msg.ToStringAndRelease(), "Stop Course?", HighLogic.UISkin, new Rect(0.5f, 0.5f, 150f, 60f), new DialogGUIFlexibleSpace(), new DialogGUIVerticalLayout(options)); PopupDialog.SpawnPopupDialog(diag, false, HighLogic.UISkin); }
private void CancelCourse(ActiveCourse course) { DialogGUIBase[] options = new DialogGUIBase[3]; options[0] = new DialogGUIFlexibleSpace(); options[1] = new DialogGUIButton("Yes", () => { // We "complete" the course but we didn't mark it as Completed, so it just releases the students and doesn't apply rewards course.CompleteCourse(); CrewHandler.Instance.ActiveCourses.Remove(course); MaintenanceHandler.Instance?.UpdateUpkeep(); }); options[2] = new DialogGUIButton("No", () => { }); var sb = new StringBuilder("Are you sure you want to cancel this course? The following students will cease study:"); foreach (ProtoCrewMember stud in course.Students) { sb.AppendLine(); sb.Append(stud.name); } var diag = new MultiOptionDialog("ConfirmCancelCourse", sb.ToStringAndRelease(), "Stop Course?", HighLogic.UISkin, new Rect(0.5f, 0.5f, 150f, 60f), new DialogGUIFlexibleSpace(), new DialogGUIHorizontalLayout(options)); PopupDialog.SpawnPopupDialog(diag, false, HighLogic.UISkin); }