예제 #1
0
 public void Initialize()
 {
     spawner = GetComponent <ItemSpawner>();
     spawner.EmptyContainer();
     spawner.LoadItem();
     spawner.Create();
 }
예제 #2
0
    public override void OnInspectorGUI()
    {
        //Shows Script
        GUI.enabled = false;
        EditorGUILayout.ObjectField("Script:", MonoScript.FromMonoBehaviour((ItemSpawner)target), typeof(ItemSpawner), false);
        GUI.enabled = true;

        //Editor Header
        EditorGUILayout.BeginVertical();
        EditorGUILayout.LabelField("ScrollView Properties", EditorStyles.boldLabel);
        EditorGUILayout.PropertyField(m_container, new GUIContent("Container"));
        EditorGUILayout.PropertyField(m_itemPrefab, new GUIContent("Prefab"));

        EditorGUILayout.PropertyField(m_type, new GUIContent("Item Type"));
        EditorGUILayout.EndVertical();

        //Editor Dynamic Body
        EditorGUILayout.BeginVertical();
        switch (spawner.type)
        {
        case ItemType.Map:
            EditorGUILayout.LabelField("Basic Data Paths", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_iconPath, new GUIContent("Icon Path"));
            EditorGUILayout.PropertyField(m_trimmingPath, new GUIContent("How To Trim"));

            EditorGUILayout.LabelField("Animatable Data Paths", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_animationPath, new GUIContent("Animation Path"));
            EditorGUILayout.PropertyField(m_backgroundPath, new GUIContent("Background Path"));

            EditorGUILayout.LabelField("Map Specific Data Paths", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_lockedPath, new GUIContent("Locked Path"));
            break;

        case ItemType.Body:
            EditorGUILayout.LabelField("Basic Data Paths", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_iconPath, new GUIContent("Icon Path"));
            EditorGUILayout.PropertyField(m_trimmingPath, new GUIContent("Requirement Trimmer"));

            EditorGUILayout.LabelField("Checkable Data Paths", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_checkPath, new GUIContent("Check Path"));

            EditorGUILayout.LabelField("Body Specific Data Paths", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_framePath, new GUIContent("Frame Path Trimmer"));
            break;

        case ItemType.Extra:
            EditorGUILayout.LabelField("Select Extra Type", EditorStyles.boldLabel);
            spawner.extraType = (ExtraItemType)EditorGUILayout.EnumPopup(new GUIContent("ExtraType"), spawner.extraType);

            EditorGUILayout.LabelField("Basic Data Paths", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_iconPath, new GUIContent("Icon Path"));
            EditorGUILayout.PropertyField(m_trimmingPath, new GUIContent("How To Trim"));

            EditorGUILayout.LabelField("Checkable Data Paths", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_checkPath, new GUIContent("Check Path"));

            EditorGUILayout.LabelField("Extra Specific Data Paths", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_extraPath, new GUIContent("Extra Path"));
            break;

        case ItemType.Special:
            EditorGUILayout.LabelField("Basic Data Paths", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_iconPath, new GUIContent("Icon Path"));
            EditorGUILayout.PropertyField(m_trimmingPath, new GUIContent("How To Trim"));

            EditorGUILayout.LabelField("Checkable Data Paths", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_checkPath, new GUIContent("Check Path"));

            EditorGUILayout.LabelField("Special Specific Data Paths", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_specialPath, new GUIContent("Special Path"));
            break;

        case ItemType.Flag:
            EditorGUILayout.LabelField("Basic Data Paths", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_iconPath, new GUIContent("Icon Path"));
            EditorGUILayout.PropertyField(m_trimmingPath, new GUIContent("How To Trim"));

            EditorGUILayout.LabelField("Animatable Data Paths", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_animationPath, new GUIContent("Animation Path"));
            EditorGUILayout.PropertyField(m_backgroundPath, new GUIContent("Background Path"));

            EditorGUILayout.LabelField("Checkable Data Paths", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_checkPath, new GUIContent("Check Path"));
            break;

        default:
            break;
        }
        EditorGUILayout.EndVertical();

        //Editor Footer
        EditorGUILayout.BeginVertical();
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PropertyField(m_itemName, new GUIContent("Name"));
        EditorGUILayout.PropertyField(m_itemDistance, new GUIContent("Distance"));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.PropertyField(m_PointManager, new GUIContent("Point Manager"));
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Empty Container"))
        {
            spawner.EmptyContainer();
        }
        if (GUILayout.Button("Load Resources"))
        {
            spawner.LoadItem();
        }
        EditorGUILayout.EndHorizontal();
        if (spawner.IsReadyToCreate)
        {
            if (GUILayout.Button("Create Items"))
            {
                spawner.Create();
            }
        }

        serializedObject.ApplyModifiedProperties();
    }