add ckg
plantilla base para movimiento básico
This commit is contained in:
@@ -0,0 +1,267 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
|
||||
[CustomEditor (typeof(screenObjectivesSystem))]
|
||||
public class screenObjectivesSystemEditor : Editor
|
||||
{
|
||||
SerializedProperty showObjectivesActive;
|
||||
SerializedProperty objectiveIconList;
|
||||
SerializedProperty objectiveList;
|
||||
|
||||
SerializedProperty mainMapCreatorManagerName;
|
||||
|
||||
bool expanded;
|
||||
|
||||
GUIStyle buttonStyle = new GUIStyle ();
|
||||
|
||||
void OnEnable ()
|
||||
{
|
||||
showObjectivesActive = serializedObject.FindProperty ("showObjectivesActive");
|
||||
objectiveIconList = serializedObject.FindProperty ("objectiveIconList");
|
||||
objectiveList = serializedObject.FindProperty ("objectiveList");
|
||||
|
||||
mainMapCreatorManagerName = serializedObject.FindProperty ("mainMapCreatorManagerName");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI ()
|
||||
{
|
||||
GUILayout.BeginVertical (GUILayout.Height (30));
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
buttonStyle = new GUIStyle (GUI.skin.button);
|
||||
|
||||
buttonStyle.fontStyle = FontStyle.Bold;
|
||||
buttonStyle.fontSize = 12;
|
||||
|
||||
GUILayout.BeginVertical ("Main Settings", "window");
|
||||
EditorGUILayout.PropertyField (showObjectivesActive);
|
||||
GUILayout.EndVertical ();
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.BeginVertical ("Objective Icon List", "window");
|
||||
showObjectiveIconList (objectiveIconList);
|
||||
GUILayout.EndVertical ();
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.BeginVertical ("Objective List (DEBUG)", "window");
|
||||
showObjectiveList (objectiveList);
|
||||
GUILayout.EndVertical ();
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.BeginVertical ("Other Settings", "window");
|
||||
EditorGUILayout.PropertyField (mainMapCreatorManagerName);
|
||||
GUILayout.EndVertical ();
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.EndVertical ();
|
||||
if (GUI.changed) {
|
||||
serializedObject.ApplyModifiedProperties ();
|
||||
}
|
||||
}
|
||||
|
||||
void showObjectiveIconInfo (SerializedProperty list)
|
||||
{
|
||||
GUILayout.BeginVertical ("box");
|
||||
EditorGUILayout.PropertyField (list.FindPropertyRelative ("name"));
|
||||
EditorGUILayout.PropertyField (list.FindPropertyRelative ("iconInfoElement"));
|
||||
EditorGUILayout.PropertyField (list.FindPropertyRelative ("changeObjectiveColors"));
|
||||
if (list.FindPropertyRelative ("changeObjectiveColors").boolValue) {
|
||||
EditorGUILayout.PropertyField (list.FindPropertyRelative ("objectiveColor"));
|
||||
}
|
||||
EditorGUILayout.PropertyField (list.FindPropertyRelative ("minDefaultDistance"));
|
||||
GUILayout.EndVertical ();
|
||||
}
|
||||
|
||||
void showObjectiveIconList (SerializedProperty list)
|
||||
{
|
||||
GUILayout.BeginVertical ();
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
if (GUILayout.Button ("Show/Hide Objective Icon List", buttonStyle)) {
|
||||
list.isExpanded = !list.isExpanded;
|
||||
}
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
if (list.isExpanded) {
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUI.color = Color.cyan;
|
||||
EditorGUILayout.HelpBox ("Configure the icons used in every screen objective type", MessageType.None);
|
||||
GUI.color = Color.white;
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.Label ("Number Of Icons: \t" + list.arraySize);
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.BeginHorizontal ();
|
||||
if (GUILayout.Button ("Add Icon")) {
|
||||
list.arraySize++;
|
||||
}
|
||||
if (GUILayout.Button ("Clear List")) {
|
||||
list.arraySize = 0;
|
||||
}
|
||||
GUILayout.EndHorizontal ();
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.BeginHorizontal ();
|
||||
if (GUILayout.Button ("Expand All")) {
|
||||
for (int i = 0; i < list.arraySize; i++) {
|
||||
list.GetArrayElementAtIndex (i).isExpanded = true;
|
||||
}
|
||||
}
|
||||
if (GUILayout.Button ("Collapse All")) {
|
||||
for (int i = 0; i < list.arraySize; i++) {
|
||||
list.GetArrayElementAtIndex (i).isExpanded = false;
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal ();
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
for (int i = 0; i < list.arraySize; i++) {
|
||||
expanded = false;
|
||||
GUILayout.BeginHorizontal ();
|
||||
GUILayout.BeginHorizontal ("box");
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
if (i < list.arraySize && i >= 0) {
|
||||
EditorGUILayout.BeginVertical ();
|
||||
EditorGUILayout.PropertyField (list.GetArrayElementAtIndex (i), false);
|
||||
if (list.GetArrayElementAtIndex (i).isExpanded) {
|
||||
expanded = true;
|
||||
showObjectiveIconInfo (list.GetArrayElementAtIndex (i));
|
||||
}
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.EndVertical ();
|
||||
}
|
||||
GUILayout.EndHorizontal ();
|
||||
|
||||
if (expanded) {
|
||||
GUILayout.BeginVertical ();
|
||||
} else {
|
||||
GUILayout.BeginHorizontal ();
|
||||
}
|
||||
if (GUILayout.Button ("x")) {
|
||||
list.DeleteArrayElementAtIndex (i);
|
||||
}
|
||||
if (GUILayout.Button ("v")) {
|
||||
if (i >= 0) {
|
||||
list.MoveArrayElement (i, i + 1);
|
||||
}
|
||||
}
|
||||
if (GUILayout.Button ("^")) {
|
||||
if (i < list.arraySize) {
|
||||
list.MoveArrayElement (i, i - 1);
|
||||
}
|
||||
}
|
||||
if (expanded) {
|
||||
GUILayout.EndVertical ();
|
||||
} else {
|
||||
GUILayout.EndHorizontal ();
|
||||
}
|
||||
GUILayout.EndHorizontal ();
|
||||
}
|
||||
}
|
||||
GUILayout.EndVertical ();
|
||||
}
|
||||
|
||||
void showObjectiveListElement (SerializedProperty list)
|
||||
{
|
||||
GUILayout.BeginVertical ("box");
|
||||
EditorGUILayout.PropertyField (list.FindPropertyRelative ("Name"));
|
||||
EditorGUILayout.PropertyField (list.FindPropertyRelative ("mapObject"));
|
||||
EditorGUILayout.PropertyField (list.FindPropertyRelative ("iconTransform"));
|
||||
|
||||
EditorGUILayout.PropertyField (list.FindPropertyRelative ("onScreenIcon"));
|
||||
EditorGUILayout.PropertyField (list.FindPropertyRelative ("offScreenIcon"));
|
||||
EditorGUILayout.PropertyField (list.FindPropertyRelative ("iconText"));
|
||||
EditorGUILayout.PropertyField (list.FindPropertyRelative ("ID"));
|
||||
EditorGUILayout.PropertyField (list.FindPropertyRelative ("useCloseDistance"));
|
||||
EditorGUILayout.PropertyField (list.FindPropertyRelative ("closeDistance"));
|
||||
EditorGUILayout.PropertyField (list.FindPropertyRelative ("showOffScreenIcon"));
|
||||
EditorGUILayout.PropertyField (list.FindPropertyRelative ("showDistance"));
|
||||
EditorGUILayout.PropertyField (list.FindPropertyRelative ("iconOffset"));
|
||||
EditorGUILayout.PropertyField (list.FindPropertyRelative ("showIconPaused"));
|
||||
|
||||
GUILayout.EndVertical ();
|
||||
}
|
||||
|
||||
void showObjectiveList (SerializedProperty list)
|
||||
{
|
||||
GUILayout.BeginVertical ();
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
if (GUILayout.Button ("Show/Hide Objective List", buttonStyle)) {
|
||||
list.isExpanded = !list.isExpanded;
|
||||
}
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
if (list.isExpanded) {
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.Label ("Number Of Objectives: \t" + list.arraySize);
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.BeginHorizontal ();
|
||||
if (GUILayout.Button ("Expand All")) {
|
||||
for (int i = 0; i < list.arraySize; i++) {
|
||||
list.GetArrayElementAtIndex (i).isExpanded = true;
|
||||
}
|
||||
}
|
||||
if (GUILayout.Button ("Collapse All")) {
|
||||
for (int i = 0; i < list.arraySize; i++) {
|
||||
list.GetArrayElementAtIndex (i).isExpanded = false;
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal ();
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
for (int i = 0; i < list.arraySize; i++) {
|
||||
GUILayout.BeginHorizontal ();
|
||||
GUILayout.BeginHorizontal ("box");
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
if (i < list.arraySize && i >= 0) {
|
||||
EditorGUILayout.BeginVertical ();
|
||||
EditorGUILayout.PropertyField (list.GetArrayElementAtIndex (i),
|
||||
new GUIContent (list.GetArrayElementAtIndex (i).displayName + " - " + list.GetArrayElementAtIndex (i).FindPropertyRelative ("ID").intValue));
|
||||
if (list.GetArrayElementAtIndex (i).isExpanded) {
|
||||
expanded = true;
|
||||
showObjectiveListElement (list.GetArrayElementAtIndex (i));
|
||||
}
|
||||
|
||||
EditorGUILayout.Space ();
|
||||
|
||||
GUILayout.EndVertical ();
|
||||
}
|
||||
GUILayout.EndHorizontal ();
|
||||
GUILayout.EndHorizontal ();
|
||||
}
|
||||
}
|
||||
GUILayout.EndVertical ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user