Subversion Repository Public Repository

Nextrek

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
using UnityEngine;
using UnityEditor;
using System.Collections;
using AC;

[CustomEditor (typeof (ConstantID), true)]
public class ConstantIDEditor : Editor
{

	public override void OnInspectorGUI()
    {
		SharedGUI ();
	}
	
	
	protected void SharedGUI()
	{
		ConstantID _target = (ConstantID) target;

		EditorGUILayout.BeginVertical ("Button");

		EditorGUILayout.LabelField ("Constant ID number", EditorStyles.boldLabel);

		_target.autoManual = (AutoManual) EditorGUILayout.EnumPopup ("Set:", _target.autoManual);

		_target.retainInPrefab = EditorGUILayout.Toggle ("Retain in prefab?", _target.retainInPrefab);

		if (!_target.gameObject.activeInHierarchy)
		{
			// Prefab
			if (!_target.retainInPrefab && _target.constantID != 0)
			{
				_target.constantID = 0;
			}
			else if (_target.retainInPrefab && _target.constantID == 0)
			{
				_target.SetNewID_Prefab ();
			}
		}

		EditorGUILayout.BeginHorizontal ();
			EditorGUILayout.LabelField ("ID:", GUILayout.Width (50f));
			if (_target.autoManual == AutoManual.Automatic)
			{
				EditorGUILayout.LabelField (_target.constantID.ToString ());
			}
			else
			{
				_target.constantID = EditorGUILayout.IntField (_target.constantID);
			}
			if (GUILayout.Button ("Copy number"))
			{
				EditorGUIUtility.systemCopyBuffer = _target.constantID.ToString ();
			}
		EditorGUILayout.EndHorizontal ();

		EditorGUILayout.EndVertical ();

		EditorUtility.SetDirty(_target);
	}

}

Commits for Nextrek/SpaceCrew/SpaceCrew/Assets/AdventureCreator/Scripts/Save system/Editor/ConstantIDEditor.cs

Diff revisions: vs.
Revision Author Commited Message
83 FMMortaroli picture FMMortaroli Tue 13 May, 2014 11:32:51 +0000