├── .gitignore
├── README.md
├── ShaderGUI_Ex.Shader
├── ShaderGUI_Ex.cs
├── ShaderGUI_Ex.gif
├── ShaderGUI_Ex_V02.Shader
├── V0.2
├── ShaderGUI_Ex.cs
├── ShaderGUI_Ex.shader
└── V0.2.png
└── V3.0
└── ShaderGUI_Extend.cs
/.gitignore:
--------------------------------------------------------------------------------
1 | /[Ll]ibrary/
2 | /[Tt]emp/
3 | /[Oo]bj/
4 | /[Bb]uild/
5 | /[Bb]uilds/
6 | /Assets/AssetStoreTools*
7 |
8 | # Visual Studio 2015 cache directory
9 | /.vs/
10 |
11 | # Autogenerated VS/MD/Consulo solution and project files
12 | ExportedObj/
13 | .consulo/
14 | *.csproj
15 | *.unityproj
16 | *.sln
17 | *.suo
18 | *.tmp
19 | *.user
20 | *.userprefs
21 | *.pidb
22 | *.booproj
23 | *.svd
24 | *.pdb
25 |
26 | # Unity3D generated meta files
27 | *.pidb.meta
28 |
29 | # Unity3D Generated File On Crash Reports
30 | sysinfo.txt
31 |
32 | # Builds
33 | *.apk
34 | *.unitypackage
35 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ShaderGUI_Ex-
2 | 简易的shaderGUI,快捷方便的优点下带来的弊端是功能不够Editor强大
3 | 
4 |
5 | V0.2版本新增
6 | 
7 |
--------------------------------------------------------------------------------
/ShaderGUI_Ex.Shader:
--------------------------------------------------------------------------------
1 | Shader "Unlit/ShaderGUI_Ex"
2 | {
3 | Properties
4 | {
5 | _SlideToggle("Slider Toggle",Range(0,2)) = 1
6 | [Toggle] _A("A",float) = 1
7 | [Toggle] _B("B",float) = 1
8 | ////----
9 | //[ShowProperty(_A_ON)] _MainTex1("(ShowProperty)A可开启显示", 2D) = "white" {}
10 | //[ShowProperty(_A_ON,_B_ON)] _MainTex2("(ShowProperty)A与B可开启显示", 2D) = "white" {}
11 | ////----
12 | //[HideProperty(_A_ON)] _MainTex3("(HideProperty)A可关闭显示", 2D) = "white" {}
13 | //[HideProperty(_A_ON,_B_ON)] _MainTex4("(HideProperty)A与B可关闭显示", 2D) = "white" {}
14 | ////----
15 | //[ShowToggle(_A_ON)]_C("(ShowToggle)A可开启显示",float) = 1
16 | //[ShowToggle(_A_ON,_B_ON)]_D("(ShowToggle)A与B可开启显示",float) = 1
17 | ////----
18 | //[ShowSlider(_A_ON)] _Slider1("(ShowSlider)A可开启显示",Range(0,4)) = 1
19 | //[ShowSlider(_A_ON,_B_ON)] _Slider2("(ShowSlider)A与B可开启显示",Range(0,4)) = 1
20 | ////----
21 | //[ShowIntRange(_A_ON)]_Slider3("(ShowSlider)A可开启显示",Range(0,4)) = 1
22 | //[ShowIntRange(_A_ON,_B_ON)]_Slider4("(ShowSlider)A与B可开启显示",Range(0,4)) = 1
23 | ////----
24 | //[ShowSpace(_A_ON,10)] _Float1("(ShowSpace)A可开启显示",float) = 1
25 | //[ShowSpace(_A_ON,_B_ON,10)] _Float2("(ShowSpace)A与B可开启显示",float) = 1
26 | ////----
27 | //[ShowHeader(_A_ON,Only English)]_Test1("(ShowHeader)A可开启显示",color) = (1,1,1,1)
28 | //[ShowHeader(_A_ON,_B_ON,Only English)]_Test2("(ShowHeader)A与B可开启显示",color) = (1,1,1,1)
29 | ////----参数中的1没有实际的意义,任何数值都可以,只是作为分隔符使用
30 | //[ShowKeywordEnum(_A_ON,1, None, Add, Multiply,a,b,c,d,e,f,g)] _KeywordTest1("(ShowKeywordEnum)A可开启显示", Float) = 0
31 | //[ShowKeywordEnum(_A_ON,_B_ON,1, None, Add, Multiply,a,b,c,d,e,f,g)] _KeywordTest2("(ShowKeywordEnum)A与B可开启显示", Float) = 0
32 | ////----
33 | //[ShowEnum(_A_ON,UnityEngine.Rendering.BlendMode)] _Blend1("Blend1", Float) = 1
34 | //[ShowEnum(_A_ON,UnityEngine.Rendering.CullMode)] _Blend2("Blend2", Float) = 1
35 | //[ShowEnum(_A_ON,UnityEngine.Rendering.CompareFunction)] _Blend3("Blend3", Float) = 1
36 | //[ShowEnum(_A_ON,_B_ON,UnityEngine.Rendering.BlendMode)] _Blend4("Blend4", Float) = 1
37 | //[ShowEnum(_A_ON,_B_ON,UnityEngine.Rendering.CullMode)] _Blend5("Blend5", Float) = 1
38 | //[ShowEnum(_A_ON,_B_ON,UnityEngine.Rendering.CompareFunction)] _Blend6("Blend6", Float) = 1
39 | //[ShowEnum(_A_ON,One,1,SrcAlpha,5)] _Blend7("Blend7", Float) = 1
40 | //[ShowEnum(_A_ON,_B_ON,One,1,SrcAlpha,5,AAAA,7)] _Blend8("Blend8", Float) = 1
41 | [ShowBasedProperty(_SlideToggle,0.5)]_Based1("Base1",Color) = (1,1,1,1)
42 |
43 |
44 | }
45 | SubShader
46 | {
47 | Tags { "RenderType"="Opaque" }
48 | LOD 100
49 |
50 | Pass
51 | {
52 | CGPROGRAM
53 | #pragma vertex vert
54 | #pragma fragment frag
55 | #pragma shader_feature _A_ON
56 | #pragma shader_feature _B_ON
57 | #include "UnityCG.cginc"
58 |
59 | struct appdata
60 | {
61 | float4 vertex : POSITION;
62 | };
63 |
64 | struct v2f
65 | {
66 | float4 vertex : SV_POSITION;
67 | };
68 |
69 | sampler2D _MainTex;
70 | float4 _MainTex_ST;
71 |
72 | v2f vert (appdata v)
73 | {
74 | v2f o;
75 | o.vertex = UnityObjectToClipPos(v.vertex);
76 | return o;
77 | }
78 |
79 | fixed4 frag (v2f i) : SV_Target
80 | {
81 | return 1;
82 | }
83 | ENDCG
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/ShaderGUI_Ex.cs:
--------------------------------------------------------------------------------
1 | #if UNITY_EDITOR
2 | using UnityEngine;
3 | using UnityEditor;
4 | using System.Collections.Generic;
5 | using System;
6 |
7 | ///根据keyword的开关去控制该属性的显示和隐藏,keyword都是ON,则开启GUI显示
8 | /*-------------------Shader中的例子-----------------------------
9 | [Toggle] _A("A",float) = 1
10 | [Toggle] _B("B",float) = 1
11 | [ShowProperty(_A_ON,_B_ON)] _Show("Show Property",float) = 1
12 | ---------------------------------------------------------------*/
13 | public class ShowPropertyDrawer : MaterialPropertyDrawer
14 | {
15 | string[] _propertyNameArr;
16 | bool _condition;
17 | public ShowPropertyDrawer(string n1)
18 | {
19 | _propertyNameArr = new string[] { n1 };
20 | }
21 | public ShowPropertyDrawer(string n1, string n2)
22 | {
23 | _propertyNameArr = new string[] { n1, n2 };
24 | }
25 | public ShowPropertyDrawer(string n1, string n2, string n3)
26 | {
27 | _propertyNameArr = new string[] { n1, n2, n3 };
28 | }
29 | public ShowPropertyDrawer(string n1, string n2, string n3, string n4)
30 | {
31 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
32 | }
33 |
34 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
35 | {
36 | _condition = false;
37 | if (_propertyNameArr.Length == 0)
38 | {
39 | editor.DefaultShaderProperty(prop, label);
40 | return;
41 | }
42 | for (int i = 0; i < editor.targets.Length; i++)
43 | {
44 | Material mat = editor.targets[i] as Material;
45 | if (mat == null) return;
46 |
47 | for (int j = 0; j < _propertyNameArr.Length; j++)
48 | {
49 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
50 | }
51 | }
52 | if (!_condition) editor.DefaultShaderProperty(prop, label);
53 | }
54 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
55 | {
56 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
57 | }
58 | }
59 | ///根据keyword的开关去控制该属性的显示和隐藏,keyword都是ON,则开启GUI隐藏
60 | /*-------------------Shader中的例子-----------------------------
61 | [Toggle] _A("A",float) = 1
62 | [Toggle] _B("B",float) = 1
63 | [HideProperty(_A_ON,_B_ON)] _Show("Show Property",float) = 1
64 | ---------------------------------------------------------------*/
65 | public class HidePropertyDrawer : MaterialPropertyDrawer
66 | {
67 | string[] _propertyNameArr;
68 | bool _condition;
69 | public HidePropertyDrawer(string n1)
70 | {
71 | _propertyNameArr = new string[] { n1 };
72 | }
73 | public HidePropertyDrawer(string n1, string n2)
74 | {
75 | _propertyNameArr = new string[] { n1, n2 };
76 | }
77 | public HidePropertyDrawer(string n1, string n2, string n3)
78 | {
79 | _propertyNameArr = new string[] { n1, n2, n3 };
80 | }
81 | public HidePropertyDrawer(string n1, string n2, string n3, string n4)
82 | {
83 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
84 | }
85 |
86 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
87 | {
88 | _condition = false;
89 | if (_propertyNameArr.Length == 0)
90 | {
91 | editor.DefaultShaderProperty(prop, label);
92 | return;
93 | }
94 | for (int i = 0; i < editor.targets.Length; i++)
95 | {
96 | Material mat = editor.targets[i] as Material;
97 | if (mat == null) return;
98 |
99 | for (int j = 0; j < _propertyNameArr.Length; j++)
100 | {
101 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
102 | }
103 | }
104 | if (_condition) editor.DefaultShaderProperty(prop, label);
105 | }
106 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
107 | {
108 | return _condition ? base.GetPropertyHeight(prop, label, editor) : 0;
109 | }
110 | }
111 | public class ShowToggleDrawer : MaterialPropertyDrawer
112 | {
113 | string[] _propertyNameArr;
114 | bool _condition;
115 | public ShowToggleDrawer(string n1)
116 | {
117 | _propertyNameArr = new string[] { n1 };
118 | }
119 | public ShowToggleDrawer(string n1, string n2)
120 | {
121 | _propertyNameArr = new string[] { n1, n2 };
122 | }
123 | public ShowToggleDrawer(string n1, string n2, string n3)
124 | {
125 | _propertyNameArr = new string[] { n1, n2, n3 };
126 | }
127 | public ShowToggleDrawer(string n1, string n2, string n3, string n4)
128 | {
129 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
130 | }
131 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
132 | {
133 | _condition = false;
134 | if (_propertyNameArr.Length == 0)
135 | {
136 | editor.DefaultShaderProperty(prop, label);
137 | return;
138 | }
139 | for (int i = 0; i < editor.targets.Length; i++)
140 | {
141 | //material object that we're targetting...
142 | Material mat = editor.targets[i] as Material;
143 | if (mat != null)
144 | {
145 | for (int j = 0; j < _propertyNameArr.Length; j++)
146 | {
147 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
148 | }
149 | }
150 | }
151 | if (!_condition)
152 | {
153 | //editor.DefaultShaderProperty(prop, label);
154 | bool value = (prop.floatValue != 0.0f);
155 | EditorGUI.BeginChangeCheck();
156 | EditorGUI.showMixedValue = prop.hasMixedValue;
157 | value = EditorGUI.Toggle(position, label, value);
158 | EditorGUI.showMixedValue = false;
159 | if (EditorGUI.EndChangeCheck())
160 | {
161 | prop.floatValue = value ? 1.0f : 0.0f;
162 | }
163 | }
164 | }
165 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
166 | {
167 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
168 | }
169 | }
170 | public class ShowSliderDrawer : MaterialPropertyDrawer
171 | {
172 | string[] _propertyNameArr;
173 | bool _condition;
174 |
175 | public ShowSliderDrawer(string n1)
176 | {
177 | _propertyNameArr = new string[] { n1 };
178 | }
179 | public ShowSliderDrawer(string n1, string n2)
180 | {
181 | _propertyNameArr = new string[] { n1, n2 };
182 | }
183 | public ShowSliderDrawer(string n1, string n2, string n3)
184 | {
185 | _propertyNameArr = new string[] { n1, n2, n3 };
186 | }
187 | public ShowSliderDrawer(string n1, string n2, string n3, string n4)
188 | {
189 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
190 | }
191 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
192 | {
193 | _condition = false;
194 |
195 | if (_propertyNameArr.Length == 0)
196 | {
197 | editor.DefaultShaderProperty(prop, label);
198 | return;
199 | }
200 |
201 | for (int i = 0; i < editor.targets.Length; i++)
202 | {
203 | //material object that we're targetting...
204 | Material mat = editor.targets[i] as Material;
205 | if (mat != null)
206 | {
207 | for (int j = 0; j < _propertyNameArr.Length; j++)
208 | {
209 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
210 | }
211 | }
212 | }
213 | if (!_condition)
214 | {
215 | float value = prop.floatValue;
216 |
217 | EditorGUI.BeginChangeCheck();
218 | EditorGUI.showMixedValue = prop.hasMixedValue;
219 | string newLabel = label + "[" + prop.rangeLimits.x + "-" + prop.rangeLimits.y + "]";
220 | float offsetX = newLabel.Length * 10;
221 | if (offsetX > position.width / 2.0f) offsetX = position.width / 2;
222 |
223 | Rect newLabelPos = new Rect(position.x, position.y, offsetX, position.height);
224 | EditorGUI.LabelField(position, newLabel);
225 |
226 | Rect newPos = new Rect(position.x + position.width * 0.4f, position.y, position.width * 0.6f, position.height);
227 | value = EditorGUI.Slider(newPos, "", value, prop.rangeLimits.x, prop.rangeLimits.y);
228 |
229 | //value = EditorGUI.Slider(position, label, value, prop.rangeLimits.x, prop.rangeLimits.y);
230 |
231 | EditorGUI.showMixedValue = false;
232 |
233 |
234 | if (EditorGUI.EndChangeCheck())
235 | {
236 | prop.floatValue = value;
237 | }
238 | }
239 |
240 | }
241 |
242 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
243 | {
244 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
245 | }
246 | }
247 | //////ShowPowerSlider//////////END
248 | public class ShowIntRangeDrawer : MaterialPropertyDrawer
249 | {
250 | string[] _propertyNameArr;
251 | bool _condition;
252 |
253 | public ShowIntRangeDrawer(string n1)
254 | {
255 | _propertyNameArr = new string[] { n1 };
256 | }
257 | public ShowIntRangeDrawer(string n1, string n2)
258 | {
259 | _propertyNameArr = new string[] { n1, n2 };
260 | }
261 | public ShowIntRangeDrawer(string n1, string n2, string n3)
262 | {
263 | _propertyNameArr = new string[] { n1, n2, n3 };
264 | }
265 | public ShowIntRangeDrawer(string n1, string n2, string n3, string n4)
266 | {
267 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
268 | }
269 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
270 | {
271 | _condition = false;
272 |
273 | if (_propertyNameArr.Length == 0)
274 | {
275 | editor.DefaultShaderProperty(prop, label);
276 | return;
277 | }
278 |
279 | for (int i = 0; i < editor.targets.Length; i++)
280 | {
281 | //material object that we're targetting...
282 | Material mat = editor.targets[i] as Material;
283 | if (mat != null)
284 | {
285 | for (int j = 0; j < _propertyNameArr.Length; j++)
286 | {
287 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
288 | }
289 | }
290 | }
291 | if (!_condition)
292 | {
293 | int value = (int)prop.floatValue;
294 |
295 | EditorGUI.BeginChangeCheck();
296 | EditorGUI.showMixedValue = prop.hasMixedValue;
297 |
298 | string newLabel = label + "[" + (int)prop.rangeLimits.x + "-" + (int)prop.rangeLimits.y + "]";
299 | float offsetX = newLabel.Length * 10;
300 | if (offsetX > position.width / 2.0f) offsetX = position.width / 2;
301 |
302 | Rect newLabelPos = new Rect(position.x, position.y, offsetX, position.height);
303 | EditorGUI.LabelField(position, newLabel);
304 |
305 | Rect newPos = new Rect(position.x + position.width * 0.4f, position.y, position.width * 0.6f, position.height);
306 | value = EditorGUI.IntSlider(newPos, "", value, (int)prop.rangeLimits.x, (int)prop.rangeLimits.y);
307 |
308 | EditorGUI.showMixedValue = false;
309 |
310 |
311 | if (EditorGUI.EndChangeCheck())
312 | {
313 | prop.floatValue = value;
314 | }
315 | }
316 | }
317 |
318 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
319 | {
320 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
321 | }
322 | }
323 | public class ShowSpaceDrawer : MaterialPropertyDrawer
324 | {
325 | string[] _propertyNameArr = new string[] { };
326 | bool _condition;
327 | private float space;
328 | public ShowSpaceDrawer(string n1, float space)
329 | {
330 | _propertyNameArr = new string[] { n1 };
331 | this.space = space;
332 | }
333 | public ShowSpaceDrawer(string n1, string n2, float space)
334 | {
335 | _propertyNameArr = new string[] { n1, n2 };
336 | this.space = space;
337 | }
338 | public ShowSpaceDrawer(string n1, string n2, string n3, float space)
339 | {
340 | _propertyNameArr = new string[] { n1, n2, n3 };
341 | this.space = space;
342 | }
343 | public ShowSpaceDrawer(string n1, string n2, string n3, string n4, float space)
344 | {
345 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
346 | this.space = space;
347 | }
348 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
349 | {
350 | _condition = false;
351 |
352 | if (_propertyNameArr.Length == 0)
353 | {
354 | editor.DefaultShaderProperty(prop, label);
355 | return;
356 | }
357 |
358 | for (int i = 0; i < editor.targets.Length; i++)
359 | {
360 | //material object that we're targetting...
361 | Material mat = editor.targets[i] as Material;
362 | if (mat != null)
363 | {
364 | for (int j = 0; j < _propertyNameArr.Length; j++)
365 | {
366 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
367 | }
368 | }
369 | }
370 | if (!_condition)
371 | {
372 | GUILayout.Space(-16 + space);
373 | editor.DefaultShaderProperty(prop, label);
374 | }
375 | }
376 |
377 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
378 | {
379 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
380 | }
381 | }
382 | public class ShowHeaderDrawer : MaterialPropertyDrawer
383 | {
384 | string[] _propertyNameArr = new string[] { };
385 | bool _condition;
386 | private string info;
387 | GUIStyle style = new GUIStyle();
388 |
389 | public ShowHeaderDrawer(string n1, string info)
390 | {
391 | _propertyNameArr = new string[] { n1 };
392 | this.info = info;
393 | }
394 | public ShowHeaderDrawer(string n1, string n2, string info)
395 | {
396 | _propertyNameArr = new string[] { n1, n2 };
397 | this.info = info;
398 | }
399 | public ShowHeaderDrawer(string n1, string n2, string n3, string info)
400 | {
401 | _propertyNameArr = new string[] { n1, n2, n3 };
402 | this.info = info;
403 | }
404 | public ShowHeaderDrawer(string n1, string n2, string n3, string n4, string info)
405 | {
406 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
407 | this.info = info;
408 | }
409 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
410 | {
411 | _condition = false;
412 |
413 | if (_propertyNameArr.Length == 0)
414 | {
415 | editor.DefaultShaderProperty(prop, label);
416 | return;
417 | }
418 |
419 | for (int i = 0; i < editor.targets.Length; i++)
420 | {
421 | //material object that we're targetting...
422 | Material mat = editor.targets[i] as Material;
423 | if (mat != null)
424 | {
425 | for (int j = 0; j < _propertyNameArr.Length; j++)
426 | {
427 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
428 | }
429 | }
430 | }
431 | if (!_condition)
432 | {
433 | GUILayout.Space(-16);
434 | style.richText = true;
435 | GUILayout.Label("" + info + " ", style);
436 | //EditorGUI.LabelField(position,info,style);
437 | editor.DefaultShaderProperty(prop, label);
438 | }
439 | }
440 |
441 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
442 | {
443 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
444 | }
445 | }
446 | public class ShowKeywordEnumDrawer : MaterialPropertyDrawer
447 | {
448 | string[] _propertyNameArr = new string[] { };
449 | string[] _elementArr = new string[] { };
450 | bool _condition;
451 |
452 | #region 构造器
453 | //element count 1
454 | public ShowKeywordEnumDrawer(string n1, float separation, string e1)//params string[] n)
455 | {
456 | _propertyNameArr = new string[] { n1 };
457 | _elementArr = new string[] { e1 };
458 | }
459 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1)//params string[] n)
460 | {
461 | _propertyNameArr = new string[] { n1, n2 };
462 | _elementArr = new string[] { e1 };
463 | }
464 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1)//params string[] n)
465 | {
466 | _propertyNameArr = new string[] { n1, n2, n3 };
467 | _elementArr = new string[] { e1 };
468 | }
469 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1)//params string[] n)
470 | {
471 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
472 | _elementArr = new string[] { e1 };
473 | }
474 |
475 |
476 | //element count 2
477 | public ShowKeywordEnumDrawer(string n1, float separation, string e1, string e2)//params string[] n)
478 | {
479 | _propertyNameArr = new string[] { n1 };
480 | _elementArr = new string[] { e1, e2 };
481 | }
482 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1, string e2)//params string[] n)
483 | {
484 | _propertyNameArr = new string[] { n1, n2 };
485 | _elementArr = new string[] { e1, e2 };
486 | }
487 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1, string e2)//params string[] n)
488 | {
489 | _propertyNameArr = new string[] { n1, n2, n3 };
490 | _elementArr = new string[] { e1, e2 };
491 | }
492 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1, string e2)//params string[] n)
493 | {
494 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
495 | _elementArr = new string[] { e1, e2 };
496 | }
497 |
498 | //element count 3
499 | public ShowKeywordEnumDrawer(string n1, float separation, string e1, string e2, string e3)//params string[] n)
500 | {
501 | _propertyNameArr = new string[] { n1 };
502 | _elementArr = new string[] { e1, e2, e3 };
503 | }
504 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1, string e2, string e3)//params string[] n)
505 | {
506 | _propertyNameArr = new string[] { n1, n2 };
507 | _elementArr = new string[] { e1, e2, e3 };
508 | }
509 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1, string e2, string e3)//params string[] n)
510 | {
511 | _propertyNameArr = new string[] { n1, n2, n3 };
512 | _elementArr = new string[] { e1, e2, e3 };
513 | }
514 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1, string e2, string e3)//params string[] n)
515 | {
516 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
517 | _elementArr = new string[] { e1, e2, e3 };
518 | }
519 |
520 | //element count 4
521 | public ShowKeywordEnumDrawer(string n1, float separation, string e1, string e2, string e3, string e4)//params string[] n)
522 | {
523 | _propertyNameArr = new string[] { n1 };
524 | _elementArr = new string[] { e1, e2, e3, e4 };
525 | }
526 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1, string e2, string e3, string e4)//params string[] n)
527 | {
528 | _propertyNameArr = new string[] { n1, n2 };
529 | _elementArr = new string[] { e1, e2, e3, e4 };
530 | }
531 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1, string e2, string e3, string e4)//params string[] n)
532 | {
533 | _propertyNameArr = new string[] { n1, n2, n3 };
534 | _elementArr = new string[] { e1, e2, e3, e4 };
535 | }
536 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1, string e2, string e3, string e4)//params string[] n)
537 | {
538 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
539 | _elementArr = new string[] { e1, e2, e3, e4 };
540 | }
541 |
542 | //element count 5
543 | public ShowKeywordEnumDrawer(string n1, float separation, string e1, string e2, string e3, string e4, string e5)//params string[] n)
544 | {
545 | _propertyNameArr = new string[] { n1 };
546 | _elementArr = new string[] { e1, e2, e3, e4, e5 };
547 | }
548 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1, string e2, string e3, string e4, string e5)//params string[] n)
549 | {
550 | _propertyNameArr = new string[] { n1, n2 };
551 | _elementArr = new string[] { e1, e2, e3, e4, e5 };
552 | }
553 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1, string e2, string e3, string e4, string e5)//params string[] n)
554 | {
555 | _propertyNameArr = new string[] { n1, n2, n3 };
556 | _elementArr = new string[] { e1, e2, e3, e4, e5 };
557 | }
558 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1, string e2, string e3, string e4, string e5)//params string[] n)
559 | {
560 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
561 | _elementArr = new string[] { e1, e2, e3, e4, e5 };
562 | }
563 |
564 |
565 | //element count 6
566 | public ShowKeywordEnumDrawer(string n1, float separation, string e1, string e2, string e3, string e4, string e5, string e6)//params string[] n)
567 | {
568 | _propertyNameArr = new string[] { n1 };
569 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6 };
570 | }
571 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1, string e2, string e3, string e4, string e5, string e6)//params string[] n)
572 | {
573 | _propertyNameArr = new string[] { n1, n2 };
574 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6 };
575 | }
576 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1, string e2, string e3, string e4, string e5, string e6)//params string[] n)
577 | {
578 | _propertyNameArr = new string[] { n1, n2, n3 };
579 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6 };
580 | }
581 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1, string e2, string e3, string e4, string e5, string e6)//params string[] n)
582 | {
583 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
584 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6 };
585 | }
586 |
587 | //element count 7
588 | public ShowKeywordEnumDrawer(string n1, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7)//params string[] n)
589 | {
590 | _propertyNameArr = new string[] { n1 };
591 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7 };
592 | }
593 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7)//params string[] n)
594 | {
595 | _propertyNameArr = new string[] { n1, n2 };
596 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7 };
597 | }
598 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7)//params string[] n)
599 | {
600 | _propertyNameArr = new string[] { n1, n2, n3 };
601 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7 };
602 | }
603 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7)//params string[] n)
604 | {
605 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
606 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7 };
607 | }
608 |
609 |
610 | //element count 8
611 | public ShowKeywordEnumDrawer(string n1, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8)//params string[] n)
612 | {
613 | _propertyNameArr = new string[] { n1 };
614 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8 };
615 | }
616 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8)//params string[] n)
617 | {
618 | _propertyNameArr = new string[] { n1, n2 };
619 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8 };
620 | }
621 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8)//params string[] n)
622 | {
623 | _propertyNameArr = new string[] { n1, n2, n3 };
624 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8 };
625 | }
626 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8)//params string[] n)
627 | {
628 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
629 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8 };
630 | }
631 |
632 | //element count 9
633 | public ShowKeywordEnumDrawer(string n1, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8, string e9)//params string[] n)
634 | {
635 | _propertyNameArr = new string[] { n1 };
636 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8, e9 };
637 | }
638 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8, string e9)//params string[] n)
639 | {
640 | _propertyNameArr = new string[] { n1, n2 };
641 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8, e9 };
642 | }
643 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8, string e9)//params string[] n)
644 | {
645 | _propertyNameArr = new string[] { n1, n2, n3 };
646 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8, e9 };
647 | }
648 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8, string e9)//params string[] n)
649 | {
650 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
651 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8, e9 };
652 | }
653 |
654 | //element count 10
655 | public ShowKeywordEnumDrawer(string n1, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8, string e9, string e10)//params string[] n)
656 | {
657 | _propertyNameArr = new string[] { n1 };
658 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 };
659 | }
660 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8, string e9, string e10)//params string[] n)
661 | {
662 | _propertyNameArr = new string[] { n1, n2 };
663 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 };
664 | }
665 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8, string e9, string e10)//params string[] n)
666 | {
667 | _propertyNameArr = new string[] { n1, n2, n3 };
668 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 };
669 | }
670 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8, string e9, string e10)//params string[] n)
671 | {
672 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
673 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 };
674 | }
675 |
676 | #endregion
677 |
678 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
679 | {
680 | _condition = false;
681 | if (_propertyNameArr.Length == 0)
682 | {
683 | editor.DefaultShaderProperty(prop, label);
684 | return;
685 | }
686 |
687 | for (int i = 0; i < editor.targets.Length; i++)
688 | {
689 | Material mat = editor.targets[i] as Material;
690 | if (mat != null)
691 | {
692 | for (int j = 0; j < _propertyNameArr.Length; j++)
693 | {
694 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
695 | }
696 | }
697 | }
698 | if (!_condition)
699 | {
700 | int index = (int)prop.floatValue;
701 |
702 | EditorGUI.BeginChangeCheck();
703 | EditorGUI.showMixedValue = prop.hasMixedValue;
704 |
705 | index = EditorGUI.Popup(position, label, index, _elementArr);
706 | EditorGUI.showMixedValue = false;
707 | if (EditorGUI.EndChangeCheck())
708 | {
709 | prop.floatValue = index;
710 | }
711 | }
712 | }
713 |
714 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
715 | {
716 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
717 | }
718 |
719 | }
720 | //这个有点乱,无所谓了。。。不行合并写了。。
721 | public class ShowEnumDrawer : MaterialPropertyDrawer
722 | {
723 | string[] _propertyNameArr;
724 | bool _condition;
725 | string[] _e;
726 | string[] _blendModes = new string[]
727 | {
728 | "Zero",
729 | "One",
730 | "DstColor",
731 | "SrcColor",
732 | "OneMinusDstColor",
733 | "SrcAlpha",
734 | "OneMinusSrcColor",
735 | "DstAlpha",
736 | "OneMinusDstAlpha",
737 | "SrcAlphaSaturate",
738 | "OneMinusSrcAlpha",
739 | };
740 | string[] _cullModes = new string[]
741 | {
742 | "Off",
743 | "Front",
744 | "Back",
745 | };
746 | string[] _compareFunction = new string[]
747 | {
748 | "Disabled",
749 | "Never",
750 | "Less",
751 | "Equal",
752 | "LessEqual",
753 | "Greater",
754 | "NotEqual",
755 | "GreaterEqual",
756 | "Always",
757 | };
758 | Dictionary _dic;
759 | string _current_dickey;
760 | bool type;
761 |
762 | #region 构造器
763 | public ShowEnumDrawer(string n1, string e)
764 | {
765 | _propertyNameArr = new string[] { n1 };
766 | e = e.ToLower();
767 | switch (e)
768 | {
769 | case "unityengine.rendering.blendmode":
770 | _e = _blendModes;
771 | type = true;
772 | break;
773 | case "unityengine.rendering.cullmode":
774 | _e = _cullModes;
775 | type = true;
776 | break;
777 | case "unityengine.rendering.comparefunction":
778 | _e = _compareFunction;
779 | type = true;
780 | break;
781 | default:
782 | type = false;
783 | break;
784 | }
785 | }
786 | public ShowEnumDrawer(string n1, string n2, string e)
787 | {
788 | _propertyNameArr = new string[] { n1, n2 };
789 | e = e.ToLower();
790 | switch (e)
791 | {
792 | case "unityengine.rendering.blendmode":
793 | _e = _blendModes;
794 | type = true;
795 | break;
796 | case "unityengine.rendering.cullmode":
797 | _e = _cullModes;
798 | type = true;
799 | break;
800 | case "unityengine.rendering.comparefunction":
801 | _e = _compareFunction;
802 | type = true;
803 | break;
804 | default:
805 | type = false;
806 | break;
807 | }
808 | }
809 | public ShowEnumDrawer(string n1, string n2, string n3, string e)
810 | {
811 | _propertyNameArr = new string[] { n1, n2, n3 };
812 | e = e.ToLower();
813 | switch (e)
814 | {
815 | case "unityengine.rendering.blendmode":
816 | _e = _blendModes;
817 | type = true;
818 | break;
819 | case "unityengine.rendering.cullmode":
820 | _e = _cullModes;
821 | type = true;
822 | break;
823 | case "unityengine.rendering.comparefunction":
824 | _e = _compareFunction;
825 | type = true;
826 | break;
827 | default:
828 | type = false;
829 | break;
830 | }
831 | }
832 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e)
833 | {
834 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
835 | e = e.ToLower();
836 | switch (e)
837 | {
838 | case "unityengine.rendering.blendmode":
839 | _e = _blendModes;
840 | type = true;
841 | break;
842 | case "unityengine.rendering.cullmode":
843 | _e = _cullModes;
844 | type = true;
845 | break;
846 | case "unityengine.rendering.comparefunction":
847 | _e = _compareFunction;
848 | type = true;
849 | break;
850 | default:
851 | type = false;
852 | break;
853 | }
854 | }
855 | #endregion
856 | #region 构造器
857 | //Enum element 1
858 | public ShowEnumDrawer(string n1, string e1, float f1)
859 | {
860 | _propertyNameArr = new string[] { n1 };
861 | _dic = new Dictionary();
862 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
863 | _current_dickey = e1;
864 | }
865 | public ShowEnumDrawer(string n1, string n2, string e1, float f1)
866 | {
867 | _propertyNameArr = new string[] { n1, n2 };
868 | _dic = new Dictionary();
869 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
870 | _current_dickey = e1;
871 | }
872 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1)
873 | {
874 | _propertyNameArr = new string[] { n1, n2, n3 };
875 | _dic = new Dictionary();
876 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
877 | _current_dickey = e1;
878 | }
879 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1)
880 | {
881 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
882 | _dic = new Dictionary();
883 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
884 | _current_dickey = e1;
885 | }
886 |
887 | //Enum element 2
888 | public ShowEnumDrawer(string n1, string e1, float f1, string e2, float f2)
889 | {
890 | _propertyNameArr = new string[] { n1 };
891 | _dic = new Dictionary();
892 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
893 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
894 | _current_dickey = e1;
895 | }
896 | public ShowEnumDrawer(string n1, string n2, string e1, float f1, string e2, float f2)
897 | {
898 | _propertyNameArr = new string[] { n1, n2 };
899 | _dic = new Dictionary();
900 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
901 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
902 | _current_dickey = e1;
903 | }
904 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1, string e2, float f2)
905 | {
906 | _propertyNameArr = new string[] { n1, n2, n3 };
907 | _dic = new Dictionary();
908 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
909 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
910 | _current_dickey = e1;
911 | }
912 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1, string e2, float f2)
913 | {
914 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
915 | _dic = new Dictionary();
916 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
917 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
918 | _current_dickey = e1;
919 | }
920 | //Enum element 3
921 | public ShowEnumDrawer(string n1, string e1, float f1, string e2, float f2, string e3, float f3)
922 | {
923 | _propertyNameArr = new string[] { n1 };
924 | _dic = new Dictionary();
925 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
926 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
927 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
928 | _current_dickey = e1;
929 | }
930 | public ShowEnumDrawer(string n1, string n2, string e1, float f1, string e2, float f2, string e3, float f3)
931 | {
932 | _propertyNameArr = new string[] { n1, n2 };
933 | _dic = new Dictionary();
934 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
935 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
936 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
937 | _current_dickey = e1;
938 | }
939 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1, string e2, float f2, string e3, float f3)
940 | {
941 | _propertyNameArr = new string[] { n1, n2, n3 };
942 | _dic = new Dictionary();
943 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
944 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
945 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
946 | _current_dickey = e1;
947 | }
948 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1, string e2, float f2, string e3, float f3)
949 | {
950 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
951 | _dic = new Dictionary();
952 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
953 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
954 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
955 | _current_dickey = e1;
956 | }
957 | //Enum element 4
958 | public ShowEnumDrawer(string n1, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4)
959 | {
960 | _propertyNameArr = new string[] { n1 };
961 | _dic = new Dictionary();
962 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
963 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
964 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
965 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
966 | _current_dickey = e1;
967 | }
968 | public ShowEnumDrawer(string n1, string n2, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4)
969 | {
970 | _propertyNameArr = new string[] { n1, n2 };
971 | _dic = new Dictionary();
972 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
973 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
974 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
975 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
976 | _current_dickey = e1;
977 | }
978 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4)
979 | {
980 | _propertyNameArr = new string[] { n1, n2, n3 };
981 | _dic = new Dictionary();
982 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
983 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
984 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
985 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
986 | _current_dickey = e1;
987 | }
988 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4)
989 | {
990 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
991 | _dic = new Dictionary();
992 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
993 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
994 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
995 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
996 | _current_dickey = e1;
997 | }
998 | //Enum element 5
999 | public ShowEnumDrawer(string n1, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5)
1000 | {
1001 | _propertyNameArr = new string[] { n1 };
1002 | _dic = new Dictionary();
1003 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1004 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1005 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1006 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1007 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1008 | _current_dickey = e1;
1009 | }
1010 | public ShowEnumDrawer(string n1, string n2, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5)
1011 | {
1012 | _propertyNameArr = new string[] { n1, n2 };
1013 | _dic = new Dictionary();
1014 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1015 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1016 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1017 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1018 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1019 | _current_dickey = e1;
1020 | }
1021 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5)
1022 | {
1023 | _propertyNameArr = new string[] { n1, n2, n3 };
1024 | _dic = new Dictionary();
1025 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1026 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1027 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1028 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1029 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1030 | _current_dickey = e1;
1031 | }
1032 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5)
1033 | {
1034 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
1035 | _dic = new Dictionary();
1036 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1037 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1038 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1039 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1040 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1041 | _current_dickey = e1;
1042 | }
1043 | //Enum element 6
1044 | public ShowEnumDrawer(string n1, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6)
1045 | {
1046 | _propertyNameArr = new string[] { n1 };
1047 | _dic = new Dictionary();
1048 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1049 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1050 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1051 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1052 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1053 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1054 | _current_dickey = e1;
1055 | }
1056 | public ShowEnumDrawer(string n1, string n2, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6)
1057 | {
1058 | _propertyNameArr = new string[] { n1, n2 };
1059 | _dic = new Dictionary();
1060 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1061 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1062 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1063 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1064 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1065 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1066 | _current_dickey = e1;
1067 | }
1068 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6)
1069 | {
1070 | _propertyNameArr = new string[] { n1, n2, n3 };
1071 | _dic = new Dictionary();
1072 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1073 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1074 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1075 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1076 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1077 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1078 | _current_dickey = e1;
1079 | }
1080 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6)
1081 | {
1082 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
1083 | _dic = new Dictionary();
1084 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1085 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1086 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1087 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1088 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1089 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1090 | _current_dickey = e1;
1091 | }
1092 | //Enum element 7
1093 | public ShowEnumDrawer(string n1, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7)
1094 | {
1095 | _propertyNameArr = new string[] { n1 };
1096 | _dic = new Dictionary();
1097 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1098 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1099 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1100 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1101 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1102 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1103 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1104 | _current_dickey = e1;
1105 | }
1106 | public ShowEnumDrawer(string n1, string n2, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7)
1107 | {
1108 | _propertyNameArr = new string[] { n1, n2 };
1109 | _dic = new Dictionary();
1110 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1111 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1112 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1113 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1114 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1115 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1116 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1117 | _current_dickey = e1;
1118 | }
1119 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7)
1120 | {
1121 | _propertyNameArr = new string[] { n1, n2, n3 };
1122 | _dic = new Dictionary();
1123 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1124 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1125 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1126 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1127 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1128 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1129 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1130 | _current_dickey = e1;
1131 | }
1132 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7)
1133 | {
1134 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
1135 | _dic = new Dictionary();
1136 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1137 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1138 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1139 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1140 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1141 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1142 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1143 | _current_dickey = e1;
1144 | }
1145 | //Enum element 8
1146 | public ShowEnumDrawer(string n1, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8)
1147 | {
1148 | _propertyNameArr = new string[] { n1 };
1149 | _dic = new Dictionary();
1150 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1151 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1152 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1153 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1154 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1155 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1156 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1157 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1158 | _current_dickey = e1;
1159 | }
1160 | public ShowEnumDrawer(string n1, string n2, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8)
1161 | {
1162 | _propertyNameArr = new string[] { n1, n2 };
1163 | _dic = new Dictionary();
1164 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1165 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1166 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1167 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1168 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1169 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1170 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1171 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1172 | _current_dickey = e1;
1173 | }
1174 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8)
1175 | {
1176 | _propertyNameArr = new string[] { n1, n2, n3 };
1177 | _dic = new Dictionary();
1178 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1179 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1180 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1181 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1182 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1183 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1184 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1185 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1186 | _current_dickey = e1;
1187 | }
1188 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8)
1189 | {
1190 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
1191 | _dic = new Dictionary();
1192 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1193 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1194 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1195 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1196 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1197 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1198 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1199 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1200 | _current_dickey = e1;
1201 | }
1202 | //Enum element 9
1203 | public ShowEnumDrawer(string n1, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8, string e9, float f9)
1204 | {
1205 | _propertyNameArr = new string[] { n1 };
1206 | _dic = new Dictionary();
1207 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1208 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1209 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1210 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1211 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1212 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1213 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1214 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1215 | if (!_dic.ContainsKey(e9)) _dic.Add(e9, (int)f9);
1216 | _current_dickey = e1;
1217 | }
1218 | public ShowEnumDrawer(string n1, string n2, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8, string e9, float f9)
1219 | {
1220 | _propertyNameArr = new string[] { n1, n2 };
1221 | _dic = new Dictionary();
1222 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1223 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1224 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1225 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1226 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1227 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1228 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1229 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1230 | if (!_dic.ContainsKey(e9)) _dic.Add(e9, (int)f9);
1231 | _current_dickey = e1;
1232 | }
1233 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8, string e9, float f9)
1234 | {
1235 | _propertyNameArr = new string[] { n1, n2, n3 };
1236 | _dic = new Dictionary();
1237 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1238 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1239 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1240 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1241 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1242 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1243 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1244 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1245 | if (!_dic.ContainsKey(e9)) _dic.Add(e9, (int)f9);
1246 | _current_dickey = e1;
1247 | }
1248 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8, string e9, float f9)
1249 | {
1250 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
1251 | _dic = new Dictionary();
1252 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1253 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1254 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1255 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1256 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1257 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1258 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1259 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1260 | if (!_dic.ContainsKey(e9)) _dic.Add(e9, (int)f9);
1261 | _current_dickey = e1;
1262 | }
1263 | //Enum element 10
1264 | public ShowEnumDrawer(string n1, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8, string e9, float f9, string e10, float f10)
1265 | {
1266 | _propertyNameArr = new string[] { n1 };
1267 | _dic = new Dictionary();
1268 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1269 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1270 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1271 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1272 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1273 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1274 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1275 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1276 | if (!_dic.ContainsKey(e9)) _dic.Add(e9, (int)f9);
1277 | if (!_dic.ContainsKey(e10)) _dic.Add(e10, (int)f10);
1278 | _current_dickey = e1;
1279 | }
1280 | public ShowEnumDrawer(string n1, string n2, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8, string e9, float f9, string e10, float f10)
1281 | {
1282 | _propertyNameArr = new string[] { n1, n2 };
1283 | _dic = new Dictionary();
1284 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1285 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1286 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1287 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1288 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1289 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1290 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1291 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1292 | if (!_dic.ContainsKey(e9)) _dic.Add(e9, (int)f9);
1293 | if (!_dic.ContainsKey(e10)) _dic.Add(e10, (int)f10);
1294 | _current_dickey = e1;
1295 | }
1296 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8, string e9, float f9, string e10, float f10)
1297 | {
1298 | _propertyNameArr = new string[] { n1, n2, n3 };
1299 | _dic = new Dictionary();
1300 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1301 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1302 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1303 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1304 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1305 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1306 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1307 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1308 | if (!_dic.ContainsKey(e9)) _dic.Add(e9, (int)f9);
1309 | if (!_dic.ContainsKey(e10)) _dic.Add(e10, (int)f10);
1310 | _current_dickey = e1;
1311 | }
1312 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8, string e9, float f9, string e10, float f10)
1313 | {
1314 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
1315 | _dic = new Dictionary();
1316 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1317 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1318 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1319 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1320 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1321 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1322 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1323 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1324 | if (!_dic.ContainsKey(e9)) _dic.Add(e9, (int)f9);
1325 | if (!_dic.ContainsKey(e10)) _dic.Add(e10, (int)f10);
1326 | _current_dickey = e1;
1327 | }
1328 | #endregion
1329 |
1330 | void HandleDicSelect(object param)
1331 | {
1332 | object[] param_arr = (param as object[]);
1333 | _current_dickey = (string)param_arr[0];
1334 | MaterialProperty prop = (MaterialProperty)param_arr[1];
1335 | prop.floatValue = _dic[_current_dickey];
1336 | }
1337 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
1338 | {
1339 | _condition = false;
1340 | if (_propertyNameArr.Length == 0)
1341 | {
1342 | editor.DefaultShaderProperty(prop, label);
1343 | return;
1344 | }
1345 | for (int i = 0; i < editor.targets.Length; i++)
1346 | {
1347 | Material mat = editor.targets[i] as Material;
1348 | if (mat == null) return;
1349 |
1350 | for (int j = 0; j < _propertyNameArr.Length; j++)
1351 | {
1352 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
1353 | }
1354 | }
1355 | if (!_condition)
1356 | {
1357 | if (type)
1358 | {
1359 | int index = (int)prop.floatValue;
1360 | EditorGUI.BeginChangeCheck();
1361 | EditorGUI.showMixedValue = prop.hasMixedValue;
1362 |
1363 | index = EditorGUI.Popup(position, label, index, _e);
1364 |
1365 | EditorGUI.showMixedValue = false;
1366 | if (EditorGUI.EndChangeCheck())
1367 | {
1368 | prop.floatValue = index;
1369 | }
1370 | }
1371 | else
1372 | {
1373 | GUILayout.Space(-16);
1374 | GUILayout.BeginHorizontal();
1375 | GUILayout.Label(label);
1376 | if (GUILayout.Button(_current_dickey, GUILayout.Width(65), GUILayout.Height(16)))
1377 | {
1378 | GenericMenu menu = new GenericMenu();
1379 | List dkey = new List(_dic.Keys);
1380 | dkey.Sort();
1381 | for (int i = 0; i < dkey.Count; i++)
1382 | {
1383 | menu.AddItem(new GUIContent(dkey[i]), _current_dickey == dkey[i], HandleDicSelect, new object[] { dkey[i], prop });
1384 | }
1385 | menu.ShowAsContext();
1386 | }
1387 | GUILayout.EndHorizontal();
1388 | }
1389 | }
1390 | }
1391 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
1392 | {
1393 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
1394 | }
1395 | }
1396 |
1397 |
1398 | public class ShowBasedPropertyDrawer : MaterialPropertyDrawer
1399 | {
1400 | string _propertyNameArr;
1401 | bool _condition;
1402 | float _value;
1403 | public ShowBasedPropertyDrawer(string n1,float f1)
1404 | {
1405 | _propertyNameArr = n1 ;
1406 | _value = f1;
1407 | }
1408 |
1409 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
1410 | {
1411 | _condition = false;
1412 | if (_propertyNameArr.Length == 0)
1413 | {
1414 | editor.DefaultShaderProperty(prop, label);
1415 | return;
1416 | }
1417 | for (int i = 0; i < editor.targets.Length; i++)
1418 | {
1419 | Material mat = editor.targets[i] as Material;
1420 | if (mat == null) return;
1421 |
1422 | _condition = mat.GetFloat(_propertyNameArr) < _value;
1423 |
1424 | }
1425 | if (!_condition)
1426 | {
1427 | editor.DefaultShaderProperty(prop, label);
1428 | }
1429 | }
1430 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
1431 | {
1432 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
1433 | }
1434 | }
1435 | #endif
1436 |
--------------------------------------------------------------------------------
/ShaderGUI_Ex.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CorsairProhell/ShaderGUI_Ex-/4a9ff5ef8a0f656b86ae7eb0a3bb2b1f379a0d32/ShaderGUI_Ex.gif
--------------------------------------------------------------------------------
/ShaderGUI_Ex_V02.Shader:
--------------------------------------------------------------------------------
1 | Shader "Unlit/ShaderGUI_Ex"
2 | {
3 | Properties
4 | {
5 | _SlideToggle("Slider Toggle",Range(0,2)) = 1
6 | [Toggle] _A("A",float) = 1
7 | [Toggle] _B("B",float) = 1
8 | _MainTex("Main Texture",2D) = ""{}
9 | _Color("Main Color",Color) = (1,1,1,1)
10 | //----
11 | //[ShowProperty(_A_ON)] _MainTex1("(ShowProperty)A可开启显示", 2D) = "white" {}
12 | //[ShowProperty(_A_ON,_B_ON)] _MainTex2("(ShowProperty)A与B可开启显示", 2D) = "white" {}
13 | ////----
14 | //[HideProperty(_A_ON)] _MainTex3("(HideProperty)A可关闭显示", 2D) = "white" {}
15 | //[HideProperty(_A_ON,_B_ON)] _MainTex4("(HideProperty)A与B可关闭显示", 2D) = "white" {}
16 | ////----
17 | //[ShowToggle(_A_ON)]_C("(ShowToggle)A可开启显示",float) = 1
18 | //[ShowToggle(_A_ON,_B_ON)]_D("(ShowToggle)A与B可开启显示",float) = 1
19 | ////----
20 | //[ShowSlider(_A_ON)] _Slider1("(ShowSlider)A可开启显示",Range(0,4)) = 1
21 | //[ShowSlider(_A_ON,_B_ON)] _Slider2("(ShowSlider)A与B可开启显示",Range(0,4)) = 1
22 | ////----
23 | //[ShowIntRange(_A_ON)]_Slider3("(ShowSlider)A可开启显示",Range(0,4)) = 1
24 | //[ShowIntRange(_A_ON,_B_ON)]_Slider4("(ShowSlider)A与B可开启显示",Range(0,4)) = 1
25 | ////----
26 | //[ShowSpace(_A_ON,10)] _Float1("(ShowSpace)A可开启显示",float) = 1
27 | //[ShowSpace(_A_ON,_B_ON,10)] _Float2("(ShowSpace)A与B可开启显示",float) = 1
28 | ////----
29 | //[ShowHeader(_A_ON,Only English)]_Test1("(ShowHeader)A可开启显示",color) = (1,1,1,1)
30 | //[ShowHeader(_A_ON,_B_ON,Only English)]_Test2("(ShowHeader)A与B可开启显示",color) = (1,1,1,1)
31 | ////----参数中的1没有实际的意义,任何数值都可以,只是作为分隔符使用
32 | //[ShowKeywordEnum(_A_ON,1, None, Add, Multiply,a,b,c,d,e,f,g)] _KeywordTest1("(ShowKeywordEnum)A可开启显示", Float) = 0
33 | //[ShowKeywordEnum(_A_ON,_B_ON,1, None, Add, Multiply,a,b,c,d,e,f,g)] _KeywordTest2("(ShowKeywordEnum)A与B可开启显示", Float) = 0
34 | ////----
35 | //[ShowEnum(_A_ON,UnityEngine.Rendering.BlendMode)] _Blend1("Blend1", Float) = 1
36 | //[ShowEnum(_A_ON,UnityEngine.Rendering.CullMode)] _Blend2("Blend2", Float) = 1
37 | //[ShowEnum(_A_ON,UnityEngine.Rendering.CompareFunction)] _Blend3("Blend3", Float) = 1
38 | //[ShowEnum(_A_ON,_B_ON,UnityEngine.Rendering.BlendMode)] _Blend4("Blend4", Float) = 1
39 | //[ShowEnum(_A_ON,_B_ON,UnityEngine.Rendering.CullMode)] _Blend5("Blend5", Float) = 1
40 | //[ShowEnum(_A_ON,_B_ON,UnityEngine.Rendering.CompareFunction)] _Blend6("Blend6", Float) = 1
41 | //[ShowEnum(_A_ON,One,1,SrcAlpha,5)] _Blend7("Blend7", Float) = 1
42 | //[ShowEnum(_A_ON,_B_ON,One,1,SrcAlpha,5,AAAA,7)] _Blend8("Blend8", Float) = 1
43 | //----
44 | [ShowBasedProperty(_SlideToggle,0.5)]_Based1("Base1",Color) = (1,1,1,1)
45 | [ShowBasedProperty(_MainTex)]_Based2("Base2",2D) = ""{}
46 | //[ShowBasedProperty(_Color,0,0,0,1)]_Based3("Base3",Color) = (1,1,0,1)//编辑器会报错
47 | //----
48 | [ShowHelpBox(_A_ON,Error,3)] _TextField1("Text1",float) = 0
49 | //----
50 |
51 | [ShowTexture(_A_ON)]_Tex1("Texture 1",2D) = ""{}
52 |
53 | }
54 | SubShader
55 | {
56 | Tags { "RenderType"="Opaque" }
57 | LOD 100
58 |
59 | Pass
60 | {
61 | CGPROGRAM
62 | #pragma vertex vert
63 | #pragma fragment frag
64 | #pragma shader_feature _A_ON
65 | #pragma shader_feature _B_ON
66 | #include "UnityCG.cginc"
67 |
68 | struct appdata
69 | {
70 | float4 vertex : POSITION;
71 | };
72 |
73 | struct v2f
74 | {
75 | float4 vertex : SV_POSITION;
76 | };
77 |
78 | sampler2D _MainTex;
79 | float4 _MainTex_ST;
80 |
81 | v2f vert (appdata v)
82 | {
83 | v2f o;
84 | o.vertex = UnityObjectToClipPos(v.vertex);
85 | return o;
86 | }
87 |
88 | fixed4 frag (v2f i) : SV_Target
89 | {
90 | return float4(1,0,0,1);
91 | }
92 | ENDCG
93 | }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/V0.2/ShaderGUI_Ex.cs:
--------------------------------------------------------------------------------
1 | #if UNITY_EDITOR
2 | using UnityEngine;
3 | using UnityEditor;
4 | using System.Collections.Generic;
5 | using System;
6 |
7 | ///根据keyword的开关去控制该属性的显示和隐藏,keyword都是ON,则开启GUI显示
8 | /*-------------------Shader中的例子-----------------------------
9 | [Toggle] _A("A",float) = 1
10 | [Toggle] _B("B",float) = 1
11 | [ShowProperty(_A_ON,_B_ON)] _Show("Show Property",float) = 1
12 | ---------------------------------------------------------------*/
13 | public class ShowPropertyDrawer : MaterialPropertyDrawer
14 | {
15 | string[] _propertyNameArr;
16 | bool _condition;
17 | public ShowPropertyDrawer(string n1)
18 | {
19 | _propertyNameArr = new string[] { n1 };
20 | }
21 | public ShowPropertyDrawer(string n1, string n2)
22 | {
23 | _propertyNameArr = new string[] { n1, n2 };
24 | }
25 | public ShowPropertyDrawer(string n1, string n2, string n3)
26 | {
27 | _propertyNameArr = new string[] { n1, n2, n3 };
28 | }
29 | public ShowPropertyDrawer(string n1, string n2, string n3, string n4)
30 | {
31 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
32 | }
33 |
34 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
35 | {
36 | _condition = false;
37 | if (_propertyNameArr.Length == 0)
38 | {
39 | editor.DefaultShaderProperty(prop, label);
40 | return;
41 | }
42 | for (int i = 0; i < editor.targets.Length; i++)
43 | {
44 | Material mat = editor.targets[i] as Material;
45 | if (mat == null) return;
46 |
47 | for (int j = 0; j < _propertyNameArr.Length; j++)
48 | {
49 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
50 | }
51 | }
52 | if (!_condition) editor.DefaultShaderProperty(prop, label);
53 | }
54 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
55 | {
56 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
57 | }
58 | }
59 | ///根据keyword的开关去控制该属性的显示和隐藏,keyword都是ON,则开启GUI隐藏
60 | /*-------------------Shader中的例子-----------------------------
61 | [Toggle] _A("A",float) = 1
62 | [Toggle] _B("B",float) = 1
63 | [HideProperty(_A_ON,_B_ON)] _Show("Show Property",float) = 1
64 | ---------------------------------------------------------------*/
65 | public class HidePropertyDrawer : MaterialPropertyDrawer
66 | {
67 | string[] _propertyNameArr;
68 | bool _condition;
69 | public HidePropertyDrawer(string n1)
70 | {
71 | _propertyNameArr = new string[] { n1 };
72 | }
73 | public HidePropertyDrawer(string n1, string n2)
74 | {
75 | _propertyNameArr = new string[] { n1, n2 };
76 | }
77 | public HidePropertyDrawer(string n1, string n2, string n3)
78 | {
79 | _propertyNameArr = new string[] { n1, n2, n3 };
80 | }
81 | public HidePropertyDrawer(string n1, string n2, string n3, string n4)
82 | {
83 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
84 | }
85 |
86 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
87 | {
88 | _condition = false;
89 | if (_propertyNameArr.Length == 0)
90 | {
91 | editor.DefaultShaderProperty(prop, label);
92 | return;
93 | }
94 | for (int i = 0; i < editor.targets.Length; i++)
95 | {
96 | Material mat = editor.targets[i] as Material;
97 | if (mat == null) return;
98 |
99 | for (int j = 0; j < _propertyNameArr.Length; j++)
100 | {
101 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
102 | }
103 | }
104 | if (_condition) editor.DefaultShaderProperty(prop, label);
105 | }
106 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
107 | {
108 | return _condition ? base.GetPropertyHeight(prop, label, editor) : 0;
109 | }
110 | }
111 | public class ShowToggleDrawer : MaterialPropertyDrawer
112 | {
113 | string[] _propertyNameArr;
114 | bool _condition;
115 | public ShowToggleDrawer(string n1)
116 | {
117 | _propertyNameArr = new string[] { n1 };
118 | }
119 | public ShowToggleDrawer(string n1, string n2)
120 | {
121 | _propertyNameArr = new string[] { n1, n2 };
122 | }
123 | public ShowToggleDrawer(string n1, string n2, string n3)
124 | {
125 | _propertyNameArr = new string[] { n1, n2, n3 };
126 | }
127 | public ShowToggleDrawer(string n1, string n2, string n3, string n4)
128 | {
129 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
130 | }
131 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
132 | {
133 | _condition = false;
134 | if (_propertyNameArr.Length == 0)
135 | {
136 | editor.DefaultShaderProperty(prop, label);
137 | return;
138 | }
139 | for (int i = 0; i < editor.targets.Length; i++)
140 | {
141 | //material object that we're targetting...
142 | Material mat = editor.targets[i] as Material;
143 | if (mat != null)
144 | {
145 | for (int j = 0; j < _propertyNameArr.Length; j++)
146 | {
147 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
148 | }
149 | }
150 | }
151 | if (!_condition)
152 | {
153 | //editor.DefaultShaderProperty(prop, label);
154 | bool value = (prop.floatValue != 0.0f);
155 | EditorGUI.BeginChangeCheck();
156 | EditorGUI.showMixedValue = prop.hasMixedValue;
157 | value = EditorGUI.Toggle(position, label, value);
158 | EditorGUI.showMixedValue = false;
159 | if (EditorGUI.EndChangeCheck())
160 | {
161 | prop.floatValue = value ? 1.0f : 0.0f;
162 | }
163 | }
164 | }
165 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
166 | {
167 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
168 | }
169 | }
170 | public class ShowSliderDrawer : MaterialPropertyDrawer
171 | {
172 | string[] _propertyNameArr;
173 | bool _condition;
174 |
175 | public ShowSliderDrawer(string n1)
176 | {
177 | _propertyNameArr = new string[] { n1 };
178 | }
179 | public ShowSliderDrawer(string n1, string n2)
180 | {
181 | _propertyNameArr = new string[] { n1, n2 };
182 | }
183 | public ShowSliderDrawer(string n1, string n2, string n3)
184 | {
185 | _propertyNameArr = new string[] { n1, n2, n3 };
186 | }
187 | public ShowSliderDrawer(string n1, string n2, string n3, string n4)
188 | {
189 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
190 | }
191 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
192 | {
193 | _condition = false;
194 |
195 | if (_propertyNameArr.Length == 0)
196 | {
197 | editor.DefaultShaderProperty(prop, label);
198 | return;
199 | }
200 |
201 | for (int i = 0; i < editor.targets.Length; i++)
202 | {
203 | //material object that we're targetting...
204 | Material mat = editor.targets[i] as Material;
205 | if (mat != null)
206 | {
207 | for (int j = 0; j < _propertyNameArr.Length; j++)
208 | {
209 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
210 | }
211 | }
212 | }
213 | if (!_condition)
214 | {
215 | float value = prop.floatValue;
216 |
217 | EditorGUI.BeginChangeCheck();
218 | EditorGUI.showMixedValue = prop.hasMixedValue;
219 | string newLabel = label + "[" + prop.rangeLimits.x + "-" + prop.rangeLimits.y + "]";
220 | float offsetX = newLabel.Length * 10;
221 | if (offsetX > position.width / 2.0f) offsetX = position.width / 2;
222 |
223 | Rect newLabelPos = new Rect(position.x, position.y, offsetX, position.height);
224 | EditorGUI.LabelField(position, newLabel);
225 |
226 | Rect newPos = new Rect(position.x + position.width * 0.4f, position.y, position.width * 0.6f, position.height);
227 | value = EditorGUI.Slider(newPos, "", value, prop.rangeLimits.x, prop.rangeLimits.y);
228 |
229 | //value = EditorGUI.Slider(position, label, value, prop.rangeLimits.x, prop.rangeLimits.y);
230 |
231 | EditorGUI.showMixedValue = false;
232 |
233 |
234 | if (EditorGUI.EndChangeCheck())
235 | {
236 | prop.floatValue = value;
237 | }
238 | }
239 |
240 | }
241 |
242 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
243 | {
244 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
245 | }
246 | }
247 | //////ShowPowerSlider//////////END
248 | public class ShowIntRangeDrawer : MaterialPropertyDrawer
249 | {
250 | string[] _propertyNameArr;
251 | bool _condition;
252 |
253 | public ShowIntRangeDrawer(string n1)
254 | {
255 | _propertyNameArr = new string[] { n1 };
256 | }
257 | public ShowIntRangeDrawer(string n1, string n2)
258 | {
259 | _propertyNameArr = new string[] { n1, n2 };
260 | }
261 | public ShowIntRangeDrawer(string n1, string n2, string n3)
262 | {
263 | _propertyNameArr = new string[] { n1, n2, n3 };
264 | }
265 | public ShowIntRangeDrawer(string n1, string n2, string n3, string n4)
266 | {
267 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
268 | }
269 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
270 | {
271 | _condition = false;
272 |
273 | if (_propertyNameArr.Length == 0)
274 | {
275 | editor.DefaultShaderProperty(prop, label);
276 | return;
277 | }
278 |
279 | for (int i = 0; i < editor.targets.Length; i++)
280 | {
281 | //material object that we're targetting...
282 | Material mat = editor.targets[i] as Material;
283 | if (mat != null)
284 | {
285 | for (int j = 0; j < _propertyNameArr.Length; j++)
286 | {
287 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
288 | }
289 | }
290 | }
291 | if (!_condition)
292 | {
293 | int value = (int)prop.floatValue;
294 |
295 | EditorGUI.BeginChangeCheck();
296 | EditorGUI.showMixedValue = prop.hasMixedValue;
297 |
298 | string newLabel = label + "[" + (int)prop.rangeLimits.x + "-" + (int)prop.rangeLimits.y + "]";
299 | float offsetX = newLabel.Length * 10;
300 | if (offsetX > position.width / 2.0f) offsetX = position.width / 2;
301 |
302 | Rect newLabelPos = new Rect(position.x, position.y, offsetX, position.height);
303 | EditorGUI.LabelField(position, newLabel);
304 |
305 | Rect newPos = new Rect(position.x + position.width * 0.4f, position.y, position.width * 0.6f, position.height);
306 | value = EditorGUI.IntSlider(newPos, "", value, (int)prop.rangeLimits.x, (int)prop.rangeLimits.y);
307 |
308 | EditorGUI.showMixedValue = false;
309 |
310 |
311 | if (EditorGUI.EndChangeCheck())
312 | {
313 | prop.floatValue = value;
314 | }
315 | }
316 | }
317 |
318 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
319 | {
320 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
321 | }
322 | }
323 | public class ShowSpaceDrawer : MaterialPropertyDrawer
324 | {
325 | string[] _propertyNameArr = new string[] { };
326 | bool _condition;
327 | private float space;
328 | public ShowSpaceDrawer(string n1, float space)
329 | {
330 | _propertyNameArr = new string[] { n1 };
331 | this.space = space;
332 | }
333 | public ShowSpaceDrawer(string n1, string n2, float space)
334 | {
335 | _propertyNameArr = new string[] { n1, n2 };
336 | this.space = space;
337 | }
338 | public ShowSpaceDrawer(string n1, string n2, string n3, float space)
339 | {
340 | _propertyNameArr = new string[] { n1, n2, n3 };
341 | this.space = space;
342 | }
343 | public ShowSpaceDrawer(string n1, string n2, string n3, string n4, float space)
344 | {
345 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
346 | this.space = space;
347 | }
348 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
349 | {
350 | _condition = false;
351 |
352 | if (_propertyNameArr.Length == 0)
353 | {
354 | editor.DefaultShaderProperty(prop, label);
355 | return;
356 | }
357 |
358 | for (int i = 0; i < editor.targets.Length; i++)
359 | {
360 | //material object that we're targetting...
361 | Material mat = editor.targets[i] as Material;
362 | if (mat != null)
363 | {
364 | for (int j = 0; j < _propertyNameArr.Length; j++)
365 | {
366 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
367 | }
368 | }
369 | }
370 | if (!_condition)
371 | {
372 | GUILayout.Space(-16 + space);
373 | editor.DefaultShaderProperty(prop, label);
374 | }
375 | }
376 |
377 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
378 | {
379 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
380 | }
381 | }
382 | public class ShowHeaderDrawer : MaterialPropertyDrawer
383 | {
384 | string[] _propertyNameArr = new string[] { };
385 | bool _condition;
386 | private string info;
387 | GUIStyle style = new GUIStyle();
388 |
389 | public ShowHeaderDrawer(string n1, string info)
390 | {
391 | _propertyNameArr = new string[] { n1 };
392 | this.info = info;
393 | }
394 | public ShowHeaderDrawer(string n1, string n2, string info)
395 | {
396 | _propertyNameArr = new string[] { n1, n2 };
397 | this.info = info;
398 | }
399 | public ShowHeaderDrawer(string n1, string n2, string n3, string info)
400 | {
401 | _propertyNameArr = new string[] { n1, n2, n3 };
402 | this.info = info;
403 | }
404 | public ShowHeaderDrawer(string n1, string n2, string n3, string n4, string info)
405 | {
406 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
407 | this.info = info;
408 | }
409 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
410 | {
411 | _condition = false;
412 |
413 | if (_propertyNameArr.Length == 0)
414 | {
415 | editor.DefaultShaderProperty(prop, label);
416 | return;
417 | }
418 |
419 | for (int i = 0; i < editor.targets.Length; i++)
420 | {
421 | //material object that we're targetting...
422 | Material mat = editor.targets[i] as Material;
423 | if (mat != null)
424 | {
425 | for (int j = 0; j < _propertyNameArr.Length; j++)
426 | {
427 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
428 | }
429 | }
430 | }
431 | if (!_condition)
432 | {
433 | GUILayout.Space(-16);
434 | style.richText = true;
435 | GUILayout.Label("" + info + " ", style);
436 | //EditorGUI.LabelField(position,info,style);
437 | editor.DefaultShaderProperty(prop, label);
438 | }
439 | }
440 |
441 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
442 | {
443 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
444 | }
445 | }
446 | public class ShowKeywordEnumDrawer : MaterialPropertyDrawer
447 | {
448 | string[] _propertyNameArr = new string[] { };
449 | string[] _elementArr = new string[] { };
450 | bool _condition;
451 |
452 | #region 构造器
453 | //element count 1
454 | public ShowKeywordEnumDrawer(string n1, float separation, string e1)//params string[] n)
455 | {
456 | _propertyNameArr = new string[] { n1 };
457 | _elementArr = new string[] { e1 };
458 | }
459 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1)//params string[] n)
460 | {
461 | _propertyNameArr = new string[] { n1, n2 };
462 | _elementArr = new string[] { e1 };
463 | }
464 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1)//params string[] n)
465 | {
466 | _propertyNameArr = new string[] { n1, n2, n3 };
467 | _elementArr = new string[] { e1 };
468 | }
469 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1)//params string[] n)
470 | {
471 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
472 | _elementArr = new string[] { e1 };
473 | }
474 |
475 |
476 | //element count 2
477 | public ShowKeywordEnumDrawer(string n1, float separation, string e1, string e2)//params string[] n)
478 | {
479 | _propertyNameArr = new string[] { n1 };
480 | _elementArr = new string[] { e1, e2 };
481 | }
482 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1, string e2)//params string[] n)
483 | {
484 | _propertyNameArr = new string[] { n1, n2 };
485 | _elementArr = new string[] { e1, e2 };
486 | }
487 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1, string e2)//params string[] n)
488 | {
489 | _propertyNameArr = new string[] { n1, n2, n3 };
490 | _elementArr = new string[] { e1, e2 };
491 | }
492 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1, string e2)//params string[] n)
493 | {
494 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
495 | _elementArr = new string[] { e1, e2 };
496 | }
497 |
498 | //element count 3
499 | public ShowKeywordEnumDrawer(string n1, float separation, string e1, string e2, string e3)//params string[] n)
500 | {
501 | _propertyNameArr = new string[] { n1 };
502 | _elementArr = new string[] { e1, e2, e3 };
503 | }
504 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1, string e2, string e3)//params string[] n)
505 | {
506 | _propertyNameArr = new string[] { n1, n2 };
507 | _elementArr = new string[] { e1, e2, e3 };
508 | }
509 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1, string e2, string e3)//params string[] n)
510 | {
511 | _propertyNameArr = new string[] { n1, n2, n3 };
512 | _elementArr = new string[] { e1, e2, e3 };
513 | }
514 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1, string e2, string e3)//params string[] n)
515 | {
516 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
517 | _elementArr = new string[] { e1, e2, e3 };
518 | }
519 |
520 | //element count 4
521 | public ShowKeywordEnumDrawer(string n1, float separation, string e1, string e2, string e3, string e4)//params string[] n)
522 | {
523 | _propertyNameArr = new string[] { n1 };
524 | _elementArr = new string[] { e1, e2, e3, e4 };
525 | }
526 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1, string e2, string e3, string e4)//params string[] n)
527 | {
528 | _propertyNameArr = new string[] { n1, n2 };
529 | _elementArr = new string[] { e1, e2, e3, e4 };
530 | }
531 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1, string e2, string e3, string e4)//params string[] n)
532 | {
533 | _propertyNameArr = new string[] { n1, n2, n3 };
534 | _elementArr = new string[] { e1, e2, e3, e4 };
535 | }
536 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1, string e2, string e3, string e4)//params string[] n)
537 | {
538 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
539 | _elementArr = new string[] { e1, e2, e3, e4 };
540 | }
541 |
542 | //element count 5
543 | public ShowKeywordEnumDrawer(string n1, float separation, string e1, string e2, string e3, string e4, string e5)//params string[] n)
544 | {
545 | _propertyNameArr = new string[] { n1 };
546 | _elementArr = new string[] { e1, e2, e3, e4, e5 };
547 | }
548 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1, string e2, string e3, string e4, string e5)//params string[] n)
549 | {
550 | _propertyNameArr = new string[] { n1, n2 };
551 | _elementArr = new string[] { e1, e2, e3, e4, e5 };
552 | }
553 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1, string e2, string e3, string e4, string e5)//params string[] n)
554 | {
555 | _propertyNameArr = new string[] { n1, n2, n3 };
556 | _elementArr = new string[] { e1, e2, e3, e4, e5 };
557 | }
558 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1, string e2, string e3, string e4, string e5)//params string[] n)
559 | {
560 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
561 | _elementArr = new string[] { e1, e2, e3, e4, e5 };
562 | }
563 |
564 |
565 | //element count 6
566 | public ShowKeywordEnumDrawer(string n1, float separation, string e1, string e2, string e3, string e4, string e5, string e6)//params string[] n)
567 | {
568 | _propertyNameArr = new string[] { n1 };
569 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6 };
570 | }
571 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1, string e2, string e3, string e4, string e5, string e6)//params string[] n)
572 | {
573 | _propertyNameArr = new string[] { n1, n2 };
574 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6 };
575 | }
576 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1, string e2, string e3, string e4, string e5, string e6)//params string[] n)
577 | {
578 | _propertyNameArr = new string[] { n1, n2, n3 };
579 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6 };
580 | }
581 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1, string e2, string e3, string e4, string e5, string e6)//params string[] n)
582 | {
583 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
584 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6 };
585 | }
586 |
587 | //element count 7
588 | public ShowKeywordEnumDrawer(string n1, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7)//params string[] n)
589 | {
590 | _propertyNameArr = new string[] { n1 };
591 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7 };
592 | }
593 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7)//params string[] n)
594 | {
595 | _propertyNameArr = new string[] { n1, n2 };
596 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7 };
597 | }
598 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7)//params string[] n)
599 | {
600 | _propertyNameArr = new string[] { n1, n2, n3 };
601 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7 };
602 | }
603 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7)//params string[] n)
604 | {
605 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
606 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7 };
607 | }
608 |
609 |
610 | //element count 8
611 | public ShowKeywordEnumDrawer(string n1, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8)//params string[] n)
612 | {
613 | _propertyNameArr = new string[] { n1 };
614 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8 };
615 | }
616 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8)//params string[] n)
617 | {
618 | _propertyNameArr = new string[] { n1, n2 };
619 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8 };
620 | }
621 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8)//params string[] n)
622 | {
623 | _propertyNameArr = new string[] { n1, n2, n3 };
624 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8 };
625 | }
626 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8)//params string[] n)
627 | {
628 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
629 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8 };
630 | }
631 |
632 | //element count 9
633 | public ShowKeywordEnumDrawer(string n1, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8, string e9)//params string[] n)
634 | {
635 | _propertyNameArr = new string[] { n1 };
636 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8, e9 };
637 | }
638 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8, string e9)//params string[] n)
639 | {
640 | _propertyNameArr = new string[] { n1, n2 };
641 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8, e9 };
642 | }
643 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8, string e9)//params string[] n)
644 | {
645 | _propertyNameArr = new string[] { n1, n2, n3 };
646 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8, e9 };
647 | }
648 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8, string e9)//params string[] n)
649 | {
650 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
651 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8, e9 };
652 | }
653 |
654 | //element count 10
655 | public ShowKeywordEnumDrawer(string n1, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8, string e9, string e10)//params string[] n)
656 | {
657 | _propertyNameArr = new string[] { n1 };
658 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 };
659 | }
660 | public ShowKeywordEnumDrawer(string n1, string n2, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8, string e9, string e10)//params string[] n)
661 | {
662 | _propertyNameArr = new string[] { n1, n2 };
663 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 };
664 | }
665 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8, string e9, string e10)//params string[] n)
666 | {
667 | _propertyNameArr = new string[] { n1, n2, n3 };
668 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 };
669 | }
670 | public ShowKeywordEnumDrawer(string n1, string n2, string n3, string n4, float separation, string e1, string e2, string e3, string e4, string e5, string e6, string e7, string e8, string e9, string e10)//params string[] n)
671 | {
672 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
673 | _elementArr = new string[] { e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 };
674 | }
675 |
676 | #endregion
677 |
678 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
679 | {
680 | _condition = false;
681 | if (_propertyNameArr.Length == 0)
682 | {
683 | editor.DefaultShaderProperty(prop, label);
684 | return;
685 | }
686 |
687 | for (int i = 0; i < editor.targets.Length; i++)
688 | {
689 | Material mat = editor.targets[i] as Material;
690 | if (mat != null)
691 | {
692 | for (int j = 0; j < _propertyNameArr.Length; j++)
693 | {
694 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
695 | }
696 | }
697 | }
698 | if (!_condition)
699 | {
700 | int index = (int)prop.floatValue;
701 |
702 | EditorGUI.BeginChangeCheck();
703 | EditorGUI.showMixedValue = prop.hasMixedValue;
704 |
705 | index = EditorGUI.Popup(position, label, index, _elementArr);
706 | EditorGUI.showMixedValue = false;
707 | if (EditorGUI.EndChangeCheck())
708 | {
709 | prop.floatValue = index;
710 | }
711 | }
712 | }
713 |
714 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
715 | {
716 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
717 | }
718 |
719 | }
720 | //这个有点乱,无所谓了。。。不行合并写了。。
721 | public class ShowEnumDrawer : MaterialPropertyDrawer
722 | {
723 | string[] _propertyNameArr;
724 | bool _condition;
725 | string[] _e;
726 | string[] _blendModes = new string[]
727 | {
728 | "Zero",
729 | "One",
730 | "DstColor",
731 | "SrcColor",
732 | "OneMinusDstColor",
733 | "SrcAlpha",
734 | "OneMinusSrcColor",
735 | "DstAlpha",
736 | "OneMinusDstAlpha",
737 | "SrcAlphaSaturate",
738 | "OneMinusSrcAlpha",
739 | };
740 | string[] _cullModes = new string[]
741 | {
742 | "Off",
743 | "Front",
744 | "Back",
745 | };
746 | string[] _compareFunction = new string[]
747 | {
748 | "Disabled",
749 | "Never",
750 | "Less",
751 | "Equal",
752 | "LessEqual",
753 | "Greater",
754 | "NotEqual",
755 | "GreaterEqual",
756 | "Always",
757 | };
758 | Dictionary _dic;
759 | string _current_dickey;
760 | bool type;
761 |
762 | #region 构造器
763 | public ShowEnumDrawer(string n1, string e)
764 | {
765 | _propertyNameArr = new string[] { n1 };
766 | e = e.ToLower();
767 | switch (e)
768 | {
769 | case "unityengine.rendering.blendmode":
770 | _e = _blendModes;
771 | type = true;
772 | break;
773 | case "unityengine.rendering.cullmode":
774 | _e = _cullModes;
775 | type = true;
776 | break;
777 | case "unityengine.rendering.comparefunction":
778 | _e = _compareFunction;
779 | type = true;
780 | break;
781 | default:
782 | type = false;
783 | break;
784 | }
785 | }
786 | public ShowEnumDrawer(string n1, string n2, string e)
787 | {
788 | _propertyNameArr = new string[] { n1, n2 };
789 | e = e.ToLower();
790 | switch (e)
791 | {
792 | case "unityengine.rendering.blendmode":
793 | _e = _blendModes;
794 | type = true;
795 | break;
796 | case "unityengine.rendering.cullmode":
797 | _e = _cullModes;
798 | type = true;
799 | break;
800 | case "unityengine.rendering.comparefunction":
801 | _e = _compareFunction;
802 | type = true;
803 | break;
804 | default:
805 | type = false;
806 | break;
807 | }
808 | }
809 | public ShowEnumDrawer(string n1, string n2, string n3, string e)
810 | {
811 | _propertyNameArr = new string[] { n1, n2, n3 };
812 | e = e.ToLower();
813 | switch (e)
814 | {
815 | case "unityengine.rendering.blendmode":
816 | _e = _blendModes;
817 | type = true;
818 | break;
819 | case "unityengine.rendering.cullmode":
820 | _e = _cullModes;
821 | type = true;
822 | break;
823 | case "unityengine.rendering.comparefunction":
824 | _e = _compareFunction;
825 | type = true;
826 | break;
827 | default:
828 | type = false;
829 | break;
830 | }
831 | }
832 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e)
833 | {
834 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
835 | e = e.ToLower();
836 | switch (e)
837 | {
838 | case "unityengine.rendering.blendmode":
839 | _e = _blendModes;
840 | type = true;
841 | break;
842 | case "unityengine.rendering.cullmode":
843 | _e = _cullModes;
844 | type = true;
845 | break;
846 | case "unityengine.rendering.comparefunction":
847 | _e = _compareFunction;
848 | type = true;
849 | break;
850 | default:
851 | type = false;
852 | break;
853 | }
854 | }
855 | #endregion
856 | #region 构造器
857 | //Enum element 1
858 | public ShowEnumDrawer(string n1, string e1, float f1)
859 | {
860 | _propertyNameArr = new string[] { n1 };
861 | _dic = new Dictionary();
862 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
863 | _current_dickey = e1;
864 | }
865 | public ShowEnumDrawer(string n1, string n2, string e1, float f1)
866 | {
867 | _propertyNameArr = new string[] { n1, n2 };
868 | _dic = new Dictionary();
869 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
870 | _current_dickey = e1;
871 | }
872 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1)
873 | {
874 | _propertyNameArr = new string[] { n1, n2, n3 };
875 | _dic = new Dictionary();
876 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
877 | _current_dickey = e1;
878 | }
879 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1)
880 | {
881 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
882 | _dic = new Dictionary();
883 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
884 | _current_dickey = e1;
885 | }
886 |
887 | //Enum element 2
888 | public ShowEnumDrawer(string n1, string e1, float f1, string e2, float f2)
889 | {
890 | _propertyNameArr = new string[] { n1 };
891 | _dic = new Dictionary();
892 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
893 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
894 | _current_dickey = e1;
895 | }
896 | public ShowEnumDrawer(string n1, string n2, string e1, float f1, string e2, float f2)
897 | {
898 | _propertyNameArr = new string[] { n1, n2 };
899 | _dic = new Dictionary();
900 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
901 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
902 | _current_dickey = e1;
903 | }
904 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1, string e2, float f2)
905 | {
906 | _propertyNameArr = new string[] { n1, n2, n3 };
907 | _dic = new Dictionary();
908 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
909 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
910 | _current_dickey = e1;
911 | }
912 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1, string e2, float f2)
913 | {
914 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
915 | _dic = new Dictionary();
916 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
917 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
918 | _current_dickey = e1;
919 | }
920 | //Enum element 3
921 | public ShowEnumDrawer(string n1, string e1, float f1, string e2, float f2, string e3, float f3)
922 | {
923 | _propertyNameArr = new string[] { n1 };
924 | _dic = new Dictionary();
925 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
926 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
927 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
928 | _current_dickey = e1;
929 | }
930 | public ShowEnumDrawer(string n1, string n2, string e1, float f1, string e2, float f2, string e3, float f3)
931 | {
932 | _propertyNameArr = new string[] { n1, n2 };
933 | _dic = new Dictionary();
934 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
935 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
936 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
937 | _current_dickey = e1;
938 | }
939 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1, string e2, float f2, string e3, float f3)
940 | {
941 | _propertyNameArr = new string[] { n1, n2, n3 };
942 | _dic = new Dictionary();
943 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
944 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
945 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
946 | _current_dickey = e1;
947 | }
948 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1, string e2, float f2, string e3, float f3)
949 | {
950 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
951 | _dic = new Dictionary();
952 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
953 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
954 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
955 | _current_dickey = e1;
956 | }
957 | //Enum element 4
958 | public ShowEnumDrawer(string n1, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4)
959 | {
960 | _propertyNameArr = new string[] { n1 };
961 | _dic = new Dictionary();
962 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
963 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
964 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
965 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
966 | _current_dickey = e1;
967 | }
968 | public ShowEnumDrawer(string n1, string n2, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4)
969 | {
970 | _propertyNameArr = new string[] { n1, n2 };
971 | _dic = new Dictionary();
972 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
973 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
974 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
975 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
976 | _current_dickey = e1;
977 | }
978 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4)
979 | {
980 | _propertyNameArr = new string[] { n1, n2, n3 };
981 | _dic = new Dictionary();
982 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
983 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
984 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
985 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
986 | _current_dickey = e1;
987 | }
988 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4)
989 | {
990 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
991 | _dic = new Dictionary();
992 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
993 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
994 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
995 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
996 | _current_dickey = e1;
997 | }
998 | //Enum element 5
999 | public ShowEnumDrawer(string n1, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5)
1000 | {
1001 | _propertyNameArr = new string[] { n1 };
1002 | _dic = new Dictionary();
1003 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1004 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1005 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1006 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1007 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1008 | _current_dickey = e1;
1009 | }
1010 | public ShowEnumDrawer(string n1, string n2, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5)
1011 | {
1012 | _propertyNameArr = new string[] { n1, n2 };
1013 | _dic = new Dictionary();
1014 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1015 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1016 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1017 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1018 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1019 | _current_dickey = e1;
1020 | }
1021 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5)
1022 | {
1023 | _propertyNameArr = new string[] { n1, n2, n3 };
1024 | _dic = new Dictionary();
1025 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1026 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1027 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1028 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1029 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1030 | _current_dickey = e1;
1031 | }
1032 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5)
1033 | {
1034 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
1035 | _dic = new Dictionary();
1036 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1037 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1038 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1039 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1040 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1041 | _current_dickey = e1;
1042 | }
1043 | //Enum element 6
1044 | public ShowEnumDrawer(string n1, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6)
1045 | {
1046 | _propertyNameArr = new string[] { n1 };
1047 | _dic = new Dictionary();
1048 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1049 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1050 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1051 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1052 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1053 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1054 | _current_dickey = e1;
1055 | }
1056 | public ShowEnumDrawer(string n1, string n2, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6)
1057 | {
1058 | _propertyNameArr = new string[] { n1, n2 };
1059 | _dic = new Dictionary();
1060 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1061 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1062 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1063 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1064 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1065 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1066 | _current_dickey = e1;
1067 | }
1068 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6)
1069 | {
1070 | _propertyNameArr = new string[] { n1, n2, n3 };
1071 | _dic = new Dictionary();
1072 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1073 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1074 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1075 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1076 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1077 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1078 | _current_dickey = e1;
1079 | }
1080 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6)
1081 | {
1082 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
1083 | _dic = new Dictionary();
1084 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1085 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1086 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1087 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1088 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1089 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1090 | _current_dickey = e1;
1091 | }
1092 | //Enum element 7
1093 | public ShowEnumDrawer(string n1, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7)
1094 | {
1095 | _propertyNameArr = new string[] { n1 };
1096 | _dic = new Dictionary();
1097 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1098 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1099 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1100 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1101 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1102 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1103 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1104 | _current_dickey = e1;
1105 | }
1106 | public ShowEnumDrawer(string n1, string n2, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7)
1107 | {
1108 | _propertyNameArr = new string[] { n1, n2 };
1109 | _dic = new Dictionary();
1110 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1111 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1112 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1113 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1114 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1115 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1116 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1117 | _current_dickey = e1;
1118 | }
1119 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7)
1120 | {
1121 | _propertyNameArr = new string[] { n1, n2, n3 };
1122 | _dic = new Dictionary();
1123 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1124 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1125 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1126 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1127 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1128 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1129 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1130 | _current_dickey = e1;
1131 | }
1132 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7)
1133 | {
1134 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
1135 | _dic = new Dictionary();
1136 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1137 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1138 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1139 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1140 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1141 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1142 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1143 | _current_dickey = e1;
1144 | }
1145 | //Enum element 8
1146 | public ShowEnumDrawer(string n1, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8)
1147 | {
1148 | _propertyNameArr = new string[] { n1 };
1149 | _dic = new Dictionary();
1150 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1151 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1152 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1153 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1154 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1155 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1156 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1157 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1158 | _current_dickey = e1;
1159 | }
1160 | public ShowEnumDrawer(string n1, string n2, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8)
1161 | {
1162 | _propertyNameArr = new string[] { n1, n2 };
1163 | _dic = new Dictionary();
1164 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1165 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1166 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1167 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1168 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1169 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1170 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1171 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1172 | _current_dickey = e1;
1173 | }
1174 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8)
1175 | {
1176 | _propertyNameArr = new string[] { n1, n2, n3 };
1177 | _dic = new Dictionary();
1178 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1179 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1180 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1181 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1182 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1183 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1184 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1185 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1186 | _current_dickey = e1;
1187 | }
1188 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8)
1189 | {
1190 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
1191 | _dic = new Dictionary();
1192 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1193 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1194 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1195 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1196 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1197 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1198 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1199 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1200 | _current_dickey = e1;
1201 | }
1202 | //Enum element 9
1203 | public ShowEnumDrawer(string n1, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8, string e9, float f9)
1204 | {
1205 | _propertyNameArr = new string[] { n1 };
1206 | _dic = new Dictionary();
1207 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1208 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1209 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1210 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1211 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1212 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1213 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1214 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1215 | if (!_dic.ContainsKey(e9)) _dic.Add(e9, (int)f9);
1216 | _current_dickey = e1;
1217 | }
1218 | public ShowEnumDrawer(string n1, string n2, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8, string e9, float f9)
1219 | {
1220 | _propertyNameArr = new string[] { n1, n2 };
1221 | _dic = new Dictionary();
1222 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1223 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1224 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1225 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1226 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1227 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1228 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1229 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1230 | if (!_dic.ContainsKey(e9)) _dic.Add(e9, (int)f9);
1231 | _current_dickey = e1;
1232 | }
1233 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8, string e9, float f9)
1234 | {
1235 | _propertyNameArr = new string[] { n1, n2, n3 };
1236 | _dic = new Dictionary();
1237 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1238 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1239 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1240 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1241 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1242 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1243 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1244 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1245 | if (!_dic.ContainsKey(e9)) _dic.Add(e9, (int)f9);
1246 | _current_dickey = e1;
1247 | }
1248 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8, string e9, float f9)
1249 | {
1250 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
1251 | _dic = new Dictionary();
1252 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1253 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1254 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1255 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1256 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1257 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1258 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1259 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1260 | if (!_dic.ContainsKey(e9)) _dic.Add(e9, (int)f9);
1261 | _current_dickey = e1;
1262 | }
1263 | //Enum element 10
1264 | public ShowEnumDrawer(string n1, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8, string e9, float f9, string e10, float f10)
1265 | {
1266 | _propertyNameArr = new string[] { n1 };
1267 | _dic = new Dictionary();
1268 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1269 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1270 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1271 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1272 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1273 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1274 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1275 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1276 | if (!_dic.ContainsKey(e9)) _dic.Add(e9, (int)f9);
1277 | if (!_dic.ContainsKey(e10)) _dic.Add(e10, (int)f10);
1278 | _current_dickey = e1;
1279 | }
1280 | public ShowEnumDrawer(string n1, string n2, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8, string e9, float f9, string e10, float f10)
1281 | {
1282 | _propertyNameArr = new string[] { n1, n2 };
1283 | _dic = new Dictionary();
1284 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1285 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1286 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1287 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1288 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1289 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1290 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1291 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1292 | if (!_dic.ContainsKey(e9)) _dic.Add(e9, (int)f9);
1293 | if (!_dic.ContainsKey(e10)) _dic.Add(e10, (int)f10);
1294 | _current_dickey = e1;
1295 | }
1296 | public ShowEnumDrawer(string n1, string n2, string n3, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8, string e9, float f9, string e10, float f10)
1297 | {
1298 | _propertyNameArr = new string[] { n1, n2, n3 };
1299 | _dic = new Dictionary();
1300 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1301 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1302 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1303 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1304 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1305 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1306 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1307 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1308 | if (!_dic.ContainsKey(e9)) _dic.Add(e9, (int)f9);
1309 | if (!_dic.ContainsKey(e10)) _dic.Add(e10, (int)f10);
1310 | _current_dickey = e1;
1311 | }
1312 | public ShowEnumDrawer(string n1, string n2, string n3, string n4, string e1, float f1, string e2, float f2, string e3, float f3, string e4, float f4, string e5, float f5, string e6, float f6, string e7, float f7, string e8, float f8, string e9, float f9, string e10, float f10)
1313 | {
1314 | _propertyNameArr = new string[] { n1, n2, n3, n4 };
1315 | _dic = new Dictionary();
1316 | if (!_dic.ContainsKey(e1)) _dic.Add(e1, (int)f1);
1317 | if (!_dic.ContainsKey(e2)) _dic.Add(e2, (int)f2);
1318 | if (!_dic.ContainsKey(e3)) _dic.Add(e3, (int)f3);
1319 | if (!_dic.ContainsKey(e4)) _dic.Add(e4, (int)f4);
1320 | if (!_dic.ContainsKey(e5)) _dic.Add(e5, (int)f5);
1321 | if (!_dic.ContainsKey(e6)) _dic.Add(e6, (int)f6);
1322 | if (!_dic.ContainsKey(e7)) _dic.Add(e7, (int)f7);
1323 | if (!_dic.ContainsKey(e8)) _dic.Add(e8, (int)f8);
1324 | if (!_dic.ContainsKey(e9)) _dic.Add(e9, (int)f9);
1325 | if (!_dic.ContainsKey(e10)) _dic.Add(e10, (int)f10);
1326 | _current_dickey = e1;
1327 | }
1328 | #endregion
1329 |
1330 | void HandleDicSelect(object param)
1331 | {
1332 | object[] param_arr = (param as object[]);
1333 | _current_dickey = (string)param_arr[0];
1334 | MaterialProperty prop = (MaterialProperty)param_arr[1];
1335 | prop.floatValue = _dic[_current_dickey];
1336 | }
1337 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
1338 | {
1339 | _condition = false;
1340 | if (_propertyNameArr.Length == 0)
1341 | {
1342 | editor.DefaultShaderProperty(prop, label);
1343 | return;
1344 | }
1345 | for (int i = 0; i < editor.targets.Length; i++)
1346 | {
1347 | Material mat = editor.targets[i] as Material;
1348 | if (mat == null) return;
1349 |
1350 | for (int j = 0; j < _propertyNameArr.Length; j++)
1351 | {
1352 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
1353 | }
1354 | }
1355 | if (!_condition)
1356 | {
1357 | if (type)
1358 | {
1359 | int index = (int)prop.floatValue;
1360 | EditorGUI.BeginChangeCheck();
1361 | EditorGUI.showMixedValue = prop.hasMixedValue;
1362 |
1363 | index = EditorGUI.Popup(position, label, index, _e);
1364 |
1365 | EditorGUI.showMixedValue = false;
1366 | if (EditorGUI.EndChangeCheck())
1367 | {
1368 | prop.floatValue = index;
1369 | }
1370 | }
1371 | else
1372 | {
1373 | GUILayout.Space(-16);
1374 | GUILayout.BeginHorizontal();
1375 | GUILayout.Label(label);
1376 | if (GUILayout.Button(_current_dickey, GUILayout.Width(65), GUILayout.Height(16)))
1377 | {
1378 | GenericMenu menu = new GenericMenu();
1379 | List dkey = new List(_dic.Keys);
1380 | dkey.Sort();
1381 | for (int i = 0; i < dkey.Count; i++)
1382 | {
1383 | menu.AddItem(new GUIContent(dkey[i]), _current_dickey == dkey[i], HandleDicSelect, new object[] { dkey[i], prop });
1384 | }
1385 | menu.ShowAsContext();
1386 | }
1387 | GUILayout.EndHorizontal();
1388 | }
1389 | }
1390 | }
1391 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
1392 | {
1393 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
1394 | }
1395 | }
1396 |
1397 |
1398 | ///下面的只写了一种构造器,按照自己的需要自己添加吧
1399 | public class ShowBasedPropertyDrawer : MaterialPropertyDrawer
1400 | {
1401 | string _propertyName;
1402 | bool _condition;
1403 | int type = 0;
1404 | float _value;
1405 | Color c = new Color();
1406 | public ShowBasedPropertyDrawer(string n1, float f1)
1407 | {
1408 | _propertyName = n1;
1409 | _value = f1;
1410 | type = 1;
1411 | }
1412 | public ShowBasedPropertyDrawer(string n1)
1413 | {
1414 | _propertyName = n1;
1415 | type = 2;
1416 | }
1417 | public ShowBasedPropertyDrawer(string n1, float r, float g, float b, float a)
1418 | {
1419 | _propertyName = n1;
1420 | this.c = new Color(r, g, b, a);
1421 | type = 3;
1422 | }
1423 |
1424 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
1425 | {
1426 | _condition = false;
1427 | if (_propertyName.Length == 0)
1428 | {
1429 | editor.DefaultShaderProperty(prop, label);
1430 | return;
1431 | }
1432 | for (int i = 0; i < editor.targets.Length; i++)
1433 | {
1434 | Material mat = editor.targets[i] as Material;
1435 | if (mat == null) return;
1436 | switch (type)
1437 | {
1438 | case 1: _condition = mat.GetFloat(_propertyName) < _value; break;
1439 | case 2: _condition = mat.GetTexture(_propertyName) == null; break;
1440 | //case 3: _condition = mat.GetColor(_propertyName).r == c.r;break;//编辑器会报错
1441 | }
1442 |
1443 |
1444 | }
1445 | if (!_condition)
1446 | {
1447 | editor.DefaultShaderProperty(prop, label);
1448 | }
1449 | }
1450 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
1451 | {
1452 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
1453 | }
1454 | }
1455 |
1456 | public class ShowHelpBoxDrawer : MaterialPropertyDrawer
1457 | {
1458 | string[] _propertyNameArr;
1459 | bool _condition;
1460 | string _info;
1461 | MessageType type = MessageType.Error;
1462 |
1463 | public ShowHelpBoxDrawer(string n1, string info, float t)
1464 | {
1465 | _propertyNameArr = new string[] { n1 };
1466 | this._info = info;
1467 | switch ((int)t)
1468 | {
1469 | case 0: type = MessageType.Error; break;
1470 | case 1: type = MessageType.Info; break;
1471 | case 2: type = MessageType.None; break;
1472 | case 3: type = MessageType.Warning; break;
1473 | default: break;
1474 | }
1475 | }
1476 |
1477 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
1478 | {
1479 | _condition = false;
1480 | if (_propertyNameArr.Length == 0)
1481 | {
1482 | editor.DefaultShaderProperty(prop, label);
1483 | return;
1484 | }
1485 | for (int i = 0; i < editor.targets.Length; i++)
1486 | {
1487 | Material mat = editor.targets[i] as Material;
1488 | if (mat == null) return;
1489 |
1490 | for (int j = 0; j < _propertyNameArr.Length; j++)
1491 | {
1492 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
1493 | }
1494 | }
1495 | if (!_condition)
1496 | {
1497 | EditorGUI.HelpBox(position, _info, type);
1498 |
1499 | editor.DefaultShaderProperty(prop, label);
1500 | }
1501 | }
1502 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
1503 | {
1504 | return !_condition ? base.GetPropertyHeight(prop, label, editor) : 0;
1505 | }
1506 | }
1507 |
1508 | public class ShowTextureDrawer : MaterialPropertyDrawer
1509 | {
1510 | string[] _propertyNameArr;
1511 | bool _condition;
1512 | Texture tex;
1513 | int height = 0;
1514 | Rect newPos = new Rect();
1515 | Material mat;
1516 |
1517 | public ShowTextureDrawer(string n1)
1518 | {
1519 | _propertyNameArr = new string[] { n1 };
1520 | }
1521 |
1522 | public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
1523 | {
1524 | _condition = false;
1525 | if (_propertyNameArr.Length == 0)
1526 | {
1527 | editor.DefaultShaderProperty(prop, label);
1528 | return;
1529 | }
1530 | for (int i = 0; i < editor.targets.Length; i++)
1531 | {
1532 | Material mat = editor.targets[i] as Material;
1533 | if (mat == null) return;
1534 |
1535 | for (int j = 0; j < _propertyNameArr.Length; j++)
1536 | {
1537 | _condition |= !mat.IsKeywordEnabled(_propertyNameArr[j]);
1538 | }
1539 | tex = mat.GetTexture(prop.name);
1540 | this.mat = mat;
1541 | }
1542 | if (!_condition)
1543 | {
1544 |
1545 | editor.DefaultShaderProperty(prop, label);
1546 |
1547 | if (tex != null)
1548 | {
1549 | GUILayout.BeginHorizontal();
1550 |
1551 | newPos.x = position.x-120;
1552 | newPos.y = position.y;
1553 | newPos.width = position.width;
1554 | newPos.height = position.height;
1555 | EditorGUI.DrawTextureAlpha(newPos, tex, ScaleMode.ScaleToFit);
1556 |
1557 | newPos.x = position.x - 20;
1558 | EditorGUI.DrawTextureTransparent(newPos, tex, ScaleMode.ScaleToFit);
1559 |
1560 | newPos.x = position.x + 80;
1561 | EditorGUI.DrawPreviewTexture(newPos, tex,mat, ScaleMode.ScaleToFit);
1562 |
1563 | GUILayout.EndHorizontal();
1564 | height = 1;
1565 | }
1566 | else
1567 | {
1568 | height = 0;
1569 | }
1570 | }
1571 | }
1572 | public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
1573 | {
1574 | return !_condition ? base.GetPropertyHeight(prop, label, editor) + 70 * height : 0;
1575 | }
1576 | }
1577 | #endif
1578 |
--------------------------------------------------------------------------------
/V0.2/ShaderGUI_Ex.shader:
--------------------------------------------------------------------------------
1 | Shader "Unlit/ShaderGUI_Ex"
2 | {
3 | Properties
4 | {
5 | _SlideToggle("Slider Toggle",Range(0,2)) = 1
6 | [Toggle] _A("A",float) = 1
7 | [Toggle] _B("B",float) = 1
8 | _MainTex("Main Texture",2D) = ""{}
9 | _Color("Main Color",Color) = (1,1,1,1)
10 | //----
11 | //[ShowProperty(_A_ON)] _MainTex1("(ShowProperty)A可开启显示", 2D) = "white" {}
12 | //[ShowProperty(_A_ON,_B_ON)] _MainTex2("(ShowProperty)A与B可开启显示", 2D) = "white" {}
13 | ////----
14 | //[HideProperty(_A_ON)] _MainTex3("(HideProperty)A可关闭显示", 2D) = "white" {}
15 | //[HideProperty(_A_ON,_B_ON)] _MainTex4("(HideProperty)A与B可关闭显示", 2D) = "white" {}
16 | ////----
17 | //[ShowToggle(_A_ON)]_C("(ShowToggle)A可开启显示",float) = 1
18 | //[ShowToggle(_A_ON,_B_ON)]_D("(ShowToggle)A与B可开启显示",float) = 1
19 | ////----
20 | //[ShowSlider(_A_ON)] _Slider1("(ShowSlider)A可开启显示",Range(0,4)) = 1
21 | //[ShowSlider(_A_ON,_B_ON)] _Slider2("(ShowSlider)A与B可开启显示",Range(0,4)) = 1
22 | ////----
23 | //[ShowIntRange(_A_ON)]_Slider3("(ShowSlider)A可开启显示",Range(0,4)) = 1
24 | //[ShowIntRange(_A_ON,_B_ON)]_Slider4("(ShowSlider)A与B可开启显示",Range(0,4)) = 1
25 | ////----
26 | //[ShowSpace(_A_ON,10)] _Float1("(ShowSpace)A可开启显示",float) = 1
27 | //[ShowSpace(_A_ON,_B_ON,10)] _Float2("(ShowSpace)A与B可开启显示",float) = 1
28 | ////----
29 | //[ShowHeader(_A_ON,Only English)]_Test1("(ShowHeader)A可开启显示",color) = (1,1,1,1)
30 | //[ShowHeader(_A_ON,_B_ON,Only English)]_Test2("(ShowHeader)A与B可开启显示",color) = (1,1,1,1)
31 | ////----参数中的1没有实际的意义,任何数值都可以,只是作为分隔符使用
32 | //[ShowKeywordEnum(_A_ON,1, None, Add, Multiply,a,b,c,d,e,f,g)] _KeywordTest1("(ShowKeywordEnum)A可开启显示", Float) = 0
33 | //[ShowKeywordEnum(_A_ON,_B_ON,1, None, Add, Multiply,a,b,c,d,e,f,g)] _KeywordTest2("(ShowKeywordEnum)A与B可开启显示", Float) = 0
34 | ////----
35 | //[ShowEnum(_A_ON,UnityEngine.Rendering.BlendMode)] _Blend1("Blend1", Float) = 1
36 | //[ShowEnum(_A_ON,UnityEngine.Rendering.CullMode)] _Blend2("Blend2", Float) = 1
37 | //[ShowEnum(_A_ON,UnityEngine.Rendering.CompareFunction)] _Blend3("Blend3", Float) = 1
38 | //[ShowEnum(_A_ON,_B_ON,UnityEngine.Rendering.BlendMode)] _Blend4("Blend4", Float) = 1
39 | //[ShowEnum(_A_ON,_B_ON,UnityEngine.Rendering.CullMode)] _Blend5("Blend5", Float) = 1
40 | //[ShowEnum(_A_ON,_B_ON,UnityEngine.Rendering.CompareFunction)] _Blend6("Blend6", Float) = 1
41 | //[ShowEnum(_A_ON,One,1,SrcAlpha,5)] _Blend7("Blend7", Float) = 1
42 | //[ShowEnum(_A_ON,_B_ON,One,1,SrcAlpha,5,AAAA,7)] _Blend8("Blend8", Float) = 1
43 | //----
44 | [ShowBasedProperty(_SlideToggle,0.5)]_Based1("Base1",Color) = (1,1,1,1)
45 | [ShowBasedProperty(_MainTex)]_Based2("Base2",2D) = ""{}
46 | //[ShowBasedProperty(_Color,0,0,0,1)]_Based3("Base3",Color) = (1,1,0,1)//编辑器会报错
47 | //----
48 | [ShowHelpBox(_A_ON,Error,3)] _TextField1("Text1",float) = 0
49 | //----
50 |
51 | [ShowTexture(_A_ON)]_Tex1("Texture 1",2D) = ""{}
52 |
53 | }
54 | SubShader
55 | {
56 | Tags { "RenderType"="Opaque" }
57 | LOD 100
58 |
59 | Pass
60 | {
61 | CGPROGRAM
62 | #pragma vertex vert
63 | #pragma fragment frag
64 | #pragma shader_feature _A_ON
65 | #pragma shader_feature _B_ON
66 | #include "UnityCG.cginc"
67 |
68 | struct appdata
69 | {
70 | float4 vertex : POSITION;
71 | };
72 |
73 | struct v2f
74 | {
75 | float4 vertex : SV_POSITION;
76 | };
77 |
78 | sampler2D _MainTex;
79 | float4 _MainTex_ST;
80 |
81 | v2f vert (appdata v)
82 | {
83 | v2f o;
84 | o.vertex = UnityObjectToClipPos(v.vertex);
85 | return o;
86 | }
87 |
88 | fixed4 frag (v2f i) : SV_Target
89 | {
90 | return float4(1,0,0,1);
91 | }
92 | ENDCG
93 | }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/V0.2/V0.2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CorsairProhell/ShaderGUI_Ex-/4a9ff5ef8a0f656b86ae7eb0a3bb2b1f379a0d32/V0.2/V0.2.png
--------------------------------------------------------------------------------