ReadMeEditor.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using UnityEngine;
  2. using UnityEditor;
  3. using System.Collections;
  4. namespace TerrainComposer2
  5. {
  6. [CustomEditor (typeof(ReadMe))]
  7. public class ReadMeEditor : Editor
  8. {
  9. public override void OnInspectorGUI()
  10. {
  11. ReadMe r = (ReadMe)target;
  12. Event eventCurrent = Event.current;
  13. GUI.changed = false;
  14. if (eventCurrent.control && eventCurrent.shift && eventCurrent.keyCode == KeyCode.E && eventCurrent.type == EventType.KeyDown)
  15. {
  16. r.buttonEdit = !r.buttonEdit;
  17. GUI.changed = true;
  18. }
  19. GUILayout.Space(5);
  20. if (r.buttonEdit)
  21. {
  22. r.readme = EditorGUILayout.TextArea(r.readme);
  23. r.buttonLink = EditorGUILayout.TextField(r.buttonLink);
  24. }
  25. else
  26. {
  27. EditorGUILayout.TextArea(r.readme);
  28. GUILayout.Space(5);
  29. GUI.backgroundColor = Color.green;
  30. if (GUILayout.Button("Download Examples Pack"))
  31. {
  32. Application.OpenURL("https://mega.nz/#!7QBj3YzR!yHXkhDY2Njvk0obqSA36vzn5EVcN4biRC15nJSxK4ao");
  33. }
  34. if (GUILayout.Button("Download Stamp Pack"))
  35. {
  36. Application.OpenURL("https://mega.nz/#!HNIjxZZA!OQTmlM1jiT5rOCPz7_PZBJ-8UwJOPOsW-ghs25wHAik");
  37. }
  38. if (GUILayout.Button("Documentation"))
  39. {
  40. Application.OpenURL("http://www.terraincomposer.com/terraincomposer2-documentation/");
  41. }
  42. GUI.backgroundColor = Color.white;
  43. }
  44. if (GUI.changed) EditorUtility.SetDirty(target);
  45. }
  46. }
  47. }