Ejemplo n.º 1
0
        internal void BuffIcon_Awake(On.RoR2.UI.BuffIcon.orig_Awake orig, RoR2.UI.BuffIcon self)
        {
            orig(self);
            if (self.transform.parent.name == "BuffDisplayRoot")
            {
                if (mod.config.BuffTooltips.Value)
                {
                    UnityEngine.UI.GraphicRaycaster raycaster = self.transform.parent.GetComponent <UnityEngine.UI.GraphicRaycaster>();
                    if (raycaster == null)
                    {
                        self.transform.parent.gameObject.AddComponent <UnityEngine.UI.GraphicRaycaster>();
                    }
                    self.gameObject.AddComponent <RoR2.UI.TooltipProvider>();
                }
                if (mod.config.BuffTimers.Value)
                {
                    GameObject                TimerText     = new GameObject("TimerText");
                    RectTransform             timerRect     = TimerText.AddComponent <RectTransform>();
                    RoR2.UI.HGTextMeshProUGUI timerTextMesh = TimerText.AddComponent <RoR2.UI.HGTextMeshProUGUI>();
                    TimerText.transform.SetParent(self.transform);

                    timerTextMesh.enableWordWrapping = false;
                    timerTextMesh.alignment          = mod.config.BuffTimersTextAlignmentOption;
                    timerTextMesh.fontSize           = mod.config.BuffTimersFontSize.Value;
                    timerTextMesh.faceColor          = Color.white;
                    timerTextMesh.text = "";

                    timerRect.localPosition    = Vector3.zero;
                    timerRect.anchorMin        = new Vector2(1, 0);
                    timerRect.anchorMax        = new Vector2(1, 0);
                    timerRect.localScale       = Vector3.one;
                    timerRect.sizeDelta        = new Vector2(48, 48);
                    timerRect.anchoredPosition = new Vector2(-24, 24);
                }
            }
        }
Ejemplo n.º 2
0
 private void BuffIcon_Awake(On.RoR2.UI.BuffIcon.orig_Awake orig, BuffIcon self)
 {
     orig(self);
     self.gameObject.AddComponent <GraphicRaycaster>();
     self.gameObject.AddComponent <TooltipProvider>();
 }
Ejemplo n.º 3
0
 private void BuffIcon_Awake(On.RoR2.UI.BuffIcon.orig_Awake orig, BuffIcon self)
 {
     orig(self);
     var tooltipProvider = self.gameObject.AddComponent <TooltipProvider>();
 }