Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.4 KiB

  1. using UnityEditor;
  2. namespace AmplifyShaderEditor
  3. {
  4. [System.Serializable]
  5. public class OptionsWindow
  6. {
  7. private AmplifyShaderEditorWindow m_parentWindow = null;
  8. private bool m_coloredPorts = true;
  9. private bool m_multiLinePorts = true;
  10. private const string MultiLineId = "MultiLinePortsDefault";
  11. private const string ColorPortId = "ColoredPortsDefault";
  12. public OptionsWindow( AmplifyShaderEditorWindow parentWindow )
  13. {
  14. m_parentWindow = parentWindow;
  15. //Load ();
  16. }
  17. public void Init()
  18. {
  19. Load();
  20. }
  21. public void Destroy()
  22. {
  23. Save();
  24. }
  25. public void Save()
  26. {
  27. EditorPrefs.SetBool( ColorPortId, ColoredPorts );
  28. EditorPrefs.SetBool( MultiLineId, m_multiLinePorts );
  29. }
  30. public void Load()
  31. {
  32. ColoredPorts = EditorPrefs.GetBool( ColorPortId, true );
  33. m_multiLinePorts = EditorPrefs.GetBool( MultiLineId, true );
  34. }
  35. public bool ColoredPorts
  36. {
  37. get { return m_coloredPorts; }
  38. set
  39. {
  40. if ( m_coloredPorts != value )
  41. EditorPrefs.SetBool( ColorPortId, value );
  42. m_coloredPorts = value;
  43. }
  44. }
  45. public bool MultiLinePorts
  46. {
  47. get { return m_multiLinePorts; }
  48. set
  49. {
  50. if ( m_multiLinePorts != value )
  51. EditorPrefs.SetBool( MultiLineId, value );
  52. m_multiLinePorts = value;
  53. }
  54. }
  55. public AmplifyShaderEditorWindow ParentWindow { get { return m_parentWindow; } set { m_parentWindow = value; } }
  56. }
  57. }