private static void ShowItemPopup(string nameKey, string spriteName) { GameObject popup = ObjectCache.RelicGetMsg; popup.transform.Find("Text").GetComponent <TMPro.TextMeshPro>().text = LanguageStringManager.GetLanguageString(nameKey, "UI"); popup.transform.Find("Icon").GetComponent <SpriteRenderer>().sprite = RandomizerMod.GetSprite(spriteName); popup.SetActive(true); }
public override void Initialize(Dictionary <string, Dictionary <string, GameObject> > preloaded) { if (Instance != null) { LogWarn("Attempting to make multiple instances of mod, ignoring"); return; } // Set instance for outside use Instance = this; // Make sure the play mode screen is always unlocked Ref.GM.EnablePermadeathMode(); // Unlock godseeker too because idk why not Ref.GM.SetStatusRecordInt("RecBossRushMode", 1); Assembly randoDLL = GetType().Assembly; // Load embedded resources _sprites = ResourceHelper.GetSprites("RandomizerMod.Resources."); try { LanguageStringManager.LoadLanguageXML( randoDLL.GetManifestResourceStream("RandomizerMod.Resources.language.xml")); } catch (Exception e) { LogError("Could not process language xml:\n" + e); } _logicParseThread = new Thread(() => LogicManager.ParseXML(randoDLL)); _logicParseThread.Start(); UnityEngine.SceneManagement.SceneManager.activeSceneChanged += OnMainMenu; // Setup preloaded objects ObjectCache.GetPrefabs(preloaded); // Some items have two bools for no reason, gotta deal with that _secondaryBools = new Dictionary <string, string> { { nameof(PlayerData.hasDash), nameof(PlayerData.canDash) }, { nameof(PlayerData.hasShadowDash), nameof(PlayerData.canShadowDash) }, { nameof(PlayerData.hasSuperDash), nameof(PlayerData.canSuperDash) }, { nameof(PlayerData.hasWalljump), nameof(PlayerData.canWallJump) }, { nameof(PlayerData.gotCharm_23), nameof(PlayerData.fragileHealth_unbreakable) }, { nameof(PlayerData.gotCharm_24), nameof(PlayerData.fragileGreed_unbreakable) }, { nameof(PlayerData.gotCharm_25), nameof(PlayerData.fragileStrength_unbreakable) } }; _logicParseThread.Join(); // new update -- logic manager is needed to supply start locations to menu MenuChanger.EditUI(); }
public static void AddItem(string item, string location, bool showArea = true) { if (canvas == null) { Create(); } item = RandomizerMod.Instance.Settings.GetEffectiveItem(item); string itemName = LanguageStringManager.GetLanguageString(LogicManager.GetItemDef(item).nameKey, "UI"); string areaName = LogicManager.ShopNames.Contains(location) ? location.Replace('_', ' ') : RandoLogger.CleanAreaName(LogicManager.GetItemDef(location).areaName); string msg = showArea ? itemName + "\nfrom " + areaName : itemName; GameObject basePanel = CanvasUtil.CreateBasePanel(canvas, new CanvasUtil.RectData(new Vector2(200, 50), Vector2.zero, new Vector2(0.9f, 0.9f), new Vector2(0.9f, 0.9f))); string spriteKey = LogicManager.GetItemDef(item).shopSpriteKey; CanvasUtil.CreateImagePanel(basePanel, RandomizerMod.GetSprite(spriteKey), new CanvasUtil.RectData(new Vector2(50, 50), Vector2.zero, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f))); CanvasUtil.CreateTextPanel(basePanel, msg, 24, TextAnchor.MiddleLeft, new CanvasUtil.RectData(new Vector2(400, 100), Vector2.zero, new Vector2(1.2f, 0.5f), new Vector2(1.2f, 0.5f)), CanvasUtil.GetFont("Perpetua")); items.Enqueue(basePanel); if (items.Count > MaxItems) { Object.Destroy(items.Dequeue()); } UpdatePositions(); }
private static void ProcessRestrictions() { if (RandomizerMod.Instance.Settings.AllBosses || RandomizerMod.Instance.Settings.AllCharms || RandomizerMod.Instance.Settings.AllSkills) { // Close the door and get rid of Quirrel Ref.PD.openedBlackEggDoor = false; Ref.PD.quirrelLeftEggTemple = true; // Prevent the game from opening the door GameObject door = GameObject.Find("Final Boss Door"); PlayMakerFSM doorFSM = FSMUtility.LocateFSM(door, "Control"); doorFSM.SetState("Idle"); // The door is cosmetic, gotta get rid of the actual TransitionPoint too TransitionPoint doorTransitionPoint = door.GetComponentInChildren <TransitionPoint>(true); doorTransitionPoint.gameObject.SetActive(false); // Make Hornet appear GameObject hornet = GameObject.Find("Hornet Black Egg NPC"); hornet.SetActive(true); FsmState activeCheck = FSMUtility.LocateFSM(hornet, "Conversation Control").GetState("Active?"); activeCheck.RemoveActionsOfType <IntCompare>(); activeCheck.RemoveActionsOfType <PlayerDataBoolTest>(); // Reset Hornet dialog to default LanguageStringManager.ResetString(HORNET_SHEET, HORNET_DOOR_KEY); // Check dreamers if (!Ref.PD.lurienDefeated || !Ref.PD.monomonDefeated || !Ref.PD.hegemolDefeated) { LanguageStringManager.SetString(HORNET_SHEET, HORNET_DOOR_KEY, "What kind of idiot comes here without even killing the dreamers?"); return; } // Check all charms if (RandomizerMod.Instance.Settings.AllCharms) { Ref.PD.CountCharms(); if (Ref.PD.charmsOwned < 40) { LanguageStringManager.SetString(HORNET_SHEET, HORNET_DOOR_KEY, "What are you doing here? Go get the rest of the charms."); return; } if (Ref.PD.royalCharmState < 3) { LanguageStringManager.SetString(HORNET_SHEET, HORNET_DOOR_KEY, "Nice try, but half of a charm doesn't count. Go get the rest of the kingsoul."); return; } } // Check all skills if (RandomizerMod.Instance.Settings.AllSkills) { List <string> missingSkills = new List <string>(); foreach (KeyValuePair <string, string> kvp in Skills) { if (!Ref.PD.GetBool(kvp.Key)) { missingSkills.Add(kvp.Value); } } // These aren't as easy to check in a loop, so I'm just gonna check them manually if (Ref.PD.fireballLevel == 0) { missingSkills.Add("Vengeful Spirit"); } if (Ref.PD.fireballLevel < 2) { missingSkills.Add("Shade Soul"); } if (Ref.PD.quakeLevel == 0) { missingSkills.Add("Desolate Dive"); } if (Ref.PD.quakeLevel < 2) { missingSkills.Add("Descending Dark"); } if (Ref.PD.screamLevel == 0) { missingSkills.Add("Howling Wraiths"); } if (Ref.PD.screamLevel < 2) { missingSkills.Add("Abyss Shriek"); } if (missingSkills.Count > 0) { string hornetStr = "You are still missing "; for (int i = 0; i < missingSkills.Count; i++) { if (i != 0 && i == missingSkills.Count - 1) { hornetStr += " and "; } hornetStr += missingSkills[i]; if (i != missingSkills.Count - 1) { hornetStr += ", "; } } hornetStr += "."; LanguageStringManager.SetString(HORNET_SHEET, HORNET_DOOR_KEY, hornetStr); return; } } // Check all bosses if (RandomizerMod.Instance.Settings.AllBosses) { List <string> missingBosses = new List <string>(); foreach (KeyValuePair <string, string> kvp in Bosses) { if (!Ref.PD.GetBool(kvp.Key)) { missingBosses.Add(kvp.Value); } } // CG2 has no bool if (Ref.PD.killsMegaBeamMiner > 0) { missingBosses.Add("Crystal Guardian 2"); } if (missingBosses.Count > 0) { if (missingBosses.Count >= 10) { LanguageStringManager.SetString(HORNET_SHEET, HORNET_DOOR_KEY, $"You haven't killed {missingBosses.Count} bosses."); return; } string hornetStr = "You haven't killed "; for (int i = 0; i < missingBosses.Count; i++) { if (i != 0 && i == missingBosses.Count - 1) { hornetStr += " and "; } hornetStr += missingBosses[i]; if (i != missingBosses.Count - 1) { hornetStr += ", "; } } hornetStr += "."; LanguageStringManager.SetString(HORNET_SHEET, HORNET_DOOR_KEY, hornetStr); return; } if (Ref.PD.royalCharmState != 4) { LanguageStringManager.SetString(HORNET_SHEET, HORNET_DOOR_KEY, "You chose all bosses, go get void heart ya dip."); return; } } // All checks passed, time to open up Ref.PD.openedBlackEggDoor = true; doorFSM.SetState("Opened"); doorTransitionPoint.gameObject.SetActive(true); } }