예제 #1
0
        /// <summary>
        /// Setup the buff view from these fields.
        /// </summary>
        /// <param name="name">Name of the buff</param>
        /// <param name="duration">Duration of the buff</param>
        /// <param name="icon">Icon of the buff</param>
        /// <param name="color">Color of the text</param>
        /// <param name="body">Tooltip description of the buff</param>
        public void Setup(
            string name,
            string duration,
            Sprite icon,
            Color color,
            string body
            )
        {
            nameText.text     = name;
            durationText.text = duration;
            image.sprite      = icon;
            nameText.color    = color;

            Tip.Setup(new TooltipBundle(icon, name, body));
        }
예제 #2
0
 public static void ShowTip(string msg = "", int seconds = 2)
 {
     if (mTip == null)
     {
         GameObject canvas = GameObject.Find("Canvas");
         mTip = canvas.transform.Find("Tip").GetComponent <Tip>();
     }
     if (mTip == null)
     {
         Debug.LogError("mTip is null");
         return;
     }
     mTip.gameObject.SetActive(true);
     mTip.Setup(msg, seconds);
 }
예제 #3
0
 /// <summary>
 /// Setups the specified negative color.
 /// </summary>
 /// <param name="negativeColor">Color of the negative.</param>
 /// <param name="fillColor">Color of the fill.</param>
 /// <param name="sprite">The sprite.</param>
 /// <param name="barText">The bar text.</param>
 /// <param name="numerator">The numerator.</param>
 /// <param name="denominator">The denominator.</param>
 /// <param name="title">The title.</param>
 /// <param name="typeDescription">The type description.</param>
 public void Setup(
     Color negativeColor,
     Color fillColor,
     Sprite sprite,
     string barText,
     int numerator,
     int denominator,
     string title,
     string typeDescription)
 {
     emptyBar.color      = negativeColor;
     fillBar.color       = fillColor;
     resourceIcon.sprite = sprite;
     text.text           = barText;
     SetBarScale(numerator, denominator);
     tip.Setup(new TooltipBundle(sprite, title, string.Format("Current: {0}\nMaximum: {1}\n\n{2}", numerator, denominator, typeDescription)));
 }