Newer
Older
TheVengeance-Project-IADE-Unity2D / Assets / Ink / Demos / Basic Demo / Scripts / Editor / BasicInkExampleEditor.cs
@Rackday Rackday on 29 Oct 908 bytes Major Update
  1. using Ink.Runtime;
  2. using Ink.UnityIntegration;
  3. using UnityEditor;
  4. using UnityEngine;
  5. [CustomEditor(typeof(BasicInkExample))]
  6. [InitializeOnLoad]
  7. public class BasicInkExampleEditor : Editor {
  8. static bool storyExpanded;
  9. static BasicInkExampleEditor () {
  10. BasicInkExample.OnCreateStory += OnCreateStory;
  11. }
  12. static void OnCreateStory (Story story) {
  13. // If you'd like NOT to automatically show the window and attach (your teammates may appreciate it!) then replace "true" with "false" here.
  14. InkPlayerWindow window = InkPlayerWindow.GetWindow(true);
  15. if(window != null) InkPlayerWindow.Attach(story);
  16. }
  17. public override void OnInspectorGUI () {
  18. Repaint();
  19. base.OnInspectorGUI ();
  20. var realTarget = target as BasicInkExample;
  21. var story = realTarget.story;
  22. InkPlayerWindow.DrawStoryPropertyField(story, ref storyExpanded, new GUIContent("Story"));
  23. }
  24. }