embed:tutorial2
差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
embed:tutorial2 [2023/01/17 20:18] – machiaworx | embed:tutorial2 [2023/01/21 13:15] (現在) – [実装] machiaworx | ||
---|---|---|---|
行 31: | 行 31: | ||
using Miniscript; | using Miniscript; | ||
using TMPro; | using TMPro; | ||
- | |||
public class ScriptMover : MonoBehaviour | public class ScriptMover : MonoBehaviour | ||
行 40: | 行 39: | ||
public Interpreter interpreter; | public Interpreter interpreter; | ||
- | public string globalVarName=""; | + | |
+ | | ||
private int frame=0; | private int frame=0; | ||
| | ||
行 53: | 行 53: | ||
interpreter.implicitOutput = (string s,bool t) => Debug.Log($" | interpreter.implicitOutput = (string s,bool t) => Debug.Log($" | ||
interpreter.errorOutput = (string s,bool t) => { | interpreter.errorOutput = (string s,bool t) => { | ||
- | |||
// | // | ||
Debug.LogError(s); | Debug.LogError(s); | ||
行 70: | 行 69: | ||
}; | }; | ||
+ | // | ||
RunScript(loadText); | RunScript(loadText); | ||
} | } | ||
行 76: | 行 76: | ||
// | // | ||
string extraSource = " | string extraSource = " | ||
+ | | ||
+ | // | ||
interpreter.Reset(extraSource+sourceCode); | interpreter.Reset(extraSource+sourceCode); | ||
| | ||
行 81: | 行 83: | ||
interpreter.Compile(); | interpreter.Compile(); | ||
- | // | + | // |
ValMap data = new ValMap(); | ValMap data = new ValMap(); | ||
data[" | data[" | ||
行 87: | 行 89: | ||
data[" | data[" | ||
data[" | data[" | ||
+ | | ||
+ | // | ||
interpreter.SetGlobalValue(globalVarName, | interpreter.SetGlobalValue(globalVarName, | ||
} | } | ||
行 101: | 行 105: | ||
#endif | #endif | ||
} | } | ||
+ | | ||
+ | // | ||
UpdateFromScript(); | UpdateFromScript(); | ||
} | } | ||
行 107: | 行 113: | ||
ValMap data = null; | ValMap data = null; | ||
try { | try { | ||
+ | // | ||
data = interpreter.GetGlobalValue(globalVarName) as ValMap; | data = interpreter.GetGlobalValue(globalVarName) as ValMap; | ||
} catch (UndefinedIdentifierException) { | } catch (UndefinedIdentifierException) { |
embed/tutorial2.1673954310.txt.gz · 最終更新: 2023/01/17 20:18 by machiaworx