private void DisplayPresetPicker()
    {
        GUILayout.BeginHorizontal();
        GUILayout.Label("Current preset", EditorStyles.boldLabel, GUILayout.Width(150));
        int index = EditorGUILayout.Popup(availablePresets.IndexOf(currentPreset.loadName), availablePresets.ToArray());

        if (index != availablePresets.IndexOf(currentPreset.loadName))
        {
            if (PresetFileLoader.SavePreset(currentPreset))
            {
                currentPreset = PresetFileLoader.LoadPreset(availablePresets [index]);
            }
        }
        if (GUILayout.Button("NEW", GUILayout.Width(38)))
        {
            CreateNewPreset();
        }
        GUILayout.EndHorizontal();
        EditorGUI.BeginChangeCheck();
        currentPreset.presetName = GUILayout.TextField(currentPreset.presetName);
        if (EditorGUI.EndChangeCheck() && currentPreset.presetName.Length > 0)
        {
            if (PresetFileLoader.SavePreset(currentPreset))
            {
                availablePresets = PresetFileLoader.LoadPresets();
            }
        }
    }
    private void CreateNewPreset()
    {
        TextureConverterPreset tempPreset = ScriptableObject.CreateInstance <TextureConverterPreset> ();

        //	Debug.Log (tempPreset.loadName);
        while (availablePresets.Contains(tempPreset.loadName))
        {
            tempPreset.loadName   += "I";
            tempPreset.presetName += "I";
        }
        PresetFileLoader.SavePreset(tempPreset);
        string newPreset = tempPreset.loadName;

        availablePresets = PresetFileLoader.LoadPresets();
        currentPreset    = PresetFileLoader.LoadPreset(newPreset);
    }
    private void OnEnable()
    {
//		Debug.Log ("OnEnableCalled");
        availablePresets = PresetFileLoader.LoadPresets();
        if (availablePresets.Count == 0)
        {
//			Debug.Log ("creating");
            TextureConverterPreset tempPreset = ScriptableObject.CreateInstance <TextureConverterPreset> ();
            Debug.Log(tempPreset.loadName);
            if (PresetFileLoader.SavePreset(tempPreset))
            {
                availablePresets = PresetFileLoader.LoadPresets();
            }
        }
        currentPreset = PresetFileLoader.LoadPreset(availablePresets [0]);
//		Debug.Log (availablePresets [0]);

//		Undo.undoRedoPerformed += OnUndoRedo;
    }
    private void OnDisable()
    {
        PresetFileLoader.SavePreset(currentPreset);
//		Undo.undoRedoPerformed -= OnUndoRedo;
    }
예제 #5
0
 public LoosePresetProvider(PresetFileLoader presetLoader, IEngineInfoProvider engineInfo, ILogger <LoosePresetProvider> logger)
 {
     _presetLoader = presetLoader;
     _engineInfo   = engineInfo;
     _logger       = logger;
 }