Пример #1
0
        private void OnGUI()
        {
            if (null == centeredGUIStyle)
            {
                centeredGUIStyle = new GUIStyle("box");
                centeredGUIStyle.normal.textColor = Color.red;
                centeredGUIStyle.alignment        = TextAnchor.MiddleCenter;
                centeredGUIStyle.fontSize         = 16;
            }
            if (!input || !(bWrnFileExists || bWrnInvalidName))
            {
                return;
            }


            centeredGUIStyle.normal.textColor = bWrnFileExists ? Color.yellow : Color.red;
            GUI.Box(CVSPUIUtils.RectTransformToRect(input.transform as RectTransform), bWrnFileExists ? wrnFileExists : wrnInvalidName, centeredGUIStyle);
        }
 private void OnGUI()
 {
     if (showLabel && labelItem)
     {
         var style = CVSPPresetSelector.centeredGUIStyle;
         if (style == null)
         {
             return;
         }
         style.normal.textColor = Color.white;
         var r = CVSPUIUtils.RectTransformToRect(labelItem.transform as RectTransform, getARectAboveTransform: true);
         r.x               -= 40 - r.width / 2;
         r.width            = 80;
         labelRect.size     = Vector2.Lerp(labelRect.size, r.size, 0.25f);
         labelRect.position = (labelRect.position - r.position).sqrMagnitude > 40000f ? r.position : Vector2.Lerp(labelRect.position, r.position, 0.25f);
         GUI.Box(labelRect, labelInfo.name, style);
     }
 }