-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAlfa_Editor.cs
More file actions
151 lines (91 loc) · 3.54 KB
/
Copy pathAlfa_Editor.cs
File metadata and controls
151 lines (91 loc) · 3.54 KB
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
using UnityEngine;
using UnityEditor;
using UnityEngine.UI;
public class Alfa_Editor : EditorWindow
{
/// <summary>
[Range(0.1f,1f)]
static float sizeMultiplier;
/// </summary>
string guide;
static GameObject ImageObject = null;
static string hata = "Bildirici";
[MenuItem("Alpha/AlphaEditor _%#&I")]
static void ramo()
{
Alfa_Editor window = (Alfa_Editor)EditorWindow.GetWindow(typeof(Alfa_Editor), true, "Alpha Editor Window");
window.Show();
}
void OnGUI()
{
sizeMultiplier = EditorGUILayout.Slider(sizeMultiplier, 0.1f, 1.0f);
ImageObject = (GameObject)EditorGUI.ObjectField(new Rect(3, 35, position.width - 6, 20), "Find Dependency", ImageObject, typeof(GameObject));
if (ImageObject !=null)
if (GUI.Button(new Rect(3, 60, position.width - 6, 20), "Check Dependencies"))
Selection.objects = EditorUtility.CollectDependencies(new GameObject[] { ImageObject });
if (GUI.Button(new Rect(3, 105, position.width -6, 20), "Alpha 0"))
{
Alpha_0();
}
if (GUI.Button(new Rect(3, 135, position.width -6, 20), "Alpha Slider"))
{
Alpha_100();
}
if (GUI.Button(new Rect(3, 165, position.width -6, 20), "Alpha 255"))
{
Alpha_255();
}
else if (ImageObject == null)
EditorGUI.LabelField(new Rect(0, 65, position.width - 6, 20), "Missing:"+ " Select an object first");
EditorGUI.LabelField(new Rect(3, 200, position.width - 6, 20), hata, EditorStyles.boldLabel);
EditorGUI.LabelField(new Rect(3, 265, position.width - 6, 40), "Kodun Çalışması için \nInpector açık olmalı", EditorStyles.boldLabel);
}
[MenuItem("Alpha/Alpha_0 _&v")]
static void Alpha_0()
{
if (ImageObject != null && ImageObject.GetComponent<Image>() != null)
{
Debug.Log("alpha bir foreach");
var a_color_0 = ImageObject.GetComponent<Image>().color;
a_color_0.a = 0;
ImageObject.GetComponent<Image>().color = a_color_0;
hata = "Alpha = 0";
Debug.Log("alpha bir color");
}
else
{
Debug.Log("İmage seç Lapara ");
hata = "İmage seç, Lapara!!!";
}
}
[MenuItem("Alpha/Alpha_100 _&b")]
static void Alpha_100()
{
if ( ImageObject != null && ImageObject.GetComponent<Image>() != null)
{
var a_color_100 = ImageObject.GetComponent<Image>().color;
a_color_100.a = sizeMultiplier;
ImageObject.GetComponent<Image>().color = a_color_100;
hata = "Yeni Alpha Değeri : " + sizeMultiplier;
}
else
{ Debug.Log("İmage seç, Lapara ");
hata = "İmage seç, Lapara";
}
}
[MenuItem("Alpha/Alpha_255 _&n")]
static void Alpha_255()
{
if (ImageObject != null && ImageObject.GetComponent<Image>() != null)
{
var a_color_255 = ImageObject.GetComponent<Image>().color;
a_color_255.a = 1f;
ImageObject.GetComponent<Image>().color = a_color_255;
hata = "Alpha = 255";
}
else
{ Debug.Log("İmage seç Lapara ");
hata = "Laa, İmage seç, Lapara";
}
}
}