private void Dialog_OnClosed(Dialog.ReturnStatus status) { // nothing }
public static Dialog Popup(DwarfGUI gui, string title, string message, ButtonType buttons, int w, int h, GUIComponent parent, int x, int y) { Dialog d = new Dialog(gui, parent) { LocalBounds = new Rectangle(x, y, w, h), MinWidth = w - 150, MinHeight = h - 150 }; d.Initialize(buttons, title, message); return d; }
void HireDialog_OnClosed(Dialog.ReturnStatus status) { }
void destroyDialog_OnClosed(Dialog.ReturnStatus status, Room room) { if (status == Dialog.ReturnStatus.Ok) { DesignatedRooms.Remove(room); List<BuildVoxelOrder> existingDesignations = GetDesignationsAssociatedWithRoom(room); BuildRoomOrder buildRoomDes = null; foreach (BuildVoxelOrder des in existingDesignations) { des.Order.VoxelOrders.Remove(des); buildRoomDes = des.Order; } BuildDesignations.Remove(buildRoomDes); room.Destroy(); } }
public override void Initialize(Dialog.ButtonType buttons, string title, string message) { WasSomeoneHired = false; GenerateApplicants(); IsModal = true; OnClicked += HireDialog_OnClicked; OnClosed += HireDialog_OnClosed; int w = LocalBounds.Width; int h = LocalBounds.Height; int rows = h / 64; int cols = 8; GridLayout layout = new GridLayout(GUI, this, rows, cols); Title = new Label(GUI, layout, title, GUI.TitleFont); layout.SetComponentPosition(Title, 0, 0, 2, 1); GroupBox applicantSelectorBox = new GroupBox(GUI, layout, ""); layout.SetComponentPosition(applicantSelectorBox, 0, 1, rows / 2 - 1, cols - 1); GridLayout selectorLayout = new GridLayout(GUI, applicantSelectorBox, 1, 1); ScrollView view = new ScrollView(GUI, selectorLayout); ApplicantSelector = new ListSelector(GUI, view) { Label = "-Applicants-" }; selectorLayout.SetComponentPosition(view, 0, 0, 1, 1); foreach (Applicant applicant in Applicants) { ApplicantSelector.AddItem(applicant.Level.Name + " - " + applicant.Name); } ApplicantSelector.DrawPanel = false; ApplicantSelector.LocalBounds = new Rectangle(0, 0, 128, Applicants.Count * 24); ApplicantSelector.OnItemSelected += ApplicantSelector_OnItemSelected; CurrentApplicant = Applicants[0]; GroupBox applicantPanel = new GroupBox(GUI, layout, ""); layout.SetComponentPosition(applicantPanel, rows / 2 - 1, 1, rows / 2 - 1, cols - 1); GridLayout applicantLayout = new GridLayout(GUI, applicantPanel, 1, 1); ApplicantPanel = new ApplicationPanel(applicantLayout); applicantLayout.SetComponentPosition(ApplicantPanel, 0, 0, 1, 1); ApplicantPanel.SetApplicant(CurrentApplicant); bool createOK = false; bool createCancel = false; switch (buttons) { case ButtonType.None: break; case ButtonType.OkAndCancel: createOK = true; createCancel = true; break; case ButtonType.OK: createOK = true; break; case ButtonType.Cancel: createCancel = true; break; } if (createOK) { Button okButton = new Button(GUI, layout, "OK", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.Check)); layout.SetComponentPosition(okButton, cols - 2, rows - 1 , 2, 1); okButton.OnClicked += okButton_OnClicked; } if (createCancel) { Button cancelButton = new Button(GUI, layout, "Cancel", GUI.DefaultFont, Button.ButtonMode.PushButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.Ex)); layout.SetComponentPosition(cancelButton, cols - 4, rows - 1, 2, 1); cancelButton.OnClicked += cancelButton_OnClicked; } HireButton = new Button(GUI, layout, "Hire", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.ZoomIn)); layout.SetComponentPosition(HireButton, cols - 1, rows - 2, 1, 1); HireButton.OnClicked += HireButton_OnClicked; }