Пример #1
0
    protected void WriteAllComponents(ES2AutoSave autoSave, ES2Writer writer)
    {
        Component[] components = autoSave.GetComponents <Component>();

        foreach (Component c in components)
        {
            if (c == null)
            {
                continue;
            }

            ES2Type type;
            ES2AutoSaveComponentInfo info = autoSave.GetComponentInfo(c);

            type = ES2TypeManager.GetES2Type(c.GetType());
            if (type == null)
            {
                continue;
            }

            if (info == null)
            {
                info = new ES2AutoSaveComponentInfo(c, autoSave);
            }
            WriteVariableRecursive(autoSave, info, writer, c);
        }
    }
Пример #2
0
    protected void GetColumnsForAutoSave(ES2AutoSave autoSave, int hierarchyDepth)
    {
        ES2EditorColumn column = GetColumn(0);
        ES2EditorRow    row    = column.AddRow(autoSave.gameObject.name, autoSave, ES2EditorWindow.instance.style.saveButtonStyle, ES2EditorWindow.instance.style.saveButtonSelectedStyle, hierarchyDepth);

        if (autoSave.selected)
        {
            if (autoSave.selectionChanged)
            {
                ES2EditorAutoSaveUtility.UpdateAutoSave(autoSave);
            }

            GetComponentsColumnForAutoSave(autoSave, column, row);
        }

        if (autoSave.buttonSelected && autoSave.buttonSelectionChanged)
        {
            // Add support for any Components which are currently unsupported.
            Component[] components = autoSave.GetComponents <Component>();
            foreach (Component c in components)
            {
                // Handle unassigned components.
                if (c == null)
                {
                    continue;
                }
                // If this Component isn't currently supported, add support for it and isn't an ES2AutoSave.
                if (!ES2EditorTypeUtility.TypeIsSupported(c.GetType()) &&
                    !typeof(ES2AutoSave).IsAssignableFrom(c.GetType()) &&
                    !typeof(ES2AutoSaveManager).IsAssignableFrom(c.GetType()))
                {
                    ES2EditorTypeUtility.AddType(c.GetType());
                }
            }
        }

        foreach (Transform t in autoSave.transform)
        {
            ES2AutoSave child = ES2AutoSave.GetAutoSave(t.gameObject);
            if (child != null)
            {
                GetColumnsForAutoSave(child, hierarchyDepth + 1);
            }
        }
    }