protected static void AddLocalizedText(LevelFailedTextEffect levelFailedTextEffect) { bool wasActive = levelFailedTextEffect.gameObject.activeSelf; levelFailedTextEffect.gameObject.SetActive(false); RectTransform transform = (RectTransform)levelFailedTextEffect.transform; transform.sizeDelta = new Vector2(12, transform.sizeDelta.y); Transform textTransform = levelFailedTextEffect.transform.Find("Text"); if (!textTransform) { Plugin.Log.Error($"Could not find 'Text' transform on '{levelFailedTextEffect}'"); return; } TextMeshPro text = textTransform.GetComponent <TextMeshPro>(); text.fontStyle |= FontStyles.UpperCase; text.lineSpacing = -40; LocalizedTextMeshPro localizedText = textTransform.gameObject.AddComponent <LocalizedTextMeshPro>(); localizedText.SetField <LocalizedTextComponent <TextMeshPro>, TextMeshPro>("localizedComponent", text); localizedText.Key = "LEVEL_FAILED"; levelFailedTextEffect.gameObject.SetActive(wasActive); }
public void Show(Vector2 pos) { base.Show(); effectActor.ReadEffect(new Effect(activatedCard.cardAsset.effecttype)); Vector3 newposition = GameManager.instance.UICamera.ScreenToWorldPoint(new Vector3(pos.x, pos.y, GameManager.instance.UICamera.nearClipPlane)); Vector3 offsetPosition = Vector3.Scale(new Vector3(30, 10, 0), new Vector3(1, 1, 0)); newposition += offsetPosition; newposition.z = 0; this.transform.position = newposition; bool effectUsable = GameLogic.CanUseEffect(activatedCard.cardAsset.effecttype); buttonOk.gameObject.SetActive(effectUsable); LocalizedTextMeshPro locale = header.GetComponent <LocalizedTextMeshPro>(); if (effectUsable) { locale.SetLocalizationKey("questionActivate"); } else { locale.SetLocalizationKey("effectNotUsable"); } this.gameObject.SetActive(true); }