Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Assembly-UnityScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
- // Nickname_Controller
- using System;
- using System.Collections.Generic;
- using System.Runtime.CompilerServices;
- using UnityEngine;
- public class Nickname_Controller : MonoBehaviour
- {
- public static Nickname_Controller instance { get; private set; }
- [CompilerGenerated]
- private static Canvas canvas_0;
- [CompilerGenerated]
- private float float_0;
- public Dictionary<string, UTM_GradientData> gradients = new Dictionary<string, UTM_GradientData>();
- [CompilerGenerated]
- private float float_1;
- [CompilerGenerated]
- private RectTransform rectTransform_0;
- [CompilerGenerated]
- private UnionTextMesh unionTextMesh_0;
- [CompilerGenerated]
- private UnionTextMesh unionTextMesh_1;
- [CompilerGenerated]
- private string string_0;
- [CompilerGenerated]
- private float float_2;
- [CompilerGenerated]
- private float float_3;
- [CompilerGenerated]
- private Transform transform_0;
- [CompilerGenerated]
- private string string_1;
- [CompilerGenerated]
- private bool bool_0;
- [CompilerGenerated]
- private bool bool_1;
- [CompilerGenerated]
- private Camera camera_0;
- [CompilerGenerated]
- private Vector3 vector3_0;
- [CompilerGenerated]
- private Color color_0;
- [CompilerGenerated]
- private float float_4;
- [CompilerGenerated]
- private int int_0;
- [CompilerGenerated]
- private Gradient gradient_0;
- [CompilerGenerated]
- private GameObject gameObject_0;
- [CompilerGenerated]
- private bool bool_2;
- [CompilerGenerated]
- private bool bool_3;
- private readonly float float_5 = 1.4f;
- private readonly float float_6 = 1f;
- private static Canvas Canvas_0
- {
- [CompilerGenerated]
- get
- {
- return canvas_0;
- }
- [CompilerGenerated]
- set
- {
- canvas_0 = value;
- }
- }
- private float Single_0
- {
- [CompilerGenerated]
- get
- {
- return float_0;
- }
- [CompilerGenerated]
- set
- {
- float_0 = value;
- }
- }
- private float Single_1
- {
- [CompilerGenerated]
- get
- {
- return float_1;
- }
- [CompilerGenerated]
- set
- {
- float_1 = value;
- }
- }
- private RectTransform RectTransform_0
- {
- [CompilerGenerated]
- get
- {
- return rectTransform_0;
- }
- [CompilerGenerated]
- set
- {
- rectTransform_0 = value;
- }
- }
- private UnionTextMesh UnionTextMesh_0
- {
- [CompilerGenerated]
- get
- {
- return unionTextMesh_0;
- }
- [CompilerGenerated]
- set
- {
- unionTextMesh_0 = value;
- }
- }
- private UnionTextMesh UnionTextMesh_1
- {
- [CompilerGenerated]
- get
- {
- return unionTextMesh_1;
- }
- [CompilerGenerated]
- set
- {
- unionTextMesh_1 = value;
- }
- }
- private string String_0
- {
- [CompilerGenerated]
- get
- {
- return string_0;
- }
- [CompilerGenerated]
- set
- {
- string_0 = value;
- }
- }
- private float Single_2
- {
- [CompilerGenerated]
- get
- {
- return float_2;
- }
- [CompilerGenerated]
- set
- {
- float_2 = value;
- }
- }
- private float Single_3
- {
- [CompilerGenerated]
- get
- {
- return float_3;
- }
- [CompilerGenerated]
- set
- {
- float_3 = value;
- }
- }
- private Transform Transform_0
- {
- [CompilerGenerated]
- get
- {
- return transform_0;
- }
- [CompilerGenerated]
- set
- {
- transform_0 = value;
- }
- }
- private string String_1
- {
- [CompilerGenerated]
- get
- {
- return string_1;
- }
- [CompilerGenerated]
- set
- {
- string_1 = value;
- }
- }
- private bool Boolean_0
- {
- [CompilerGenerated]
- get
- {
- return bool_0;
- }
- [CompilerGenerated]
- set
- {
- bool_0 = value;
- }
- }
- private bool Boolean_1
- {
- [CompilerGenerated]
- get
- {
- return bool_1;
- }
- [CompilerGenerated]
- set
- {
- bool_1 = value;
- }
- }
- private Camera Camera_0
- {
- [CompilerGenerated]
- get
- {
- return camera_0;
- }
- [CompilerGenerated]
- set
- {
- camera_0 = value;
- }
- }
- private Vector3 Vector3_0
- {
- [CompilerGenerated]
- get
- {
- return vector3_0;
- }
- [CompilerGenerated]
- set
- {
- vector3_0 = value;
- }
- }
- private Color Color_0
- {
- [CompilerGenerated]
- get
- {
- return color_0;
- }
- [CompilerGenerated]
- set
- {
- color_0 = value;
- }
- }
- public float CycleTime
- {
- [CompilerGenerated]
- get
- {
- return float_4;
- }
- [CompilerGenerated]
- set
- {
- float_4 = value;
- }
- }
- private int Int32_0
- {
- [CompilerGenerated]
- get
- {
- return int_0;
- }
- [CompilerGenerated]
- set
- {
- int_0 = value;
- }
- }
- private Gradient Gradient_0
- {
- [CompilerGenerated]
- get
- {
- return gradient_0;
- }
- [CompilerGenerated]
- set
- {
- gradient_0 = value;
- }
- }
- private GameObject GameObject_0
- {
- [CompilerGenerated]
- get
- {
- return gameObject_0;
- }
- [CompilerGenerated]
- set
- {
- gameObject_0 = value;
- }
- }
- private bool Boolean_2
- {
- [CompilerGenerated]
- get
- {
- return bool_2;
- }
- [CompilerGenerated]
- set
- {
- bool_2 = value;
- }
- }
- private bool Boolean_3
- {
- [CompilerGenerated]
- get
- {
- return bool_3;
- }
- [CompilerGenerated]
- set
- {
- bool_3 = value;
- }
- }
- private bool Boolean_4
- {
- get
- {
- if (Gradient_0 != null)
- {
- return Int32_0 == 0;
- }
- return false;
- }
- }
- public static Nickname_Controller GetNewController()
- {
- if (CheckCanvas())
- {
- GameObject gameObject = new GameObject();
- gameObject.SetActive(value: false);
- RectTransform rectTransform = gameObject.AddComponent<RectTransform>();
- rectTransform.anchoredPosition = Vector2.zero;
- rectTransform.anchorMax = Vector2.zero;
- rectTransform.anchorMin = Vector2.zero;
- gameObject.transform.parent = Canvas_0.transform;
- Nickname_Controller nickname_Controller = gameObject.AddComponent<Nickname_Controller>();
- nickname_Controller.method_3();
- return nickname_Controller;
- }
- return null;
- }
- public static bool CheckCanvas()
- {
- if (Canvas_0 == null)
- {
- try
- {
- using (Class16 @class = new Class16(Bundles.BundleFolder + "\\data\\0567450c01ede42222eb77861798bac5.union"))
- {
- @class.method_3();
- Canvas_0 = UnityEngine.Object.Instantiate(@class.AssetBundle_0.LoadAsset<GameObject>("Nickname_Canvas")).GetComponent<Canvas>();
- Canvas_0.name = "NewNickname_Canvas";
- UnityEngine.Object.DontDestroyOnLoad(Canvas_0.gameObject);
- }
- GameObject gameObject = GameObject.Find("Nickname_Canvas");
- if (gameObject != null)
- {
- gameObject.SetActive(value: false);
- UnityEngine.Object.Destroy(gameObject.GetComponent<GUInames>());
- Canvas_0.gameObject.AddComponent<GUInames>();
- }
- }
- catch (Exception arg)
- {
- Debug.LogError($"[ERROR] Error to load canvas for nicknames. {arg}");
- return false;
- }
- }
- return true;
- }
- public void Start()
- {
- InitTextParams();
- Single_0 = 100f;
- Single_1 = Time.unscaledTime;
- }
- // Dictionary for assigning fonts based on title
- private static readonly Dictionary<string, string> TitleFonts = new Dictionary<string, string>
- {
- { "[Support Team]", "Angry" },
- { "[Moderation Assistant]", "Angry" },
- { "[Moderation Team]", "Angry" },
- { "[DJ]", "Angry" },
- { "[GAME FOUNDER]", "Facon" },
- { "[VIP]", "Mono45Headline-Light" }
- };
- // Default font for unlisted titles
- private const string DefaultTitleFont = "calibri";
- public void InitTextParams()
- {
- if (UnionTextMesh_1 == null) return;
- // ✅ Set Base Properties
- UnionTextMesh_1.color = Color.white;
- UnionTextMesh_1.size = 18;
- UnionTextMesh_1.quality = 32;
- // ✅ Apply Default Font First
- Font defaultFont = UTM_StaticData.Data.method_2();
- if (defaultFont != null)
- {
- UnionTextMesh_1.font = defaultFont;
- }
- if (UnionTextMesh_1.textMaterial.HasProperty("_ShadowDistance"))
- {
- UnionTextMesh_1.textMaterial.SetFloat("_ShadowDistance", 1.9f);
- }
- // ✅ Apply Title Effects & Find Font based on title text
- string titleFont = DefaultTitleFont;
- string text = UnionTextMesh_1.text;
- foreach (var entry in TitleFonts)
- {
- if (text.Contains(entry.Key))
- {
- titleFont = entry.Value;
- break;
- }
- }
- // ✅ Change Font if Exists in LoadedFonts (for title)
- if (FontManager.LoadedFonts.TryGetValue(titleFont, out UTMFontData selectedFontData))
- {
- UnionTextMesh_1.font = selectedFontData.font;
- Debug.Log($"[INFO] Applied title font: {selectedFontData.font.name} for {titleFont}");
- }
- else
- {
- Debug.LogWarning($"[WARNING] Font '{titleFont}' not found. Using default.");
- }
- // ✅ Apply text effects (color/negrita) según NickTypeTitle
- if (!string.IsNullOrEmpty(NickTypeTitle) || !string.IsNullOrEmpty(NickEffectTitle))
- {
- text = $"<c={NickTypeTitle}><b>{text}</b></c>";
- }
- else
- {
- text = "<b>" + text + "</b>";
- }
- // ✅ Apply additional text effects (jitter) según NickEffectTitle
- if (!string.IsNullOrEmpty(NickEffectTitle))
- {
- text = $"<j={NickEffectTitle}><b>{text}</b></j>";
- }
- else
- {
- text = "<b>" + text + "</b>";
- }
- // Nota: Se remueve el bloque que envolvía el texto con <f=...> ya que se quiere aplicar la fuente directamente
- // ✅ Aplica la fuente directamente si NickFontTitle está definido
- if (!string.IsNullOrEmpty(NickFontTitle))
- {
- if (FontManager.LoadedFonts.TryGetValue(NickFontTitle, out UTMFontData nickFontData))
- {
- UnionTextMesh_1.font = nickFontData.font;
- Debug.Log($"[INFO] Applied Nick font: {nickFontData.font.name}");
- }
- else
- {
- Debug.LogWarning($"[WARNING] Font '{NickFontTitle}' not found. Using default.");
- }
- }
- // ✅ Apply Text Only if Changed
- if (text != UnionTextMesh_1.text)
- {
- UnionTextMesh_1.text = text;
- UnionTextMesh_1.Rebuild();
- }
- method_2(); // Mantiene la lógica existente
- }
- private int method_0()
- {
- return settings.NickSize switch
- {
- 0 => 16,
- 1 => 20,
- 2 => 13,
- _ => 16,
- };
- }
- private int method_1()
- {
- return settings.NickSize switch
- {
- 0 => 11,
- 1 => 14,
- 2 => 9,
- _ => 11,
- };
- }
- public void method_2()
- {
- int num = -17;
- num = settings.NickSize switch
- {
- 0 => -17,
- 1 => -20,
- 2 => -13,
- _ => -17,
- };
- // Ajustar la posición del 'customTag' (UnionTextMesh_0) arriba
- int tagOffset = 35; // Puedes modificar este valor según la distancia que desees entre el customTag y el nickname
- UnionTextMesh_0.gameObject.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, num);
- // Ajustar la posición del 'nickname' (UnionTextMesh_1) debajo
- UnionTextMesh_1.gameObject.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, num + tagOffset);
- }
- private void method_3()
- {
- Boolean_0 = false;
- Single_3 = float_6;
- Single_2 = float_6;
- Color_0 = Color.white;
- GameObject_0 = new GameObject("NickName");
- GameObject_0.transform.parent = base.transform;
- GameObject_0.AddComponent<RectTransform>().anchoredPosition = Vector2.zero;
- RectTransform_0 = GetComponent<RectTransform>();
- method_4(GameObject_0);
- }
- private void method_4(GameObject gameObject_1)
- {
- if (UnionTextMesh_0 == null)
- {
- UnionTextMesh_0 = gameObject_1.AddComponent<UnionTextMesh>();
- UnionTextMesh_0.text = "";
- UnionTextMesh_0.anchor = TextAnchor.MiddleCenter;
- UnionTextMesh_0.alignment = UnionTextMesh.Alignment.Center;
- UnionTextMesh_0.verticalLimitMode = UnionTextMesh.VerticalLimitMode.Ignore;
- UnionTextMesh_0.uiWrap = false;
- UnionTextMesh_0.uiLimit = false;
- UnionTextMesh_0.removeEmoji = false;
- }
- }
- private void method_5(ref bool bool_4)
- {
- if (bool_4 && Transform_0.position.y < -5f)
- {
- bool_4 = false;
- }
- }
- private void method_6(ref bool bool_4)
- {
- if (!bool_4)
- {
- return;
- }
- if (Camera_0 == null)
- {
- Camera_0 = Camera.main;
- }
- if (!(Camera_0 != null))
- {
- bool_4 = false;
- return;
- }
- Vector3_0 = Camera_0.WorldToScreenPoint(Transform_0.position);
- if (Vector3_0.z < 0f)
- {
- bool_4 = false;
- }
- }
- public void FixedUpdate()
- {
- if (!(Time.unscaledTime > Single_1 + 0.3f))
- {
- return;
- }
- Single_1 = Time.unscaledTime;
- if (settings.NickSize > 2)
- {
- if (Camera_0 == null)
- {
- Camera_0 = Camera.main;
- }
- if (Camera_0 != null && Transform_0 != null)
- {
- Single_0 = Vector3.Distance(Camera_0.transform.position, Transform_0.transform.position);
- }
- }
- else if (Single_0 < 100f)
- {
- Single_0 = 100f;
- }
- }
- public void Update()
- {
- Color color = this.Color_0;
- bool flag = !settings.hideAllGui && this.UnionTextMesh_0 != null && settings.drops["names"] == 0;
- this.method_5(ref flag);
- this.method_6(ref flag);
- if (flag != this.UnionTextMesh_0.gameObject.activeSelf)
- {
- this.UnionTextMesh_0.gameObject.SetActive(flag);
- this.UnionTextMesh_1.gameObject.SetActive(flag);
- }
- if (!flag)
- {
- if (this.Single_2 != this.float_6)
- {
- this.Single_2 = this.float_6;
- this.Single_3 = this.Single_2;
- base.transform.localScale = Vector3.one * this.Single_2;
- }
- return;
- }
- this.RectTransform_0.anchoredPosition = new Vector2(this.Vector3_0.x, this.Vector3_0.y + this.method_8());
- bool bool_;
- if (bool_ = (GlobalGUI.OnNickname == this.String_1))
- {
- color = Color.white;
- this.Single_3 = this.float_5;
- }
- else
- {
- if (this.Boolean_4)
- {
- color = this.Gradient_0.Evaluate(1f / this.CycleTime * (Time.time % this.CycleTime));
- }
- this.Single_3 = this.method_7();
- }
- this.method_15(bool_);
- this.UnionTextMesh_0.color = color;
- if (this.Single_2 != this.Single_3)
- {
- this.Single_2 = Mathf.Lerp(this.Single_2, this.Single_3, Time.deltaTime * 10f);
- this.GameObject_0.transform.localScale = Vector3.one * this.Single_2;
- }
- }
- private float method_7()
- {
- if (settings.NickSize < 3)
- {
- return float_6;
- }
- if (Single_0 < 2f)
- {
- return float_6 * 1.2f;
- }
- if (Single_0 >= 5f)
- {
- if (Single_0 >= 10f)
- {
- if (Single_0 >= 20f)
- {
- if (Single_0 < 30f)
- {
- return float_6 * 0.8f;
- }
- if (Single_0 >= 50f)
- {
- if (settings.NickSize == 3)
- {
- return float_6 * 0.6f;
- }
- if (Single_0 < 75f)
- {
- return float_6 * 0.6f;
- }
- return 0f;
- }
- return float_6 * 0.7f;
- }
- return float_6 * 0.9f;
- }
- return float_6;
- }
- return float_6 * 1.1f;
- }
- private float method_8()
- {
- if (!(UnionTextMesh_1 == null) && !string.IsNullOrEmpty(UnionTextMesh_1.text))
- {
- float num = 15f;
- switch (settings.NickSize)
- {
- default:
- if (Single_0 >= 3f)
- {
- if (Single_0 >= 4f)
- {
- return num * 1f;
- }
- return num * 0.5f;
- }
- return num * 0f;
- case 0:
- return 15f;
- case 1:
- return 20f;
- case 2:
- return 10f;
- }
- }
- return 0f;
- }
- internal void method_9(string string_2)
- {
- String_1 = string_2;
- base.gameObject.name = string_2 + "_nickname";
- method_15();
- Boolean_3 = string_2 == Login.login;
- }
- internal void method_10(Transform transform_1)
- {
- Transform_0 = transform_1;
- }
- internal void method_11()
- {
- Boolean_0 = true;
- if (!base.gameObject.activeSelf)
- {
- base.gameObject.SetActive(value: true);
- }
- }
- internal void method_12()
- {
- Boolean_0 = false;
- if (base.gameObject.activeSelf)
- {
- base.gameObject.SetActive(value: false);
- }
- }
- public void OnLevelWasLoaded()
- {
- UnityEngine.Object.Destroy(base.gameObject);
- }
- internal void method_13(string string_2)
- {
- Boolean_1 = string_2 == "-";
- Color_0 = UnionUtils.ToColor(string_2);
- }
- internal void method_14(Gradient gradient_1, float float_7)
- {
- Gradient_0 = gradient_1;
- CycleTime = float_7;
- }
- // Default font if no specific font is assigned
- private const string DefaultFont = "Calibri";
- private void method_15(bool bool_4 = false)
- {
- if (!Boolean_0) return;
- // Obtener etiquetas de gradiente y jitter
- string gradientTag = (bool_4 || Int32_0 <= 0) ? "" : UTM_StaticData.GetGradientTag(Int32_0.ToString());
- string jitterTag = (bool_4 || Int32_0 <= 0) ? "" : UTM_StaticData.GetJitterTag(Int32_0.ToString());
- // Construir el texto base
- string text = gradientTag + jitterTag + String_1;
- // Aplicar efecto de color y negrita
- if (!string.IsNullOrEmpty(NickType))
- {
- text = $"<c={NickType}><b>{text}</b></c>";
- }
- else
- {
- text = "<b>" + text + "</b>";
- }
- // ✅ Apply text effects (color/negrita) según NickTypeTitle
- if (!string.IsNullOrEmpty(NickEffect))
- {
- text = $"<j={NickEffect}><b>{text}</b></j>";
- }
- else
- {
- text = "<b>" + text + "</b>";
- }
- // Aplicar tamaño de texto
- UnionTextMesh_0.size = 18;
- // Limpiar texto si es necesario
- if (Boolean_2)
- text = "";
- // Asignar y reconstruir el texto si ha cambiado
- if (text != UnionTextMesh_0.Text)
- {
- UnionTextMesh_0.Text = text;
- UnionTextMesh_0.Rebuild();
- }
- // Aplicar la fuente: si NickFont tiene valor y está en el bundle, se asigna directamente.
- if (!string.IsNullOrEmpty(NickFont))
- {
- if (FontManager.LoadedFonts.TryGetValue(NickFont, out UTMFontData nickFontData))
- {
- UnionTextMesh_0.font = nickFontData.font;
- Debug.Log($"[INFO] Applied Nick font: {nickFontData.font.name} for {NickFont}");
- }
- else
- {
- Debug.LogWarning($"[WARNING] Font '{NickFont}' not found in bundle. Using default.");
- }
- }
- else
- {
- // Si NickFont no está definido, se sigue la lógica anterior (por ejemplo, usar DefaultFont o UserFonts).
- string assignedFont = DefaultFont;
- if (FontManager.LoadedFonts.TryGetValue(assignedFont, out UTMFontData selectedFontData))
- {
- UnionTextMesh_0.font = selectedFontData.font;
- Debug.Log($"[INFO] Applied font: {selectedFontData.font.name} for {assignedFont}");
- }
- else
- {
- Debug.LogWarning($"[WARNING] Font '{assignedFont}' not found. Using default.");
- }
- }
- }
- internal void method_16(string customTag)
- {
- // Ensure our UnionTextMesh for the custom tag is created.
- if (UnionTextMesh_1 == null)
- {
- GameObject tagObj = new GameObject("SetCustomTag");
- tagObj.transform.parent = GameObject_0.transform;
- RectTransform rt = tagObj.AddComponent<RectTransform>();
- // Set position so that the custom tag appears above the nickname.
- rt.anchoredPosition = new Vector2(0f, 25f); // Adjust Y value as needed
- UnionTextMesh_1 = tagObj.AddComponent<UnionTextMesh>();
- unionTextMesh_1.color = Color.magenta;
- UnionTextMesh_1.text = "";
- UnionTextMesh_1.anchor = TextAnchor.MiddleCenter;
- UnionTextMesh_1.alignment = UnionTextMesh.Alignment.Center;
- UnionTextMesh_1.verticalLimitMode = UnionTextMesh.VerticalLimitMode.Ignore;
- UnionTextMesh_1.uiWrap = false;
- UnionTextMesh_1.uiLimit = false;
- UnionTextMesh_1.removeEmoji = false;
- // Make the custom tag text bigger than the nickname.
- UnionTextMesh_1.size = 30; // Increase by 4 units; tweak as needed.
- }
- // If the custom tag contains a dot and parses as numbers, use the old behavior.
- if (!string.IsNullOrEmpty(customTag) && customTag.Contains("."))
- {
- string[] parts = customTag.Split('.');
- if (parts.Length == 2 &&
- int.TryParse(parts[0], out int num1) &&
- int.TryParse(parts[1], out int num2))
- {
- UnionTextMesh_1.text = Class51.smethod_7(num1, num2);
- return;
- }
- }
- // Force the Pixel font for the title
- GetFont(5);
- // Apply wave effect and Pixel font to the custom tag text.
- UnionTextMesh_1.text = customTag;
- }
- private string NickType;
- private string NickFont;
- private string NickEffect;
- private string NickTypeTitle;
- private string NickFontTitle;
- private string NickEffectTitle;
- internal void SetNickType(string value)
- {
- NickType = value;
- }
- internal void SetNickFont(string value)
- {
- NickFont = value;
- }
- internal void SetNickEffect(string value)
- {
- NickEffect = value;
- }
- internal void SetNickFontTitle(string value)
- {
- NickFontTitle = value;
- }
- internal void SetNickTypeTitle(string value)
- {
- NickTypeTitle = value;
- }
- internal void SetNickEffectTitle(string value)
- {
- NickEffectTitle = value;
- }
- internal string GetFont(int int_1)
- {
- switch (int_1)
- {
- case 2:
- return "Blangkon";
- case 3:
- return "Caveat";
- case 4:
- return "CocoBiker";
- case 5:
- return "Pixel";
- case 6:
- return "Futura";
- default:
- return "";
- }
- }
- internal void method_18(int int_1)
- {
- Int32_0 = int_1;
- method_15();
- }
- internal void method_19(bool bool_4)
- {
- Boolean_2 = bool_4;
- method_15();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment