소스 검색

Fixed story UI flickering

jamesperet 2 년 전
부모
커밋
f033f87694
3개의 변경된 파일15개의 추가작업 그리고 8개의 파일을 삭제
  1. 1 1
      Readme.md
  2. 13 6
      Runtime/UI/StoryViewUI.cs
  3. 1 1
      package.json

+ 1 - 1
Readme.md

@@ -1,4 +1,4 @@
-# 📦 KairoEngine.StorySystem v0.1.5
+# 📦 KairoEngine.StorySystem v0.1.6
 
 The Story System uses the Ink Language and runtime to navigate through a story written in a plain text file. This package contains the Story Module that receives an ink story and runs it. The story can show lines and branches, execute functions in unity and wait for events. Unity also has an API for navigating, getting and setting variables in the story.
 

+ 13 - 6
Runtime/UI/StoryViewUI.cs

@@ -17,6 +17,7 @@ namespace KairoEngine.StorySystem.UI
         public Transform panel;
         
         [BoxGroup("Story Lines")]public bool showLines = false;
+        [BoxGroup("Story Lines")] public bool skipEmptyLines = true;
         [BoxGroup("Story Lines"), ShowIf("@showLines")] public bool showMultipleLines = true;
         [BoxGroup("Story Lines"), ShowIf("@showLines && showMultipleLines")] public bool destroyLinesAfterPath = true;
         [BoxGroup("Story Lines"), ShowIf("@showLines && showMultipleLines")] public GameObject storyLinePrefab;
@@ -59,13 +60,15 @@ namespace KairoEngine.StorySystem.UI
             if(buttons != null)
             {
                 for (int i = 0; i < buttons.Count; i++) Destroy(buttons[i]);
+                buttons.Clear();
             }
-            buttons.Clear();
-            GameObject[] oldButtons = branchContainer.GetComponentsInChildren<GameObject>();
-            if(oldButtons != null)
-            {
-                for (int i = 0; i < oldButtons.Length; i++) Destroy(oldButtons[i]);
-            }
+            else buttons = new List<GameObject>();
+            //GameObject[] oldButtons = null;
+            //if(branchContainer != null) oldButtons = branchContainer.gameObject.GetComponentsInChildren<GameObject>();
+            // if(oldButtons != null)
+            // {
+            //     for (int i = 0; i < oldButtons.Length; i++) Destroy(oldButtons[i]);
+            // }
             for (int i = 0; i < prePopulateButtons; i++)
             {
                 GameObject obj = Instantiate(storyBranchPrefab, branchContainer);
@@ -89,6 +92,10 @@ namespace KairoEngine.StorySystem.UI
 
         private void OnStoryStep(StoryStepData storyStep)
         {
+            if(skipEmptyLines)
+            {
+                if(storyStep.text == "" && storyStep.branches == null) return;
+            }
             switch (storyStep.category)
             {
                 case StoryStepType.Line:

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
     "name": "at.kairoscope.kairoengine.story-system",
     "displayName": "KairoEngine Story System",
-    "version": "0.1.5",
+    "version": "0.1.6",
     "unity": "2020.3",
     "description": "Kairoengine story system based on the Ink language.",
     "dependencies": {