걍 안까먹을려고 마이피에 저장할려고 써봐요..ㅋ
void DrawWindowForSpriteRenderer(int windowID)
{
ActionCam /s!crip/ = (ActionCam)target;
GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);
buttonStyle.margin = new RectOffset(0, 5, 2, 0);
GUILayout.Label("z,c,s,x : move pos\n a,d : go_Back \n b,m,h,n : angle \n o,p : rotate \n zero pos : F (G) \n mouse right click : target \n save pos : L(K-update)");
}
void OnSceneGUI()
{
ActionCam /s!crip/ = (ActionCam)target;
Event e = Event.current;
EditorGUI.BeginChangeCheck();
Handles.BeginGUI();
Rect windowRect = new Rect(0, Screen.height - 150, 300, 150);
GUILayout.Window(666, windowRect, DrawWindowForSpriteRenderer, "ActionCam Tool");
GUILayout.BeginHorizontal();
for (int i = 0; i < 7; i++)
{
if (GUILayout.Button("" + (i + 1), GUILayout.Width(24)))
{
if(/s!crip/._My_Char)
/s!crip/._My_Char.Play(i + 1);
}
}
GUILayout.EndHorizontal();
Handles.EndGUI();
Handles.CubeHandleCap(0, /s!crip/.cam.transform.p-osition, /s!crip/.cam.transform.localRotation, 0.5f, EventType.Repaint);
switch (e.type)
{
case EventType.keyDown:
{
if (Event.current.keyCode == (KeyCode.O))
{
}
}
break;
}
if (GUI.changed)
EditorUtility.SetDirty(myTarget);
}
///////
void OnEnable()
{
bError = false;
SoundManager sm = GameObject.FindObjectOfType<SoundManager>();
if(!sm)
{
bError = true;
ErrorText = "Sound Manager Not Found!";
return;
}
sndList = new string[sm.Effect_Clip.Length+1];
int p = 1;
sndList[0] = "NONE";
foreach (SndClass s in sm.Effect_Clip)
{
sndList[p] = s.ClipName;
p++;
}
EffectManager em = GameObject.FindObjectOfType<EffectManager>();
if (!em)
{
bError = true;
ErrorText = "Effect Manager Not Found!";
return;
}
effList = new string[em.EffectObj.Length+1];
effList[0] = "NONE";
p = 1;
foreach (GameObject g in em.EffectObj)
{
if(g != null)
effList[p] = g.ToString();
else
effList[p] = "null";
p++;
}
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
if(bError)
{
EditorGUILayout.LabelField(ErrorText);
return;
}
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
PlayEffect myTarget = (PlayEffect)target;
for (int i = 0; i < myTarget._Effect.Count; i++)
{
GUILayout.BeginHorizontal();
EditorGUILayout.LabelField(string.Format("LIST : {0}", i));
if (GUILayout.Button("Delete"))
{
myTarget._Effect.Remove(myTarget._Effect[i]);
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
myTarget._Effect[i].Damage = EditorGUILayout.Toggle("",myTarget._Effect[i].Damage,GUILayout.Width(30));
EditorGUILayout.LabelField(string.Format("Effect",i),GUILayout.Width(80));
myTarget._Effect[i].EffectNum = EditorGUILayout.Popup(myTarget._Effect[i].EffectNum, effList, GUILayout.Width(80));
EditorGUILayout.LabelField(string.Format("Sound", i), GUILayout.Width(80));
myTarget._Effect[i].SndNum = EditorGUILayout.Popup(myTarget._Effect[i].SndNum, sndList, GUILayout.Width(80));
GUILayout.EndHorizontal();
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
}
if (GUI.changed)
EditorUtility.SetDirty(myTarget);
if (GUILayout.Button("Add"))
{
EffectList el = new EffectList();
myTarget._Effect.Add(el);
}
}