Lunatic-Works / Nova

Programmer-friendly framework for visual novels (VN) / text-based adventure games (AVG) on Unity
MIT License
597 stars 78 forks source link

奇怪的问题 求助 - 当我运行colorless 的工程时,到第二章 #62

Closed mrwill84 closed 12 months ago

mrwill84 commented 12 months ago

Nova的大佬你们好: 非常nice的工程,我发现了一个问题不知道是不是都会出现

<| show(陈高天, 'normal', {0, -0.3, 0.4}) |> show也可以显示角色立绘,gaotian对应的就是Hierarchy里的Characters/Gaotian

ParserException: Syntax error while parsing lazy execution block. characterName: , displayName: , dialogue: stage: Default, code: __Nova.action_coroutine = coroutine.start(function() Nova.coroutineHelper:AcquireActionPause() action_before_lazy_block('') -- Begin original code block show(陈高天, 'normal') -- End original code block action_after_lazy_block('') Nova.coroutineHelper:ReleaseActionPause() end) Nova.DialogueEntryParser.ParseDialogueEntries (System.Collections.Generic.IReadOnlyList`1[T] chunks) (at Assets/Nova/Sources/Core/ScriptParsing/DialogueEntryParser.cs:206) Nova.ScriptLoader.AddDeferredDialogueChunks (Nova.FlowChartNode node) (at Assets/Nova/Sources/Core/ScriptParsing/ScriptLoader.cs:233) 我debug 看到是个regex解析问题 ,但是我看一章也用了这个markdown的问题

([^]*)` 我在网上的regex c#版也试了 应该是正常的 ,求助如何解决

woct0rdho commented 12 months ago

我这边没复现出这个问题。你用的Nova是master branch的最新版吗?改过里面的东西吗?你的Unity是什么版本?

mrwill84 commented 12 months ago

没改动过,今天下午下载. unity版本是2021.1.6f1 .master分支

woct0rdho commented 12 months ago

首先,Syntax error while parsing lazy execution block.说的应该不是regex或者Markdown的问题,lazy execution block(<| |>里面的代码块)和文本会首先被parser分开,代码块里只有注释会用regex处理

你先试试重启Unity,然后清空存档,然后从头开始运行教程,看看这个bug会不会稳定出现,出现的时候(Unity暂停的时候)屏幕上显示的是哪句话

然后,既然报错里说正在parse的代码是show(陈高天, 'normal'),你把tut02.txt里的这一句删掉,看看会不会有同样的报错

woct0rdho commented 12 months ago

话说你的操作系统是什么?也许macOS上Lua处理中文的方法不一样(但也不应该在这个陈高天的时候才报错。。)

mrwill84 commented 12 months ago

mac 系统 ,挂载了 tut1的最后一句 ,这时候开始jump了

然后就是parse tut2里面的东西的时候

ParserException: Syntax error while parsing lazy execution block. characterName: , displayName: , dialogue: show也可以显示角色立绘,陈高天对应的就是Hierarchy里的Characters/Gaotian的GameCharacterController.luaGlobalName stage: Default, code: __Nova.action_coroutine = coroutine.start(function() Nova.coroutineHelper:AcquireActionPause() action_before_lazy_block('') -- Begin original code block show(陈高天, 'normal', {0, -0.3, 0.4}) -- End original code block action_after_lazy_block('') Nova.coroutineHelper:ReleaseActionPause() end) Nova.DialogueEntryParser.ParseDialogueEntries (System.Collections.Generic.IReadOnlyList1[T] chunks) (at Assets/Nova/Sources/Core/ScriptParsing/DialogueEntryParser.cs:206) Nova.ScriptLoader.AddDeferredDialogueChunks (Nova.FlowChartNode node) (at Assets/Nova/Sources/Core/ScriptParsing/ScriptLoader.cs:233) Nova.GameState.MoveToNextNode (Nova.FlowChartNode nextNode) (at Assets/Nova/Sources/Core/GameState.cs:509) Nova.GameState.StepAtEndOfNode () (at Assets/Nova/Sources/Core/GameState.cs:483) Nova.GameState.Step () (at Assets/Nova/Sources/Core/GameState.cs:666) Nova.GameViewController.Step () (at Assets/Nova/Sources/Scripts/UI/Views/GameViewController.cs:105) Nova.GameViewInput.ClickForward () (at Assets/Nova/Sources/Scripts/UI/Dialogue/GameViewInput.cs:319) Nova.GameViewInput.OnPointerUp (UnityEngine.EventSystems.PointerEventData _eventData) (at Assets/Nova/Sources/Scripts/UI/Dialogue/GameViewInput.cs:234) UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerUpHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:50) UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction1[T1] functor) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:272) UnityEngine.EventSystems.EventSystem:Update() (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:501)

mrwill84 commented 12 months ago

稳定复现目前

mrwill84 commented 12 months ago

var entries = DialogueEntryParser.ParseDialogueEntries(chunks); node.SetDialogueEntries(entries); 然后是 text = MarkdownCodePattern.Replace(text, @"$1"); 从log上看 这句已经成功了

mrwill84 commented 12 months ago

如果我删了 会崩在<| show(陈高天, 'cry') |> 改变一下立绘的表情 这句话

woct0rdho commented 12 months ago

你试试用revert_lua_name branch

跟 #60 有关,看样子这个PR改了之后在macOS上会有问题,等我们有空再考虑怎么改

mrwill84 commented 12 months ago

看样子是这个问题,用了这个分支好了