Skip to content

Commit 4968f49

Browse files
committed
[同步]1. 同步主框架内容。最后版本时间 2025-04-11 20:14
提交版本 23c157f04ea351542fbc025310a140b61589be06
1 parent 32f987b commit 4968f49

25 files changed

+1657
-1515
lines changed

Editor/DisplayObjectEditor.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ void _onEditorAppUpdate()
3131

3232
public override void OnInspectorGUI()
3333
{
34-
DisplayObject obj = (target as DisplayObjectInfo).displayObject;
34+
DisplayObject obj = (target as DisplayObjectInfo)?.displayObject;
3535
if (obj == null)
36+
{
3637
return;
38+
}
3739

3840
EditorGUILayout.LabelField(obj.GetType().Name + ": " + obj.id, (GUIStyle)"OL Title");
3941
EditorGUILayout.Separator();
@@ -65,6 +67,11 @@ public override void OnInspectorGUI()
6567
EditorGUILayout.EndHorizontal();
6668
}
6769

70+
EditorGUI.BeginChangeCheck();
71+
name = EditorGUILayout.TextField("Name", gObj.name);
72+
if (EditorGUI.EndChangeCheck())
73+
gObj.name = name;
74+
6875
if (gObj.parent != null)
6976
{
7077
string[] options = new string[gObj.parent.numChildren];
@@ -146,8 +153,8 @@ public override void OnInspectorGUI()
146153
var colorProperty = objType.GetProperty("color");
147154
if (colorProperty != null)
148155
{
149-
Color color = (Color)colorProperty.GetValue(gObj);
150156
EditorGUI.BeginChangeCheck();
157+
Color color = (Color)colorProperty.GetValue(gObj);
151158
color = EditorGUILayout.ColorField("Color", color);
152159
if (EditorGUI.EndChangeCheck())
153160
{
@@ -173,6 +180,7 @@ public override void OnInspectorGUI()
173180
gObj.draggable = draggable;
174181
}
175182

183+
#if UNITY_2019_1_OR_NEWER
176184
TextFormat textFormat = null;
177185
if (gObj is GTextField gTxt)
178186
{
@@ -260,7 +268,7 @@ public override void OnInspectorGUI()
260268

261269
for (var i = 0; i < ctl.pageCount; i++)
262270
{
263-
var btnName = i + ": " + ctl.GetPageName(i);
271+
var btnName = ctl.GetPageId(i) + ": " + ctl.GetPageName(i);
264272
var btnStyle = new GUIStyle("ButtonMid");
265273
if (ctl.selectedIndex == i)
266274
{
@@ -333,6 +341,7 @@ public override void OnInspectorGUI()
333341
EditorGUILayout.EndHorizontal();
334342
EditorGUI.EndDisabledGroup();
335343
}
344+
#endif
336345
}
337346
}
338347
}
Lines changed: 151 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -1,154 +1,151 @@
1-
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
2-
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
3-
4-
Shader "FairyGUI/BMFont"
5-
{
6-
Properties
7-
{
8-
_MainTex ("Base (RGB), Alpha (A)", 2D) = "black" {}
9-
10-
_StencilComp ("Stencil Comparison", Float) = 8
11-
_Stencil ("Stencil ID", Float) = 0
12-
_StencilOp ("Stencil Operation", Float) = 0
13-
_StencilWriteMask ("Stencil Write Mask", Float) = 255
14-
_StencilReadMask ("Stencil Read Mask", Float) = 255
15-
16-
_ColorMask ("Color Mask", Float) = 15
17-
18-
_BlendSrcFactor ("Blend SrcFactor", Float) = 5
19-
_BlendDstFactor ("Blend DstFactor", Float) = 10
20-
}
21-
22-
SubShader
23-
{
24-
LOD 100
25-
26-
Tags
27-
{
28-
"Queue" = "Transparent"
29-
"IgnoreProjector" = "True"
30-
"RenderType" = "Transparent"
31-
}
32-
33-
Stencil
34-
{
35-
Ref [_Stencil]
36-
Comp [_StencilComp]
37-
Pass [_StencilOp]
38-
ReadMask [_StencilReadMask]
39-
WriteMask [_StencilWriteMask]
40-
}
41-
42-
Cull Off
43-
Lighting Off
44-
ZWrite Off
45-
Fog { Mode Off }
46-
Blend [_BlendSrcFactor] [_BlendDstFactor]
47-
ColorMask [_ColorMask]
48-
49-
Pass
50-
{
51-
CGPROGRAM
52-
#pragma multi_compile NOT_GRAYED GRAYED
53-
#pragma multi_compile NOT_CLIPPED CLIPPED SOFT_CLIPPED
54-
#pragma vertex vert
55-
#pragma fragment frag
56-
#pragma exclude_renderers d3d9 opengl flash
57-
58-
#include "UnityCG.cginc"
59-
60-
struct appdata_t
61-
{
62-
float4 vertex : POSITION;
63-
fixed4 color : COLOR;
64-
float4 texcoord : TEXCOORD0;
65-
};
66-
67-
struct v2f
68-
{
69-
float4 vertex : SV_POSITION;
70-
fixed4 color : COLOR;
71-
float4 texcoord : TEXCOORD0;
72-
73-
#ifdef CLIPPED
74-
float2 clipPos : TEXCOORD1;
75-
#endif
76-
77-
#ifdef SOFT_CLIPPED
78-
float2 clipPos : TEXCOORD1;
79-
#endif
80-
};
81-
82-
sampler2D _MainTex;
83-
84-
CBUFFER_START(UnityPerMaterial)
85-
#ifdef CLIPPED
86-
float4 _ClipBox = float4(-2, -2, 0, 0);
87-
#endif
88-
89-
#ifdef SOFT_CLIPPED
90-
float4 _ClipBox = float4(-2, -2, 0, 0);
91-
float4 _ClipSoftness = float4(0, 0, 0, 0);
92-
#endif
93-
CBUFFER_END
94-
95-
v2f vert (appdata_t v)
96-
{
97-
v2f o;
98-
o.vertex = UnityObjectToClipPos(v.vertex);
99-
o.texcoord = v.texcoord;
100-
#if !defined(UNITY_COLORSPACE_GAMMA) && (UNITY_VERSION >= 550)
101-
o.color.rgb = GammaToLinearSpace(v.color.rgb);
102-
o.color.a = v.color.a;
103-
#else
104-
o.color = v.color;
105-
#endif
106-
107-
#ifdef CLIPPED
108-
o.clipPos = mul(unity_ObjectToWorld, v.vertex).xy * _ClipBox.zw + _ClipBox.xy;
109-
#endif
110-
111-
#ifdef SOFT_CLIPPED
112-
o.clipPos = mul(unity_ObjectToWorld, v.vertex).xy * _ClipBox.zw + _ClipBox.xy;
113-
#endif
114-
115-
return o;
116-
}
117-
118-
fixed4 frag (v2f i) : SV_Target
119-
{
120-
fixed4 col = i.color;
121-
fixed4 tcol = tex2D(_MainTex, i.texcoord);
122-
col.a *= tcol[i.texcoord.z];//z stores channel
123-
124-
#ifdef GRAYED
125-
fixed grey = dot(col.rgb, fixed3(0.299, 0.587, 0.114));
126-
col.rgb = fixed3(grey, grey, grey);
127-
#endif
128-
129-
#ifdef SOFT_CLIPPED
130-
float2 factor = float2(0,0);
131-
if(i.clipPos.x<0)
132-
factor.x = (1.0-abs(i.clipPos.x)) * _ClipSoftness.x;
133-
else
134-
factor.x = (1.0-i.clipPos.x) * _ClipSoftness.z;
135-
if(i.clipPos.y<0)
136-
factor.y = (1.0-abs(i.clipPos.y)) * _ClipSoftness.w;
137-
else
138-
factor.y = (1.0-i.clipPos.y) * _ClipSoftness.y;
139-
col.a *= clamp(min(factor.x, factor.y), 0.0, 1.0);
140-
#endif
141-
142-
#ifdef CLIPPED
143-
float2 factor = abs(i.clipPos);
144-
col.a *= step(max(factor.x, factor.y), 1);
145-
#endif
146-
147-
return col;
148-
}
149-
ENDCG
150-
}
151-
}
152-
153-
Fallback "FairyGUI/Text"
154-
}
1+
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
2+
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
3+
4+
Shader "FairyGUI/BMFont"
5+
{
6+
Properties
7+
{
8+
_MainTex ("Base (RGB), Alpha (A)", 2D) = "black" {}
9+
10+
_StencilComp ("Stencil Comparison", Float) = 8
11+
_Stencil ("Stencil ID", Float) = 0
12+
_StencilOp ("Stencil Operation", Float) = 0
13+
_StencilWriteMask ("Stencil Write Mask", Float) = 255
14+
_StencilReadMask ("Stencil Read Mask", Float) = 255
15+
16+
_ColorMask ("Color Mask", Float) = 15
17+
18+
_BlendSrcFactor ("Blend SrcFactor", Float) = 5
19+
_BlendDstFactor ("Blend DstFactor", Float) = 10
20+
}
21+
22+
SubShader
23+
{
24+
LOD 100
25+
26+
Tags
27+
{
28+
"Queue" = "Transparent"
29+
"IgnoreProjector" = "True"
30+
"RenderType" = "Transparent"
31+
}
32+
33+
Stencil
34+
{
35+
Ref [_Stencil]
36+
Comp [_StencilComp]
37+
Pass [_StencilOp]
38+
ReadMask [_StencilReadMask]
39+
WriteMask [_StencilWriteMask]
40+
}
41+
42+
Cull Off
43+
Lighting Off
44+
ZWrite Off
45+
Fog
46+
{
47+
Mode Off
48+
}
49+
Blend [_BlendSrcFactor] [_BlendDstFactor]
50+
ColorMask [_ColorMask]
51+
52+
Pass
53+
{
54+
CGPROGRAM
55+
#pragma multi_compile _ GRAYED
56+
#pragma multi_compile _ CLIPPED SOFT_CLIPPED
57+
#pragma vertex vert
58+
#pragma fragment frag
59+
#pragma exclude_renderers d3d9 opengl flash
60+
61+
#include "UnityCG.cginc"
62+
63+
struct appdata_t
64+
{
65+
float4 vertex : POSITION;
66+
fixed4 color : COLOR;
67+
float4 texcoord : TEXCOORD0;
68+
};
69+
70+
struct v2f
71+
{
72+
float4 vertex : SV_POSITION;
73+
fixed4 color : COLOR;
74+
float4 texcoord : TEXCOORD0;
75+
76+
#ifdef CLIPPED
77+
float2 clipPos : TEXCOORD1;
78+
#endif
79+
80+
#ifdef SOFT_CLIPPED
81+
float2 clipPos : TEXCOORD1;
82+
#endif
83+
};
84+
85+
sampler2D _MainTex;
86+
87+
CBUFFER_START(UnityPerMaterial)
88+
#ifdef CLIPPED
89+
float4 _ClipBox = float4(-2, -2, 0, 0);
90+
#endif
91+
92+
#ifdef SOFT_CLIPPED
93+
float4 _ClipBox = float4(-2, -2, 0, 0);
94+
float4 _ClipSoftness = float4(0, 0, 0, 0);
95+
#endif
96+
CBUFFER_END
97+
98+
v2f vert(appdata_t v)
99+
{
100+
v2f o;
101+
o.vertex = UnityObjectToClipPos(v.vertex);
102+
o.texcoord = v.texcoord;
103+
#if !defined(UNITY_COLORSPACE_GAMMA) && (UNITY_VERSION >= 550)
104+
o.color.rgb = GammaToLinearSpace(v.color.rgb);
105+
o.color.a = v.color.a;
106+
#else
107+
o.color = v.color;
108+
#endif
109+
110+
#ifdef CLIPPED
111+
o.clipPos = mul(unity_ObjectToWorld, v.vertex).xy * _ClipBox.zw + _ClipBox.xy;
112+
#endif
113+
114+
#ifdef SOFT_CLIPPED
115+
o.clipPos = mul(unity_ObjectToWorld, v.vertex).xy * _ClipBox.zw + _ClipBox.xy;
116+
#endif
117+
118+
return o;
119+
}
120+
121+
fixed4 frag(v2f i) : SV_Target
122+
{
123+
fixed4 col = i.color;
124+
fixed4 tcol = tex2D(_MainTex, i.texcoord);
125+
col.a *= tcol[i.texcoord.z]; //z stores channel
126+
127+
#ifdef GRAYED
128+
fixed grey = dot(col.rgb, fixed3(0.299, 0.587, 0.114));
129+
col.rgb = fixed3(grey, grey, grey);
130+
#endif
131+
132+
#ifdef SOFT_CLIPPED
133+
float2 factor;
134+
float2 condition = step(i.clipPos.xy, 0);
135+
float4 clip_softness = _ClipSoftness * float4(condition, 1 - condition);
136+
factor.xy = (1.0 - abs(i.clipPos.xy)) * (clip_softness.xw + clip_softness.zy);
137+
col.a *= clamp(min(factor.x, factor.y), 0.0, 1.0);
138+
#endif
139+
#ifdef CLIPPED
140+
float2 factor = abs(i.clipPos);
141+
col.a *= step(max(factor.x, factor.y), 1);
142+
#endif
143+
144+
return col;
145+
}
146+
ENDCG
147+
}
148+
}
149+
150+
//Fallback "FairyGUI/Text"
151+
}

0 commit comments

Comments
 (0)