1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
|
using System;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
namespace TweenAnimation
{
internal class TweenModuleGUIStyles
{
private delegate bool GetBoldDefaultFontFunc();
private static GetBoldDefaultFontFunc GetBoldDefaultFont;
static Texture2D m_BgTexture;
static Texture2D m_BgTextureActive;
static Texture2D m_BgTextureWire;
static Texture2D m_BgTextureWireSmall;
static Material m_material;
public static Texture2D eventIcon;
public static Texture2D moduleIcon;
public static Texture2D eventBuoy;
public Material defaultUIMaterail => m_material;
static Texture2D LoadTexture(string path)
{
return AssetDatabase.LoadAssetAtPath(path, typeof(Texture2D)) as Texture2D;
}
static TweenModuleGUIStyles()
{
Type editorGUIUtility = typeof(EditorGUIUtility);
GetBoldDefaultFont = (GetBoldDefaultFontFunc)GetMethod(typeof(GetBoldDefaultFontFunc), typeof(EditorGUIUtility), "GetBoldDefaultFont", BindingFlags.Static | BindingFlags.NonPublic);
m_BgTexture = LoadTexture(TweenAnimationSetup.root + "Icons/Background.png");
m_BgTextureActive = LoadTexture(TweenAnimationSetup.root + "Icons/BackgroundActive.png");
m_BgTextureWire = LoadTexture(TweenAnimationSetup.root + "Icons/BackgroundWire.png");
m_BgTextureWireSmall = LoadTexture(TweenAnimationSetup.root + "Icons/BackgroundWireSmall.png");
eventIcon = LoadTexture(TweenAnimationSetup.root + "Icons/EventIcon.png");
moduleIcon = LoadTexture(TweenAnimationSetup.root + "Icons/ModuleIcon.png");
eventBuoy = LoadTexture(TweenAnimationSetup.root + "Icons/EventBuoy.png");
m_material = new Material(Shader.Find("Hidden/Internal-Colored"));
m_material.hideFlags = HideFlags.HideAndDontSave;
}
private static Delegate GetMethod(Type del, Type type, string name, BindingFlags flag)
{
var method = type.GetMethod(name, flag);
Delegate deleg = Delegate.CreateDelegate(del, method);
return deleg;
}
public GUIStyle label
{
get
{
return GetBoldDefaultFont() ? this.m_LabelBold : this.m_Label;
}
}
public GUIStyle editableLabel
{
get
{
return GetBoldDefaultFont() ? this.m_EditableLabelBold : this.m_EditableLabel;
}
}
public GUIStyle objectField
{
get
{
return GetBoldDefaultFont() ? this.m_ObjectFieldBold : this.m_ObjectField;
}
}
public GUIStyle numberField
{
get
{
return GetBoldDefaultFont() ? this.m_NumberFieldBold : this.m_NumberField;
}
}
public GUIStyle moduleHeaderStyle
{
get
{
return GetBoldDefaultFont() ? this.m_ModuleHeaderStyleBold : this.m_ModuleHeaderStyle;
}
}
public GUIStyle popup
{
get
{
return GetBoldDefaultFont() ? this.m_PopupStyleBold : this.m_PopupStyle;
}
}
public GUIStyle emitterHeaderStyle
{
get
{
return this.m_EmitterHeaderStyle;
}
}
public GUIStyle effectBgStyle
{
get
{
return this.m_EffectBgStyle;
}
}
public GUIStyle moduleBgStyle
{
get
{
return this.m_ModuleBgStyle;
}
}
public GUIStyle plus
{
get
{
return this.m_Plus;
}
}
public GUIStyle minus
{
get
{
return this.m_Minus;
}
}
public GUIStyle checkmark
{
get
{
return this.m_Checkmark;
}
}
public GUIStyle checkmarkMixed
{
get
{
return this.m_CheckmarkMixed;
}
}
public GUIStyle minMaxCurveStateDropDown
{
get
{
return this.m_MinMaxCurveStateDropDown;
}
}
public GUIStyle toggle
{
get
{
return this.m_Toggle;
}
}
public GUIStyle toggleMixed
{
get
{
return this.m_ToggleMixed;
}
}
public GUIStyle selectionMarker
{
get
{
return this.m_SelectionMarker;
}
}
public GUIStyle toolbarButtonLeftAlignText
{
get
{
return this.m_ToolbarButtonLeftAlignText;
}
}
public GUIStyle modulePadding
{
get
{
return this.m_ModulePadding;
}
}
public GUIStyle customDataWindow
{
get
{
return this.m_CustomDataWindow;
}
}
public Texture2D warningIcon
{
get
{
return this.m_WarningIcon;
}
}
public GUIStyle floatfiled
{
get
{
return m_FloatField;
}
}
public GUIStyle headerBg
{
get
{
return m_HeaderBg;
}
}
private GUIStyle m_Label;
private GUIStyle m_LabelBold;
private GUIStyle m_EditableLabel;
private GUIStyle m_EditableLabelBold;
private GUIStyle m_ObjectField;
private GUIStyle m_ObjectFieldBold;
private GUIStyle m_NumberField;
private GUIStyle m_NumberFieldBold;
private GUIStyle m_ModuleHeaderStyle;
private GUIStyle m_ModuleHeaderStyleBold;
private GUIStyle m_PopupStyle;
private GUIStyle m_PopupStyleBold;
private GUIStyle m_EmitterHeaderStyle;
private GUIStyle m_EffectBgStyle;
private GUIStyle m_ModuleBgStyle;
private GUIStyle m_Plus;
private GUIStyle m_Minus;
private GUIStyle m_Checkmark;
private GUIStyle m_CheckmarkMixed;
private GUIStyle m_MinMaxCurveStateDropDown;
private GUIStyle m_Toggle;
private GUIStyle m_ToggleMixed;
private GUIStyle m_SelectionMarker;
private GUIStyle m_ToolbarButtonLeftAlignText;
private GUIStyle m_ModulePadding;
private GUIStyle m_CustomDataWindow;
private GUIStyle m_FloatField;
private Texture2D m_WarningIcon;
private static TweenModuleGUIStyles s_TweenModuleGUIStyles;
private GUIStyle m_HeaderBg;
private GUIStyle m_HeaderTitle;
public GUIStyle headerTitle { get { return m_HeaderTitle; } }
private GUIStyle m_Bg;
public GUIStyle bg { get { return m_Bg; } }
private GUIStyle m_BgSmall;
public GUIStyle bgSmall { get { return m_BgSmall; } }
private GUIStyle m_AddNewModule;
public GUIStyle addNewModule { get { return m_AddNewModule; } }
private GUIStyle m_Text;
public GUIStyle text { get { return m_Text; } }
private GUIStyle m_TextSmall;
public GUIStyle textSmall { get { return m_TextSmall; } }
private GUIStyle m_TextBold;
public GUIStyle textBold { get { return m_TextBold; } }
private GUIStyle m_TextBoldBig;
public GUIStyle textBoldBig { get { return m_TextBoldBig; } }
private GUIStyle m_TextField;
public GUIStyle textField { get { return m_TextField; } }
private GUIStyle m_MiniLeft;
public GUIStyle miniLeft { get { return m_MiniLeft; } }
private GUIStyle m_MiniMid;
public GUIStyle miniMid { get { return m_MiniMid; } }
private GUIStyle m_MiniRight;
public GUIStyle miniRight { get { return m_MiniRight; } }
public GUIStyle m_Obj;
public GUIStyle obj { get { return m_Obj; } }
public static TweenModuleGUIStyles Get()
{
bool flag = s_TweenModuleGUIStyles == null;
if (flag)
{
s_TweenModuleGUIStyles = new TweenModuleGUIStyles();
}
return s_TweenModuleGUIStyles;
}
private TweenModuleGUIStyles()
{
InitStyle(out this.m_Label, out this.m_LabelBold, "ShurikenLabel");
InitStyle(out this.m_EditableLabel, out this.m_EditableLabelBold, "ShurikenEditableLabel");
InitStyle(out this.m_ObjectField, out this.m_ObjectFieldBold, "ShurikenObjectField");
InitStyle(out this.m_NumberField, out this.m_NumberFieldBold, "ShurikenValue");
InitStyle(out this.m_ModuleHeaderStyle, out this.m_ModuleHeaderStyleBold, "ShurikenModuleTitle");
InitStyle(out this.m_PopupStyle, out this.m_PopupStyleBold, "ShurikenPopUp");
InitStyle(out this.m_EmitterHeaderStyle, "ShurikenEmitterTitle");
InitStyle(out this.m_EmitterHeaderStyle, "ShurikenEmitterTitle");
InitStyle(out this.m_EffectBgStyle, "ShurikenEffectBg");
InitStyle(out this.m_ModuleBgStyle, "ShurikenModuleBg");
InitStyle(out this.m_Plus, "OL Plus");
InitStyle(out this.m_Minus, "OL Minus");
InitStyle(out this.m_Checkmark, "ShurikenCheckMark");
InitStyle(out this.m_CheckmarkMixed, "ShurikenCheckMarkMixed");
InitStyle(out this.m_MinMaxCurveStateDropDown, "ShurikenDropdown");
InitStyle(out this.m_Toggle, "ShurikenToggle");
InitStyle(out this.m_ToggleMixed, "ShurikenToggleMixed");
InitStyle(out this.m_SelectionMarker, "IN ThumbnailShadow");
InitStyle(out this.m_ToolbarButtonLeftAlignText, "ToolbarButton");
this.m_CustomDataWindow = new GUIStyle(GUI.skin.window);
this.m_CustomDataWindow.font = EditorStyles.miniFont;
this.m_EmitterHeaderStyle.clipping = TextClipping.Clip;
this.m_EmitterHeaderStyle.padding.right = 45;
this.m_ToolbarButtonLeftAlignText = new GUIStyle(this.m_ToolbarButtonLeftAlignText);
this.m_ToolbarButtonLeftAlignText.alignment = TextAnchor.MiddleLeft;
this.m_ModulePadding = new GUIStyle();
this.m_ModulePadding.padding = new RectOffset(3, 3, 4, 2);
InitStyle(out m_FloatField, EditorStyles.numberField, s => s.fontSize = 9);
InitStyle(out m_HeaderBg, s => {
s.border = new RectOffset(11, 15, 10, 15);
s.normal.background = m_BgTexture;
s.active.background = m_BgTextureActive;
s.hover.background = m_BgTexture;
});
InitStyle(out m_HeaderTitle, s => {
s.fontStyle = FontStyle.Bold;
s.fontSize = 10;
});
InitStyle(out m_Bg, s => {
s.border = new RectOffset(5, 5, 5, 5);
s.normal.background = m_BgTextureWire;
});
InitStyle(out m_BgSmall, s => {
s.border = new RectOffset(3, 3, 3, 3);
s.normal.background = m_BgTextureWireSmall;
});
InitStyle(out m_AddNewModule,EditorStyles.miniButtonMid , s => {
s.fontSize = 9;
});
InitStyle(out m_Text, /*EditorStyles.label, */s => {
s.fontSize = 10;
});
InitStyle(out m_TextSmall, /*EditorStyles.label, */s => {
s.fontSize = 7;
});
InitStyle(out m_TextBold, /*EditorStyles.label, */s => {
s.fontStyle = FontStyle.Bold;
s.fontSize = 10;
});
InitStyle(out m_TextBoldBig, /*EditorStyles.label, */s => {
s.fontStyle = FontStyle.Bold;
s.fontSize = 12;
});
InitStyle(out m_TextField, EditorStyles.textField, s => {
s.fontSize = 9;
});
InitStyle(out m_MiniLeft, EditorStyles.miniButtonLeft, s => {
s.fontSize = 9;
});
InitStyle(out m_MiniMid, EditorStyles.miniButtonMid, s => {
s.fontSize = 9;
});
InitStyle(out m_MiniRight, EditorStyles.miniButtonRight, s => {
s.fontSize = 9;
});
InitStyle(out m_Obj, EditorStyles.objectField, s => {
s.fontSize = 9;
});
}
private static void InitStyle(out GUIStyle normal, string name)
{
normal = FindStyle(name);
}
private delegate void Initter(GUIStyle style);
private static void InitStyle(out GUIStyle normal, GUIStyle other, Initter initter)
{
normal = new GUIStyle(other);
initter(normal);
}
private static void InitStyle(out GUIStyle normal, Initter initter)
{
normal = new GUIStyle();
initter(normal);
}
private static void InitStyle(out GUIStyle normal, out GUIStyle bold, string name)
{
InitStyle(out normal, name);
bold = new GUIStyle(normal);
bold.font = EditorStyles.miniBoldFont;
}
private static GUIStyle FindStyle(string styleName)
{
return styleName;
}
}
}
|