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 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(); }