Exemplo n.º 1
0
        public GenericPresetLibraryInspector(UnityEngine.Object target, string header, Action <string> editButtonClicked)
        {
            this.m_Target = target;
            this.m_Header = header;
            this.m_EditButtonClickedCallback = editButtonClicked;
            string assetPath = AssetDatabase.GetAssetPath(this.m_Target.GetInstanceID());
            string text      = Path.GetExtension(assetPath);

            if (!string.IsNullOrEmpty(text))
            {
                text = text.TrimStart(new char[]
                {
                    '.'
                });
            }
            this.m_SaveLoadHelper          = new ScriptableObjectSaveLoadHelper <T>(text, SaveType.Text);
            this.m_Grid                    = new VerticalGrid();
            this.maxShowNumPresets         = 49;
            this.presetSize                = new Vector2(14f, 14f);
            this.lineSpacing               = 1f;
            this.useOnePixelOverlappedGrid = false;
            this.marginsForList            = new RectOffset(10, 10, 5, 5);
            this.marginsForGrid            = new RectOffset(10, 10, 5, 5);
            this.itemViewMode              = PresetLibraryEditorState.ItemViewMode.List;
        }
        public GenericPresetLibraryInspector(UnityEngine.Object target, string header, Action <string> editButtonClicked)
        {
            m_Target = target;
            m_Header = header;
            m_EditButtonClickedCallback = editButtonClicked;

            string assetPath = AssetDatabase.GetAssetPath(m_Target.GetInstanceID());
            string extension = Path.GetExtension(assetPath);

            if (!string.IsNullOrEmpty(extension))
            {
                extension = extension.TrimStart('.');
            }
            m_SaveLoadHelper = new ScriptableObjectSaveLoadHelper <T>(extension, SaveType.Text);
            m_Grid           = new VerticalGrid();

            // Default configuration
            maxShowNumPresets         = 49; // We clear some preview caches when they reach 50 (See AnimationCurvePreviewCache and GradientPreviewCache)
            presetSize                = new Vector2(14, 14);
            lineSpacing               = 1f;
            useOnePixelOverlappedGrid = false;
            marginsForList            = new RectOffset(10, 10, 5, 5);
            marginsForGrid            = new RectOffset(10, 10, 5, 5);
            itemViewMode              = PresetLibraryEditorState.ItemViewMode.List;
        }
Exemplo n.º 3
0
 public PresetLibraryEditor(ScriptableObjectSaveLoadHelper <T> helper, PresetLibraryEditorState state, Action <int, object> itemClickedCallback)
 {
     this.m_DragState                         = new DragState <T>();
     this.m_Grid                              = new VerticalGrid();
     this.m_MinMaxPreviewHeight               = new Vector2(14f, 64f);
     this.m_PreviewAspect                     = 8f;
     this.m_ShowAddNewPresetItem              = true;
     this.m_IsOpenForEdit                     = true;
     this.m_SaveLoadHelper                    = helper;
     this.m_State                             = state;
     this.m_ItemClickedCallback               = itemClickedCallback;
     this.settingsMenuRightMargin             = 10f;
     this.useOnePixelOverlappedGrid           = false;
     this.alwaysShowScrollAreaHorizontalLines = true;
     this.marginsForList                      = new RectOffset(10, 10, 5, 5);
     this.marginsForGrid                      = new RectOffset(5, 5, 5, 5);
     this.m_PresetLibraryFileLocation         = PresetLibraryLocations.GetFileLocationFromPath(this.currentLibraryWithoutExtension);
 }
        public GenericPresetLibraryInspector(Object target, string header, Action <string> editButtonClicked)
        {
            this.m_LastRepaintedWidth        = -1f;
            this.m_Target                    = target;
            this.m_Header                    = header;
            this.m_EditButtonClickedCallback = editButtonClicked;
            string extension = Path.GetExtension(AssetDatabase.GetAssetPath(this.m_Target.GetInstanceID()));

            if (!string.IsNullOrEmpty(extension))
            {
                char[] trimChars = new char[] { '.' };
                extension = extension.TrimStart(trimChars);
            }
            this.m_SaveLoadHelper          = new ScriptableObjectSaveLoadHelper <T>(extension, SaveType.Text);
            this.m_Grid                    = new VerticalGrid();
            this.maxShowNumPresets         = 0x31;
            this.presetSize                = new Vector2(14f, 14f);
            this.lineSpacing               = 1f;
            this.useOnePixelOverlappedGrid = false;
            this.marginsForList            = new RectOffset(10, 10, 5, 5);
            this.marginsForGrid            = new RectOffset(10, 10, 5, 5);
            this.itemViewMode              = PresetLibraryEditorState.ItemViewMode.List;
        }