A game about forced loneliness, made by TACStudios
at master 47 lines 1.9 kB view raw
1using System.Collections; 2using System.Collections.Generic; 3using UnityEditor; 4using UnityEngine; 5namespace UnityEditor.U2D.Sprites 6{ 7 internal class SpriteEditorWindowSettings : SettingsProvider 8 { 9 public const string kSettingsUniqueKey = "UnityEditor.U2D.Sprites/SpriteEditorWindow"; 10 public const string kShowRevertConfirmation = kSettingsUniqueKey + "RevertConfirmation"; 11 public const string kShowApplyConfirmation = kSettingsUniqueKey + "ApplyConfirmation"; 12 public static readonly GUIContent kShowRevertConfirmationLabel = EditorGUIUtility.TrTextContent("Show Revert Confirmation"); 13 public static readonly GUIContent kShowApplyConfirmationLabel = EditorGUIUtility.TrTextContent("Show Apply Confirmation"); 14 15 public SpriteEditorWindowSettings() : base("Preferences/2D/Sprite Editor Window", SettingsScope.User) 16 { 17 guiHandler = OnGUI; 18 } 19 20 [SettingsProvider] 21 private static SettingsProvider CreateSettingsProvider() 22 { 23 return new SpriteEditorWindowSettings() 24 { 25 guiHandler = SettingsGUI 26 }; 27 } 28 29 private static void SettingsGUI(string searchContext) 30 { 31 showApplyConfirmation = EditorGUILayout.Toggle(kShowApplyConfirmationLabel, showApplyConfirmation); 32 showRevertConfirmation = EditorGUILayout.Toggle(kShowRevertConfirmationLabel, showRevertConfirmation); 33 } 34 35 public static bool showRevertConfirmation 36 { 37 get { return EditorPrefs.GetBool(kShowRevertConfirmation, false); } 38 set { EditorPrefs.SetBool(kShowRevertConfirmation, value); } 39 } 40 41 public static bool showApplyConfirmation 42 { 43 get { return EditorPrefs.GetBool(kShowApplyConfirmation, false); } 44 set { EditorPrefs.SetBool(kShowApplyConfirmation, value); } 45 } 46 } 47}