kyperbelt / yarngdx Goto Github PK
View Code? Open in Web Editor NEWYarnGdx is a Libgdx Library for interactive dialogue in games! This is a port of [YarnSpinner](https://github.com/thesecretlab/YarnSpinner) by thesecretlab
License: MIT License
YarnGdx is a Libgdx Library for interactive dialogue in games! This is a port of [YarnSpinner](https://github.com/thesecretlab/YarnSpinner) by thesecretlab
License: MIT License
Kudos on this fantastic library - when compiling for a desktop target, it works great! I created my own experiment, which is kind of a refactored version of the included demo.
https://github.com/jojomickymack/yarn_dialog01
When compiling for an android target, however, anything that's not a text token will throw a 'TokeniserException' when the json or yarn.txt file is getting loaded. I reduced a script to starting with
<<if visited("Gravedigger") is true>>
(Gravedigger is the name of the node) and this is what I see
desktop
trying for the next token in line <<if visited("Gravedigger") is true>>
current_state.token_rules
5
regex \G\<\<
match?
true
rule.type
BeginCommand
line:1 col:2 text:<<
trying for the next token in line <<if visited("Gravedigger") is true>>
current_state.token_rules
8
regex \Gif(?!\w)
match?
true
rule.type
If
line:1 col:4 text:if
android
trying for the next token in line <<if visited("Gravedigger") is true>>
current_state.token_rules
5
regex \G\<\<
match?
true
I/System.out: rule.type
BeginCommand
line:1 col:2 text:<<
trying for the next token in line <<if visited("Gravedigger") is true>>
current_state.token_rules
8
regex \Gif(?!\w)
match?
false
The regex '\Gif(?!\w)' which is supposed to match the 'if' following the '<<' is not matching like it does when loading successfully on desktop. I believe that this is because of android's java 1.6 vs the desktop's java 1.8 and support for the regex '\G' flag - I see when I remove it from the 'addTransition' method, I'm able to match the if and everything else in the expression, but run into other issues.
I think this issue is fixable using a different system of parsing the line without relying on the \G (global - this means that the match is supposed to immediately follow the previous match - i.e - only when 'if' follows '<<' should this be true).
I'll play around with it - I'd really like to see this work for android as well as desktop since this is such a cool way of handling dialog trees.
YarnGdx/core/src/com/kyper/yarn/Loader.java
Line 111 in 0c3c2f0
One way to tackle this would be to try{...} catch{...} outside the for loop rather than inside of it - declaring the incrementing variable inside the try block.
We need the info in catch to properly log debugs, so my idea is that a reference of the last investigated node should be stored in the method scope
Hi guys, i really love this project, i have a little question (i dont know if is a bug or is my fault)
i notice if i apply colors to the text when create the file on https://yarnspinnertool.github.io/YarnEditor/
when read the file in my app then this crash. i am missing something?
(sorry my bad engish)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.