Guest User

Nickname_Controller

a guest
Feb 28th, 2025
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 26.47 KB | None | 0 0
  1. // Assembly-UnityScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
  2. // Nickname_Controller
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Runtime.CompilerServices;
  6. using UnityEngine;
  7.  
  8. public class Nickname_Controller : MonoBehaviour
  9. {
  10.  
  11.     public static Nickname_Controller instance { get; private set; }
  12.  
  13.     [CompilerGenerated]
  14.     private static Canvas canvas_0;
  15.  
  16.     [CompilerGenerated]
  17.     private float float_0;
  18.  
  19.     public Dictionary<string, UTM_GradientData> gradients = new Dictionary<string, UTM_GradientData>();
  20.  
  21.     [CompilerGenerated]
  22.     private float float_1;
  23.  
  24.     [CompilerGenerated]
  25.     private RectTransform rectTransform_0;
  26.  
  27.     [CompilerGenerated]
  28.     private UnionTextMesh unionTextMesh_0;
  29.  
  30.     [CompilerGenerated]
  31.     private UnionTextMesh unionTextMesh_1;
  32.  
  33.     [CompilerGenerated]
  34.     private string string_0;
  35.  
  36.     [CompilerGenerated]
  37.     private float float_2;
  38.  
  39.     [CompilerGenerated]
  40.     private float float_3;
  41.  
  42.     [CompilerGenerated]
  43.     private Transform transform_0;
  44.  
  45.     [CompilerGenerated]
  46.     private string string_1;
  47.  
  48.     [CompilerGenerated]
  49.     private bool bool_0;
  50.  
  51.     [CompilerGenerated]
  52.     private bool bool_1;
  53.  
  54.     [CompilerGenerated]
  55.     private Camera camera_0;
  56.  
  57.     [CompilerGenerated]
  58.     private Vector3 vector3_0;
  59.  
  60.     [CompilerGenerated]
  61.     private Color color_0;
  62.  
  63.     [CompilerGenerated]
  64.     private float float_4;
  65.  
  66.     [CompilerGenerated]
  67.     private int int_0;
  68.  
  69.     [CompilerGenerated]
  70.     private Gradient gradient_0;
  71.  
  72.     [CompilerGenerated]
  73.     private GameObject gameObject_0;
  74.  
  75.     [CompilerGenerated]
  76.     private bool bool_2;
  77.  
  78.     [CompilerGenerated]
  79.     private bool bool_3;
  80.  
  81.     private readonly float float_5 = 1.4f;
  82.  
  83.     private readonly float float_6 = 1f;
  84.  
  85.     private static Canvas Canvas_0
  86.     {
  87.         [CompilerGenerated]
  88.         get
  89.         {
  90.             return canvas_0;
  91.         }
  92.         [CompilerGenerated]
  93.         set
  94.         {
  95.             canvas_0 = value;
  96.         }
  97.     }
  98.  
  99.     private float Single_0
  100.     {
  101.         [CompilerGenerated]
  102.         get
  103.         {
  104.             return float_0;
  105.         }
  106.         [CompilerGenerated]
  107.         set
  108.         {
  109.             float_0 = value;
  110.         }
  111.     }
  112.  
  113.     private float Single_1
  114.     {
  115.         [CompilerGenerated]
  116.         get
  117.         {
  118.             return float_1;
  119.         }
  120.         [CompilerGenerated]
  121.         set
  122.         {
  123.             float_1 = value;
  124.         }
  125.     }
  126.  
  127.     private RectTransform RectTransform_0
  128.     {
  129.         [CompilerGenerated]
  130.         get
  131.         {
  132.             return rectTransform_0;
  133.         }
  134.         [CompilerGenerated]
  135.         set
  136.         {
  137.             rectTransform_0 = value;
  138.         }
  139.     }
  140.  
  141.     private UnionTextMesh UnionTextMesh_0
  142.     {
  143.         [CompilerGenerated]
  144.         get
  145.         {
  146.             return unionTextMesh_0;
  147.         }
  148.         [CompilerGenerated]
  149.         set
  150.         {
  151.             unionTextMesh_0 = value;
  152.         }
  153.     }
  154.  
  155.     private UnionTextMesh UnionTextMesh_1
  156.     {
  157.         [CompilerGenerated]
  158.         get
  159.         {
  160.             return unionTextMesh_1;
  161.         }
  162.         [CompilerGenerated]
  163.         set
  164.         {
  165.             unionTextMesh_1 = value;
  166.         }
  167.     }
  168.  
  169.     private string String_0
  170.     {
  171.         [CompilerGenerated]
  172.         get
  173.         {
  174.             return string_0;
  175.         }
  176.         [CompilerGenerated]
  177.         set
  178.         {
  179.             string_0 = value;
  180.         }
  181.     }
  182.  
  183.     private float Single_2
  184.     {
  185.         [CompilerGenerated]
  186.         get
  187.         {
  188.             return float_2;
  189.         }
  190.         [CompilerGenerated]
  191.         set
  192.         {
  193.             float_2 = value;
  194.         }
  195.     }
  196.  
  197.     private float Single_3
  198.     {
  199.         [CompilerGenerated]
  200.         get
  201.         {
  202.             return float_3;
  203.         }
  204.         [CompilerGenerated]
  205.         set
  206.         {
  207.             float_3 = value;
  208.         }
  209.     }
  210.  
  211.     private Transform Transform_0
  212.     {
  213.         [CompilerGenerated]
  214.         get
  215.         {
  216.             return transform_0;
  217.         }
  218.         [CompilerGenerated]
  219.         set
  220.         {
  221.             transform_0 = value;
  222.         }
  223.     }
  224.  
  225.     private string String_1
  226.     {
  227.         [CompilerGenerated]
  228.         get
  229.         {
  230.             return string_1;
  231.         }
  232.         [CompilerGenerated]
  233.         set
  234.         {
  235.             string_1 = value;
  236.         }
  237.     }
  238.  
  239.     private bool Boolean_0
  240.     {
  241.         [CompilerGenerated]
  242.         get
  243.         {
  244.             return bool_0;
  245.         }
  246.         [CompilerGenerated]
  247.         set
  248.         {
  249.             bool_0 = value;
  250.         }
  251.     }
  252.  
  253.     private bool Boolean_1
  254.     {
  255.         [CompilerGenerated]
  256.         get
  257.         {
  258.             return bool_1;
  259.         }
  260.         [CompilerGenerated]
  261.         set
  262.         {
  263.             bool_1 = value;
  264.         }
  265.     }
  266.  
  267.     private Camera Camera_0
  268.     {
  269.         [CompilerGenerated]
  270.         get
  271.         {
  272.             return camera_0;
  273.         }
  274.         [CompilerGenerated]
  275.         set
  276.         {
  277.             camera_0 = value;
  278.         }
  279.     }
  280.  
  281.     private Vector3 Vector3_0
  282.     {
  283.         [CompilerGenerated]
  284.         get
  285.         {
  286.             return vector3_0;
  287.         }
  288.         [CompilerGenerated]
  289.         set
  290.         {
  291.             vector3_0 = value;
  292.         }
  293.     }
  294.  
  295.     private Color Color_0
  296.     {
  297.         [CompilerGenerated]
  298.         get
  299.         {
  300.             return color_0;
  301.         }
  302.         [CompilerGenerated]
  303.         set
  304.         {
  305.             color_0 = value;
  306.         }
  307.     }
  308.  
  309.     public float CycleTime
  310.     {
  311.         [CompilerGenerated]
  312.         get
  313.         {
  314.             return float_4;
  315.         }
  316.         [CompilerGenerated]
  317.         set
  318.         {
  319.             float_4 = value;
  320.         }
  321.     }
  322.  
  323.     private int Int32_0
  324.     {
  325.         [CompilerGenerated]
  326.         get
  327.         {
  328.             return int_0;
  329.         }
  330.         [CompilerGenerated]
  331.         set
  332.         {
  333.             int_0 = value;
  334.         }
  335.     }
  336.  
  337.     private Gradient Gradient_0
  338.     {
  339.         [CompilerGenerated]
  340.         get
  341.         {
  342.             return gradient_0;
  343.         }
  344.         [CompilerGenerated]
  345.         set
  346.         {
  347.             gradient_0 = value;
  348.         }
  349.     }
  350.  
  351.     private GameObject GameObject_0
  352.     {
  353.         [CompilerGenerated]
  354.         get
  355.         {
  356.             return gameObject_0;
  357.         }
  358.         [CompilerGenerated]
  359.         set
  360.         {
  361.             gameObject_0 = value;
  362.         }
  363.     }
  364.  
  365.     private bool Boolean_2
  366.     {
  367.         [CompilerGenerated]
  368.         get
  369.         {
  370.             return bool_2;
  371.         }
  372.         [CompilerGenerated]
  373.         set
  374.         {
  375.             bool_2 = value;
  376.         }
  377.     }
  378.  
  379.     private bool Boolean_3
  380.     {
  381.         [CompilerGenerated]
  382.         get
  383.         {
  384.             return bool_3;
  385.         }
  386.         [CompilerGenerated]
  387.         set
  388.         {
  389.             bool_3 = value;
  390.         }
  391.     }
  392.  
  393.     private bool Boolean_4
  394.     {
  395.         get
  396.         {
  397.             if (Gradient_0 != null)
  398.             {
  399.                 return Int32_0 == 0;
  400.             }
  401.             return false;
  402.         }
  403.     }
  404.  
  405.     public static Nickname_Controller GetNewController()
  406.     {
  407.         if (CheckCanvas())
  408.         {
  409.             GameObject gameObject = new GameObject();
  410.             gameObject.SetActive(value: false);
  411.             RectTransform rectTransform = gameObject.AddComponent<RectTransform>();
  412.             rectTransform.anchoredPosition = Vector2.zero;
  413.             rectTransform.anchorMax = Vector2.zero;
  414.             rectTransform.anchorMin = Vector2.zero;
  415.             gameObject.transform.parent = Canvas_0.transform;
  416.             Nickname_Controller nickname_Controller = gameObject.AddComponent<Nickname_Controller>();
  417.             nickname_Controller.method_3();
  418.             return nickname_Controller;
  419.         }
  420.         return null;
  421.     }
  422.  
  423.     public static bool CheckCanvas()
  424.     {
  425.         if (Canvas_0 == null)
  426.         {
  427.             try
  428.             {
  429.                 using (Class16 @class = new Class16(Bundles.BundleFolder + "\\data\\0567450c01ede42222eb77861798bac5.union"))
  430.                 {
  431.                     @class.method_3();
  432.                     Canvas_0 = UnityEngine.Object.Instantiate(@class.AssetBundle_0.LoadAsset<GameObject>("Nickname_Canvas")).GetComponent<Canvas>();
  433.                     Canvas_0.name = "NewNickname_Canvas";
  434.                     UnityEngine.Object.DontDestroyOnLoad(Canvas_0.gameObject);
  435.                 }
  436.                 GameObject gameObject = GameObject.Find("Nickname_Canvas");
  437.                 if (gameObject != null)
  438.                 {
  439.                     gameObject.SetActive(value: false);
  440.                     UnityEngine.Object.Destroy(gameObject.GetComponent<GUInames>());
  441.                     Canvas_0.gameObject.AddComponent<GUInames>();
  442.                 }
  443.             }
  444.             catch (Exception arg)
  445.             {
  446.                 Debug.LogError($"[ERROR] Error to load canvas for nicknames. {arg}");
  447.                 return false;
  448.             }
  449.         }
  450.         return true;
  451.     }
  452.  
  453.     public void Start()
  454.     {
  455.         InitTextParams();
  456.         Single_0 = 100f;
  457.         Single_1 = Time.unscaledTime;
  458.     }
  459.  
  460.     // Dictionary for assigning fonts based on title
  461.     private static readonly Dictionary<string, string> TitleFonts = new Dictionary<string, string>
  462. {
  463.     { "[Support Team]", "Angry" },
  464.     { "[Moderation Assistant]", "Angry" },
  465.     { "[Moderation Team]", "Angry" },
  466.     { "[DJ]", "Angry" },
  467.     { "[GAME FOUNDER]", "Facon" },
  468.     { "[VIP]", "Mono45Headline-Light" }
  469. };
  470.  
  471.     // Default font for unlisted titles
  472.     private const string DefaultTitleFont = "calibri";
  473.  
  474.     public void InitTextParams()
  475.     {
  476.         if (UnionTextMesh_1 == null) return;
  477.  
  478.         // ✅ Set Base Properties
  479.         UnionTextMesh_1.color = Color.white;
  480.         UnionTextMesh_1.size = 18;
  481.         UnionTextMesh_1.quality = 32;
  482.  
  483.         // ✅ Apply Default Font First
  484.         Font defaultFont = UTM_StaticData.Data.method_2();
  485.         if (defaultFont != null)
  486.         {
  487.             UnionTextMesh_1.font = defaultFont;
  488.         }
  489.  
  490.         if (UnionTextMesh_1.textMaterial.HasProperty("_ShadowDistance"))
  491.         {
  492.             UnionTextMesh_1.textMaterial.SetFloat("_ShadowDistance", 1.9f);
  493.         }
  494.  
  495.         // ✅ Apply Title Effects & Find Font based on title text
  496.         string titleFont = DefaultTitleFont;
  497.         string text = UnionTextMesh_1.text;
  498.  
  499.         foreach (var entry in TitleFonts)
  500.         {
  501.             if (text.Contains(entry.Key))
  502.             {
  503.                 titleFont = entry.Value;
  504.                 break;
  505.             }
  506.         }
  507.  
  508.         // ✅ Change Font if Exists in LoadedFonts (for title)
  509.         if (FontManager.LoadedFonts.TryGetValue(titleFont, out UTMFontData selectedFontData))
  510.         {
  511.             UnionTextMesh_1.font = selectedFontData.font;
  512.             Debug.Log($"[INFO] Applied title font: {selectedFontData.font.name} for {titleFont}");
  513.         }
  514.         else
  515.         {
  516.             Debug.LogWarning($"[WARNING] Font '{titleFont}' not found. Using default.");
  517.         }
  518.  
  519.         // ✅ Apply text effects (color/negrita) según NickTypeTitle
  520.         if (!string.IsNullOrEmpty(NickTypeTitle) || !string.IsNullOrEmpty(NickEffectTitle))
  521.         {
  522.             text = $"<c={NickTypeTitle}><b>{text}</b></c>";
  523.         }
  524.         else
  525.         {
  526.             text = "<b>" + text + "</b>";
  527.         }
  528.  
  529.         // ✅ Apply additional text effects (jitter) según NickEffectTitle
  530.         if (!string.IsNullOrEmpty(NickEffectTitle))
  531.         {
  532.             text = $"<j={NickEffectTitle}><b>{text}</b></j>";
  533.         }
  534.         else
  535.         {
  536.             text = "<b>" + text + "</b>";
  537.         }
  538.  
  539.         // Nota: Se remueve el bloque que envolvía el texto con <f=...> ya que se quiere aplicar la fuente directamente
  540.  
  541.         // ✅ Aplica la fuente directamente si NickFontTitle está definido
  542.         if (!string.IsNullOrEmpty(NickFontTitle))
  543.         {
  544.             if (FontManager.LoadedFonts.TryGetValue(NickFontTitle, out UTMFontData nickFontData))
  545.             {
  546.                 UnionTextMesh_1.font = nickFontData.font;
  547.                 Debug.Log($"[INFO] Applied Nick font: {nickFontData.font.name}");
  548.             }
  549.             else
  550.             {
  551.                 Debug.LogWarning($"[WARNING] Font '{NickFontTitle}' not found. Using default.");
  552.             }
  553.         }
  554.  
  555.         // ✅ Apply Text Only if Changed
  556.         if (text != UnionTextMesh_1.text)
  557.         {
  558.             UnionTextMesh_1.text = text;
  559.             UnionTextMesh_1.Rebuild();
  560.         }
  561.  
  562.         method_2(); // Mantiene la lógica existente
  563.     }
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.     private int method_0()
  571.     {
  572.         return settings.NickSize switch
  573.         {
  574.             0 => 16,
  575.             1 => 20,
  576.             2 => 13,
  577.             _ => 16,
  578.         };
  579.     }
  580.  
  581.     private int method_1()
  582.     {
  583.         return settings.NickSize switch
  584.         {
  585.             0 => 11,
  586.             1 => 14,
  587.             2 => 9,
  588.             _ => 11,
  589.         };
  590.     }
  591.  
  592.     public void method_2()
  593.     {
  594.         int num = -17;
  595.         num = settings.NickSize switch
  596.         {
  597.             0 => -17,
  598.             1 => -20,
  599.             2 => -13,
  600.             _ => -17,
  601.         };
  602.  
  603.         // Ajustar la posición del 'customTag' (UnionTextMesh_0) arriba
  604.         int tagOffset = 35;  // Puedes modificar este valor según la distancia que desees entre el customTag y el nickname
  605.         UnionTextMesh_0.gameObject.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, num);
  606.  
  607.         // Ajustar la posición del 'nickname' (UnionTextMesh_1) debajo
  608.         UnionTextMesh_1.gameObject.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, num + tagOffset);
  609.  
  610.     }
  611.  
  612.  
  613.     private void method_3()
  614.     {
  615.         Boolean_0 = false;
  616.         Single_3 = float_6;
  617.         Single_2 = float_6;
  618.         Color_0 = Color.white;
  619.         GameObject_0 = new GameObject("NickName");
  620.         GameObject_0.transform.parent = base.transform;
  621.         GameObject_0.AddComponent<RectTransform>().anchoredPosition = Vector2.zero;
  622.         RectTransform_0 = GetComponent<RectTransform>();
  623.         method_4(GameObject_0);
  624.     }
  625.  
  626.     private void method_4(GameObject gameObject_1)
  627.     {
  628.         if (UnionTextMesh_0 == null)
  629.         {
  630.             UnionTextMesh_0 = gameObject_1.AddComponent<UnionTextMesh>();
  631.  
  632.  
  633.             UnionTextMesh_0.text = "";
  634.  
  635.             UnionTextMesh_0.anchor = TextAnchor.MiddleCenter;
  636.             UnionTextMesh_0.alignment = UnionTextMesh.Alignment.Center;
  637.             UnionTextMesh_0.verticalLimitMode = UnionTextMesh.VerticalLimitMode.Ignore;
  638.             UnionTextMesh_0.uiWrap = false;
  639.             UnionTextMesh_0.uiLimit = false;
  640.             UnionTextMesh_0.removeEmoji = false;
  641.         }
  642.     }
  643.  
  644.     private void method_5(ref bool bool_4)
  645.     {
  646.         if (bool_4 && Transform_0.position.y < -5f)
  647.         {
  648.             bool_4 = false;
  649.         }
  650.     }
  651.  
  652.     private void method_6(ref bool bool_4)
  653.     {
  654.         if (!bool_4)
  655.         {
  656.             return;
  657.         }
  658.         if (Camera_0 == null)
  659.         {
  660.             Camera_0 = Camera.main;
  661.         }
  662.         if (!(Camera_0 != null))
  663.         {
  664.             bool_4 = false;
  665.             return;
  666.         }
  667.         Vector3_0 = Camera_0.WorldToScreenPoint(Transform_0.position);
  668.         if (Vector3_0.z < 0f)
  669.         {
  670.             bool_4 = false;
  671.         }
  672.     }
  673.  
  674.     public void FixedUpdate()
  675.     {
  676.         if (!(Time.unscaledTime > Single_1 + 0.3f))
  677.         {
  678.             return;
  679.         }
  680.         Single_1 = Time.unscaledTime;
  681.         if (settings.NickSize > 2)
  682.         {
  683.             if (Camera_0 == null)
  684.             {
  685.                 Camera_0 = Camera.main;
  686.             }
  687.             if (Camera_0 != null && Transform_0 != null)
  688.             {
  689.                 Single_0 = Vector3.Distance(Camera_0.transform.position, Transform_0.transform.position);
  690.             }
  691.         }
  692.         else if (Single_0 < 100f)
  693.         {
  694.             Single_0 = 100f;
  695.         }
  696.     }
  697.  
  698.     public void Update()
  699.     {
  700.         Color color = this.Color_0;
  701.         bool flag = !settings.hideAllGui && this.UnionTextMesh_0 != null && settings.drops["names"] == 0;
  702.         this.method_5(ref flag);
  703.         this.method_6(ref flag);
  704.         if (flag != this.UnionTextMesh_0.gameObject.activeSelf)
  705.         {
  706.             this.UnionTextMesh_0.gameObject.SetActive(flag);
  707.             this.UnionTextMesh_1.gameObject.SetActive(flag);
  708.         }
  709.         if (!flag)
  710.         {
  711.             if (this.Single_2 != this.float_6)
  712.             {
  713.                 this.Single_2 = this.float_6;
  714.                 this.Single_3 = this.Single_2;
  715.                 base.transform.localScale = Vector3.one * this.Single_2;
  716.             }
  717.             return;
  718.         }
  719.         this.RectTransform_0.anchoredPosition = new Vector2(this.Vector3_0.x, this.Vector3_0.y + this.method_8());
  720.         bool bool_;
  721.         if (bool_ = (GlobalGUI.OnNickname == this.String_1))
  722.         {
  723.             color = Color.white;
  724.             this.Single_3 = this.float_5;
  725.         }
  726.         else
  727.         {
  728.             if (this.Boolean_4)
  729.             {
  730.                 color = this.Gradient_0.Evaluate(1f / this.CycleTime * (Time.time % this.CycleTime));
  731.             }
  732.             this.Single_3 = this.method_7();
  733.         }
  734.         this.method_15(bool_);
  735.         this.UnionTextMesh_0.color = color;
  736.         if (this.Single_2 != this.Single_3)
  737.         {
  738.             this.Single_2 = Mathf.Lerp(this.Single_2, this.Single_3, Time.deltaTime * 10f);
  739.             this.GameObject_0.transform.localScale = Vector3.one * this.Single_2;
  740.         }
  741.  
  742.     }
  743.  
  744.     private float method_7()
  745.     {
  746.         if (settings.NickSize < 3)
  747.         {
  748.             return float_6;
  749.         }
  750.         if (Single_0 < 2f)
  751.         {
  752.             return float_6 * 1.2f;
  753.         }
  754.         if (Single_0 >= 5f)
  755.         {
  756.             if (Single_0 >= 10f)
  757.             {
  758.                 if (Single_0 >= 20f)
  759.                 {
  760.                     if (Single_0 < 30f)
  761.                     {
  762.                         return float_6 * 0.8f;
  763.                     }
  764.                     if (Single_0 >= 50f)
  765.                     {
  766.                         if (settings.NickSize == 3)
  767.                         {
  768.                             return float_6 * 0.6f;
  769.                         }
  770.                         if (Single_0 < 75f)
  771.                         {
  772.                             return float_6 * 0.6f;
  773.                         }
  774.                         return 0f;
  775.                     }
  776.                     return float_6 * 0.7f;
  777.                 }
  778.                 return float_6 * 0.9f;
  779.             }
  780.             return float_6;
  781.         }
  782.         return float_6 * 1.1f;
  783.     }
  784.  
  785.     private float method_8()
  786.     {
  787.         if (!(UnionTextMesh_1 == null) && !string.IsNullOrEmpty(UnionTextMesh_1.text))
  788.         {
  789.             float num = 15f;
  790.             switch (settings.NickSize)
  791.             {
  792.                 default:
  793.                     if (Single_0 >= 3f)
  794.                     {
  795.                         if (Single_0 >= 4f)
  796.                         {
  797.                             return num * 1f;
  798.                         }
  799.                         return num * 0.5f;
  800.                     }
  801.                     return num * 0f;
  802.                 case 0:
  803.                     return 15f;
  804.                 case 1:
  805.                     return 20f;
  806.                 case 2:
  807.                     return 10f;
  808.             }
  809.         }
  810.         return 0f;
  811.     }
  812.  
  813.     internal void method_9(string string_2)
  814.     {
  815.         String_1 = string_2;
  816.         base.gameObject.name = string_2 + "_nickname";
  817.         method_15();
  818.         Boolean_3 = string_2 == Login.login;
  819.     }
  820.  
  821.     internal void method_10(Transform transform_1)
  822.     {
  823.         Transform_0 = transform_1;
  824.     }
  825.  
  826.     internal void method_11()
  827.     {
  828.         Boolean_0 = true;
  829.         if (!base.gameObject.activeSelf)
  830.         {
  831.             base.gameObject.SetActive(value: true);
  832.         }
  833.     }
  834.  
  835.     internal void method_12()
  836.     {
  837.         Boolean_0 = false;
  838.         if (base.gameObject.activeSelf)
  839.         {
  840.             base.gameObject.SetActive(value: false);
  841.         }
  842.     }
  843.  
  844.     public void OnLevelWasLoaded()
  845.     {
  846.         UnityEngine.Object.Destroy(base.gameObject);
  847.     }
  848.  
  849.     internal void method_13(string string_2)
  850.     {
  851.         Boolean_1 = string_2 == "-";
  852.         Color_0 = UnionUtils.ToColor(string_2);
  853.     }
  854.  
  855.     internal void method_14(Gradient gradient_1, float float_7)
  856.     {
  857.         Gradient_0 = gradient_1;
  858.         CycleTime = float_7;
  859.     }
  860.  
  861.  
  862.  
  863.     // Default font if no specific font is assigned
  864.     private const string DefaultFont = "Calibri";
  865.  
  866.     private void method_15(bool bool_4 = false)
  867.     {
  868.         if (!Boolean_0) return;
  869.  
  870.         // Obtener etiquetas de gradiente y jitter
  871.         string gradientTag = (bool_4 || Int32_0 <= 0) ? "" : UTM_StaticData.GetGradientTag(Int32_0.ToString());
  872.         string jitterTag = (bool_4 || Int32_0 <= 0) ? "" : UTM_StaticData.GetJitterTag(Int32_0.ToString());
  873.  
  874.         // Construir el texto base
  875.         string text = gradientTag + jitterTag + String_1;
  876.  
  877.         // Aplicar efecto de color y negrita
  878.         if (!string.IsNullOrEmpty(NickType))
  879.         {
  880.             text = $"<c={NickType}><b>{text}</b></c>";
  881.         }
  882.         else
  883.         {
  884.             text = "<b>" + text + "</b>";
  885.         }
  886.  
  887.         // ✅ Apply text effects (color/negrita) según NickTypeTitle
  888.         if (!string.IsNullOrEmpty(NickEffect))
  889.         {
  890.             text = $"<j={NickEffect}><b>{text}</b></j>";
  891.         }
  892.         else
  893.         {
  894.             text = "<b>" + text + "</b>";
  895.         }
  896.  
  897.         // Aplicar tamaño de texto
  898.         UnionTextMesh_0.size = 18;
  899.  
  900.         // Limpiar texto si es necesario
  901.         if (Boolean_2)
  902.             text = "";
  903.  
  904.         // Asignar y reconstruir el texto si ha cambiado
  905.         if (text != UnionTextMesh_0.Text)
  906.         {
  907.             UnionTextMesh_0.Text = text;
  908.             UnionTextMesh_0.Rebuild();
  909.         }
  910.  
  911.         // Aplicar la fuente: si NickFont tiene valor y está en el bundle, se asigna directamente.
  912.         if (!string.IsNullOrEmpty(NickFont))
  913.         {
  914.             if (FontManager.LoadedFonts.TryGetValue(NickFont, out UTMFontData nickFontData))
  915.             {
  916.                 UnionTextMesh_0.font = nickFontData.font;
  917.                 Debug.Log($"[INFO] Applied Nick font: {nickFontData.font.name} for {NickFont}");
  918.             }
  919.             else
  920.             {
  921.                 Debug.LogWarning($"[WARNING] Font '{NickFont}' not found in bundle. Using default.");
  922.             }
  923.         }
  924.         else
  925.         {
  926.             // Si NickFont no está definido, se sigue la lógica anterior (por ejemplo, usar DefaultFont o UserFonts).
  927.             string assignedFont = DefaultFont;
  928.  
  929.             if (FontManager.LoadedFonts.TryGetValue(assignedFont, out UTMFontData selectedFontData))
  930.             {
  931.                 UnionTextMesh_0.font = selectedFontData.font;
  932.                 Debug.Log($"[INFO] Applied font: {selectedFontData.font.name} for {assignedFont}");
  933.             }
  934.             else
  935.             {
  936.                 Debug.LogWarning($"[WARNING] Font '{assignedFont}' not found. Using default.");
  937.             }
  938.         }
  939.     }
  940.  
  941.  
  942.  
  943.  
  944.     internal void method_16(string customTag)
  945.     {
  946.         // Ensure our UnionTextMesh for the custom tag is created.
  947.         if (UnionTextMesh_1 == null)
  948.         {
  949.             GameObject tagObj = new GameObject("SetCustomTag");
  950.             tagObj.transform.parent = GameObject_0.transform;
  951.             RectTransform rt = tagObj.AddComponent<RectTransform>();
  952.  
  953.             // Set position so that the custom tag appears above the nickname.
  954.             rt.anchoredPosition = new Vector2(0f, 25f); // Adjust Y value as needed
  955.  
  956.             UnionTextMesh_1 = tagObj.AddComponent<UnionTextMesh>();
  957.             unionTextMesh_1.color = Color.magenta;
  958.             UnionTextMesh_1.text = "";
  959.             UnionTextMesh_1.anchor = TextAnchor.MiddleCenter;
  960.             UnionTextMesh_1.alignment = UnionTextMesh.Alignment.Center;
  961.             UnionTextMesh_1.verticalLimitMode = UnionTextMesh.VerticalLimitMode.Ignore;
  962.             UnionTextMesh_1.uiWrap = false;
  963.             UnionTextMesh_1.uiLimit = false;
  964.             UnionTextMesh_1.removeEmoji = false;
  965.  
  966.  
  967.             // Make the custom tag text bigger than the nickname.
  968.             UnionTextMesh_1.size = 30; // Increase by 4 units; tweak as needed.
  969.         }
  970.  
  971.         // If the custom tag contains a dot and parses as numbers, use the old behavior.
  972.         if (!string.IsNullOrEmpty(customTag) && customTag.Contains("."))
  973.         {
  974.             string[] parts = customTag.Split('.');
  975.             if (parts.Length == 2 &&
  976.                 int.TryParse(parts[0], out int num1) &&
  977.                 int.TryParse(parts[1], out int num2))
  978.             {
  979.                 UnionTextMesh_1.text = Class51.smethod_7(num1, num2);
  980.                 return;
  981.             }
  982.         }
  983.  
  984.         // Force the Pixel font for the title
  985.         GetFont(5);
  986.  
  987.         // Apply wave effect and Pixel font to the custom tag text.
  988.         UnionTextMesh_1.text = customTag;
  989.     }
  990.  
  991.     private string NickType;
  992.     private string NickFont;
  993.     private string NickEffect;
  994.     private string NickTypeTitle;
  995.     private string NickFontTitle;
  996.     private string NickEffectTitle;
  997.     internal void SetNickType(string value)
  998.     {
  999.         NickType = value;
  1000.     }
  1001.  
  1002.     internal void SetNickFont(string value)
  1003.     {
  1004.         NickFont = value;
  1005.     }
  1006.  
  1007.     internal void SetNickEffect(string value)
  1008.     {
  1009.         NickEffect = value;
  1010.     }
  1011.     internal void SetNickFontTitle(string value)
  1012.     {
  1013.         NickFontTitle = value;
  1014.     }
  1015.     internal void SetNickTypeTitle(string value)
  1016.     {
  1017.         NickTypeTitle = value;
  1018.     }
  1019.     internal void SetNickEffectTitle(string value)
  1020.     {
  1021.         NickEffectTitle = value;
  1022.     }
  1023.  
  1024.     internal string GetFont(int int_1)
  1025.     {
  1026.         switch (int_1)
  1027.         {
  1028.             case 2:
  1029.                 return "Blangkon";
  1030.             case 3:
  1031.                 return "Caveat";
  1032.             case 4:
  1033.                 return "CocoBiker";
  1034.             case 5:
  1035.                 return "Pixel";
  1036.             case 6:
  1037.                 return "Futura";
  1038.             default:
  1039.                 return "";
  1040.         }
  1041.     }
  1042.  
  1043.     internal void method_18(int int_1)
  1044.     {
  1045.         Int32_0 = int_1;
  1046.         method_15();
  1047.     }
  1048.  
  1049.     internal void method_19(bool bool_4)
  1050.     {
  1051.         Boolean_2 = bool_4;
  1052.         method_15();
  1053.     }
  1054. }
  1055.  
  1056.  
Advertisement
Add Comment
Please, Sign In to add comment