private static Bitmap backdrop; //, backWithPortrait; /// <summary> /// Don't see a Subscreen with multiple handlers often... /// </summary> public static void CharacterCreator() { if (Subscreens.FirstDraw) { //Start creating the world as we work... if (worldgen == null) //Conditional added by Mat. { worldgen = new System.Threading.Thread(NoxicoGame.Me.CreateRealm); worldgen.Start(); } //Load all bonus traits. var traits = new List <string>(); var traitHelps = new List <string>(); var traitsDoc = Mix.GetTokenTree("bonustraits.tml"); foreach (var trait in traitsDoc.Where(t => t.Name == "trait")) { traits.Add(trait.GetToken("display").Text); traitHelps.Add(trait.GetToken("description").Text); } //Define the help texts for the standard controls. controlHelps = new Dictionary <string, string>() { { "back", i18n.GetString("cchelp_back") }, { "next", i18n.GetString("cchelp_next") }, { "play", Random.NextDouble() > 0.7 ? "FRUITY ANGELS MOLEST SHARKY" : "ENGAGE RIDLEY MOTHER F****R" }, { "name", i18n.GetString("cchelp_name") }, { "species", string.Empty }, { "sex", i18n.GetString("cchelp_sex") }, { "gid", i18n.GetString("cchelp_gid") }, { "pref", i18n.GetString("cchelp_pref") }, { "tutorial", i18n.GetString("cchelp_tutorial") }, { "easy", i18n.GetString("cchelp_easy") }, { "gift", traitHelps[0] }, }; var xScale = Program.Cols / 80f; var yScale = Program.Rows / 25f; //backdrop = Mix.GetBitmap("chargen.png"); backdrop = new Bitmap(Program.Cols, Program.Rows * 2, System.Drawing.Imaging.PixelFormat.Format24bppRgb); var ccback = Mix.GetBitmap("ccback.png"); var ccpage = Mix.GetBitmap("ccpage.png"); var ccbars = Mix.GetBitmap("ccbars.png"); var pageLeft = Program.Cols - ccpage.Width - (int)(2 * yScale); 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, pageLeft, 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); } //Build the interface. var title = "\xB4 " + i18n.GetString("cc_title") + " \xC3"; var bar = new string('\xC4', 33); string[] sexoptions = { i18n.GetString("Male"), i18n.GetString("Female"), i18n.GetString("Herm"), i18n.GetString("Neuter") }; string[] prefoptions = { i18n.GetString("Male"), i18n.GetString("Female"), i18n.GetString("Either") }; var labelL = pageLeft + 5; var cntrlL = labelL + 2; var header = (pageTop / 2) + 3; var top = header + 2; var buttons = (pageTop / 2) + 20; controls = new Dictionary <string, UIElement>() { { "backdrop", new UIPNGBackground(backdrop) }, //backWithPortrait) }, { "headerline", new UILabel(bar) { Left = labelL, Top = header, Foreground = Color.Black } }, { "header", new UILabel(title) { Left = labelL + 17 - (title.Length() / 2), Top = header, Width = title.Length(), Foreground = Color.Black } }, { "back", new UIButton(i18n.GetString("cc_back"), null) { Left = labelL, Top = buttons, Width = 10, Height = 1 } }, { "next", new UIButton(i18n.GetString("cc_next"), null) { Left = labelL + 23, Top = buttons, Width = 10, Height = 1 } }, { "wait", new UILabel(i18n.GetString("cc_wait")) { Left = labelL + 23, Top = buttons, Foreground = Color.Silver } }, { "play", new UIButton(i18n.GetString("cc_play"), null) { Left = labelL + 23, Top = buttons, Width = 10, Height = 1, Hidden = true } }, { "nameLabel", new UILabel(i18n.GetString("cc_name")) { Left = labelL, Top = top, Foreground = Color.Gray } }, { "name", new UITextBox(string.Empty) { Left = cntrlL, Top = top + 1, Width = 24, Foreground = Color.Black, Background = Color.Transparent } }, { "nameRandom", new UILabel(i18n.GetString("cc_random")) { Left = cntrlL + 2, Top = top + 1, Foreground = Color.Gray } }, { "speciesLabel", new UILabel(i18n.GetString("cc_species")) { Left = labelL, Top = top + 3, Foreground = Color.Gray } }, { "species", new UISingleList() { Left = cntrlL, Top = top + 4, Width = 26, Foreground = Color.Black, Background = Color.Transparent } }, { "tutorial", new UIToggle(i18n.GetString("cc_tutorial")) { Left = labelL, Top = top + 6, Width = 24, Foreground = Color.Black, Background = Color.Transparent } }, { "easy", new UIToggle(i18n.GetString("cc_easy")) { Left = labelL, Top = top + 7, Width = 24, Foreground = Color.Black, Background = Color.Transparent } }, { "sexLabel", new UILabel(i18n.GetString("cc_sex")) { Left = labelL, Top = top, Foreground = Color.Gray } }, { "sex", new UIRadioList(sexoptions) { Left = cntrlL, Top = top + 1, Width = 24, Foreground = Color.Black, Background = Color.Transparent } }, { "gidLabel", new UILabel(i18n.GetString("cc_gid")) { Left = labelL, Top = top + 6, Foreground = Color.Gray } }, { "gid", new UISingleList(string.Empty, null, sexoptions.ToList(), 0) { Left = cntrlL, Top = top + 7, Width = 26, Foreground = Color.Black, Background = Color.Transparent } }, { "prefLabel", new UILabel(i18n.GetString("cc_pref")) { Left = labelL, Top = top + 9, Foreground = Color.Gray } }, { "pref", new UISingleList(string.Empty, null, prefoptions.ToList(), 1) { Left = cntrlL, Top = top + 10, Width = 26, Foreground = Color.Black, Background = Color.Transparent } }, { "giftLabel", new UILabel(i18n.GetString("cc_gift")) { Left = labelL, Top = top, Foreground = Color.Gray } }, { "gift", new UIList(string.Empty, null, traits) { Left = cntrlL, Top = top + 1, Width = 30, Height = 24, Foreground = Color.Black, Background = Color.Transparent } }, { "controlHelp", new UILabel(traitHelps[0]) { Left = 1, Top = 1, Width = pageLeft - 2, Height = 4, Foreground = Color.White, Darken = true } }, { "topHeader", new UILabel(i18n.GetString("cc_header")) { Left = 1, Top = 0, Foreground = Color.Silver } }, { "helpLine", new UILabel(i18n.GetString("cc_footer")) { Left = 1, Top = Program.Rows - 1, Foreground = Color.Silver } }, }; //Map the controls to pages. pages = new List <UIElement>[] { new List <UIElement>() { controls["backdrop"], controls["headerline"], controls["header"], controls["topHeader"], controls["helpLine"], controls["nameLabel"], controls["name"], controls["nameRandom"], controls["speciesLabel"], controls["species"], controls["tutorial"], controls["easy"], controls["controlHelp"], controls["next"], }, new List <UIElement>() { controls["backdrop"], controls["headerline"], controls["header"], controls["topHeader"], controls["helpLine"], controls["sexLabel"], controls["sex"], controls["gidLabel"], controls["gid"], controls["prefLabel"], controls["pref"], controls["controlHelp"], controls["back"], controls["next"], }, new List <UIElement>(), //Placeholder, filled in on-demand from PlayableRace.ColorItems. new List <UIElement>() { controls["backdrop"], controls["headerline"], controls["header"], controls["topHeader"], controls["helpLine"], controls["giftLabel"], controls["gift"], controls["controlHelp"], controls["back"], controls["wait"], controls["play"], }, }; CollectPlayables(); loadPage = new Action <int>(p => { UIManager.Elements.Clear(); UIManager.Elements.AddRange(pages[page]); UIManager.Highlight = UIManager.Elements[5]; //select whatever comes after helpLine. }); //Called when changing species. loadColors = new Action <int>(i => { var species = playables[i]; controlHelps["species"] = species.Bestiary; pages[2].Clear(); pages[2].AddRange(new[] { controls["backdrop"], controls["headerline"], controls["header"], controls["topHeader"], controls["helpLine"] }); pages[2].AddRange(species.ColorItems.Values); pages[2].AddRange(new[] { controls["controlHelp"], controls["back"], controls["next"] }); }); controls["back"].Enter = (s, e) => { page--; loadPage(page); UIManager.Draw(); }; controls["next"].Enter = (s, e) => { page++; loadPage(page); UIManager.Draw(); }; controls["play"].Enter = (s, e) => { var playerName = controls["name"].Text; var sex = ((UIRadioList)controls["sex"]).Value; var gid = ((UISingleList)controls["gid"]).Index; var pref = ((UISingleList)controls["pref"]).Index; var species = ((UISingleList)controls["species"]).Index; var tutorial = ((UIToggle)controls["tutorial"]).Checked; var easy = ((UIToggle)controls["easy"]).Checked; var bonus = ((UIList)controls["gift"]).Text; var colorMap = new Dictionary <string, string>(); foreach (var editable in playables[species].ColorItems) { if (editable.Key.StartsWith("lbl")) { continue; } var path = editable.Key; var value = ((UISingleList)editable.Value).Text; colorMap.Add(path, value); } NoxicoGame.Me.CreatePlayerCharacter(playerName.Trim(), (Gender)(sex + 1), (Gender)(gid + 1), pref, playables[species].ID, colorMap, bonus); if (tutorial) { NoxicoGame.Me.Player.Character.AddToken("tutorial"); } if (easy) { NoxicoGame.Me.Player.Character.AddToken("easymode"); } NoxicoGame.InGameTime = NoxicoGame.InGameTime.AddYears(Random.Next(0, 10)); NoxicoGame.InGameTime = NoxicoGame.InGameTime.AddDays(Random.Next(20, 340)); NoxicoGame.InGameTime = NoxicoGame.InGameTime.AddHours(Random.Next(10, 54)); NoxicoGame.Me.CurrentBoard.UpdateLightmap(NoxicoGame.Me.Player, true); Subscreens.FirstDraw = true; NoxicoGame.Immediate = true; /* #if DEBUG * NoxicoGame.Me.Player.Character.GetToken("items").AddToken("orgasm_denial_ring"); * NoxicoGame.Me.Player.Character.GetToken("items").AddToken("baseballbat"); * NoxicoGame.Me.Player.Character.GetToken("items").AddToken("really_kinky_panties"); * NoxicoGame.Me.Player.Character.GetToken("items").AddToken("timertest"); * NoxicoGame.Me.Player.Character.GetToken("items").AddToken("clit_regenring"); * NoxicoGame.Me.Player.Character.GetToken("items").AddToken("gExtractor"); * NoxicoGame.Me.Player.Character.GetToken("items").AddToken("strapon_ovi"); * NoxicoGame.Me.Player.Character.GetToken("items").AddToken("strapon"); #if FREETESTPOTIONS * NoxicoGame.Me.Player.Character.GetToken("items").AddToken("foxite"); // ok * NoxicoGame.Me.Player.Character.GetToken("items").AddToken("odd_nip"); // ok * //NoxicoGame.Me.Player.Character.GetToken("items").AddToken("dogmorph"); no bodyplan * //NoxicoGame.Me.Player.Character.GetToken("items").AddToken("bunnymorph"); no bodyplan * NoxicoGame.Me.Player.Character.GetToken("items").AddToken("chaos_potion"); // ok * NoxicoGame.Me.Player.Character.GetToken("items").AddToken("enhanced_chaos_potion"); // ok * NoxicoGame.Me.Player.Character.GetToken("items").AddToken("demonite_potion"); * NoxicoGame.Me.Player.Character.GetToken("items").AddToken("tentacle_potion"); * NoxicoGame.Me.Player.Character.GetToken("items").AddToken("cock_potion"); * NoxicoGame.Me.Player.Character.GetToken("items").AddToken("corrupted_cock_potion"); * NoxicoGame.Me.Player.Character.GetToken("items").AddToken("neutralizer_potion"); * NoxicoGame.Me.Player.Character.GetToken("items").AddToken("spidermorph"); #endif #endif */ NoxicoGame.AddMessage(i18n.GetString("welcometonoxico"), Color.Yellow); NoxicoGame.AddMessage(i18n.GetString("rememberhelp")); //Story(); }; ((UISingleList)controls["species"]).Items.Clear(); playables.ForEach(x => ((UISingleList)controls["species"]).Items.Add(x.Name.Titlecase())); ((UISingleList)controls["species"]).Index = 0; loadColors(0); ((UIRadioList)controls["sex"]).ItemsEnabled = playables[0].SexLocks; controls["species"].Change = (s, e) => { var speciesIndex = ((UISingleList)controls["species"]).Index; loadColors(speciesIndex); var playable = playables[speciesIndex]; controlHelps["species"] = playable.Bestiary; controls["controlHelp"].Text = playable.Bestiary.Wordwrap(controls["controlHelp"].Width); var sexList = (UIRadioList)controls["sex"]; sexList.ItemsEnabled = playable.SexLocks; if (!sexList.ItemsEnabled[sexList.Value]) { //Uh-oh. Select the first non-disabled item. for (var i = 0; i < sexList.ItemsEnabled.Length; i++) { if (sexList.ItemsEnabled[i]) { sexList.Value = i; break; } } } //redrawBackdrop(0); UIManager.Draw(); }; controls["sex"].Change = (s, e) => { //redrawBackdrop(0); UIManager.Draw(); }; controls["name"].Change = (s, e) => { controls["nameRandom"].Hidden = !controls["name"].Text.IsBlank(); UIManager.Draw(); }; controls["gift"].Change = (s, e) => { var giftIndex = ((UIList)controls["gift"]).Index; controls["controlHelp"].Text = traitHelps[giftIndex].Wordwrap(controls["controlHelp"].Width); controls["controlHelp"].Top = controls["gift"].Top + giftIndex; UIManager.Draw(); }; ((UIToggle)controls["tutorial"]).Checked = IniFile.GetValue("misc", "tutorial", true); ((UIToggle)controls["easy"]).Checked = IniFile.GetValue("misc", "easymode", false); UIManager.Initialize(); UIManager.HighlightChanged = (s, e) => { var c = controls.FirstOrDefault(x => x.Value == UIManager.Highlight); if (c.Key != null && controlHelps.ContainsKey(c.Key)) { controls["controlHelp"].Text = controlHelps[c.Key].Wordwrap(controls["controlHelp"].Width); controls["controlHelp"].Top = c.Value.Top; } else { controls["controlHelp"].Text = string.Empty; } UIManager.Draw(); }; loadPage(page); //redrawBackdrop(0); Subscreens.FirstDraw = false; Subscreens.Redraw = true; UIManager.HighlightChanged(null, null); NoxicoGame.Sound.PlayMusic("set://Character Creation", false); NoxicoGame.InGame = false; } if (Subscreens.Redraw) { UIManager.Draw(); Subscreens.Redraw = false; } if (WorldGenFinished) { WorldGenFinished = false; controls["play"].Hidden = false; UIManager.Draw(); } UIManager.CheckKeys(); }