public DialogItem(string txt, Dialog dialogLink, LinkedEvent evLink) { //enabled = true; text = txt; linksTo = dialogLink; if (evLink != null) { eventLink = new InputEventHandler(evLink); } else { eventLink = null; } }
public static DialogUI CreateLoadGameDialog(SortedDictionary<DateTime, Demo.GameState> allSavedStates) { FontSurface fnt = FontSurface.BitmapMonospace("Resources" + "/" + "monkey.png", new Size(6, 14)); Dialog chooseDialog = new Dialog("The Narrator", new List<String>() { "Choose a saved game:" }, new List<DialogItem>()), finishedLoadDialog = new Dialog("The Narrator", new List<String>() { "Are you ready?" }, new List<DialogItem>()), cannotLoadDialog = new Dialog("The Narrator", new List<String>() { "Play a little first, then you will have a game to load." }, new List<DialogItem>()); DialogItem newGameItem = new DialogItem("New Game", chooseDialog, null, Demo.Init), endOKItem = new DialogItem("OK!", null, null, DialogBrowser.Hide); if (!System.IO.File.Exists("save.mobsav")) { chooseDialog.options = new List<DialogItem>(){ new DialogItem("[No Previous Game]", cannotLoadDialog, null)}; } finishedLoadDialog.options.Add(endOKItem); finishedLoadDialog.setSize(); finishedLoadDialog.previousDialog = null; // finishedLoadDialog.options.Add(endOKItem); DialogUI dui = new DialogUI(chooseDialog, fnt); foreach (DateTime dt in Demo.allSavedStates.Keys) { chooseDialog.options.Add(new DialogItem("Saved on " + dt.ToShortDateString() + " at " + dt.ToShortTimeString(), null, null, Demo.LoadGame)); } chooseDialog.setSize(); dui.allDialogItems.AddRange(chooseDialog.options); chooseDialog.previousDialog = null; cannotLoadDialog.options.Add(newGameItem); cannotLoadDialog.setSize(); cannotLoadDialog.previousDialog = null; //attackChoices.menu.Add(new DialogItem("Scorch", null, Demo.OnKeyDown_SelectSkill)); dui.allDialogItems.Add(newGameItem); return dui; }
public static DialogUI InitLoadUI() { FontSurface fnt = FontSurface.BitmapMonospace("Resources" + "/" + "monkey.png", new Size(6, 14)); Dialog initialDialog = new Dialog("The Narrator", new List<String>() {"Welcome to the Unpleasant Dungeon!", "Navigate through menus with the arrow keys.", "Confirm a selection with the "+ ScreenBrowser.confirmKey.ToString() + " key.", "You can press "+ ScreenBrowser.backKey.ToString() + " to go back in menus and dialogs.", "You can quit this game by pressing Q, which will also give you the option to Save.", "Do you want to start a new game, or load a previous game?"}, new List<DialogItem>()), finishedLoadDialog = new Dialog("The Narrator", new List<String>() { "Choose a saved game:" }, new List<DialogItem>()), remapConfirmDialog = new Dialog("The Narrator", new List<String>() { "Remap the Confirm Key.", "Confirm is currently " + ScreenBrowser.confirmKey.ToString() + ".", "Back is currently " + ScreenBrowser.backKey.ToString() + "." }, new List<DialogItem>()), remapBackDialog = new Dialog("The Narrator", new List<String>() { "Remap the Back Key:", "Confirm is currently " + ScreenBrowser.confirmKey.ToString() + "." , "Back is currently " + ScreenBrowser.backKey.ToString() + "." }, new List<DialogItem>()), cannotLoadDialog = new Dialog("The Narrator", new List<String>() { "Play a little first, then you will have a game to load." }, new List<DialogItem>()); DialogItem newGameItem = new DialogItem("New Game", finishedLoadDialog, null, Demo.Init), loadItem = new DialogItem("Load Previous Game", null, null, Demo.LoadStates), remapItem = new DialogItem("Use Different Keys", remapConfirmDialog, null, RegisterConfirmKey), remapConfirmOKItem = new DialogItem("OK", remapBackDialog, null, RegisterBackKey), remapBackOKItem = new DialogItem("OK", initialDialog, null, AssignInitialDialog), endOKItem = new DialogItem("OK!", null, null, DialogBrowser.Hide); if (!System.IO.File.Exists("save.mobsav")) loadItem = new DialogItem("[No Previous Game]", cannotLoadDialog, null); initialDialog.options.Add(newGameItem); initialDialog.options.Add(loadItem); initialDialog.options.Add(remapItem); initialDialog.setSize(); initialDialog.previousDialog = null; // finishedLoadDialog.options.Add(endOKItem); finishedLoadDialog.setSize(); finishedLoadDialog.previousDialog = null; remapConfirmDialog.options.Add(remapConfirmOKItem); remapConfirmDialog.setSize(); remapConfirmDialog.previousDialog = initialDialog; remapBackDialog.options.Add(remapBackOKItem); remapBackDialog.setSize(); remapBackDialog.previousDialog = remapConfirmDialog; cannotLoadDialog.options.Add(newGameItem); cannotLoadDialog.setSize(); cannotLoadDialog.previousDialog = null; //attackChoices.menu.Add(new DialogItem("Scorch", null, Demo.OnKeyDown_SelectSkill)); DialogUI dui = new DialogUI(initialDialog, fnt); dui.allDialogItems.Add(newGameItem); dui.allDialogItems.Add(loadItem); return dui; }
public static DialogUI CreateYesNoDialog(string speaker, List<string> startText, LinkedAction yesAction, LinkedAction noAction) { FontSurface fnt = FontSurface.BitmapMonospace("Resources" + "/" + "monkey.png", new Size(6, 14)); Dialog initialDialog = new Dialog(speaker, startText, new List<DialogItem>()); DialogItem yesItem = new DialogItem("Yes", null, null, yesAction), noItem = new DialogItem("No", null, null, noAction); initialDialog.options.Add(yesItem); initialDialog.options.Add(noItem); initialDialog.setSize(); //attackChoices.menu.Add(new DialogItem("Scorch", null, Demo.OnKeyDown_SelectSkill)); DialogUI dui = new DialogUI(initialDialog, fnt); dui.allDialogItems.Add(yesItem); dui.allDialogItems.Add(noItem); return dui; }
}/* public void ShowOld() { string tx = mandrillDict['┌'].ToString(); tx = tx.PadRight(maxWidth - 1, mandrillDict['─']); tx += mandrillDict['┐']; // for (int i = 1; i < maxWidth - 1; i++) // tx += mandrillDict['─']; font.DrawText(10.0, font.FontHeight * 1, tx); font.DrawText(10.0, font.FontHeight * 2, mandrillDict['│'] + currentDialog.speaker.PadRight(maxWidth - 2, ' ') + mandrillDict['│']); tx = mandrillDict['├'].ToString(); tx = tx.PadRight(maxWidth - 1, mandrillDict['─']); tx += mandrillDict['┤']; font.DrawText(10.0, font.FontHeight * 3, tx); for (int i = 0; i < currentDialog.options.Count; i++) { font.DrawText(10.0, font.FontHeight * (4 + i), "" + mandrillDict['│']); if (i == currentDialog.) { if (currentDialog.menu[i].enabled) font.Color = Color.Red; else font.Color = Color.Gray; font.DrawText(16.0, font.FontHeight * (4 + i), "> " + currentDialog.menu[i].text.PadRight(maxWidth - 4, ' ')); } else { if (currentDialog.menu[i].enabled) font.Color = Color.White; else font.Color = Color.Gray; font.DrawText(16.0, font.FontHeight * (4 + i), currentDialog.menu[i].text.PadRight(maxWidth - 2, ' ')); } font.Color = Color.White; font.DrawText(10.0 + 6.0 * (maxWidth - 1), font.FontHeight * (4 + i), "" + mandrillDict['│']); } tx = mandrillDict['└'].ToString(); tx = tx.PadRight(maxWidth - 1, mandrillDict['─']); tx += mandrillDict['┘']; font.DrawText(10.0, font.FontHeight * (4 + currentDialog.options.Count), tx); }*/ public static DialogUI InitUI() { FontSurface fnt = FontSurface.BitmapMonospace("Resources" + "/" + "monkey.png", new Size(6, 14)); Dialog initialDialog = new Dialog("The Narrator", new List<String>() {"Welcome to the Unpleasant Dungeon!", "Navigate through menus with the arrow keys.", "Confirm a selection with the "+ ScreenBrowser.confirmKey.ToString() + " key.", "Do you understand?"}, new List<DialogItem>()), yesDialog = new Dialog("The Narrator", new List<String>() { "Great!", "You can press " + ScreenBrowser.backKey.ToString() + " to go back in menus and dialogs.", "Are you ready to start?" }, new List<DialogItem>()), noDialog = new Dialog("The Narrator", new List<String>() { "Then how did you get here?" }, new List<DialogItem>()); DialogItem yesItem = new DialogItem("Yes", yesDialog, null), noItem = new DialogItem("No", noDialog, null), endOKItem = new DialogItem("OK!", null, null, DialogBrowser.Hide), huhItem = new DialogItem("???", initialDialog, null); initialDialog.options.Add(yesItem); initialDialog.options.Add(noItem); initialDialog.setSize(); yesDialog.options.Add(endOKItem); yesDialog.setSize(); noDialog.options.Add(huhItem); noDialog.setSize(); yesDialog.previousDialog = initialDialog; noDialog.previousDialog = initialDialog; //attackChoices.menu.Add(new DialogItem("Scorch", null, Demo.OnKeyDown_SelectSkill)); DialogUI dui = new DialogUI(initialDialog, fnt); dui.allDialogItems.Add(yesItem); dui.allDialogItems.Add(noItem); return dui; }
public DialogUI(Dialog s, FontSurface fnt) { initialDialog = s; // previousDialog = s.Clone(); currentDialog = s; // allDialogs = new Dictionary<String, Dialog>() { { s.speaker + s.lines[0], s } }; allDialogItems = new List<DialogItem>(s.options); font = fnt; }
public static void NavigateBackward(Dialog s) { // currentUI.initialDialog = currentUI.currentDialog.Clone(); // currentUI.previousDialog = currentUI.currentDialog.Clone(); currentUI.currentDialog = s.previousDialog; }