public RandoMenuItem(MenuButton baseObj, Vector2 position, string name, params T[] values) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException(nameof(name)); } if (baseObj == null) { throw new ArgumentNullException(nameof(baseObj)); } if (values == null || values.Length == 0) { throw new ArgumentNullException(nameof(values)); } _selections = values; Name = name; Button = baseObj.Clone(name + "Button", MenuButton.MenuButtonType.Activate, position, string.Empty); _text = Button.transform.Find("Text").GetComponent <Text>(); _text.fontSize = 36; _align = Button.gameObject.GetComponentInChildren <FixVerticalAlign>(true); Button.ClearEvents(); Button.AddEvent(EventTriggerType.Submit, GotoNext); RefreshText(); }
private static void CreateLabel(MenuButton baseObj, Vector2 position, string text) { GameObject label = baseObj.Clone(text + "Label", MenuButton.MenuButtonType.Activate, position, text) .gameObject; Object.Destroy(label.GetComponent <EventTrigger>()); Object.Destroy(label.GetComponent <MenuButton>()); }
public static void EditUI() { // Reset settings AreaRando.Instance.Settings = new SaveSettings(); // Fetch data from vanilla screen MenuScreen playScreen = Ref.UI.playModeMenuScreen; playScreen.title.gameObject.transform.localPosition = new Vector3(0, 520.56f); Object.Destroy(playScreen.topFleur.gameObject); MenuButton classic = (MenuButton)playScreen.defaultHighlight; MenuButton steel = (MenuButton)classic.FindSelectableOnDown(); MenuButton back = (MenuButton)steel.FindSelectableOnDown(); GameObject parent = steel.transform.parent.gameObject; Object.Destroy(parent.GetComponent <VerticalLayoutGroup>()); // Create new buttons MenuButton startRandoBtn = classic.Clone("StartRando", MenuButton.MenuButtonType.Proceed, new Vector2(0, 200), "Start Game", "Randomizer v2", AreaRando.GetSprite("UI.logo")); MenuButton startNormalBtn = classic.Clone("StartNormal", MenuButton.MenuButtonType.Proceed, new Vector2(0, -200), "Start Game", "Non-Randomizer"); MenuButton startSteelRandoBtn = steel.Clone("StartSteelRando", MenuButton.MenuButtonType.Proceed, new Vector2(10000, 10000), "Steel Soul", "Randomizer v2", AreaRando.GetSprite("UI.logo2")); MenuButton startSteelNormalBtn = steel.Clone("StartSteelNormal", MenuButton.MenuButtonType.Proceed, new Vector2(10000, 10000), "Steel Soul", "Non-Randomizer"); startNormalBtn.transform.localScale = startRandoBtn.transform.localScale = startSteelNormalBtn.transform.localScale = startSteelRandoBtn.transform.localScale = new Vector2(0.75f, 0.75f); MenuButton backBtn = back.Clone("Back", MenuButton.MenuButtonType.Proceed, new Vector2(0, -100), "Back"); RandoMenuItem <string> gameTypeBtn = new RandoMenuItem <string>(back, new Vector2(0, 600), "Game Type", "Normal", "Steel Soul"); RandoMenuItem <string> presetPoolsBtn = new RandoMenuItem <string>(back, new Vector2(900, 1040), "Preset", "Progressive", "Completionist", "Junk Pit", "Custom"); RandoMenuItem <string> RandoDreamersBtn = new RandoMenuItem <string>(back, new Vector2(900, 960), "Dreamers", "Always true"); RandoMenuItem <string> RandoSkillsBtn = new RandoMenuItem <string>(back, new Vector2(900, 880), "Skills", "Always true"); RandoMenuItem <string> RandoCharmsBtn = new RandoMenuItem <string>(back, new Vector2(900, 800), "Charms", "Always true"); RandoMenuItem <string> RandoKeysBtn = new RandoMenuItem <string>(back, new Vector2(900, 720), "Keys", "Always true"); RandoMenuItem <bool> RandoGeoChestsBtn = new RandoMenuItem <bool>(back, new Vector2(900, 640), "Geo Chests", false, true); RandoMenuItem <bool> RandoMaskBtn = new RandoMenuItem <bool>(back, new Vector2(900, 560), "Mask Shards", false, true); RandoMenuItem <bool> RandoVesselBtn = new RandoMenuItem <bool>(back, new Vector2(900, 480), "Vessel Fragments", false, true); RandoMenuItem <bool> RandoOreBtn = new RandoMenuItem <bool>(back, new Vector2(900, 400), "Pale Ore", false, true); RandoMenuItem <bool> RandoNotchBtn = new RandoMenuItem <bool>(back, new Vector2(900, 320), "Charm Notches", false, true); RandoMenuItem <bool> RandoEggBtn = new RandoMenuItem <bool>(back, new Vector2(900, 240), "Rancid Eggs", false, true); RandoMenuItem <bool> RandoRelicsBtn = new RandoMenuItem <bool>(back, new Vector2(900, 160), "Relics", false, true); RandoMenuItem <string> RandoLongItemsBtn = new RandoMenuItem <string>(back, new Vector2(900, 80), "Longest Check", "Standard", "Longer Items", "Longer Quests", "All Locations", "Fast"); RandoMenuItem <string> presetSkipsBtn = new RandoMenuItem <string>(back, new Vector2(-900, 1040), "Preset", "Easy", "Hard", "Custom"); RandoMenuItem <bool> shadeSkipsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 960), "Shade Skips", false, true); RandoMenuItem <bool> acidSkipsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 880), "Acid Skips", false, true); RandoMenuItem <bool> spikeTunnelsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 800), "Spike Tunnels", false, true); RandoMenuItem <bool> miscSkipsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 720), "Misc Skips", false, true); RandoMenuItem <bool> fireballSkipsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 640), "Fireball Skips", false, true); RandoMenuItem <bool> darkRoomsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 560), "Dark Rooms", false, true); RandoMenuItem <bool> charmNotchBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 300), "Salubra Notches", true, false); RandoMenuItem <bool> lemmBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 220), "Lemm Sell All", true, false); RandoMenuItem <bool> jijiBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 140), "Jiji Hints", true, false); RandoMenuItem <bool> PleasureHouseBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 60), "Pleasure House Geo", true, false); RandoMenuItem <bool> EarlyGeoBtn = new RandoMenuItem <bool>(back, new Vector2(-900, -20), "Early Geo", true, false); RandoMenuItem <string> modeBtn = new RandoMenuItem <string>(back, new Vector2(0, 1040), "Mode", "Standard"); //, "No Claw", "All Bosses", "All Skills", "All Charms" // Create seed entry field GameObject seedGameObject = back.Clone("Seed", MenuButton.MenuButtonType.Activate, new Vector2(0, 1130), "Click to type a custom seed").gameObject; Object.DestroyImmediate(seedGameObject.GetComponent <MenuButton>()); Object.DestroyImmediate(seedGameObject.GetComponent <EventTrigger>()); Object.DestroyImmediate(seedGameObject.transform.Find("Text").GetComponent <AutoLocalizeTextUI>()); Object.DestroyImmediate(seedGameObject.transform.Find("Text").GetComponent <FixVerticalAlign>()); Object.DestroyImmediate(seedGameObject.transform.Find("Text").GetComponent <ContentSizeFitter>()); RectTransform seedRect = seedGameObject.transform.Find("Text").GetComponent <RectTransform>(); seedRect.anchorMin = seedRect.anchorMax = new Vector2(0.5f, 0.5f); seedRect.sizeDelta = new Vector2(337, 63.2f); InputField customSeedInput = seedGameObject.AddComponent <InputField>(); customSeedInput.transform.localPosition = new Vector3(0, 1240); customSeedInput.textComponent = seedGameObject.transform.Find("Text").GetComponent <Text>(); AreaRando.Instance.Settings.Seed = new Random().Next(999999999); customSeedInput.text = AreaRando.Instance.Settings.Seed.ToString(); customSeedInput.caretColor = Color.white; customSeedInput.contentType = InputField.ContentType.IntegerNumber; customSeedInput.onEndEdit.AddListener(ParseSeedInput); customSeedInput.navigation = Navigation.defaultNavigation; customSeedInput.caretWidth = 8; customSeedInput.characterLimit = 9; customSeedInput.colors = new ColorBlock { highlightedColor = Color.yellow, pressedColor = Color.red, disabledColor = Color.black, normalColor = Color.white, colorMultiplier = 2f }; // Create some labels CreateLabel(back, new Vector2(-900, 1130), "Required Skips"); CreateLabel(back, new Vector2(-900, 400), "Quality of Life"); CreateLabel(back, new Vector2(900, 1130), "Randomization"); CreateLabel(back, new Vector2(0, 200), "Area Randomizer expects use of Benchwarp"); CreateLabel(back, new Vector2(0, 1300), "Seed:"); // We don't need these old buttons anymore Object.Destroy(classic.gameObject); Object.Destroy(steel.gameObject); Object.Destroy(parent.FindGameObjectInChildren("GGButton")); Object.Destroy(back.gameObject); // Gotta put something here, we destroyed the old default playScreen.defaultHighlight = startRandoBtn; // Apply navigation info (up, right, down, left) startNormalBtn.SetNavigation(gameTypeBtn.Button, presetPoolsBtn.Button, backBtn, presetSkipsBtn.Button); startRandoBtn.SetNavigation(modeBtn.Button, presetPoolsBtn.Button, gameTypeBtn.Button, presetSkipsBtn.Button); startSteelNormalBtn.SetNavigation(gameTypeBtn.Button, presetPoolsBtn.Button, backBtn, presetSkipsBtn.Button); startSteelRandoBtn.SetNavigation(modeBtn.Button, presetPoolsBtn.Button, gameTypeBtn.Button, presetSkipsBtn.Button); modeBtn.Button.SetNavigation(backBtn, modeBtn.Button, startRandoBtn, modeBtn.Button); gameTypeBtn.Button.SetNavigation(startRandoBtn, presetPoolsBtn.Button, startNormalBtn, presetSkipsBtn.Button); backBtn.SetNavigation(startNormalBtn, backBtn, modeBtn.Button, backBtn); presetSkipsBtn.Button.SetNavigation(PleasureHouseBtn.Button, startRandoBtn, shadeSkipsBtn.Button, presetSkipsBtn.Button); shadeSkipsBtn.Button.SetNavigation(presetSkipsBtn.Button, startRandoBtn, acidSkipsBtn.Button, shadeSkipsBtn.Button); acidSkipsBtn.Button.SetNavigation(shadeSkipsBtn.Button, startRandoBtn, spikeTunnelsBtn.Button, acidSkipsBtn.Button); spikeTunnelsBtn.Button.SetNavigation(acidSkipsBtn.Button, startRandoBtn, miscSkipsBtn.Button, spikeTunnelsBtn.Button); miscSkipsBtn.Button.SetNavigation(spikeTunnelsBtn.Button, startRandoBtn, fireballSkipsBtn.Button, miscSkipsBtn.Button); fireballSkipsBtn.Button.SetNavigation(miscSkipsBtn.Button, startRandoBtn, darkRoomsBtn.Button, fireballSkipsBtn.Button); darkRoomsBtn.Button.SetNavigation(fireballSkipsBtn.Button, startRandoBtn, charmNotchBtn.Button, darkRoomsBtn.Button); charmNotchBtn.Button.SetNavigation(EarlyGeoBtn.Button, startRandoBtn, lemmBtn.Button, charmNotchBtn.Button); lemmBtn.Button.SetNavigation(charmNotchBtn.Button, startRandoBtn, jijiBtn.Button, lemmBtn.Button); jijiBtn.Button.SetNavigation(lemmBtn.Button, startRandoBtn, PleasureHouseBtn.Button, jijiBtn.Button); PleasureHouseBtn.Button.SetNavigation(jijiBtn.Button, startRandoBtn, EarlyGeoBtn.Button, PleasureHouseBtn.Button); EarlyGeoBtn.Button.SetNavigation(PleasureHouseBtn.Button, startRandoBtn, charmNotchBtn.Button, EarlyGeoBtn.Button); presetPoolsBtn.Button.SetNavigation(RandoLongItemsBtn.Button, presetPoolsBtn.Button, RandoDreamersBtn.Button, startRandoBtn); RandoDreamersBtn.Button.SetNavigation(presetPoolsBtn.Button, RandoDreamersBtn.Button, RandoSkillsBtn.Button, startRandoBtn); RandoSkillsBtn.Button.SetNavigation(RandoDreamersBtn.Button, RandoSkillsBtn.Button, RandoCharmsBtn.Button, startRandoBtn); RandoCharmsBtn.Button.SetNavigation(RandoSkillsBtn.Button, RandoCharmsBtn.Button, RandoKeysBtn.Button, startRandoBtn); RandoKeysBtn.Button.SetNavigation(RandoCharmsBtn.Button, RandoKeysBtn.Button, RandoGeoChestsBtn.Button, startRandoBtn); RandoGeoChestsBtn.Button.SetNavigation(RandoKeysBtn.Button, RandoGeoChestsBtn.Button, RandoMaskBtn.Button, startRandoBtn); RandoMaskBtn.Button.SetNavigation(RandoGeoChestsBtn.Button, RandoMaskBtn.Button, RandoVesselBtn.Button, startRandoBtn); RandoVesselBtn.Button.SetNavigation(RandoMaskBtn.Button, RandoVesselBtn.Button, RandoOreBtn.Button, startRandoBtn); RandoOreBtn.Button.SetNavigation(RandoVesselBtn.Button, RandoOreBtn.Button, RandoNotchBtn.Button, startRandoBtn); RandoNotchBtn.Button.SetNavigation(RandoOreBtn.Button, RandoNotchBtn.Button, RandoEggBtn.Button, startRandoBtn); RandoEggBtn.Button.SetNavigation(RandoNotchBtn.Button, RandoEggBtn.Button, RandoRelicsBtn.Button, startRandoBtn); RandoRelicsBtn.Button.SetNavigation(RandoEggBtn.Button, RandoRelicsBtn.Button, RandoLongItemsBtn.Button, startRandoBtn); RandoLongItemsBtn.Button.SetNavigation(RandoRelicsBtn.Button, RandoLongItemsBtn.Button, presetPoolsBtn.Button, startRandoBtn); // Setup event for changing difficulty settings buttons void UpdateSkipsButtons(RandoMenuItem <string> item) { switch (item.CurrentSelection) { case "Easy": shadeSkipsBtn.SetSelection(false); acidSkipsBtn.SetSelection(false); spikeTunnelsBtn.SetSelection(false); miscSkipsBtn.SetSelection(false); fireballSkipsBtn.SetSelection(false); darkRoomsBtn.SetSelection(false); break; case "Hard": shadeSkipsBtn.SetSelection(true); acidSkipsBtn.SetSelection(true); spikeTunnelsBtn.SetSelection(true); miscSkipsBtn.SetSelection(true); fireballSkipsBtn.SetSelection(true); darkRoomsBtn.SetSelection(true); break; case "Custom": item.SetSelection("Easy"); goto case "Easy"; default: LogWarn("Unknown value in preset button: " + item.CurrentSelection); break; } } void UpdatePoolPreset(RandoMenuItem <string> item) { switch (item.CurrentSelection) { case "Progressive": //RandoDreamersBtn.SetSelection(true); //RandoSkillsBtn.SetSelection(true); //RandoCharmsBtn.SetSelection(true); //RandoKeysBtn.SetSelection(true); RandoGeoChestsBtn.SetSelection(false); RandoMaskBtn.SetSelection(false); RandoVesselBtn.SetSelection(false); RandoOreBtn.SetSelection(false); RandoNotchBtn.SetSelection(false); RandoEggBtn.SetSelection(false); RandoRelicsBtn.SetSelection(false); RandoLongItemsBtn.SetSelection("Standard"); break; case "Completionist": //RandoDreamersBtn.SetSelection(true); //RandoSkillsBtn.SetSelection(true); //RandoCharmsBtn.SetSelection(true); // RandoKeysBtn.SetSelection(true); RandoGeoChestsBtn.SetSelection(true); RandoMaskBtn.SetSelection(true); RandoVesselBtn.SetSelection(true); RandoOreBtn.SetSelection(true); RandoNotchBtn.SetSelection(true); RandoEggBtn.SetSelection(false); RandoRelicsBtn.SetSelection(false); RandoLongItemsBtn.SetSelection("Standard"); break; case "Junk Pit": //RandoDreamersBtn.SetSelection(true); //RandoSkillsBtn.SetSelection(true); //RandoCharmsBtn.SetSelection(true); //RandoKeysBtn.SetSelection(true); RandoGeoChestsBtn.SetSelection(true); RandoMaskBtn.SetSelection(true); RandoVesselBtn.SetSelection(true); RandoOreBtn.SetSelection(true); RandoNotchBtn.SetSelection(true); RandoEggBtn.SetSelection(true); RandoRelicsBtn.SetSelection(true); RandoLongItemsBtn.SetSelection("Standard"); break; case "Custom": item.SetSelection("Progressive"); goto case "Progressive"; } } // Event for setting stuff to hard mode on no claw selected void SetMode(RandoMenuItem <string> item) { if (item.CurrentSelection == "No Claw") { SetShadeSkips(true); acidSkipsBtn.SetSelection(true); spikeTunnelsBtn.SetSelection(true); miscSkipsBtn.SetSelection(true); fireballSkipsBtn.SetSelection(true); darkRoomsBtn.SetSelection(true); } else if (item.CurrentSelection.StartsWith("All")) { presetPoolsBtn.SetSelection("Classic"); } } void SetShadeSkips(bool enabled) { if (enabled) { gameTypeBtn.SetSelection("Normal"); SwitchGameType(false); } else { modeBtn.SetSelection("Standard"); } shadeSkipsBtn.SetSelection(enabled); } void SkipsSettingChanged(RandoMenuItem <bool> item) { presetSkipsBtn.SetSelection("Custom"); if (!item.CurrentSelection && item.Name != "Mag Skips") { modeBtn.SetSelection("Standard"); } } void PoolSettingChanged(RandoMenuItem <bool> item) { presetPoolsBtn.SetSelection("Custom"); } presetSkipsBtn.Changed += UpdateSkipsButtons; presetPoolsBtn.Changed += UpdatePoolPreset; modeBtn.Changed += SetMode; shadeSkipsBtn.Changed += SkipsSettingChanged; shadeSkipsBtn.Changed += SaveShadeVal; acidSkipsBtn.Changed += SkipsSettingChanged; spikeTunnelsBtn.Changed += SkipsSettingChanged; miscSkipsBtn.Changed += SkipsSettingChanged; fireballSkipsBtn.Changed += SkipsSettingChanged; darkRoomsBtn.Changed += SkipsSettingChanged; //RandoDreamersBtn.Changed += PoolSettingChanged; //RandoSkillsBtn.Changed += PoolSettingChanged; //RandoCharmsBtn.Changed += PoolSettingChanged; //RandoKeysBtn.Changed += PoolSettingChanged; RandoGeoChestsBtn.Changed += PoolSettingChanged; RandoMaskBtn.Changed += PoolSettingChanged; RandoVesselBtn.Changed += PoolSettingChanged; RandoOreBtn.Changed += PoolSettingChanged; RandoNotchBtn.Changed += PoolSettingChanged; RandoEggBtn.Changed += PoolSettingChanged; RandoRelicsBtn.Changed += PoolSettingChanged; // Setup game type button changes void SaveShadeVal(RandoMenuItem <bool> item) { SetShadeSkips(shadeSkipsBtn.CurrentSelection); } void SwitchGameType(bool steelMode) { if (!steelMode) { // Normal mode startRandoBtn.transform.localPosition = new Vector2(0, 200); startNormalBtn.transform.localPosition = new Vector2(0, -200); startSteelRandoBtn.transform.localPosition = new Vector2(10000, 10000); startSteelNormalBtn.transform.localPosition = new Vector2(10000, 10000); //backBtn.SetNavigation(startNormalBtn, startNormalBtn, modeBtn.Button, startRandoBtn); //magolorBtn.Button.SetNavigation(fireballSkipsBtn.Button, gameTypeBtn.Button, startNormalBtn, lemmBtn.Button); //lemmBtn.Button.SetNavigation(charmNotchBtn.Button, shadeSkipsBtn.Button, startRandoBtn, allSkillsBtn.Button); } else { // Steel Soul mode startRandoBtn.transform.localPosition = new Vector2(10000, 10000); startNormalBtn.transform.localPosition = new Vector2(10000, 10000); startSteelRandoBtn.transform.localPosition = new Vector2(0, 200); startSteelNormalBtn.transform.localPosition = new Vector2(0, -200); SetShadeSkips(false); //backBtn.SetNavigation(startSteelNormalBtn, startSteelNormalBtn, modeBtn.Button, startSteelRandoBtn); //magolorBtn.Button.SetNavigation(fireballSkipsBtn.Button, gameTypeBtn.Button, startSteelNormalBtn, lemmBtn.Button); //lemmBtn.Button.SetNavigation(charmNotchBtn.Button, shadeSkipsBtn.Button, startSteelRandoBtn, allSkillsBtn.Button); } } gameTypeBtn.Button.AddEvent(EventTriggerType.Submit, garbage => SwitchGameType(gameTypeBtn.CurrentSelection != "Normal")); // Setup start game button events void StartGame(bool rando) { AreaRando.Instance.Settings.CharmNotch = charmNotchBtn.CurrentSelection; AreaRando.Instance.Settings.Lemm = lemmBtn.CurrentSelection; AreaRando.Instance.Settings.Jiji = jijiBtn.CurrentSelection; AreaRando.Instance.Settings.PleasureHouse = PleasureHouseBtn.CurrentSelection; AreaRando.Instance.Settings.EarlyGeo = EarlyGeoBtn.CurrentSelection; AreaRando.Instance.Settings.RandomizeDreamers = true; AreaRando.Instance.Settings.RandomizeSkills = true; AreaRando.Instance.Settings.RandomizeCharms = true; AreaRando.Instance.Settings.RandomizeKeys = true; AreaRando.Instance.Settings.RandomizeGeoChests = RandoGeoChestsBtn.CurrentSelection; AreaRando.Instance.Settings.RandomizeMaskShards = RandoMaskBtn.CurrentSelection; AreaRando.Instance.Settings.RandomizeVesselFragments = RandoVesselBtn.CurrentSelection; AreaRando.Instance.Settings.RandomizePaleOre = RandoOreBtn.CurrentSelection; AreaRando.Instance.Settings.RandomizeCharmNotches = RandoNotchBtn.CurrentSelection; AreaRando.Instance.Settings.RandomizeRancidEggs = RandoEggBtn.CurrentSelection; AreaRando.Instance.Settings.RandomizeRelics = RandoRelicsBtn.CurrentSelection; AreaRando.Instance.Settings.LongItemTier = 1; if (RandoLongItemsBtn.CurrentSelection == "Standard") { AreaRando.Instance.Settings.LongItemTier = 1; } if (RandoLongItemsBtn.CurrentSelection == "Longer Items") { AreaRando.Instance.Settings.LongItemTier = 2; } if (RandoLongItemsBtn.CurrentSelection == "Longer Quests") { AreaRando.Instance.Settings.LongItemTier = 3; } if (RandoLongItemsBtn.CurrentSelection == "All Locations") { AreaRando.Instance.Settings.LongItemTier = 4; } if (RandoLongItemsBtn.CurrentSelection == "Fast") { AreaRando.Instance.Settings.LongItemTier = 0; } AreaRando.Instance.Settings.Randomizer = rando; if (AreaRando.Instance.Settings.Randomizer) { AreaRando.Instance.Settings.NoClaw = false; AreaRando.Instance.Settings.AllBosses = false; AreaRando.Instance.Settings.AllSkills = false; AreaRando.Instance.Settings.AllCharms = false; AreaRando.Instance.Settings.ShadeSkips = shadeSkipsBtn.CurrentSelection; AreaRando.Instance.Settings.AcidSkips = acidSkipsBtn.CurrentSelection; AreaRando.Instance.Settings.SpikeTunnels = spikeTunnelsBtn.CurrentSelection; AreaRando.Instance.Settings.MiscSkips = miscSkipsBtn.CurrentSelection; AreaRando.Instance.Settings.FireballSkips = fireballSkipsBtn.CurrentSelection; AreaRando.Instance.Settings.DarkRooms = darkRoomsBtn.CurrentSelection; } AreaRando.Instance.StartNewGame(); } startNormalBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(false)); startRandoBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(true)); startSteelNormalBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(false)); startSteelRandoBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(true)); }
public static void EditUI() { // Reset settings RandomizerMod.Instance.Settings = new SaveSettings(); // Fetch data from vanilla screen MenuScreen playScreen = Ref.UI.playModeMenuScreen; playScreen.title.gameObject.transform.localPosition = new Vector3(0, 520.56f); Object.Destroy(playScreen.topFleur.gameObject); MenuButton classic = (MenuButton)playScreen.defaultHighlight; MenuButton steel = (MenuButton)classic.FindSelectableOnDown(); MenuButton back = (MenuButton)steel.FindSelectableOnDown(); GameObject parent = steel.transform.parent.gameObject; Object.Destroy(parent.GetComponent <VerticalLayoutGroup>()); // Create new buttons MenuButton startRandoBtn = classic.Clone("StartRando", MenuButton.MenuButtonType.Proceed, new Vector2(0, 0), "Start Game", "Randomizer", RandomizerMod.GetSprite("UI.logo")); /* * MenuButton startNormalBtn = classic.Clone("StartNormal", MenuButton.MenuButtonType.Proceed, * new Vector2(0, -200), "Start Game", "Non-Randomizer"); * MenuButton startSteelRandoBtn = steel.Clone("StartSteelRando", MenuButton.MenuButtonType.Proceed, * new Vector2(10000, 10000), "Steel Soul", "Randomizer", RandomizerMod.GetSprite("UI.logo2")); * MenuButton startSteelNormalBtn = steel.Clone("StartSteelNormal", MenuButton.MenuButtonType.Proceed, * new Vector2(10000, 10000), "Steel Soul", "Non-Randomizer"); * * startNormalBtn.transform.localScale = * startSteelNormalBtn.transform.localScale = * startSteelRandoBtn.transform.localScale = */ startRandoBtn.transform.localScale = new Vector2(0.75f, 0.75f); startRandoBtn.GetComponent <StartGameEventTrigger>().bossRush = true; MenuButton backBtn = back.Clone("Back", MenuButton.MenuButtonType.Proceed, new Vector2(0, -100), "Back"); //RandoMenuItem<string> gameTypeBtn = new RandoMenuItem<string>(back, new Vector2(0, 600), "Game Type", "Normal", "Steel Soul"); RandoMenuItem <string> presetPoolsBtn = new RandoMenuItem <string>(back, new Vector2(900, 1040), "Preset", "Progressive", "Completionist", "Junk Pit", "Custom"); RandoMenuItem <bool> RandoDreamersBtn = new RandoMenuItem <bool>(back, new Vector2(700, 960), "Dreamers", true, false); RandoMenuItem <bool> RandoSkillsBtn = new RandoMenuItem <bool>(back, new Vector2(1100, 960), "Skills", true, false); RandoMenuItem <bool> RandoCharmsBtn = new RandoMenuItem <bool>(back, new Vector2(700, 880), "Charms", true, false); RandoMenuItem <bool> RandoKeysBtn = new RandoMenuItem <bool>(back, new Vector2(1100, 880), "Keys", true, false); RandoMenuItem <bool> RandoGeoChestsBtn = new RandoMenuItem <bool>(back, new Vector2(900, 800), "Geo Chests", false, true); RandoMenuItem <bool> RandoMaskBtn = new RandoMenuItem <bool>(back, new Vector2(700, 720), "Mask Shards", false, true); RandoMenuItem <bool> RandoVesselBtn = new RandoMenuItem <bool>(back, new Vector2(1100, 720), "Vessel Fragments", false, true); RandoMenuItem <bool> RandoOreBtn = new RandoMenuItem <bool>(back, new Vector2(700, 640), "Pale Ore", false, true); RandoMenuItem <bool> RandoNotchBtn = new RandoMenuItem <bool>(back, new Vector2(1100, 640), "Charm Notches", false, true); RandoMenuItem <bool> RandoEggBtn = new RandoMenuItem <bool>(back, new Vector2(700, 560), "Rancid Eggs", false, true); RandoMenuItem <bool> RandoRelicsBtn = new RandoMenuItem <bool>(back, new Vector2(1100, 560), "Relics", false, true); RandoMenuItem <bool> RandoMapBtn = new RandoMenuItem <bool>(back, new Vector2(700, 480), "Maps", false, true); RandoMenuItem <bool> RandoStagBtn = new RandoMenuItem <bool>(back, new Vector2(1100, 480), "Stags", false, true); RandoMenuItem <bool> RandoGrubBtn = new RandoMenuItem <bool>(back, new Vector2(700, 400), "Grubs", false, true); RandoMenuItem <bool> RandoRootsBtn = new RandoMenuItem <bool>(back, new Vector2(1100, 400), "Whispering Roots", false, true); RandoMenuItem <bool> RandoStartItemsBtn = new RandoMenuItem <bool>(back, new Vector2(900, 160), "Randomize Start Items", false, true); RandoMenuItem <string> RandoStartLocationsModeBtn = new RandoMenuItem <string>(back, new Vector2(900, 80), "Start Location Setting", "Select", "Random"); RandoMenuItem <string> StartLocationsListBtn = new RandoMenuItem <string>(back, new Vector2(900, 0), "Start Location", LogicManager.StartLocations); RandoMenuItem <string> presetSkipsBtn = new RandoMenuItem <string>(back, new Vector2(-900, 1040), "Preset", "Easy", "Medium", "Hard", "Custom"); RandoMenuItem <bool> mildSkipsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 960), "Mild Skips", false, true); RandoMenuItem <bool> shadeSkipsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 880), "Shade Skips", false, true); RandoMenuItem <bool> fireballSkipsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 800), "Fireball Skips", false, true); RandoMenuItem <bool> acidSkipsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 720), "Acid Skips", false, true); RandoMenuItem <bool> spikeTunnelsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 640), "Spike Tunnels", false, true); RandoMenuItem <bool> darkRoomsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 560), "Dark Rooms", false, true); RandoMenuItem <bool> spicySkipsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 480), "Spicy Skips", false, true); RandoMenuItem <bool> charmNotchBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 300), "Salubra Notches", true, false); RandoMenuItem <bool> lemmBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 220), "Lemm Sell All", true, false); RandoMenuItem <bool> EarlyGeoBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 140), "Early Geo", true, false); RandoMenuItem <bool> jijiBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 60), "Jiji Hints", true, false); RandoMenuItem <bool> quirrelBtn = new RandoMenuItem <bool>(back, new Vector2(-900, -20), "Quirrel Hints", true, false); RandoMenuItem <bool> leverBtn = new RandoMenuItem <bool>(back, new Vector2(-900, -100), "1.2.2.1 Levers", true, false); RandoMenuItem <string> modeBtn = new RandoMenuItem <string>(back, new Vector2(0, 1040), "Mode", "Item Randomizer", "Area Randomizer", "Connected-Area Room Randomizer", "Room Randomizer", "Open Mode"); RandoMenuItem <string> cursedBtn = new RandoMenuItem <string>(back, new Vector2(0, 960), "Cursed", "no", "noo", "noooo", "noooooooo", "noooooooooooooooo", "Oh yeah"); RandoMenuItem <bool> RandoSpoilerBtn = new RandoMenuItem <bool>(back, new Vector2(0, 0), "Create Spoiler Log", true, false); // Vanilla charms does not currently work RandoCharmsBtn.SetSelection(true); RandoCharmsBtn.Lock(); // Create seed entry field GameObject seedGameObject = back.Clone("Seed", MenuButton.MenuButtonType.Activate, new Vector2(0, 1130), "Click to type a custom seed").gameObject; Object.DestroyImmediate(seedGameObject.GetComponent <MenuButton>()); Object.DestroyImmediate(seedGameObject.GetComponent <EventTrigger>()); Object.DestroyImmediate(seedGameObject.transform.Find("Text").GetComponent <AutoLocalizeTextUI>()); Object.DestroyImmediate(seedGameObject.transform.Find("Text").GetComponent <FixVerticalAlign>()); Object.DestroyImmediate(seedGameObject.transform.Find("Text").GetComponent <ContentSizeFitter>()); RectTransform seedRect = seedGameObject.transform.Find("Text").GetComponent <RectTransform>(); seedRect.anchorMin = seedRect.anchorMax = new Vector2(0.5f, 0.5f); seedRect.sizeDelta = new Vector2(337, 63.2f); InputField customSeedInput = seedGameObject.AddComponent <InputField>(); customSeedInput.transform.localPosition = new Vector3(0, 1240); customSeedInput.textComponent = seedGameObject.transform.Find("Text").GetComponent <Text>(); RandomizerMod.Instance.Settings.Seed = new Random().Next(999999999); customSeedInput.text = RandomizerMod.Instance.Settings.Seed.ToString(); customSeedInput.caretColor = Color.white; customSeedInput.contentType = InputField.ContentType.IntegerNumber; customSeedInput.onEndEdit.AddListener(ParseSeedInput); customSeedInput.navigation = Navigation.defaultNavigation; customSeedInput.caretWidth = 8; customSeedInput.characterLimit = 9; customSeedInput.colors = new ColorBlock { highlightedColor = Color.yellow, pressedColor = Color.red, disabledColor = Color.black, normalColor = Color.white, colorMultiplier = 2f }; // Create some labels CreateLabel(back, new Vector2(-900, 1130), "Required Skips"); CreateLabel(back, new Vector2(-900, 380), "Quality of Life"); CreateLabel(back, new Vector2(900, 1130), "Randomization"); CreateLabel(back, new Vector2(900, 240), "Open Mode"); CreateLabel(back, new Vector2(0, 200), "Area/Room Randomizer expect use of Benchwarp"); CreateLabel(back, new Vector2(0, 1300), "Seed:"); // We don't need these old buttons anymore Object.Destroy(classic.gameObject); Object.Destroy(steel.gameObject); Object.Destroy(parent.FindGameObjectInChildren("GGButton")); Object.Destroy(back.gameObject); // Gotta put something here, we destroyed the old default playScreen.defaultHighlight = startRandoBtn; // Apply navigation info (up, right, down, left) //startNormalBtn.SetNavigation(gameTypeBtn.Button, presetPoolsBtn.Button, backBtn, presetSkipsBtn.Button); startRandoBtn.SetNavigation(modeBtn.Button, presetPoolsBtn.Button, backBtn, presetSkipsBtn.Button); //startSteelNormalBtn.SetNavigation(gameTypeBtn.Button, presetPoolsBtn.Button, backBtn, presetSkipsBtn.Button); //startSteelRandoBtn.SetNavigation(modeBtn.Button, presetPoolsBtn.Button, gameTypeBtn.Button, presetSkipsBtn.Button); modeBtn.Button.SetNavigation(backBtn, modeBtn.Button, startRandoBtn, modeBtn.Button); //gameTypeBtn.Button.SetNavigation(startRandoBtn, presetPoolsBtn.Button, startRandoBtn, presetSkipsBtn.Button); backBtn.SetNavigation(startRandoBtn, backBtn, modeBtn.Button, backBtn); RandoSpoilerBtn.Button.SetNavigation(RandoRelicsBtn.Button, RandoSpoilerBtn.Button, presetPoolsBtn.Button, startRandoBtn); presetSkipsBtn.Button.SetNavigation(leverBtn.Button, startRandoBtn, shadeSkipsBtn.Button, presetSkipsBtn.Button); mildSkipsBtn.Button.SetNavigation(presetSkipsBtn.Button, startRandoBtn, mildSkipsBtn.Button, mildSkipsBtn.Button); shadeSkipsBtn.Button.SetNavigation(mildSkipsBtn.Button, startRandoBtn, fireballSkipsBtn.Button, shadeSkipsBtn.Button); fireballSkipsBtn.Button.SetNavigation(shadeSkipsBtn.Button, startRandoBtn, acidSkipsBtn.Button, fireballSkipsBtn.Button); acidSkipsBtn.Button.SetNavigation(fireballSkipsBtn.Button, startRandoBtn, spikeTunnelsBtn.Button, acidSkipsBtn.Button); spikeTunnelsBtn.Button.SetNavigation(acidSkipsBtn.Button, startRandoBtn, darkRoomsBtn.Button, spikeTunnelsBtn.Button); darkRoomsBtn.Button.SetNavigation(spikeTunnelsBtn.Button, startRandoBtn, spicySkipsBtn.Button, darkRoomsBtn.Button); spicySkipsBtn.Button.SetNavigation(darkRoomsBtn.Button, startRandoBtn, charmNotchBtn.Button, spicySkipsBtn.Button); charmNotchBtn.Button.SetNavigation(spicySkipsBtn.Button, startRandoBtn, lemmBtn.Button, charmNotchBtn.Button); lemmBtn.Button.SetNavigation(charmNotchBtn.Button, startRandoBtn, EarlyGeoBtn.Button, lemmBtn.Button); EarlyGeoBtn.Button.SetNavigation(lemmBtn.Button, startRandoBtn, jijiBtn.Button, EarlyGeoBtn.Button); jijiBtn.Button.SetNavigation(EarlyGeoBtn.Button, startRandoBtn, quirrelBtn.Button, jijiBtn.Button); quirrelBtn.Button.SetNavigation(jijiBtn.Button, startRandoBtn, leverBtn.Button, quirrelBtn.Button); leverBtn.Button.SetNavigation(quirrelBtn.Button, startRandoBtn, presetSkipsBtn.Button, leverBtn.Button); presetPoolsBtn.Button.SetNavigation(RandoSpoilerBtn.Button, presetPoolsBtn.Button, RandoDreamersBtn.Button, startRandoBtn); RandoDreamersBtn.Button.SetNavigation(presetPoolsBtn.Button, RandoDreamersBtn.Button, RandoSkillsBtn.Button, startRandoBtn); RandoSkillsBtn.Button.SetNavigation(RandoDreamersBtn.Button, RandoSkillsBtn.Button, RandoCharmsBtn.Button, startRandoBtn); RandoCharmsBtn.Button.SetNavigation(RandoSkillsBtn.Button, RandoCharmsBtn.Button, RandoKeysBtn.Button, startRandoBtn); RandoKeysBtn.Button.SetNavigation(RandoCharmsBtn.Button, RandoKeysBtn.Button, RandoGeoChestsBtn.Button, startRandoBtn); RandoGeoChestsBtn.Button.SetNavigation(RandoKeysBtn.Button, RandoGeoChestsBtn.Button, RandoMaskBtn.Button, startRandoBtn); RandoMaskBtn.Button.SetNavigation(RandoGeoChestsBtn.Button, RandoMaskBtn.Button, RandoVesselBtn.Button, startRandoBtn); RandoVesselBtn.Button.SetNavigation(RandoMaskBtn.Button, RandoVesselBtn.Button, RandoOreBtn.Button, startRandoBtn); RandoOreBtn.Button.SetNavigation(RandoVesselBtn.Button, RandoOreBtn.Button, RandoNotchBtn.Button, startRandoBtn); RandoNotchBtn.Button.SetNavigation(RandoOreBtn.Button, RandoNotchBtn.Button, RandoEggBtn.Button, startRandoBtn); RandoEggBtn.Button.SetNavigation(RandoNotchBtn.Button, RandoEggBtn.Button, RandoRelicsBtn.Button, startRandoBtn); RandoRelicsBtn.Button.SetNavigation(RandoEggBtn.Button, RandoRelicsBtn.Button, RandoSpoilerBtn.Button, startRandoBtn); RandoStartItemsBtn.Button.SetNavigation(RandoRelicsBtn.Button, RandoStartLocationsModeBtn.Button, RandoStartItemsBtn.Button, startRandoBtn); RandoStartLocationsModeBtn.Button.SetNavigation(RandoStartItemsBtn.Button, RandoStartLocationsModeBtn.Button, StartLocationsListBtn.Button, startRandoBtn); StartLocationsListBtn.Button.SetNavigation(RandoStartLocationsModeBtn.Button, RandoStartLocationsModeBtn.Button, StartLocationsListBtn.Button, startRandoBtn); // Setup event for changing difficulty settings buttons void ModeSettingChanged(RandoMenuItem <string> item) { //"Item Randomizer", "Area Randomizer", "Connected-Area Room Randomizer", "Room Randomizer" if (item.CurrentSelection == "Item Randomizer") { RandoDreamersBtn.Unlock(); RandoSkillsBtn.Unlock(); //RandoCharmsBtn.Unlock(); RandoKeysBtn.Unlock(); } else { RandoDreamersBtn.SetSelection(true); RandoSkillsBtn.SetSelection(true); RandoCharmsBtn.SetSelection(true); RandoKeysBtn.SetSelection(true); RandoDreamersBtn.Lock(); RandoSkillsBtn.Lock(); RandoCharmsBtn.Lock(); RandoKeysBtn.Lock(); } if (item.CurrentSelection == "Open Mode") { startRandoBtn.GetComponent <StartGameEventTrigger>().bossRush = true; } else { // startRandoBtn.GetComponent<StartGameEventTrigger>().bossRush = false; } } void UpdateSkipsButtons(RandoMenuItem <string> item) { switch (item.CurrentSelection) { case "Easy": SetShadeSkips(false); mildSkipsBtn.SetSelection(false); acidSkipsBtn.SetSelection(false); spikeTunnelsBtn.SetSelection(false); spicySkipsBtn.SetSelection(false); fireballSkipsBtn.SetSelection(false); darkRoomsBtn.SetSelection(false); break; case "Medium": SetShadeSkips(true); mildSkipsBtn.SetSelection(true); acidSkipsBtn.SetSelection(false); spikeTunnelsBtn.SetSelection(false); spicySkipsBtn.SetSelection(false); fireballSkipsBtn.SetSelection(false); darkRoomsBtn.SetSelection(false); break; case "Hard": SetShadeSkips(true); mildSkipsBtn.SetSelection(true); acidSkipsBtn.SetSelection(true); spikeTunnelsBtn.SetSelection(true); spicySkipsBtn.SetSelection(true); fireballSkipsBtn.SetSelection(true); darkRoomsBtn.SetSelection(true); break; case "Custom": item.SetSelection("Easy"); goto case "Easy"; default: LogWarn("Unknown value in preset button: " + item.CurrentSelection); break; } } void UpdatePoolPreset(RandoMenuItem <string> item) { switch (item.CurrentSelection) { case "Progressive": RandoDreamersBtn.SetSelection(true); RandoSkillsBtn.SetSelection(true); RandoCharmsBtn.SetSelection(true); RandoKeysBtn.SetSelection(true); RandoGeoChestsBtn.SetSelection(false); RandoMaskBtn.SetSelection(false); RandoVesselBtn.SetSelection(false); RandoOreBtn.SetSelection(false); RandoNotchBtn.SetSelection(false); RandoEggBtn.SetSelection(false); RandoRelicsBtn.SetSelection(false); break; case "Completionist": RandoDreamersBtn.SetSelection(true); RandoSkillsBtn.SetSelection(true); RandoCharmsBtn.SetSelection(true); RandoKeysBtn.SetSelection(true); RandoGeoChestsBtn.SetSelection(true); RandoMaskBtn.SetSelection(true); RandoVesselBtn.SetSelection(true); RandoOreBtn.SetSelection(true); RandoNotchBtn.SetSelection(true); RandoEggBtn.SetSelection(false); RandoRelicsBtn.SetSelection(false); break; case "Junk Pit": RandoDreamersBtn.SetSelection(true); RandoSkillsBtn.SetSelection(true); RandoCharmsBtn.SetSelection(true); RandoKeysBtn.SetSelection(true); RandoGeoChestsBtn.SetSelection(true); RandoMaskBtn.SetSelection(true); RandoVesselBtn.SetSelection(true); RandoOreBtn.SetSelection(true); RandoNotchBtn.SetSelection(true); RandoEggBtn.SetSelection(true); RandoRelicsBtn.SetSelection(true); break; case "Custom": item.SetSelection("Progressive"); goto case "Progressive"; } } void UpdateStartLocationColor() { // cf. TestStartLocation in PreRandomizer. Note that color is checked in StartGame to determine if a selected start was valid if (LogicManager.GetStartLocation(StartLocationsListBtn.CurrentSelection) is StartDef startDef) { if (RandoStartItemsBtn.CurrentSelection) { StartLocationsListBtn.SetColor(Color.white); } else if (modeBtn.CurrentSelection.EndsWith("Room Randomizer")) { if (startDef.roomSafe) { StartLocationsListBtn.SetColor(Color.white); } else { StartLocationsListBtn.SetColor(Color.red); } } else if (modeBtn.CurrentSelection == "Area Randomizer") { if (startDef.areaSafe) { StartLocationsListBtn.SetColor(Color.white); } else { StartLocationsListBtn.SetColor(Color.red); } } else if (startDef.itemSafe) { StartLocationsListBtn.SetColor(Color.white); } else { StartLocationsListBtn.SetColor(Color.red); } } } void SetShadeSkips(bool enabled) { if (enabled) { //gameTypeBtn.SetSelection("Normal"); //SwitchGameType(false); } shadeSkipsBtn.SetSelection(enabled); } void SkipsSettingChanged(RandoMenuItem <bool> item) { presetSkipsBtn.SetSelection("Custom"); } void PoolSettingChanged(RandoMenuItem <bool> item) { presetPoolsBtn.SetSelection("Custom"); } modeBtn.Changed += ModeSettingChanged; presetSkipsBtn.Changed += UpdateSkipsButtons; presetPoolsBtn.Changed += UpdatePoolPreset; mildSkipsBtn.Changed += SkipsSettingChanged; shadeSkipsBtn.Changed += SkipsSettingChanged; shadeSkipsBtn.Changed += SaveShadeVal; acidSkipsBtn.Changed += SkipsSettingChanged; spikeTunnelsBtn.Changed += SkipsSettingChanged; spicySkipsBtn.Changed += SkipsSettingChanged; fireballSkipsBtn.Changed += SkipsSettingChanged; darkRoomsBtn.Changed += SkipsSettingChanged; RandoDreamersBtn.Changed += PoolSettingChanged; RandoSkillsBtn.Changed += PoolSettingChanged; RandoCharmsBtn.Changed += PoolSettingChanged; RandoKeysBtn.Changed += PoolSettingChanged; RandoGeoChestsBtn.Changed += PoolSettingChanged; RandoMaskBtn.Changed += PoolSettingChanged; RandoVesselBtn.Changed += PoolSettingChanged; RandoOreBtn.Changed += PoolSettingChanged; RandoNotchBtn.Changed += PoolSettingChanged; RandoEggBtn.Changed += PoolSettingChanged; RandoRelicsBtn.Changed += PoolSettingChanged; RandoStartItemsBtn.Changed += (RandoMenuItem <bool> Item) => UpdateStartLocationColor(); RandoStartLocationsModeBtn.Changed += (RandoMenuItem <string> Item) => UpdateStartLocationColor(); StartLocationsListBtn.Changed += (RandoMenuItem <string> Item) => UpdateStartLocationColor(); modeBtn.Changed += (RandoMenuItem <string> Item) => UpdateStartLocationColor(); // Setup game type button changes void SaveShadeVal(RandoMenuItem <bool> item) { SetShadeSkips(shadeSkipsBtn.CurrentSelection); } /*void SwitchGameType(bool steelMode) * { * if (!steelMode) * { * // Normal mode * startRandoBtn.transform.localPosition = new Vector2(0, 200); * startNormalBtn.transform.localPosition = new Vector2(0, -200); * startSteelRandoBtn.transform.localPosition = new Vector2(10000, 10000); * startSteelNormalBtn.transform.localPosition = new Vector2(10000, 10000); * * //backBtn.SetNavigation(startNormalBtn, startNormalBtn, modeBtn.Button, startRandoBtn); * //magolorBtn.Button.SetNavigation(fireballSkipsBtn.Button, gameTypeBtn.Button, startNormalBtn, lemmBtn.Button); * //lemmBtn.Button.SetNavigation(charmNotchBtn.Button, shadeSkipsBtn.Button, startRandoBtn, allSkillsBtn.Button); * } * else * { * // Steel Soul mode * startRandoBtn.transform.localPosition = new Vector2(10000, 10000); * startNormalBtn.transform.localPosition = new Vector2(10000, 10000); * startSteelRandoBtn.transform.localPosition = new Vector2(0, 200); * startSteelNormalBtn.transform.localPosition = new Vector2(0, -200); * * SetShadeSkips(false); * * //backBtn.SetNavigation(startSteelNormalBtn, startSteelNormalBtn, modeBtn.Button, startSteelRandoBtn); * //magolorBtn.Button.SetNavigation(fireballSkipsBtn.Button, gameTypeBtn.Button, startSteelNormalBtn, lemmBtn.Button); * //lemmBtn.Button.SetNavigation(charmNotchBtn.Button, shadeSkipsBtn.Button, startSteelRandoBtn, allSkillsBtn.Button); * } * } * * gameTypeBtn.Button.AddEvent(EventTriggerType.Submit, * garbage => SwitchGameType(gameTypeBtn.CurrentSelection != "Normal")); */ // Setup start game button events void StartGame(bool rando) { RandomizerMod.Instance.Settings.CharmNotch = charmNotchBtn.CurrentSelection; RandomizerMod.Instance.Settings.Lemm = lemmBtn.CurrentSelection; RandomizerMod.Instance.Settings.EarlyGeo = EarlyGeoBtn.CurrentSelection; if (rando) { RandomizerMod.Instance.Settings.Jiji = jijiBtn.CurrentSelection; RandomizerMod.Instance.Settings.Quirrel = quirrelBtn.CurrentSelection; RandomizerMod.Instance.Settings.LeverSkips = leverBtn.CurrentSelection; RandomizerMod.Instance.Settings.RandomizeDreamers = RandoDreamersBtn.CurrentSelection; RandomizerMod.Instance.Settings.RandomizeSkills = RandoSkillsBtn.CurrentSelection; RandomizerMod.Instance.Settings.RandomizeCharms = RandoCharmsBtn.CurrentSelection; RandomizerMod.Instance.Settings.RandomizeKeys = RandoKeysBtn.CurrentSelection; RandomizerMod.Instance.Settings.RandomizeGeoChests = RandoGeoChestsBtn.CurrentSelection; RandomizerMod.Instance.Settings.RandomizeMaskShards = RandoMaskBtn.CurrentSelection; RandomizerMod.Instance.Settings.RandomizeVesselFragments = RandoVesselBtn.CurrentSelection; RandomizerMod.Instance.Settings.RandomizePaleOre = RandoOreBtn.CurrentSelection; RandomizerMod.Instance.Settings.RandomizeCharmNotches = RandoNotchBtn.CurrentSelection; RandomizerMod.Instance.Settings.RandomizeRancidEggs = RandoEggBtn.CurrentSelection; RandomizerMod.Instance.Settings.RandomizeRelics = RandoRelicsBtn.CurrentSelection; RandomizerMod.Instance.Settings.RandomizeMaps = RandoMapBtn.CurrentSelection; RandomizerMod.Instance.Settings.RandomizeStags = RandoStagBtn.CurrentSelection; RandomizerMod.Instance.Settings.RandomizeGrubs = RandoGrubBtn.CurrentSelection; RandomizerMod.Instance.Settings.RandomizeWhisperingRoots = RandoRootsBtn.CurrentSelection; RandomizerMod.Instance.Settings.CreateSpoilerLog = RandoSpoilerBtn.CurrentSelection; RandomizerMod.Instance.Settings.Cursed = cursedBtn.CurrentSelection.StartsWith("O"); RandomizerMod.Instance.Settings.Randomizer = rando; RandomizerMod.Instance.Settings.RandomizeAreas = modeBtn.CurrentSelection == "Area Randomizer"; RandomizerMod.Instance.Settings.RandomizeRooms = modeBtn.CurrentSelection.EndsWith("Room Randomizer"); RandomizerMod.Instance.Settings.ConnectAreas = modeBtn.CurrentSelection.StartsWith("Connected-Area"); RandomizerMod.Instance.Settings.MildSkips = mildSkipsBtn.CurrentSelection; RandomizerMod.Instance.Settings.ShadeSkips = shadeSkipsBtn.CurrentSelection; RandomizerMod.Instance.Settings.FireballSkips = fireballSkipsBtn.CurrentSelection; RandomizerMod.Instance.Settings.AcidSkips = acidSkipsBtn.CurrentSelection; RandomizerMod.Instance.Settings.SpikeTunnels = spikeTunnelsBtn.CurrentSelection; RandomizerMod.Instance.Settings.DarkRooms = darkRoomsBtn.CurrentSelection; RandomizerMod.Instance.Settings.SpicySkips = spicySkipsBtn.CurrentSelection; RandomizerMod.Instance.Settings.RandomizeStartItems = RandoStartItemsBtn.CurrentSelection; RandomizerMod.Instance.Settings.RandomizeStartLocation = RandoStartLocationsModeBtn.CurrentSelection == "Random"; RandomizerMod.Instance.Settings.StartName = StartLocationsListBtn.GetColor() == Color.red ? "King's Pass" : StartLocationsListBtn.CurrentSelection; } RandomizerMod.Instance.StartNewGame(); } //startNormalBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(false)); startRandoBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(true)); //startSteelNormalBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(false)); //startSteelRandoBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(true)); }
public static void EditUI() { // Reset settings RandomizerMod.Instance.Settings = new SaveSettings(); // Fetch data from vanilla screen MenuScreen playScreen = Ref.UI.playModeMenuScreen; playScreen.title.gameObject.transform.localPosition = new Vector3(0, 520.56f); Object.Destroy(playScreen.topFleur.gameObject); MenuButton classic = (MenuButton)playScreen.defaultHighlight; MenuButton steel = (MenuButton)classic.FindSelectableOnDown(); MenuButton back = (MenuButton)steel.FindSelectableOnDown(); GameObject parent = steel.transform.parent.gameObject; Object.Destroy(parent.GetComponent <VerticalLayoutGroup>()); // Create new buttons MenuButton startRandoBtn = classic.Clone("StartRando", MenuButton.MenuButtonType.Proceed, new Vector2(650, -480), "Start Game", "Randomizer v2", RandomizerMod.GetSprite("UI.logo")); MenuButton startNormalBtn = classic.Clone("StartNormal", MenuButton.MenuButtonType.Proceed, new Vector2(-650, -480), "Start Game", "Non-Randomizer"); MenuButton startSteelRandoBtn = steel.Clone("StartSteelRando", MenuButton.MenuButtonType.Proceed, new Vector2(10000, 10000), "Steel Soul", "Randomizer v2", RandomizerMod.GetSprite("UI.logo2")); MenuButton startSteelNormalBtn = steel.Clone("StartSteelNormal", MenuButton.MenuButtonType.Proceed, new Vector2(10000, 10000), "Steel Soul", "Non-Randomizer"); startNormalBtn.transform.localScale = startRandoBtn.transform.localScale = startSteelNormalBtn.transform.localScale = startSteelRandoBtn.transform.localScale = new Vector2(0.75f, 0.75f); MenuButton backBtn = back.Clone("Back", MenuButton.MenuButtonType.Proceed, new Vector2(0, -100), "Back"); RandoMenuItem <bool> allBossesBtn = new RandoMenuItem <bool>(back, new Vector2(0, 850), "All Bosses", false, true); RandoMenuItem <bool> allSkillsBtn = new RandoMenuItem <bool>(back, new Vector2(0, 760), "All Skills", false, true); RandoMenuItem <bool> allCharmsBtn = new RandoMenuItem <bool>(back, new Vector2(0, 670), "All Charms", false, true); RandoMenuItem <string> gameTypeBtn = new RandoMenuItem <string>(back, new Vector2(0, 400), "Game Type", "Normal", "Steel Soul"); RandoMenuItem <bool> charmNotchBtn = new RandoMenuItem <bool>(back, new Vector2(900, 850), "Salubra Notches", true, false); RandoMenuItem <bool> lemmBtn = new RandoMenuItem <bool>(back, new Vector2(900, 760), "Lemm Sell All", true, false); RandoMenuItem <string> presetBtn = new RandoMenuItem <string>(back, new Vector2(-900, 850), "Preset", "Easy", "Hard", "Moglar", "Custom"); RandoMenuItem <bool> shadeSkipsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 760), "Shade Skips", false, true); RandoMenuItem <bool> acidSkipsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 670), "Acid Skips", false, true); RandoMenuItem <bool> spikeTunnelsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 580), "Spike Tunnels", false, true); RandoMenuItem <bool> miscSkipsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 490), "Misc Skips", false, true); RandoMenuItem <bool> fireballSkipsBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 400), "Fireball Skips", false, true); RandoMenuItem <bool> magolorBtn = new RandoMenuItem <bool>(back, new Vector2(-900, 310), "Mag Skips", false, true); RandoMenuItem <string> modeBtn = new RandoMenuItem <string>(back, new Vector2(0, 1040), "Mode", "Standard", "No Claw"); // Create seed entry field GameObject seedGameObject = back.Clone("Seed", MenuButton.MenuButtonType.Activate, new Vector2(0, 1130), "Click to type a custom seed").gameObject; Object.DestroyImmediate(seedGameObject.GetComponent <MenuButton>()); Object.DestroyImmediate(seedGameObject.GetComponent <EventTrigger>()); Object.DestroyImmediate(seedGameObject.transform.Find("Text").GetComponent <AutoLocalizeTextUI>()); Object.DestroyImmediate(seedGameObject.transform.Find("Text").GetComponent <FixVerticalAlign>()); Object.DestroyImmediate(seedGameObject.transform.Find("Text").GetComponent <ContentSizeFitter>()); RectTransform seedRect = seedGameObject.transform.Find("Text").GetComponent <RectTransform>(); seedRect.anchorMin = seedRect.anchorMax = new Vector2(0.5f, 0.5f); seedRect.sizeDelta = new Vector2(337, 63.2f); InputField customSeedInput = seedGameObject.AddComponent <InputField>(); customSeedInput.transform.localPosition = new Vector3(0, 1240); customSeedInput.textComponent = seedGameObject.transform.Find("Text").GetComponent <Text>(); RandomizerMod.Instance.Settings.Seed = new Random().Next(999999999); customSeedInput.text = RandomizerMod.Instance.Settings.Seed.ToString(); customSeedInput.caretColor = Color.white; customSeedInput.contentType = InputField.ContentType.IntegerNumber; customSeedInput.onEndEdit.AddListener(ParseSeedInput); customSeedInput.navigation = Navigation.defaultNavigation; customSeedInput.caretWidth = 8; customSeedInput.characterLimit = 9; customSeedInput.colors = new ColorBlock { highlightedColor = Color.yellow, pressedColor = Color.red, disabledColor = Color.black, normalColor = Color.white, colorMultiplier = 2f }; // Create some labels CreateLabel(back, new Vector2(-900, 960), "Required Skips"); CreateLabel(back, new Vector2(0, 960), "Restrictions"); CreateLabel(back, new Vector2(900, 960), "Quality of Life"); CreateLabel(back, new Vector2(0, 1300), "Seed:"); // We don't need these old buttons anymore Object.Destroy(classic.gameObject); Object.Destroy(steel.gameObject); Object.Destroy(parent.FindGameObjectInChildren("GGButton")); Object.Destroy(back.gameObject); // Gotta put something here, we destroyed the old default playScreen.defaultHighlight = startRandoBtn; // Apply navigation info (up, right, down, left) startNormalBtn.SetNavigation(magolorBtn.Button, startRandoBtn, backBtn, startRandoBtn); startRandoBtn.SetNavigation(lemmBtn.Button, startNormalBtn, backBtn, startNormalBtn); startSteelNormalBtn.SetNavigation(magolorBtn.Button, startSteelRandoBtn, backBtn, startSteelRandoBtn); startSteelRandoBtn.SetNavigation(lemmBtn.Button, startSteelNormalBtn, backBtn, startSteelNormalBtn); backBtn.SetNavigation(startNormalBtn, startNormalBtn, modeBtn.Button, startRandoBtn); allBossesBtn.Button.SetNavigation(modeBtn.Button, charmNotchBtn.Button, allSkillsBtn.Button, presetBtn.Button); allSkillsBtn.Button.SetNavigation(allBossesBtn.Button, lemmBtn.Button, allCharmsBtn.Button, shadeSkipsBtn.Button); allCharmsBtn.Button.SetNavigation(allSkillsBtn.Button, lemmBtn.Button, gameTypeBtn.Button, acidSkipsBtn.Button); charmNotchBtn.Button.SetNavigation(modeBtn.Button, presetBtn.Button, lemmBtn.Button, allBossesBtn.Button); lemmBtn.Button.SetNavigation(charmNotchBtn.Button, shadeSkipsBtn.Button, startRandoBtn, allSkillsBtn.Button); presetBtn.Button.SetNavigation(modeBtn.Button, allBossesBtn.Button, shadeSkipsBtn.Button, charmNotchBtn.Button); shadeSkipsBtn.Button.SetNavigation(presetBtn.Button, allSkillsBtn.Button, acidSkipsBtn.Button, lemmBtn.Button); acidSkipsBtn.Button.SetNavigation(shadeSkipsBtn.Button, allCharmsBtn.Button, spikeTunnelsBtn.Button, lemmBtn.Button); spikeTunnelsBtn.Button.SetNavigation(acidSkipsBtn.Button, allCharmsBtn.Button, miscSkipsBtn.Button, lemmBtn.Button); miscSkipsBtn.Button.SetNavigation(spikeTunnelsBtn.Button, gameTypeBtn.Button, fireballSkipsBtn.Button, lemmBtn.Button); fireballSkipsBtn.Button.SetNavigation(miscSkipsBtn.Button, gameTypeBtn.Button, magolorBtn.Button, lemmBtn.Button); magolorBtn.Button.SetNavigation(fireballSkipsBtn.Button, gameTypeBtn.Button, startNormalBtn, lemmBtn.Button); modeBtn.Button.SetNavigation(backBtn, modeBtn.Button, allBossesBtn.Button, modeBtn.Button); gameTypeBtn.Button.SetNavigation(allCharmsBtn.Button, lemmBtn.Button, backBtn, fireballSkipsBtn.Button); // Setup event for changing difficulty settings buttons void UpdateButtons(RandoMenuItem <string> item) { switch (item.CurrentSelection) { case "Easy": SetShadeSkips(false); acidSkipsBtn.SetSelection(false); spikeTunnelsBtn.SetSelection(false); miscSkipsBtn.SetSelection(false); fireballSkipsBtn.SetSelection(false); magolorBtn.SetSelection(false); break; case "Hard": SetShadeSkips(true); acidSkipsBtn.SetSelection(true); spikeTunnelsBtn.SetSelection(true); miscSkipsBtn.SetSelection(true); fireballSkipsBtn.SetSelection(true); magolorBtn.SetSelection(false); break; case "Moglar": SetShadeSkips(true); acidSkipsBtn.SetSelection(true); spikeTunnelsBtn.SetSelection(true); miscSkipsBtn.SetSelection(true); fireballSkipsBtn.SetSelection(true); magolorBtn.SetSelection(true); break; case "Custom": item.SetSelection("Easy"); goto case "Easy"; default: LogWarn("Unknown value in preset button: " + item.CurrentSelection); break; } } // Event for setting stuff to hard mode on no claw selected void SetNoClaw(RandoMenuItem <string> item) { if (item.CurrentSelection == "No Claw") { SetShadeSkips(true); acidSkipsBtn.SetSelection(true); spikeTunnelsBtn.SetSelection(true); miscSkipsBtn.SetSelection(true); fireballSkipsBtn.SetSelection(true); presetBtn.SetSelection(magolorBtn.CurrentSelection ? "Moglar" : "Hard"); } } void SetShadeSkips(bool enabled) { if (enabled) { gameTypeBtn.SetSelection("Normal"); SwitchGameType(false); } else { modeBtn.SetSelection("Standard"); } shadeSkipsBtn.SetSelection(enabled); } void SettingChanged(RandoMenuItem <bool> item) { presetBtn.SetSelection("Custom"); if (!item.CurrentSelection && item.Name != "Mag Skips") { modeBtn.SetSelection("Standard"); } } presetBtn.Changed += UpdateButtons; modeBtn.Changed += SetNoClaw; shadeSkipsBtn.Changed += SettingChanged; shadeSkipsBtn.Changed += SaveShadeVal; acidSkipsBtn.Changed += SettingChanged; spikeTunnelsBtn.Changed += SettingChanged; miscSkipsBtn.Changed += SettingChanged; fireballSkipsBtn.Changed += SettingChanged; magolorBtn.Changed += SettingChanged; // Setup game type button changes void SaveShadeVal(RandoMenuItem <bool> item) { SetShadeSkips(shadeSkipsBtn.CurrentSelection); } void SwitchGameType(bool steelMode) { if (!steelMode) { // Normal mode startRandoBtn.transform.localPosition = new Vector2(650, -480); startNormalBtn.transform.localPosition = new Vector2(-650, -480); startSteelRandoBtn.transform.localPosition = new Vector2(10000, 10000); startSteelNormalBtn.transform.localPosition = new Vector2(10000, 10000); backBtn.SetNavigation(startNormalBtn, startNormalBtn, modeBtn.Button, startRandoBtn); magolorBtn.Button.SetNavigation(fireballSkipsBtn.Button, gameTypeBtn.Button, startNormalBtn, lemmBtn.Button); lemmBtn.Button.SetNavigation(charmNotchBtn.Button, shadeSkipsBtn.Button, startRandoBtn, allSkillsBtn.Button); } else { // Steel Soul mode startRandoBtn.transform.localPosition = new Vector2(10000, 10000); startNormalBtn.transform.localPosition = new Vector2(10000, 10000); startSteelRandoBtn.transform.localPosition = new Vector2(650, -480); startSteelNormalBtn.transform.localPosition = new Vector2(-650, -480); SetShadeSkips(false); backBtn.SetNavigation(startSteelNormalBtn, startSteelNormalBtn, modeBtn.Button, startSteelRandoBtn); magolorBtn.Button.SetNavigation(fireballSkipsBtn.Button, gameTypeBtn.Button, startSteelNormalBtn, lemmBtn.Button); lemmBtn.Button.SetNavigation(charmNotchBtn.Button, shadeSkipsBtn.Button, startSteelRandoBtn, allSkillsBtn.Button); } } gameTypeBtn.Button.AddEvent(EventTriggerType.Submit, garbage => SwitchGameType(gameTypeBtn.CurrentSelection != "Normal")); // Setup start game button events void StartGame(bool rando) { RandomizerMod.Instance.Settings.CharmNotch = charmNotchBtn.CurrentSelection; RandomizerMod.Instance.Settings.Lemm = lemmBtn.CurrentSelection; RandomizerMod.Instance.Settings.AllBosses = allBossesBtn.CurrentSelection; RandomizerMod.Instance.Settings.AllCharms = allCharmsBtn.CurrentSelection; RandomizerMod.Instance.Settings.AllSkills = allSkillsBtn.CurrentSelection; RandomizerMod.Instance.Settings.Randomizer = rando; if (RandomizerMod.Instance.Settings.Randomizer) { RandomizerMod.Instance.Settings.NoClaw = modeBtn.CurrentSelection == "No Claw"; RandomizerMod.Instance.Settings.ShadeSkips = gameTypeBtn.CurrentSelection == "Normal" && shadeSkipsBtn.CurrentSelection; RandomizerMod.Instance.Settings.AcidSkips = acidSkipsBtn.CurrentSelection; RandomizerMod.Instance.Settings.SpikeTunnels = spikeTunnelsBtn.CurrentSelection; RandomizerMod.Instance.Settings.MiscSkips = miscSkipsBtn.CurrentSelection; RandomizerMod.Instance.Settings.FireballSkips = fireballSkipsBtn.CurrentSelection; RandomizerMod.Instance.Settings.MagSkips = magolorBtn.CurrentSelection; } RandomizerMod.Instance.StartNewGame(); } startNormalBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(false)); startRandoBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(true)); startSteelNormalBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(false)); startSteelRandoBtn.AddEvent(EventTriggerType.Submit, garbage => StartGame(true)); }