mirror of
https://github.com/DCFApixels/Unity-DebugX.git
synced 2025-09-19 02:24:36 +08:00
fix text background
This commit is contained in:
parent
a4269ac7f5
commit
c267b9401c
@ -51,8 +51,6 @@ namespace DCFApixels
|
|||||||
}
|
}
|
||||||
public void Render_UnityGizmos(Camera camera, GizmosList<TextGizmo> list)
|
public void Render_UnityGizmos(Camera camera, GizmosList<TextGizmo> list)
|
||||||
{
|
{
|
||||||
//return;
|
|
||||||
//#if UNITY_EDITOR
|
|
||||||
if (Event.current.type != EventType.Repaint) { return; }
|
if (Event.current.type != EventType.Repaint) { return; }
|
||||||
Color dfColor = GUI.color;
|
Color dfColor = GUI.color;
|
||||||
|
|
||||||
@ -92,7 +90,9 @@ namespace DCFApixels
|
|||||||
GUI.color = c;
|
GUI.color = c;
|
||||||
//GUI.DrawTexture(rect, _whiteTexture);
|
//GUI.DrawTexture(rect, _whiteTexture);
|
||||||
|
|
||||||
//Graphics.DrawTexture(rect, EditorGUIUtility.whiteTexture);
|
var mat = DebugXAssets.Materials.Unlit;
|
||||||
|
mat.SetColor(ColorPropertyID, c);
|
||||||
|
Graphics.DrawTexture(rect, _whiteTexture, mat);
|
||||||
//Graphics.DrawTexture(screenRect, EditorGUIUtility.whiteTexture, screenRect, 0, 0, 0, 0);
|
//Graphics.DrawTexture(screenRect, EditorGUIUtility.whiteTexture, screenRect, 0, 0, 0, 0);
|
||||||
|
|
||||||
GUI.color = item.Color * GlobalColor;
|
GUI.color = item.Color * GlobalColor;
|
||||||
@ -101,9 +101,8 @@ namespace DCFApixels
|
|||||||
GL.PopMatrix();
|
GL.PopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Handles.EndGUI();
|
|
||||||
GUI.color = dfColor;
|
GUI.color = dfColor;
|
||||||
//#endif
|
DebugXAssets.Materials.Unlit.SetColor(ColorPropertyID, Color.white);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -157,7 +156,6 @@ namespace DCFApixels
|
|||||||
rect.y -= rect.height;
|
rect.y -= rect.height;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return style.padding.Add(rect);
|
return style.padding.Add(rect);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -167,7 +165,6 @@ namespace DCFApixels
|
|||||||
{
|
{
|
||||||
if (_labelStyle == null || _labelDummy == null || _whiteTexture == null)
|
if (_labelStyle == null || _labelDummy == null || _whiteTexture == null)
|
||||||
{
|
{
|
||||||
|
|
||||||
GUIStyleState GenerateGUIStyleState()
|
GUIStyleState GenerateGUIStyleState()
|
||||||
{
|
{
|
||||||
var result = new GUIStyleState();
|
var result = new GUIStyleState();
|
||||||
@ -175,24 +172,21 @@ namespace DCFApixels
|
|||||||
result.background = null;
|
result.background = null;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
GUISkin skin = (GUISkin)typeof(GUI).GetField("s_Skin", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).GetValue(null); //GUI.s_Skin
|
GUISkin skin = (GUISkin)typeof(GUI).GetField("s_Skin", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).GetValue(null); //GUI.s_Skin
|
||||||
//GUISkin skin = GUI.skin;
|
//GUISkin skin = GUI.skin;
|
||||||
_labelStyle = new GUIStyle(skin.label)
|
_labelStyle = new GUIStyle(skin.label)
|
||||||
{
|
{
|
||||||
richText = false,
|
richText = false,
|
||||||
padding = new RectOffset(0, 0, 3, 3),
|
padding = new RectOffset(1, 1, 1, 1),
|
||||||
margin = new RectOffset(4, 4, 4, 4),
|
margin = new RectOffset(0, 0, 0, 0),
|
||||||
normal = GenerateGUIStyleState(),
|
normal = GenerateGUIStyleState(),
|
||||||
active = GenerateGUIStyleState(),
|
active = GenerateGUIStyleState(),
|
||||||
hover = GenerateGUIStyleState(),
|
hover = GenerateGUIStyleState(),
|
||||||
focused = GenerateGUIStyleState(),
|
focused = GenerateGUIStyleState(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
_labelDummy = new GUIContent();
|
_labelDummy = new GUIContent();
|
||||||
|
|
||||||
|
|
||||||
_whiteTexture = new Texture2D(2, 2);
|
_whiteTexture = new Texture2D(2, 2);
|
||||||
Color32[] color = new Color32[]
|
Color32[] color = new Color32[]
|
||||||
{
|
{
|
||||||
@ -201,10 +195,8 @@ namespace DCFApixels
|
|||||||
new Color32(255,255,255,255),
|
new Color32(255,255,255,255),
|
||||||
new Color32(255,255,255,255),
|
new Color32(255,255,255,255),
|
||||||
};
|
};
|
||||||
for (int i = 0; i < 4; i++)
|
|
||||||
{
|
|
||||||
_whiteTexture.SetPixels32(color);
|
_whiteTexture.SetPixels32(color);
|
||||||
}
|
_whiteTexture.Apply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static float GetCameraZoom(Camera camera)
|
private static float GetCameraZoom(Camera camera)
|
||||||
|
Loading…
Reference in New Issue
Block a user