public static void Handler() { if (Subscreens.FirstDraw) { Subscreens.FirstDraw = false; if (!FromTitle) { UIManager.Initialize(); UIManager.Elements.Clear(); } else { //Leave the title screen background UIManager.Highlight = UIManager.Elements[0]; UIManager.Elements.RemoveRange(3, UIManager.Elements.Count - 3); } window = new UIWindow(i18n.GetString("opt_title")) { Left = 0, Top = 0, Width = 80, Height = 25, }; window.Center(); var speedLabel = new UILabel(i18n.GetString("opt_speed")); speedLabel.Move(3, 2, window); speed = new UITextBox(IniFile.GetValue("misc", "speed", "15")) { Width = 4, Numeric = true }; speed.Move(1, 1, speedLabel); var fonts = Mix.GetFilesWithPattern("fonts\\*.png").Select(x => System.IO.Path.GetFileNameWithoutExtension(x)).ToArray(); var currentFont = IniFile.GetValue("misc", "font", "8x8-thin"); var currentFontIndex = 0; if (fonts.Contains(currentFont)) { for (currentFontIndex = 0; currentFontIndex < fonts.Length; currentFontIndex++) { if (fonts[currentFontIndex] == currentFont) { break; } } } var fontLabel = new UILabel(i18n.GetString("opt_font")); fontLabel.Move(0, 3, speedLabel); font = new UIList(string.Empty, null, fonts, currentFontIndex) { Width = 20, Height = 8, }; font.Move(1, 1, fontLabel); font.Enter = (s, e) => { var previousFont = font.Text; IniFile.SetValue("misc", "font", font.Text); NoxicoGame.HostForm.RestartGraphics(false); IniFile.SetValue("misc", "font", previousFont); }; font.EnsureVisible(); var screenColsLabel = new UILabel(i18n.GetString("opt_screencols")); screenColsLabel.MoveBelow(-1, 1, font); screenCols = new UITextBox(IniFile.GetValue("misc", "screencols", "80")) { Width = 4, Numeric = true }; screenCols.Move(1, 1, screenColsLabel); var screenRowsLabel = new UILabel(i18n.GetString("opt_screenrows")); screenRowsLabel.Move(-1, 1, screenCols); screenRows = new UITextBox(IniFile.GetValue("misc", "screenrows", "25")) { Width = 4, Numeric = true }; screenRows.Move(1, 1, screenRowsLabel); screenCols.Enter = screenRows.Enter = (s, e) => { var resetGraphics = false; var i = int.Parse(screenCols.Text); if (i < 80) { i = 80; } if (i > 300) { i = 300; } if (i != Program.Cols) { resetGraphics = true; } Program.Cols = i; IniFile.SetValue("misc", "screencols", i); i = int.Parse(screenRows.Text); if (i < 25) { i = 25; } if (i > 100) { i = 100; } if (i != Program.Rows) { resetGraphics = true; } Program.Rows = i; IniFile.SetValue("misc", "screenrows", i); if (resetGraphics) { NoxicoGame.HostForm.RestartGraphics(true); window.Center(); UIManager.ReMove(); } Subscreens.Redraw = true; NoxicoGame.Me.CurrentBoard.AimCamera(); NoxicoGame.Me.CurrentBoard.Redraw(); NoxicoGame.Me.CurrentBoard.Draw(); }; var miscWindow = new UIWindow(i18n.GetString("opt_misc")) { Width = 50, Height = 11, }; miscWindow.MoveBeside(2, 0, speedLabel); rememberPause = new UIToggle(i18n.GetString("opt_rememberpause")) { Checked = IniFile.GetValue("misc", "rememberpause", true), Background = Color.Transparent, }; rememberPause.Move(2, 1, miscWindow); vistaSaves = new UIToggle(i18n.GetString("opt_vistasaves")) { Checked = IniFile.GetValue("misc", "vistasaves", true), Enabled = Vista.IsVista, Background = Color.Transparent, }; vistaSaves.MoveBelow(0, 1, rememberPause); xInput = new UIToggle(i18n.GetString("opt_xinput")) { Checked = IniFile.GetValue("misc", "xinput", true), Enabled = Vista.IsVista, Background = Color.Transparent, }; xInput.MoveBelow(0, 1, vistaSaves); imperial = new UIToggle(i18n.GetString("opt_imperial")) { Checked = IniFile.GetValue("misc", "imperial", false), Background = Color.Transparent, }; imperial.MoveBelow(0, 1, xInput); fourThirtySeven = new UIToggle(i18n.GetString("opt_437")) { Checked = IniFile.GetValue("misc", "437", false), Background = Color.Transparent, }; fourThirtySeven.MoveBelow(0, 1, imperial); var audioWindow = new UIWindow(i18n.GetString("opt_audio")) { Width = 30, Height = 8, }; audioWindow.MoveBelow(0, 1, miscWindow); enableAudio = new UIToggle(i18n.GetString("opt_enableaudio")) { Checked = IniFile.GetValue("audio", "enabled", true), Background = Color.Transparent, }; enableAudio.Move(2, 1, audioWindow); var musicVolumeLabel = new UILabel(i18n.GetString("opt_musicvolume")); musicVolumeLabel.MoveBelow(0, 1, enableAudio); musicVolume = new UITextBox(IniFile.GetValue("audio", "musicvolume", "100")); musicVolume.Move(1, 1, musicVolumeLabel); var soundVolumeLabel = new UILabel(i18n.GetString("opt_soundvolume")); soundVolumeLabel.Move(-1, 1, musicVolume); soundVolume = new UITextBox(IniFile.GetValue("audio", "soundvolume", "100")); soundVolume.Move(1, 1, soundVolumeLabel); saveButton = new UIButton(i18n.GetString("opt_save"), (s, e) => { var i = int.Parse(speed.Text); if (i < 1) { i = 1; } if (i > 200) { i = 200; } IniFile.SetValue("misc", "speed", i); IniFile.SetValue("misc", "font", font.Text); IniFile.SetValue("misc", "rememberpause", rememberPause.Checked); IniFile.SetValue("misc", "vistasaves", vistaSaves.Checked); IniFile.SetValue("misc", "xinput", xInput.Checked); IniFile.SetValue("misc", "imperial", imperial.Checked); IniFile.SetValue("misc", "437", fourThirtySeven.Checked); Vista.GamepadEnabled = xInput.Checked; var resetGraphics = false; i = int.Parse(screenCols.Text); if (i < 80) { i = 80; } if (i > 300) { i = 300; } if (i != Program.Cols) { resetGraphics = true; } Program.Cols = i; IniFile.SetValue("misc", "screencols", i); i = int.Parse(screenRows.Text); if (i < 25) { i = 25; } if (i > 100) { i = 100; } if (i != Program.Rows) { resetGraphics = true; } Program.Rows = i; IniFile.SetValue("misc", "screenrows", i); IniFile.SetValue("misc", "imperial", imperial.Checked); IniFile.SetValue("audio", "enabled", enableAudio.Checked); i = int.Parse(musicVolume.Text); if (i < 0) { i = 0; } if (i > 100) { i = 100; } NoxicoGame.Sound.MusicVolume = i / 100f; IniFile.SetValue("audio", "musicvolume", i); i = int.Parse(soundVolume.Text); if (i < 0) { i = 0; } if (i > 100) { i = 100; } NoxicoGame.Sound.SoundVolume = i / 100f; IniFile.SetValue("audio", "soundvolume", i); if (!enableAudio.Checked && NoxicoGame.Sound != null) { NoxicoGame.Sound.ShutDown(); } else if (enableAudio.Checked && !NoxicoGame.Sound.Enabled) { NoxicoGame.Sound = new SoundSystem(); if (NoxicoGame.Me.CurrentBoard != null) { NoxicoGame.Me.CurrentBoard.PlayMusic(); } } if (resetGraphics) { NoxicoGame.HostForm.RestartGraphics(true); } IniFile.Save(string.Empty); cancelButton.DoEnter(); }) { Width = 16 }; saveButton.MoveBeside(2, 0, audioWindow); keysButton = new UIButton(i18n.GetString("opt_keys"), (s, e) => { Controls.Open(); }) { Width = 16 }; keysButton.MoveBelow(0, 1, saveButton); openButton = new UIButton(i18n.GetString("opt_open"), (s, e) => { System.Diagnostics.Process.Start(NoxicoGame.HostForm.IniPath); }) { Width = 16 }; openButton.MoveBelow(0, 1, keysButton); cancelButton = new UIButton(i18n.GetString("opt_cancel"), (s, e) => { UIManager.Elements.Clear(); NoxicoGame.ClearKeys(); NoxicoGame.Immediate = true; NoxicoGame.Me.CurrentBoard.Redraw(); NoxicoGame.Me.CurrentBoard.Draw(true); NoxicoGame.Mode = UserMode.Walkabout; if (FromTitle) { Introduction.Title(); } Subscreens.FirstDraw = true; }) { Width = 16 }; cancelButton.MoveBelow(0, 1, openButton); UIManager.Elements.Add(window); UIManager.Elements.Add(speedLabel); UIManager.Elements.Add(speed); UIManager.Elements.Add(fontLabel); UIManager.Elements.Add(font); UIManager.Elements.Add(screenColsLabel); UIManager.Elements.Add(screenCols); UIManager.Elements.Add(screenRowsLabel); UIManager.Elements.Add(screenRows); UIManager.Elements.Add(miscWindow); UIManager.Elements.Add(rememberPause); UIManager.Elements.Add(vistaSaves); UIManager.Elements.Add(xInput); UIManager.Elements.Add(imperial); UIManager.Elements.Add(fourThirtySeven); UIManager.Elements.Add(audioWindow); UIManager.Elements.Add(enableAudio); UIManager.Elements.Add(musicVolumeLabel); UIManager.Elements.Add(musicVolume); UIManager.Elements.Add(soundVolumeLabel); UIManager.Elements.Add(soundVolume); UIManager.Elements.Add(saveButton); UIManager.Elements.Add(keysButton); UIManager.Elements.Add(openButton); UIManager.Elements.Add(cancelButton); Subscreens.FirstDraw = false; Subscreens.Redraw = true; } if (Subscreens.Redraw) { Subscreens.Redraw = false; UIManager.Draw(); } if (NoxicoGame.IsKeyDown(KeyBinding.Back) || Vista.Triggers == XInputButtons.B) { cancelButton.DoEnter(); } else { UIManager.CheckKeys(); } }
public static void Handler() { var player = NoxicoGame.Me.Player; if (!player.Character.HasToken("items") || player.Character.GetToken("items").Tokens.Count == 0) { MessageBox.Notice(i18n.GetString("inventory_youhavenothing"), true); Subscreens.PreviousScreen.Clear(); Subscreens.FirstDraw = true; return; } if (Subscreens.FirstDraw) { UIManager.Initialize(); Subscreens.FirstDraw = false; NoxicoGame.ClearKeys(); Subscreens.Redraw = true; } if (Subscreens.Redraw) { Subscreens.Redraw = false; inventoryTokens.Clear(); inventoryItems.Clear(); var itemTexts = new List <string>(); Inventory.sigils = new List <string>(); foreach (var carriedItem in player.Character.GetToken("items").Tokens) { var find = NoxicoGame.KnownItems.Find(x => x.ID == carriedItem.Name); if (find == null) { continue; } inventoryTokens.Add(carriedItem); inventoryItems.Add(find); var item = find; var sigils = new List <string>(); var carried = carriedItem; var icon = " "; if (item.HasToken("ascii")) { var color = "Silver"; if (item.Path("ascii/fore") != null) { color = item.Path("ascii/fore").Text; } if (carriedItem.HasToken("color")) { color = carriedItem.GetToken("color").Text; } if (item.ID == "book") { var cga = new[] { "Black", "DarkBlue", "DarkGreen", "DarkCyan", "DarkRed", "Purple", "Brown", "Silver", "Gray", "Blue", "Green", "Cyan", "Red", "Magenta", "Yellow", "White" }; color = cga[carriedItem.GetToken("id").Text.GetHashCode() % cga.Length]; } if (color.Equals("black", StringComparison.OrdinalIgnoreCase)) { color = "Gray"; } icon = "<c" + color + ">" + (char)item.Path("ascii/char").Value; } if (item.HasToken("equipable")) { var eq = item.GetToken("equipable"); //if (item.HasToken("weapon")) // sigils.Add("weapon"); if (eq.HasToken("hat") && eq.HasToken("goggles") && eq.HasToken("mask")) { sigils.Add("fullmask"); } else { foreach (var x in new[] { "hat", "goggles", "mask" }) { if (eq.HasToken(x)) { sigils.Add(x); } } } foreach (var x in new[] { "neck", "ring" }) { if (eq.HasToken(x)) { sigils.Add(x); } } if (eq.HasToken("underpants") || eq.HasToken("undershirt")) { sigils.Add("undies"); } if (eq.HasToken("shirt") && !eq.HasToken("pants")) { sigils.Add("shirt"); } if (eq.HasToken("pants") && !eq.HasToken("shirt")) { sigils.Add("pants"); } if (eq.HasToken("shirt") && eq.HasToken("pants")) { sigils.Add("suit"); } foreach (var x in new[] { "shoes", "jacket", "cloak", "socks" }) { if (eq.HasToken(x)) { sigils.Add(x); } } if (carried.HasToken("equipped")) { sigils.Add("equipped"); } } if (carried.HasToken("unidentified")) { sigils.Add("unidentified"); } /* * if (item.HasToken("statbonus")) * { * foreach (var bonus in item.GetToken("statbonus").Tokens) * { * if (bonus.Name == "health") * sigils.Add("\uE300" + bonus.Value + "HP"); * } * } */ var info = item.GetModifiers(carriedItem); sigils.AddRange(info.Select(x => "\uE300" + x)); /* Removed -- should be replaced with less cursy words. #if DEBUG * if (carried.HasToken("cursed")) * sigils.Add(carried.GetToken("cursed").HasToken("known") ? "cursed" : carried.GetToken("cursed").HasToken("hidden") ? "(cursed)" : "cursed!"); #else * if (carried.HasToken("cursed") && !carried.GetToken("cursed").HasToken("hidden") && carried.GetToken("cursed").HasToken("known")) * sigils.Add("cursed"); #endif */ var itemString = item.ToString(carried, false, false); if (itemString.Length > 33) { itemString = itemString.Disemvowel(); } itemTexts.Add(itemString); var sigilText = new StringBuilder(); var sigilComma = string.Empty; for (var i = 0; i < sigils.Count; i++) { if (sigilText.Length < Program.Cols - 40) { sigilText.Append(sigilComma); sigilText.Append((sigils[i][0] == '\uE300') ? sigils[i].Substring(1) : i18n.GetString("sigil_" + sigils[i])); sigilComma = ", "; } else { if (i < sigils.Count) { sigilText.Append('\u0137'); } break; } } Inventory.sigils.Add(icon + "<cGray> " + sigilText.ToString()); /* Inventory.sigils.Add(icon + "<cGray> " + string.Join(", ", sigils.Select(s => * { * if (s[0] == '\uE300') * return s.Substring(1); * else * return i18n.GetString("sigil_" + s); * }))); */ } var height = inventoryItems.Count; if (height > Program.Rows - 15) { height = Program.Rows - 15; } if (selection >= inventoryItems.Count) { selection = inventoryItems.Count - 1; } if (UIManager.Elements.Count < 2) { yourWindow = new UIWindow(i18n.GetString("inventory_yours")) { Left = 1, Top = 1, Width = Program.Cols - 2, Height = 2 + height }; descriptionWindow = new UIWindow(string.Empty) { Left = 2, Top = Program.Rows - 10, Width = Program.Cols - 4, Height = 8, Title = UIColors.RegularText }; howTo = new UILabel(string.Empty) { Left = 0, Top = 0, Width = Program.Cols - 1, Height = 1, Background = UIColors.StatusBackground, Foreground = UIColors.StatusForeground }; itemDesc = new UILabel(string.Empty) { Width = Program.Cols - 8, Height = 5 }; itemDesc.Move(2, 1, descriptionWindow); itemList = new UIList(string.Empty, null, itemTexts) { Width = Program.Cols - 4, Height = height, Index = selection, Background = UIColors.WindowBackground }; itemList.Move(1, 1, yourWindow); sigilView = new UILabel(string.Empty) { Width = 60, Height = height }; sigilView.Move(33, 0, itemList); itemList.Change = (s, e) => { selection = itemList.Index; var t = inventoryTokens[itemList.Index]; var i = inventoryItems[itemList.Index]; var r = string.Empty; var d = i.GetDescription(t) + "\n\n"; var weaponData = i.GetToken("weapon"); if (weaponData != null) { if (weaponData.HasToken("skill")) { d += i18n.Format("inventory_weaponskill", weaponData.GetToken("skill").Text.Replace('_', ' ') + " "); } if (weaponData.HasToken("attacktype")) { d += i18n.Format("inventory_weapontype", i18n.GetString("attacktype_" + weaponData.GetToken("attacktype").Text)); } d += '\n'; } var mods = i.GetModifiers(t); if (mods.Count > 0) { d += i18n.Format("inventory_modifiers", mods.Join()); } d = Toolkit.Wordwrap(d.SmartQuote(), itemDesc.Width); if (i.ID == "book") { r = i18n.GetString("inventory_pressenter_book"); } else if (i.HasToken("equipable")) { if (t.HasToken("equipped")) { if (t.Path("cursed/known") != null) { r = i18n.GetString("inventory_cannotunequip"); } else { r = i18n.GetString("inventory_pressenter_unequip"); } } else { r = i18n.GetString("inventory_pressenter_equip"); } } else if (i.HasToken("quest")) { r = i18n.GetString("inventory_questitem"); } else { r = i18n.GetString("inventory_pressenter_use"); } howTo.Text = (' ' + r).PadEffective(Program.Cols); itemDesc.Text = d; descriptionWindow.Text = i.ToString(t, false, false); //howTo.Draw(); //itemDesc.Draw(); UpdateColumns(); UIManager.Draw(); }; itemList.Enter = (s, e) => { TryUse(player.Character, inventoryTokens[itemList.Index], inventoryItems[itemList.Index]); }; capacity = new UILabel(string.Format("{0:F2}/{1:F2}", player.Character.Carried, player.Character.Capacity)); capacity.MoveBelow(4, -1, descriptionWindow); UIManager.Elements.Add(new UILabel(new string(' ', Program.Cols)) { Left = 0, Top = Program.Rows - 1, Background = UIColors.StatusBackground }); UIManager.Elements.Add(yourWindow); UIManager.Elements.Add(descriptionWindow); UIManager.Elements.Add(howTo); UIManager.Elements.Add(itemList); UIManager.Elements.Add(sigilView); UIManager.Elements.Add(itemDesc); UIManager.Elements.Add(capacity); UIManager.Elements.Add(new UIButton(' ' + i18n.GetString("inventory_drop") + ' ', (s, e) => { TryDrop(player, inventoryTokens[itemList.Index], inventoryItems[itemList.Index]); }) { Left = Program.Cols - 4 - i18n.GetString("inventory_drop").Length() - 2, Top = 1 }); UIManager.Highlight = itemList; } else { yourWindow.Height = 2 + height; itemList.Items = itemTexts; NoxicoGame.Me.CurrentBoard.Redraw(); NoxicoGame.Me.CurrentBoard.Draw(); } itemList.Index = selection; NoxicoGame.DrawStatus(); UIManager.Draw(); } if (NoxicoGame.IsKeyDown(KeyBinding.Back) || NoxicoGame.IsKeyDown(KeyBinding.Items) || Vista.Triggers == XInputButtons.B) { NoxicoGame.ClearKeys(); NoxicoGame.Immediate = true; NoxicoGame.Me.CurrentBoard.Redraw(); NoxicoGame.Me.CurrentBoard.Draw(true); NoxicoGame.Mode = UserMode.Walkabout; Subscreens.FirstDraw = true; } //else if (NoxicoGame.IsKeyDown(KeyBinding.Drop)) //{ // TryDrop(player, inventoryTokens[itemList.Index], inventoryItems[itemList.Index]); //} else { UIManager.CheckKeys(); sigilView.Draw(); } }
/// <summary> /// Displays a list at the given screen location or close to it. /// </summary> /// <param name="title">The title of the window.</param> /// <param name="x">The horizontal coordinate to aim the window at.</param> /// <param name="y">The vertical coordinate to aim the window at.</param> /// <param name="options">A list of options to display.</param> /// <param name="okay">What to do when an option is chosen.</param> public static void Show(string title, int x, int y, Dictionary <object, string> options, Action okay) { option = 0; onChoice = okay; Answer = null; ActionList.options = options; //Determine window width according to its contents. var width = title.Length() + 4; foreach (var o in options.Values) { if (o.Length() > width) { width = o.Length(); } } width += 4; //Place the window just to the right of the specified location. //If this goes off-screen, try placing it to the left instead. if (x + 1 + width >= Program.Cols) { x = x - width; } else { x++; } var height = options.Count + 2; if (height > Program.Rows - 5) { height = Program.Rows - 5; } //Check if we're going off the bottom of the screen and correct. if (y + height >= Program.Rows - 5) { y = Program.Rows - height - 5; } //If we go off the left or top, f**k it -- overlap the target. if (x < 0) { x = 0; } if (y < NoxicoGame.Messages.Count) { y = NoxicoGame.Messages.Count; } UIManager.Initialize(); win = new UIWindow(title) { Left = x, Top = y, Width = width, Height = height }; lst = new UIList(string.Empty, Enter, options.Values.ToList(), 0) { Left = x + 1, Top = y + 1, Width = width - 2, Height = height - 2, Background = UIColors.WindowBackground }; lst.Change += (s, e) => { option = lst.Index; ActionList.Answer = options.Keys.ToArray()[option]; }; lst.Change(null, null); //Make sure we have something -- the first item -- selected. UIManager.Elements.Add(win); UIManager.Elements.Add(lst); NoxicoGame.Mode = UserMode.Subscreen; Subscreens.FirstDraw = true; NoxicoGame.Subscreen = ActionList.Handler; }
public static void Handler() { if (Subscreens.FirstDraw) { Subscreens.FirstDraw = false; if (!Options.FromTitle) { UIManager.Initialize(); UIManager.Elements.Clear(); } else { UIManager.Highlight = UIManager.Elements[0]; UIManager.Elements.RemoveRange(3, UIManager.Elements.Count - 3); } NoxicoGame.Immediate = true; NoxicoGame.Me.CurrentBoard.Redraw(); NoxicoGame.Me.CurrentBoard.Draw(true); var items = Enum.GetNames(typeof(KeyBinding)); numControls = items.Length; var numShown = numControls > 17 ? 17 : numControls; var window = new UIWindow(i18n.GetString("key_Title")) { Width = 44, Height = numShown + 6 }; window.Center(); controlList = new UIList(string.Empty, null, items) { Width = 40, Height = numShown }; controlList.Move(2, 2, window); controlList.Enter = (s, e) => { waitingForKey = true; controlList.Items[controlList.Index] = i18n.GetString("key_" + Enum.GetName(typeof(KeyBinding), controlList.Index)).PadEffective(16) + "........"; controlList.DrawQuick(); }; saveButton = new UIButton(i18n.GetString("key_Save"), (s, e) => { //TODO: set values IniFile.Save("noxico.ini"); Options.Open(); }) { Width = 12 }; saveButton.MoveBelow(0, 1, controlList); resetButton = new UIButton(i18n.GetString("key_Reset"), (s, e) => { NoxicoGame.ResetKeymap(); UpdateItems(); UIManager.Highlight = controlList; UIManager.Draw(); }) { Width = 12 }; resetButton.MoveBeside(2, 0, saveButton); UpdateItems(); UIManager.Elements.Add(window); UIManager.Elements.Add(controlList); UIManager.Elements.Add(saveButton); UIManager.Elements.Add(resetButton); Subscreens.Redraw = true; } if (Subscreens.Redraw) { Subscreens.Redraw = false; UIManager.Draw(); } if (!waitingForKey) { UIManager.CheckKeys(); } else { var binding = (KeyBinding)controlList.Index; for (var i = 0; i < 255; i++) { if ((i >= 16 && i <= 18) || i == 91) { continue; //skip modifiers } if (NoxicoGame.KeyMap[(Keys)i]) { var theKey = (Keys)i; NoxicoGame.KeyBindings[binding] = theKey; NoxicoGame.RawBindings[binding] = theKey.ToString().ToUpperInvariant(); NoxicoGame.KeyBindingMods[binding] = NoxicoGame.Modifiers[0]; UpdateItems(); controlList.DrawQuick(); waitingForKey = false; NoxicoGame.KeyMap[(Keys)i] = false; break; } } } }
public static void Handler() { if (Subscreens.FirstDraw) { Subscreens.FirstDraw = false; var lines = text.Split('\n').Length; var height = lines + 1; var listHeight = 0; if (type == BoxType.List) { listHeight = options.Count; if (listHeight > Program.Rows - 9) { listHeight = Program.Rows - 9; } height += 1 + listHeight; } else if (type == BoxType.Input) { height += 2; } var top = (Program.Rows / 2) - (height / 2); if (top < 0) { top = 0; } if (UIManager.Elements == null || fromWalkaround) { UIManager.Initialize(); } if (icon != null) { icon.Left = Program.Cols - icon.Bitmap.Width; icon.Top = Program.Rows - icon.Bitmap.Height; UIManager.Elements.Add(icon); } var left = (Program.Cols / 2) - (width / 2); win = new UIWindow(type == BoxType.Question ? i18n.GetString("msgbox_question") : title) { Left = left, Top = top, Width = width + 4, Height = height }; UIManager.Elements.Add(win); lbl = new UILabel(text) { Left = left + 2, Top = top + 1, Width = width, Height = lines }; UIManager.Elements.Add(lbl); lst = null; txt = null; if (type == BoxType.List) { lst = new UIList(string.Empty, Enter, options.Values.ToList(), 0) { Left = left + 2, Top = top + lines + 1, Width = width, Height = listHeight }; lst.Change += (s, e) => { option = lst.Index; Answer = options.Keys.ToArray()[option]; }; lst.Change(null, null); UIManager.Elements.Add(lst); } else if (type == BoxType.Input) { txt = new UITextBox((string)Answer) { Left = left + 2, Top = top + lines + 1, Width = width - 1, Height = 1 }; UIManager.Elements.Add(txt); } var keys = string.Empty; if (type == BoxType.Notice || type == BoxType.Input) { keys = " \x137 "; } else if (type == BoxType.Question) { keys = " " + Toolkit.TranslateKey(KeyBinding.Accept) + "/" + Toolkit.TranslateKey(KeyBinding.Back) + " "; } else if (type == BoxType.List) { keys = " \x18/\x19 "; } key = new UILabel(keys) { Top = top + height - 1, Left = left + width - 2 - keys.Length() }; UIManager.Elements.Add(key); Subscreens.Redraw = true; } if (Subscreens.Redraw) { Subscreens.Redraw = false; UIManager.Draw(); } if (NoxicoGame.IsKeyDown(KeyBinding.Back) || NoxicoGame.IsKeyDown(KeyBinding.Accept) || Vista.Triggers == XInputButtons.A || Vista.Triggers == XInputButtons.B) { if (NoxicoGame.IsKeyDown(KeyBinding.Back) || Vista.Triggers == XInputButtons.B) { if (type == BoxType.List) { if (!allowEscape) { return; } else { option = -1; } } else if (type == BoxType.Input) { UIManager.CheckKeys(); return; } } Enter(null, null); if (type == BoxType.Question) { if ((NoxicoGame.IsKeyDown(KeyBinding.Accept) || Vista.Triggers == XInputButtons.A) && onYes != null) { NoxicoGame.ClearKeys(); onYes(); } else if ((NoxicoGame.IsKeyDown(KeyBinding.Back) || Vista.Triggers == XInputButtons.B) && onNo != null) { NoxicoGame.ClearKeys(); onNo(); } } else if (type == BoxType.List) { Answer = option == -1 ? -1 : options.ElementAt(option).Key; onYes(); NoxicoGame.ClearKeys(); } else if (type == BoxType.Input) { Answer = txt.Text; onYes(); NoxicoGame.ClearKeys(); } else { type = BoxType.Notice; NoxicoGame.ClearKeys(); } if (ScriptPauseHandler != null) { ScriptPauseHandler(); ScriptPauseHandler = null; } } else { UIManager.CheckKeys(); } }
/// <summary> /// Generic Subscreen handler. /// </summary> public static void Handler() { var keys = NoxicoGame.KeyMap; var player = NoxicoGame.Me.Player; var width = (Program.Cols / 2) - 2; if (Subscreens.FirstDraw) { UIManager.Initialize(); UIManager.Elements.Clear(); //Prepare the left item list and its UIElements... var height = 1; containerTokens.Clear(); containerItems.Clear(); containerList = null; var containerTexts = new List <string>(); containerWindow = new UIWindow(title) { Left = 1, Top = 1, Width = width, Height = 2 + height }; containerList = new UIList(string.Empty, null, containerTexts) { Width = width - 2, Height = height, Index = indexLeft, Background = UIColors.WindowBackground }; containerList.Move(1, 1, containerWindow); UIManager.Elements.Add(containerWindow); var emptyMessage = mode == ContainerMode.Vendor ? i18n.Format("inventory_x_hasnothing", vendorChar.Name.ToString()) : mode == ContainerMode.Corpse ? i18n.GetString("inventory_nothingleft") : i18n.GetString("inventory_empty"); var emptyMessageC = new UILabel(emptyMessage) { Width = width - 3, Height = 1 }; emptyMessageC.Move(2, 1, containerWindow); UIManager.Elements.Add(emptyMessageC); UIManager.Elements.Add(containerList); if (other.Tokens.Count == 0) { containerList.Hidden = true; containerWindow.Height = 3; } else { //Populate the left list... foreach (var carriedItem in other.Tokens) { //Only let vendors sell things meant for sale, not their literal shirt off their back if (vendorChar != null && !carriedItem.HasToken("for_sale")) { continue; } var find = NoxicoGame.KnownItems.Find(x => x.ID == carriedItem.Name); if (find == null) { continue; } containerTokens.Add(carriedItem); containerItems.Add(find); var item = find; var itemString = item.ToString(carriedItem, false, false); if (itemString.Length > width - 5) { itemString = itemString.Disemvowel(); } itemString = itemString.PadEffective(width - 5); //Add any extra sigils. if (mode == ContainerMode.Vendor && carriedItem.HasToken("equipped")) { itemString = itemString.Remove(width - 6) + i18n.GetString("sigil_short_worn"); } if (carriedItem.Path("cursed/known") != null) { itemString = itemString.Remove(width - 6) + "C"; //DO NOT TRANSLATE -- Curses will be replaced with better terms and variants such as "Slippery" or "Sticky". } containerTexts.Add(itemString); } height = containerItems.Count; if (height > Program.Rows - 15) { height = Program.Rows - 15; } if (indexLeft >= containerItems.Count) { indexLeft = containerItems.Count - 1; } containerList.Items.Clear(); containerList.Items.AddRange(containerTexts); containerWindow.Height = 2 + height; containerList.Height = height; } //Prepare the right item list and its UIElements... playerTokens.Clear(); playerItems.Clear(); playerList = null; var playerTexts = new List <string>(); playerWindow = new UIWindow(i18n.GetString("inventory_yours")) { Width = width, Height = 3 }; playerWindow.MoveBeside(2, 0, containerWindow); playerList = new UIList(string.Empty, null, playerTexts) { Width = width - 2, Height = 1, Index = indexRight, Background = UIColors.WindowBackground }; playerList.Move(1, 1, playerWindow); UIManager.Elements.Add(playerWindow); var playerNothing = new UILabel(i18n.GetString("inventory_youhavenothing")) { Left = width + 5, Top = 2, Width = width - 3, Height = 1 }; playerNothing.Move(2, 1, playerWindow); UIManager.Elements.Add(playerNothing); UIManager.Elements.Add(playerList); if (player.Character.GetToken("items").Tokens.Count == 0) { playerList.Hidden = true; playerWindow.Height = 3; } else { //Populate the right list... foreach (var carriedItem in player.Character.GetToken("items").Tokens) { var find = NoxicoGame.KnownItems.Find(x => x.ID == carriedItem.Name); if (find == null) { continue; } playerTokens.Add(carriedItem); playerItems.Add(find); var item = find; var itemString = item.ToString(carriedItem, false, false); if (itemString.Length > width - 5) { itemString = itemString.Disemvowel(); } itemString = itemString.PadEffective(width - 5); if (carriedItem.HasToken("equipped")) { itemString = itemString.Remove(width - 6) + i18n.GetString("sigil_short_worn"); } if (carriedItem.Path("cursed/known") != null) { itemString = itemString.Remove(width - 6) + "C"; //DO NOT TRANSLATE -- Curses will be replaced with better terms and variants such as "Slippery" or "Sticky". } playerTexts.Add(itemString); } var height2 = playerItems.Count; if (height2 == 0) { height2 = 1; } if (height2 > Program.Rows - 15) { height2 = Program.Rows - 15; } if (indexRight >= playerItems.Count) { indexRight = playerItems.Count - 1; } if (height2 > height) { height = height2; } playerList.Items.Clear(); playerList.Items.AddRange(playerTexts); playerWindow.Height = 2 + height2; playerList.Height = height2; } //Build the bottom window. UIManager.Elements.Add(new UILabel(new string(' ', Program.Cols)) { Left = 0, Top = 0, Width = Program.Cols - 1, Height = 1, Background = UIColors.StatusBackground, Foreground = UIColors.StatusForeground }); UIManager.Elements.Add(new UILabel(i18n.GetString(mode == ContainerMode.Vendor ? "inventory_pressenter_vendor" : "inventory_pressenter_container")) { Left = 0, Top = 0, Width = Program.Cols - 1, Height = 1, Background = UIColors.StatusBackground, Foreground = UIColors.StatusForeground }); descriptionWindow = new UIWindow(string.Empty) { Left = 2, Top = Program.Rows - 10, Width = Program.Cols - 4, Height = 8, Title = UIColors.RegularText }; description = new UILabel(string.Empty) { Width = Program.Cols - 8, Height = 5 }; description.Move(2, 1, descriptionWindow); capacity = new UILabel(string.Format("{0:F2}/{1:F2}", player.Character.Carried, player.Character.Capacity)); capacity.MoveBelow(4, -1, descriptionWindow); UIManager.Elements.Add(descriptionWindow); UIManager.Elements.Add(description); UIManager.Elements.Add(capacity); //Should we be trading, replace the weight with a money indication. if (mode == ContainerMode.Vendor) { capacity.Text = i18n.Format("inventory_money", vendorChar.Name.ToString(), vendorChar.GetToken("money").Value, player.Character.GetToken("money").Value); } //FIXME: why is this check a thing? if (containerList != null) { containerList.Change = (s, e) => { if (containerList.Items.Count == 0) { return; } indexLeft = containerList.Index; //Build up the content for the description window. var t = containerTokens[containerList.Index]; var i = containerItems[containerList.Index]; descriptionWindow.Text = i.ToString(t, false, false); var desc = i.GetDescription(t); price = 0; //Reset price no matter the mode so we don't accidentally pay for free shit. if (mode == ContainerMode.Vendor && i.HasToken("price")) { price = i.GetToken("price").Value; desc += "\n" + i18n.Format("inventory_itcosts", price); } if (mode == ContainerMode.Vendor && i.HasToken("equipable") && t.HasToken("equipped")) { desc += "\n" + i18n.Format("inventory_vendorusesthis", vendorChar.Name.ToString()); } description.Text = Toolkit.Wordwrap(desc.SmartQuote(), description.Width); descriptionWindow.Draw(); description.Draw(); capacity.Draw(); }; containerList.Enter = (s, e) => { if (containerList.Items.Count == 0) { return; } //onLeft = true; var tryAttempt = TryRetrieve(player, containerTokens[containerList.Index], containerItems[containerList.Index]); if (tryAttempt.IsBlank()) { //No errors were returned by TryRetrieve, so let's do this. playerItems.Add(containerItems[containerList.Index]); playerTokens.Add(containerTokens[containerList.Index]); playerList.Items.Add(containerList.Items[containerList.Index]); containerItems.RemoveAt(containerList.Index); containerTokens.RemoveAt(containerList.Index); containerList.Items.RemoveAt(containerList.Index); //If this was the bottom-most item, adjust our selection. if (containerList.Index >= containerList.Items.Count) { containerList.Index--; } //If this was the last item, hide the list entirely and switch to the player's side. //We know that's possible -- after all, there must be at -least- one item in there now. if (containerList.Items.Count == 0) { containerList.Hidden = true; keys[NoxicoGame.KeyBindings[KeyBinding.Right]] = true; } else { containerList.Height = (containerList.Items.Count < 10) ? containerList.Items.Count : 10; } playerList.Hidden = false; //always the case. playerList.Height = (playerList.Items.Count < 10) ? playerList.Items.Count : 10; containerWindow.Height = containerList.Height + 2; playerWindow.Height = playerList.Height + 2; capacity.Text = player.Character.Carried + "/" + player.Character.Capacity; if (mode == ContainerMode.Vendor) { capacity.Text = i18n.Format("inventory_money", vendorChar.Name.ToString(), vendorChar.GetToken("money").Value, player.Character.GetToken("money").Value); } containerList.Change(s, e); NoxicoGame.DrawStatus(); UIManager.Draw(); } else { //There was some error returned by TryRetrieve, which we'll show now. MessageBox.Notice(tryAttempt); } }; } //FIXME: same with this check. if (playerList != null) { //We do basically the same thing as above in reverse. playerList.Change = (s, e) => { if (playerList.Items.Count == 0) { return; } indexRight = playerList.Index; var t = playerTokens[playerList.Index]; var i = playerItems[playerList.Index]; descriptionWindow.Text = i.ToString(t, false, false); var desc = i.GetDescription(t); price = 0; if (mode == ContainerMode.Vendor && i.HasToken("price")) { price = i.GetToken("price").Value; desc += "\n" + i18n.Format("inventory_itcosts", price); } //This is one of the few differences. if (t.Path("cursed/path") != null) { desc += "\nThis item is cursed and can't be removed."; //DO NOT TRANSLATE -- Curses will be replaced with better terms and variants such as "Slippery" or "Sticky". } else if (i.HasToken("equipable") && t.HasToken("equipped")) { desc += "\n" + i18n.GetString("inventory_youusethis"); } description.Text = Toolkit.Wordwrap(desc.SmartQuote(), description.Width); descriptionWindow.Draw(); description.Draw(); capacity.Draw(); }; playerList.Enter = (s, e) => { if (playerList.Items.Count == 0) { return; } //onLeft = false; var tryAttempt = TryStore(player, playerTokens[playerList.Index], playerItems[playerList.Index]); if (tryAttempt.IsBlank()) { containerItems.Add(playerItems[playerList.Index]); containerTokens.Add(playerTokens[playerList.Index]); containerList.Items.Add(playerList.Items[playerList.Index]); playerItems.RemoveAt(playerList.Index); playerTokens.RemoveAt(playerList.Index); playerList.Items.RemoveAt(playerList.Index); if (playerList.Index >= playerList.Items.Count) { playerList.Index--; } if (playerList.Items.Count == 0) { playerList.Hidden = true; keys[NoxicoGame.KeyBindings[KeyBinding.Left]] = true; } else { playerList.Height = (playerList.Items.Count < 10) ? playerList.Items.Count : 10; } containerList.Hidden = false; //always the case. containerList.Height = (containerList.Items.Count < 10) ? containerList.Items.Count : 10; containerWindow.Height = containerList.Height + 2; playerWindow.Height = playerList.Height + 2; capacity.Text = player.Character.Carried + "/" + player.Character.Capacity; if (mode == ContainerMode.Vendor) { capacity.Text = i18n.Format("inventory_money", vendorChar.Name.ToString(), vendorChar.GetToken("money").Value, player.Character.GetToken("money").Value); } playerList.Change(s, e); NoxicoGame.DrawStatus(); UIManager.Draw(); } else { //This is set by TryStore. if (vendorCaughtYou) { //Immediately break out of ContainerMan and call out. NoxicoGame.ClearKeys(); NoxicoGame.Immediate = true; NoxicoGame.Me.CurrentBoard.Redraw(); NoxicoGame.Me.CurrentBoard.Draw(true); NoxicoGame.Mode = UserMode.Walkabout; Subscreens.FirstDraw = true; SceneSystem.Engage(player.Character, vendorChar, "(criminalscum)"); } else { MessageBox.Notice(tryAttempt); } } }; } UIManager.Highlight = containerList.Items.Count > 0 ? containerList : playerList; UIManager.Draw(); if (UIManager.Highlight.Change != null) { UIManager.Highlight.Change(null, null); } Subscreens.FirstDraw = false; } if (NoxicoGame.IsKeyDown(KeyBinding.Back) || Vista.Triggers == XInputButtons.B) { NoxicoGame.ClearKeys(); NoxicoGame.Immediate = true; NoxicoGame.Me.CurrentBoard.Redraw(); NoxicoGame.Me.CurrentBoard.Draw(true); NoxicoGame.Mode = UserMode.Walkabout; Subscreens.FirstDraw = true; } else if (NoxicoGame.IsKeyDown(KeyBinding.Left)) { NoxicoGame.ClearKeys(); if (containerList.Items.Count == 0) { return; } UIManager.Highlight = containerList ?? playerList; containerList.DrawQuick(); containerList.Change(null, null); playerList.DrawQuick(); } else if (NoxicoGame.IsKeyDown(KeyBinding.Right)) { NoxicoGame.ClearKeys(); if (playerList.Items.Count == 0) { return; } UIManager.Highlight = playerList ?? containerList; playerList.Change(null, null); containerList.DrawQuick(); playerList.DrawQuick(); } else { UIManager.CheckKeys(); } }
public static void Handler() { var host = NoxicoGame.HostForm; if (Subscreens.FirstDraw) { UIManager.Initialize(); Subscreens.FirstDraw = false; NoxicoGame.ClearKeys(); Subscreens.Redraw = true; var backdrop = new Bitmap(Program.Cols, Program.Rows * 2, System.Drawing.Imaging.PixelFormat.Format24bppRgb); var ccback = Mix.GetBitmap("travelback.png"); var ccpage = Mix.GetBitmap("ccpage.png"); var ccbars = Mix.GetBitmap("ccbars.png"); var pageTop = Program.Rows - (ccpage.Height / 2); using (var gfx = Graphics.FromImage(backdrop)) { gfx.Clear(Color.Black); gfx.DrawImage(ccback, 0, 0, Program.Cols, Program.Rows * 2); gfx.DrawImage(ccpage, 0, pageTop, ccpage.Width, ccpage.Height); var barsSrc = new System.Drawing.Rectangle(0, 3, ccbars.Width, 7); var barsDst = new System.Drawing.Rectangle(0, 0, Program.Cols, 7); gfx.DrawImage(ccbars, barsDst, barsSrc, GraphicsUnit.Pixel); barsSrc = new System.Drawing.Rectangle(0, 0, ccbars.Width, 5); barsDst = new System.Drawing.Rectangle(0, (Program.Rows * 2) - 5, Program.Cols, 5); gfx.DrawImage(ccbars, barsDst, barsSrc, GraphicsUnit.Pixel); } var list = new UIList() { Left = 4, Top = (pageTop / 2) + 4, Width = 34, Height = (ccpage.Height / 2) - 6, Background = Color.White, Foreground = Color.Black, }; UIManager.Elements.Add(new UIPNGBackground(backdrop)); UIManager.Elements.Add(new UILabel(i18n.GetString("travel_header")) { Left = 1, Top = 0, Foreground = Color.Silver }); UIManager.Elements.Add(new UILabel(i18n.GetString("travel_footer")) { Left = 1, Top = Program.Rows - 1, Foreground = Color.Silver }); UIManager.Elements.Add(new UILabel(i18n.GetString("travel_current") + "\n \x07<cCyan> " + (host.Noxico.CurrentBoard.Name ?? "Somewhere")) { Left = 44, Top = (pageTop / 2) + 4, Width = Program.Cols - 46, Foreground = Color.Teal }); UIManager.Elements.Add(list); var targets = new List <int>(); foreach (var target in NoxicoGame.TravelTargets) { targets.Add(target.Key); } targets.Sort(); list.Items.AddRange(targets.Select(x => NoxicoGame.TravelTargets[x])); list.Index = 0; //fixes crash when pressing Enter right away list.Enter = (s, e) => { var newBoard = NoxicoGame.TravelTargets.First(tn => tn.Value == list.Text).Key; if (host.Noxico.CurrentBoard.BoardNum == newBoard) { return; } NoxicoGame.Mode = UserMode.Walkabout; Subscreens.FirstDraw = true; NoxicoGame.InGameTime = NoxicoGame.InGameTime.AddDays(1); while (Toolkit.IsNight()) { NoxicoGame.InGameTime = NoxicoGame.InGameTime.AddHours(Random.Next(1, 3)); } NoxicoGame.InGameTime = NoxicoGame.InGameTime.AddMinutes(Random.Next(10, 50)); host.Noxico.Player.OpenBoard(newBoard); var hereNow = host.Noxico.Player.ParentBoard; if (hereNow.BoardType == BoardType.Dungeon) { //find the exit and place the player there //TODO: something similar for towns var dngExit = hereNow.Warps.FirstOrDefault(w => w.TargetBoard == -2); if (dngExit != null) { host.Noxico.Player.XPosition = dngExit.XPosition; host.Noxico.Player.YPosition = dngExit.YPosition; } } else { host.Noxico.Player.Reposition(); } }; if (host.Noxico.CurrentBoard.Name != null) { var thisBoard = NoxicoGame.TravelTargets.FirstOrDefault(tn => host.Noxico.CurrentBoard.Name.StartsWith(tn.Value)); if (thisBoard.Value != null) { list.Index = list.Items.FindIndex(i => thisBoard.Value.StartsWith(i)); } } } if (Subscreens.Redraw) { Subscreens.Redraw = false; UIManager.Draw(); } if (NoxicoGame.IsKeyDown(KeyBinding.Back) || Vista.Triggers == XInputButtons.B) { NoxicoGame.ClearKeys(); NoxicoGame.Immediate = true; host.Noxico.CurrentBoard.Redraw(); host.Noxico.CurrentBoard.Draw(true); host.Noxico.CurrentBoard.AimCamera(); NoxicoGame.Mode = UserMode.Walkabout; Subscreens.FirstDraw = true; } else { UIManager.CheckKeys(); } }
/// <summary> /// Generic Subscreen handler. /// </summary> public static void Handler() { //TODO: add more things, such as a status bar and a window with the exact results. if (Subscreens.FirstDraw) { UIManager.Initialize(); Subscreens.FirstDraw = false; NoxicoGame.ClearKeys(); Subscreens.Redraw = true; } if (Subscreens.Redraw) { Subscreens.Redraw = false; recipes = GetPossibilities(Carrier); var h = recipes.Count < 40 ? recipes.Count : 40; if (h == 0) { h++; } recipeWindow = new UIWindow(string.Empty) { Top = 2, Left = 2, Width = 76, Height = h + 2 }; recipeList = new UIList(string.Empty, null, recipes.Select(r => r.Display)) { Top = 3, Left = 3, Width = 74, Height = h }; recipeList.Enter = (s, e) => { if (recipes.Count == 0) { return; } var i = recipeList.Index; recipes[i].Apply(); //Redetermine the possibilities and update the UI accordingly. recipes = GetPossibilities(Carrier); if (recipes.Count > 0) { recipeList.Items = recipes.Select(r => r.Display).ToList(); if (i >= recipeList.Items.Count) { i = recipeList.Items.Count - 1; } recipeList.Index = i; h = recipes.Count < 40 ? recipes.Count : 40; } else { h = 1; recipeList.Hidden = true; } recipeWindow.Height = h + 2; recipeList.Height = h; NoxicoGame.Me.CurrentBoard.Redraw(); NoxicoGame.Me.CurrentBoard.Draw(); UIManager.Draw(); }; UIManager.Elements.Add(recipeWindow); UIManager.Elements.Add(new UILabel(i18n.GetString("craft_nothing")) { Left = 3, Top = 3 }); UIManager.Elements.Add(recipeList); UIManager.Highlight = recipeList; UIManager.Draw(); } if (NoxicoGame.IsKeyDown(KeyBinding.Back) || NoxicoGame.IsKeyDown(KeyBinding.Items) || Vista.Triggers == XInputButtons.B) { NoxicoGame.ClearKeys(); NoxicoGame.Immediate = true; NoxicoGame.Me.CurrentBoard.Redraw(); NoxicoGame.Me.CurrentBoard.Draw(true); NoxicoGame.Mode = UserMode.Walkabout; Subscreens.FirstDraw = true; } else { UIManager.CheckKeys(); } }
public static void Handler() { var host = NoxicoGame.HostForm; if (Subscreens.FirstDraw) { Subscreens.FirstDraw = false; UIManager.Initialize(); UIManager.Elements.Add(new UIWindow(i18n.GetString("pause_title")) { Left = 3, Top = 1, Width = 22, Height = pages.Count + 2 }); UIManager.Elements.Add(new UIWindow(string.Empty) { Left = 28, Top = 1, Width = 49, Height = 23 }); list = new UIList() { Width = 20, Height = pages.Count, Left = 4, Top = 2, Background = UIColors.WindowBackground }; list.Items.AddRange(pages.Keys); list.Change += (s, e) => { page = list.Index; text.Text = pages.Values.ElementAt(page); UIManager.Draw(); }; list.Enter += (s, e) => { if (list.Index == list.Items.Count - 1) //can't use absolute index because Debug might be missing. { host.Close(); } else if (list.Index == list.Items.Count - 2) //same { //System.Diagnostics.Process.Start(host.IniPath); Options.Open(); } else if (list.Index == 4) { TextScroller.Plain(Mix.GetString("credits.txt"), i18n.GetString("pause_credits"), false); } }; text = new UILabel("...") { Left = 30, Top = 2 }; UIManager.Elements.Add(list); UIManager.Elements.Add(text); list.Index = IniFile.GetValue("misc", "rememberpause", true) ? page : 0; UIManager.Highlight = list; Subscreens.Redraw = true; } if (Subscreens.Redraw) { Subscreens.Redraw = false; UIManager.Draw(); } if (NoxicoGame.IsKeyDown(KeyBinding.Back) || Vista.Triggers == XInputButtons.B) { NoxicoGame.ClearKeys(); NoxicoGame.Immediate = true; NoxicoGame.Me.CurrentBoard.Redraw(); NoxicoGame.Me.CurrentBoard.Draw(true); NoxicoGame.Mode = UserMode.Walkabout; Subscreens.FirstDraw = true; } else { UIManager.CheckKeys(); } }