public Block(ByteCodes opcode, int originAddress, int handlerOffset, int stackSize) { this.Opcode = opcode; this.HandlerOffset = handlerOffset; this.StackSize = stackSize; this.OriginAddress = originAddress; }
public override void ToByteCode(ByteCodes code) { List <byte> byteList = new List <byte>(); ISoundPlayer pl = ISoundPlayer.Instance; if (pl as ViNoSoundPlayer) { byteList.Add(Opcode.PLAY_SOUND); byteList.Add((byte)m_SoundType); byteList.Add((byte)m_SoundID); } else if (pl as SimpleSoundPlayer) { string tag = ""; switch (m_SoundType) { case SoundType.MUSIC: tag = "playbgm"; break; case SoundType.SE: tag = "playse"; break; case SoundType.VOICE: tag = "playvoice"; break; default: Debug.LogError("undefined SoundType : " + m_SoundType.ToString()); break; } string loopStr = loop ? "true" : "false"; CodeGenerator.AddPlaySoundCode(byteList, tag, m_SoundName, loopStr); } code.Add(byteList.ToArray()); ToByteCodeInternal(code); }
public void Visit(ASTNode_SetVar node) { mTailFlag.Push(false); node.rightNode.AcceptVisitor(this); mTailFlag.Pop(); if (node.address is LocalAddress) { ByteCodes.Add(ByteCodeEnum.POP_LOCAL); ByteCodes.Add(((LocalAddress)node.address).index); } else if (node.address is GlobalAddress) { ByteCodes.Add(ByteCodeEnum.POP_GLOBAL); ByteCodes.Add(((GlobalAddress)node.address).index); } else { var address = GetTranslatedFreeAddress((FreeAddress)node.address); ByteCodes.Add(ByteCodeEnum.POP_FREE); ByteCodes.Add(address.envIndex); ByteCodes.Add(address.index); } ByteCodes.Add(ByteCodeEnum.PUSH_LITERAL); ByteCodes.Add(GetLiteralIndex(null)); }
/// <summary> /// Tos the byte code. /// </summary> public override void ToByteCode(ByteCodes code) { List <byte> byteList = new List <byte>(); AddNodeCode(byteList); string nameHndName = (m_NameTextBox != null) ? m_NameTextBox.name : ""; string dialogHndName = (m_ViNoTextBox != null) ? m_ViNoTextBox.name : ""; for (int i = 0; i < dlgDataList.Count; i++) { DialogPartData dlgData = dlgDataList[i]; // if a item is not Checked , the item is shown. #if false if (!dlgData.active) { continue; } #endif string tag = GetSingleDialogIDNodeTag(dlgData.dialogID); ByteCodeScriptTools.AddNodeCode(byteList, tag); CodeGenerator.GenerateADialogCode(byteList, dlgData, nameHndName, dialogHndName); } code.Add(byteList.ToArray()); // To Byte codes this Children. ToByteCodeInternal(code); }
/// <summary> /// Compile the specified filename. /// </summary> /// <param name='filename'> /// Filename. /// </param> public void CompileInternalCode(string filename) { ByteCodes btcodes = CompileInternalCode(); // Save as ByteCode File Resources. SaveByteCodesToFile(filename, btcodes.GetCode()); }
public override void ToByteCode( ByteCodes code ) { List<byte> byteList = new List<byte>(); ISoundPlayer pl = ISoundPlayer.Instance; if( pl as ViNoSoundPlayer ){ byteList.Add( Opcode.PLAY_SOUND ); byteList.Add( (byte)m_SoundType ); byteList.Add( (byte)m_SoundID ); } else if( pl as SimpleSoundPlayer ) { string tag = ""; switch( m_SoundType ){ case SoundType.MUSIC: tag = "playbgm"; break; case SoundType.SE: tag = "playse"; break; case SoundType.VOICE: tag = "playvoice"; break; default: Debug.LogError( "undefined SoundType : " + m_SoundType.ToString() ); break; } string loopStr = loop ? "true" : "false"; CodeGenerator.AddPlaySoundCode( byteList , tag , m_SoundName , loopStr ); } code.Add( byteList.ToArray() ); ToByteCodeInternal( code ); }
/// <summary> /// Add an instruction to the end of the active program. /// </summary> /// <param name="opcode">The instruction opcode</param> /// <param name="data">Opcode data.</param> /// <param name="context">Parser context from which to infer line count information /// from source</param> /// <returns>The index of the NEXT instruction in the program.</returns> public int AddInstruction(ByteCodes opcode, int data, ParserRuleContext context) { Code.AddByte((byte)opcode); Code.AddUShort(data); advanceLineCounts(3, context); return(Code.Count); }
/// <summary> /// Add a single-byte instruction to the end of the active program. It is assumed /// to not correspond to actual user code and won't have line number matching. /// </summary> /// <param name="opcode">The instruction opcode</param> /// <returns>The index of the NEXT instruction in the program.</returns> public int AddInstruction(ByteCodes opcode) { if (AssertContextGiven) { throw new Exception("AddInstruction called without context"); } Code.AddByte((byte)opcode); return(Code.Count); }
public override void ToByteCode(ByteCodes code) { List <byte> byteList = new List <byte>(); // AddNodeCodeWithTag( byteList , name ); AddNodeCode(byteList); code.Add(byteList.ToArray()); ToByteCodeInternal(code); }
public override void ToByteCode( ByteCodes code ) { List<byte> byteList = new List<byte>(); // AddNodeCodeWithTag( byteList , name ); AddNodeCode( byteList ); CodeGenerator.AddSetTextCode( byteList , text , targetTextBox.name ); code.Add( byteList.ToArray() ); ToByteCodeInternal( code ); }
public override void ToByteCode(ByteCodes code) { List <byte> byteList = new List <byte>(); // AddNodeCodeWithTag( byteList , name ); AddNodeCode(byteList); CodeGenerator.AddSetTextCode(byteList, text, targetTextBox.name); code.Add(byteList.ToArray()); ToByteCodeInternal(code); }
public override void ToByteCode( ByteCodes code ) { base.ToByteCode( code ); List<byte> byteList = new List<byte>(); string target = GetTargetName(); // Debug.Log( "LoadImageTarget:" + target ); ByteCodeScriptTools.AddMessagingCode( byteList , target , OpcodeMessaging.SET_RESOURCE_AS_TEXTURE ); code.Add( byteList.ToArray() ); ToByteCodeInternal( code ); }
public override void ToByteCode( ByteCodes code ) { List<byte> byteList= new List<byte>(); // AddNodeCodeWithTag( byteList , name ); AddNodeCode( byteList ); // AddNodeCodeWithTag( byteList , GetNodeLabel() );//name + "_TEST_SEL" ); CodeGenerator.GenerateSelections( byteList , units , m_Title ); code.Add( byteList.ToArray() ); ToByteCodeInternal( code ); }
public override void ToByteCode(ByteCodes code) { base.ToByteCode(code); List <byte> byteList = new List <byte>(); string target = GetTargetName(); // Debug.Log( "LoadImageTarget:" + target ); ByteCodeScriptTools.AddMessagingCode(byteList, target, OpcodeMessaging.SET_RESOURCE_AS_TEXTURE); code.Add(byteList.ToArray()); ToByteCodeInternal(code); }
public override void ToByteCode( ByteCodes code ) { List<byte> byteList = new List<byte>(); // AddNodeCodeWithTag( byteList , name ); AddNodeCode( byteList ); ByteCodeScriptTools.AddTextLiteralCode( byteList , m_NextLevelName ); ByteCodeScriptTools.AddMessagingCode( byteList , "env" , OpcodeMessaging.LOAD_LEVEL ); code.Add( byteList.ToArray() ); ToByteCodeInternal( code ); }
public override void ToByteCode(ByteCodes code) { List <byte> byteList = new List <byte>(); // AddNodeCodeWithTag( byteList , name ); AddNodeCode(byteList); // AddNodeCodeWithTag( byteList , GetNodeLabel() );//name + "_TEST_SEL" ); CodeGenerator.GenerateSelections(byteList, units, m_Title); code.Add(byteList.ToArray()); ToByteCodeInternal(code); }
public override void ToByteCode(ByteCodes code) { List <byte> byteList = new List <byte>(); // AddNodeCodeWithTag( byteList , name ); AddNodeCode(byteList); ByteCodeScriptTools.AddTextLiteralCode(byteList, m_NextLevelName); ByteCodeScriptTools.AddMessagingCode(byteList, "env", OpcodeMessaging.LOAD_LEVEL); code.Add(byteList.ToArray()); ToByteCodeInternal(code); }
/// <summary> /// Tos the byte code. /// </summary> /// <param name='code'> /// Code. /// </param> public override void ToByteCode( ByteCodes code ) { List<byte> byteList = new List<byte>(); // AddNodeCodeWithTag( byteList , name ); AddNodeCode( byteList ); // AddNodeCodeWithTag( byteList , name ); CodeGenerator.GenerateWaitCode( byteList , m_WaitSec ); code.Add( byteList.ToArray() ); // ToByteCode this Children. ToByteCodeInternal( code ); }
public void Visit(ASTNode_Begin node) { for (int i = 0; i < node.nodes.Count - 1; ++i) { mTailFlag.Push(false); node.nodes[i].AcceptVisitor(this); mTailFlag.Pop(); ByteCodes.Add(ByteCodeEnum.POP1); } mTailFlag.Push(true); node.nodes.Last().AcceptVisitor(this); mTailFlag.Pop(); }
/// <summary> /// Tos the byte code. /// </summary> /// <param name='code'> /// Code. /// </param> public override void ToByteCode(ByteCodes code) { List <byte> byteList = new List <byte>(); // AddNodeCodeWithTag( byteList , name ); AddNodeCode(byteList); // AddNodeCodeWithTag( byteList , name ); CodeGenerator.GenerateWaitCode(byteList, m_WaitSec); code.Add(byteList.ToArray()); // ToByteCode this Children. ToByteCodeInternal(code); }
void TEST_ADD_CODE(ByteCodes btcodes, BaseNode[] nodes) { for (int i = 0; i < nodes.Length; i++) { FunctionNode sn = nodes[i] as FunctionNode; if (sn != this && nodes[i].enabled) { Debug.Log("node:" + nodes[i].name); nodes[i].ToByteCode(btcodes); } // else{ // Debug.Log( "the Node is Me !" ); // } } btcodes.Add(Opcode.STOP); }
public override void ToByteCode( ByteCodes code ) { base.ToByteCode( code ); List<byte> byteList = new List<byte>(); if( parent != null ){ ByteCodeScriptTools.AddCreateGOCode( byteList , parent.name ); } else{ ByteCodeScriptTools.AddCreateGOCode( byteList , "" ); } code.Add( byteList.ToArray () ); ToByteCodeInternal( code ); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: protected synchronized Class findClass(String name) throws ClassNotFoundException protected internal override Type FindClass(string name) { lock (this) { ByteCodes codes = _bytecodes.Remove(name); if (codes == null) { throw new ClassNotFoundException(name); } string packageName = name.Substring(0, name.LastIndexOf('.')); if (getPackage(packageName) == null) { definePackage(packageName, "", "", "", "", "", "", null); } return(defineClass(name, codes.Bytes(), null)); } }
public override void ToByteCode(ByteCodes code) { base.ToByteCode(code); List <byte> byteList = new List <byte>(); if (parent != null) { ByteCodeScriptTools.AddCreateGOCode(byteList, parent.name); } else { ByteCodeScriptTools.AddCreateGOCode(byteList, ""); } code.Add(byteList.ToArray()); ToByteCodeInternal(code); }
public override void ToByteCode(ByteCodes code) { List <byte> byteList = new List <byte>(); AddNodeCode(byteList); ISoundPlayer pl = ISoundPlayer.Instance; if (pl as ViNoSoundPlayer) { Hashtable tbl = new Hashtable(); tbl["name"] = m_SoundName; switch (m_SoundType) { case SoundType.MUSIC: tbl["category"] = "Music"; break; /* case SoundType.SE: * tbl[ "category" ] = "SE"; * break; * * case SoundType.VOICE: * tbl[ "category" ] = "Voice"; * break; * //*/ } tbl["fadeOutSeconds"] = m_FadeOutSeconds.ToString(); ByteCodeScriptTools.AddTablePairsCode(byteList, tbl); ByteCodeScriptTools.AddMessagingCode(byteList, "env", OpcodeMessaging.STOP_SOUND); } else if (pl as SimpleSoundPlayer) { Hashtable args = new Hashtable(); args["eventType"] = "fadeoutbgm"; int time = (int)(m_FadeOutSeconds * 1000f); args["time"] = time.ToString(); ByteCodeScriptTools.AddTablePairsCode(byteList, args); ByteCodeScriptTools.AddMessagingCode(byteList, " ", OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS); } code.Add(byteList.ToArray()); ToByteCodeInternal(code); }
public GameObject targetObject; // set a prefab. #endregion Fields #region Methods public override void ToByteCode( ByteCodes code ) { base.ToByteCode( code ); List<byte> byteList = new List<byte>(); // Add Parent Name. if( targetObject != null ){ ByteCodeScriptTools.AddTextLiteralCode( byteList , targetObject.name ) ; } else{ Debug.LogError( "DestroyObjectNode: target not set !" ); } byteList.Add( Opcode.DESTROY_OBJECT ); code.Add( byteList.ToArray () ); ToByteCodeInternal( code ); }
public override void ToByteCode( ByteCodes code ) { if( jumpTarget != null ){ List<byte> byteList = new List<byte>(); AddNodeCode( byteList ); string tag = jumpTarget.GetNodeTag( jumpTarget.name ); // TODO: GetNodeLabel ByteCodeScriptTools.AddJumpTargetCode( byteList , tag ); code.Add( byteList.ToArray() ); } else{ Debug.LogError( "JumpTargetNode:" + name + " isn't set jumpTarget." ); } ToByteCodeInternal( code ); }
public void InterpretAndPlay(string scenario) { CheckInstance(); SystemUtility.ClearAllTextBoxMessage(); VM vm = VM.Instance; vm.currentScenarioName = gameObject.name; ViNoToolkit.KAGInterpreter kag = new ViNoToolkit.KAGInterpreter(); List <byte> byteList = kag.Interpret(scenario); ByteCodes btcodes = new ByteCodes(byteList.ToArray()); btcodes.Add(Opcode.END); vm.SetCode(btcodes.GetCode()); vm.Run(); }
public void Visit(ASTNode_GetVar node) { if (node.address is LocalAddress) { ByteCodes.Add(ByteCodeEnum.PUSH_LOCAL); ByteCodes.Add(((LocalAddress)node.address).index); } else if (node.address is GlobalAddress) { ByteCodes.Add(ByteCodeEnum.PUSH_GLOBAL); ByteCodes.Add(((GlobalAddress)node.address).index); } else { var address = GetTranslatedFreeAddress((FreeAddress)node.address); ByteCodes.Add(ByteCodeEnum.PUSH_FREE); ByteCodes.Add(address.envIndex); ByteCodes.Add(address.index); } }
public override void ToByteCode(ByteCodes code) { if (jumpTarget != null) { List <byte> byteList = new List <byte>(); AddNodeCode(byteList); string tag = jumpTarget.GetNodeTag(jumpTarget.name); // TODO: GetNodeLabel ByteCodeScriptTools.AddJumpTargetCode(byteList, tag); code.Add(byteList.ToArray()); } else { Debug.LogError("JumpTargetNode:" + name + " isn't set jumpTarget."); } ToByteCodeInternal(code); }
public override void ToByteCode(ByteCodes code) { base.ToByteCode(code); List <byte> byteList = new List <byte>(); // Add Parent Name. if (targetObject != null) { ByteCodeScriptTools.AddTextLiteralCode(byteList, targetObject.name); } else { Debug.LogError("DestroyObjectNode: target not set !"); } byteList.Add(Opcode.DESTROY_OBJECT); code.Add(byteList.ToArray()); ToByteCodeInternal(code); }
public override void ToByteCode( ByteCodes code ) { List<byte> byteList = new List<byte>(); AddNodeCode( byteList ); ISoundPlayer pl = ISoundPlayer.Instance; if( pl as ViNoSoundPlayer ){ Hashtable tbl = new Hashtable(); tbl[ "name" ] = m_SoundName; switch( m_SoundType ){ case SoundType.MUSIC: tbl[ "category" ] = "Music"; break; /* case SoundType.SE: tbl[ "category" ] = "SE"; break; case SoundType.VOICE: tbl[ "category" ] = "Voice"; break; //*/ } tbl[ "fadeOutSeconds" ] = m_FadeOutSeconds.ToString(); ByteCodeScriptTools.AddTablePairsCode( byteList , tbl ); ByteCodeScriptTools.AddMessagingCode( byteList , "env" , OpcodeMessaging.STOP_SOUND ); } else if ( pl as SimpleSoundPlayer ){ Hashtable args = new Hashtable(); args[ "eventType" ] = "fadeoutbgm"; int time = (int)( m_FadeOutSeconds * 1000f ); args[ "time" ] = time.ToString(); ByteCodeScriptTools.AddTablePairsCode( byteList , args ); ByteCodeScriptTools.AddMessagingCode( byteList , " " , OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS ); } code.Add( byteList.ToArray() ); ToByteCodeInternal( code ); }
/// <summary> /// Tos the byte code. /// </summary> /// <param name='code'> /// Code. /// </param> public override void ToByteCode( ByteCodes code ) { List<byte> byteList = new List<byte>(); AddNodeCode( byteList ); #if false Hashtable args = new Hashtable(); args[ "eventType" ] = eventType; args[ "ID" ] = messageID.ToString(); args[ "nodeName" ] = nodeName; args[ "dialogText" ] = dialogText; #endif ByteCodeScriptTools.AddTextLiteralCode( byteList , sendMessage ); ByteCodeScriptTools.AddMessagingCode( byteList , " " , OpcodeMessaging.TRIGGER_EVENT ); code.Add( byteList.ToArray() ); // ToByteCode this Children. ToByteCodeInternal( code ); }
/// <summary> /// Tos the byte code. /// </summary> /// <param name='code'> /// Code. /// </param> public override void ToByteCode(ByteCodes code) { List <byte> byteList = new List <byte>(); AddNodeCode(byteList); #if false Hashtable args = new Hashtable(); args["eventType"] = eventType; args["ID"] = messageID.ToString(); args["nodeName"] = nodeName; args["dialogText"] = dialogText; #endif ByteCodeScriptTools.AddTextLiteralCode(byteList, sendMessage); ByteCodeScriptTools.AddMessagingCode(byteList, " ", OpcodeMessaging.TRIGGER_EVENT); code.Add(byteList.ToArray()); // ToByteCode this Children. ToByteCodeInternal(code); }
public override void ToByteCode(ByteCodes code) { base.ToByteCode(code); List <byte> byteList = new List <byte>(); #if false Hashtable hash = MakeHash(anyResourcePath, method, withFadeIn); ByteCodeScriptTools.AddTablePairsCode(byteList, hash); code.Add(byteList.ToArray()); code.Add(Opcode.LOAD_SCENE); #else Hashtable args = new Hashtable(); args["eventType"] = "enterscene"; args["name"] = sceneName; args["destroy"] = (method == Methods.DESTROY_AND_LOAD) ? "true" : "false"; args["fade"] = withFadeIn ? "true" : "false"; ByteCodeScriptTools.AddTablePairsCode(byteList, args); ByteCodeScriptTools.AddMessagingCode(byteList, " ", OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS); code.Add(byteList.ToArray()); #endif ToByteCodeInternal(code); }
public void Visit(ASTNode_Application node) { mTailFlag.Push(false); node.procedureNode.AcceptVisitor(this); mTailFlag.Pop(); foreach (var n in node.actualNodes) { mTailFlag.Push(false); n.AcceptVisitor(this); mTailFlag.Pop(); } if (mTailFlag.All(b => b)) { ByteCodes.Add(ByteCodeEnum.TAIL_CALL); } else { ByteCodes.Add(ByteCodeEnum.CALL); } ByteCodes.Add(node.actualNodes.Count); }
public void Visit(ASTNode_If node) { mTailFlag.Push(false); node.predNode.AcceptVisitor(this); mTailFlag.Pop(); ByteCodes.Add(ByteCodeEnum.CJMP); int cjmpOff = ByteCodes.Count; ByteCodes.Add(0); mTailFlag.Push(true); node.elseNode.AcceptVisitor(this); mTailFlag.Pop(); ByteCodes.Add(ByteCodeEnum.JMP); int jmpOff = ByteCodes.Count; ByteCodes.Add(0); ByteCodes[cjmpOff] = ByteCodes.Count; mTailFlag.Push(true); node.thenNode.AcceptVisitor(this); mTailFlag.Pop(); ByteCodes[jmpOff] = ByteCodes.Count; }
/// <summary> /// To Byte Coded Scripts. /// </summary> /// <param name='code'> /// Code. /// </param> public override void ToByteCode( ByteCodes code ) { ToByteCodeInternal( code ); }
/// <summary> /// If Playing a ScenarioNode , then the Played Scenario is the Instance. /// </summary> public void Play() { CheckInstance(); SystemUtility.ClearAllTextBoxMessage(); VM vm = VM.Instance; vm.currentScenarioName = gameObject.name; // ScenarioScript Mode. /* if( useScenarioScript ){ ViNoToolkit.KAGInterpreter kag = new ViNoToolkit.KAGInterpreter(); List<byte> byteList = kag.Interpret( scenarioScript.text ); ByteCodes btcodes = new ByteCodes( byteList.ToArray() ); btcodes.Add( Opcode.END ); vm.SetCode( btcodes.GetCode() ); } //*/ // Default Mode. // else{ ByteCodes btcodes = null; if( startNode.gameObject == this.gameObject ){ btcodes = new ByteCodes(); btcodes.Init(); #if true startNode.ToByteCode( btcodes ); #else TEST_ADD_CODE( btcodes , GetComponents<ViNode>() ); #endif } else{ btcodes = Compile();//useCompiledScript ? new ByteCodes( compiledScriptFile.bytes ) : Compile(); } btcodes.Add( Opcode.END ); vm.SetCode( btcodes.GetCode() ); // } if( startFromSave ){ //if ScenarioCtrl exists in this scene, then loaddata from that info. ScenarioCtrl sc = ScenarioCtrl.Instance; if( sc != null ){ ViNo.LoadData( sc.fileName , ref sc.saveInfo ); } } else{ if( useScenarioScript ){ vm.Run(); } else{ if( startNode == null ){ vm.Run(); } else{ PlayFromStartNode(); } } } }
public override void ToByteCode( ByteCodes code ) { base.ToByteCode( code ); List<byte> byteList = new List<byte>(); #if false Hashtable hash = MakeHash( anyResourcePath , method , withFadeIn ); ByteCodeScriptTools.AddTablePairsCode( byteList , hash ); code.Add( byteList.ToArray() ); code.Add( Opcode.LOAD_SCENE ); #else Hashtable args = new Hashtable(); args[ "eventType" ] = "enterscene"; args[ "name" ] = sceneName; args[ "destroy" ] = ( method == Methods.DESTROY_AND_LOAD ) ? "true" : "false"; args[ "fade" ] = withFadeIn ? "true" : "false"; ByteCodeScriptTools.AddTablePairsCode( byteList , args ); ByteCodeScriptTools.AddMessagingCode( byteList , " " , OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS ); code.Add( byteList.ToArray() ); #endif ToByteCodeInternal( code ); }
public override void ToByteCode( ByteCodes code ) { if( animTarget == null ){ ViNoDebugger.LogWarning( "Animation Target Not Set" ) ; return; } SetUpParamTable(); List<byte> byteList = new List<byte>(); // Labeling. AddNodeCode( byteList ); #if false // instantiate prefab , if target is in asset. if( isTargetInAsset ){ Debug.Log( "add load resource :" + animTarget.name ); // Add CreateObjectNode.ToByteCode... ByteCodeScriptTools.AddLoadResourceCode( byteList , animTarget.name ); GameObject parent = null; if( Application.isPlaying ){ parent = ViNoSceneManager.Instance.theSavedPanel; } else{ ViNoSceneManager sm = GameObject.FindObjectOfType( typeof(ViNoSceneManager)) as ViNoSceneManager; parent = sm.theSavedPanel; } if( parent == null ){ // SceneManager Not Needed user . parent = Camera.main.gameObject; } Debug.Log( "AddCreateGOCode :" + parent.name ); ByteCodeScriptTools.AddCreateGOCode( byteList , parent ); } else{ Debug.Log( "target is in scene..." ); } #endif ByteCodeScriptTools.AddTablePairsCode( byteList , paramTbl ); byte op = OpcodeMessaging.TWEEN; switch( animationType ){ case AnimationType.FADE_PANEL: op = OpcodeMessaging.FADE_PANEL; break; case AnimationType.CROSS_FADE: op = OpcodeMessaging.CROSS_FADE; break; } ByteCodeScriptTools.AddMessagingCode( byteList , animTarget.name , op ); code.Add( byteList.ToArray() ); ToByteCodeInternal( code ); }
public override void ToByteCode(ByteCodes code) { if (animTarget == null) { ViNoDebugger.LogWarning("Animation Target Not Set"); return; } SetUpParamTable(); List <byte> byteList = new List <byte>(); // Labeling. AddNodeCode(byteList); #if false // instantiate prefab , if target is in asset. if (isTargetInAsset) { Debug.Log("add load resource :" + animTarget.name); // Add CreateObjectNode.ToByteCode... ByteCodeScriptTools.AddLoadResourceCode(byteList, animTarget.name); GameObject parent = null; if (Application.isPlaying) { parent = ViNoSceneManager.Instance.theSavedPanel; } else { ViNoSceneManager sm = GameObject.FindObjectOfType(typeof(ViNoSceneManager)) as ViNoSceneManager; parent = sm.theSavedPanel; } if (parent == null) { // SceneManager Not Needed user . parent = Camera.main.gameObject; } Debug.Log("AddCreateGOCode :" + parent.name); ByteCodeScriptTools.AddCreateGOCode(byteList, parent); } else { Debug.Log("target is in scene..."); } #endif ByteCodeScriptTools.AddTablePairsCode(byteList, paramTbl); byte op = OpcodeMessaging.TWEEN; switch (animationType) { case AnimationType.FADE_PANEL: op = OpcodeMessaging.FADE_PANEL; break; case AnimationType.CROSS_FADE: op = OpcodeMessaging.CROSS_FADE; break; } ByteCodeScriptTools.AddMessagingCode(byteList, animTarget.name, op); code.Add(byteList.ToArray()); ToByteCodeInternal(code); }
/// <summary> /// Tos the byte code. /// </summary> public override void ToByteCode( ByteCodes code ) { List<byte> byteList = new List<byte>(); AddNodeCode( byteList ); string nameHndName = ( m_NameTextBox != null ) ? m_NameTextBox.name : "" ; string dialogHndName = ( m_ViNoTextBox != null ) ? m_ViNoTextBox.name : "" ; for( int i=0;i<dlgDataList.Count;i++){ DialogPartData dlgData = dlgDataList[ i ]; // if a item is not Checked , the item is shown. #if false if( ! dlgData.active ){ continue; } #endif string tag = GetSingleDialogIDNodeTag( dlgData.dialogID ); ByteCodeScriptTools.AddNodeCode( byteList , tag ); CodeGenerator.GenerateADialogCode( byteList , dlgData , nameHndName , dialogHndName ); } code.Add( byteList.ToArray() ); // To Byte codes this Children. ToByteCodeInternal( code ); }
/// <summary> /// Initializes a new instance of the <see cref="MonoBrick.EV3.Command"/> class as a direct command /// </summary> /// <param name="byteCode">Bytecode to use for the direct command</param> /// <param name="globalVariables">Global variables.</param> /// <param name="localVariables">Number of global variables</param> /// <param name="sequenceNumber">Number of local variables</param> /// <param name="reply">If set to <c>true</c> reply will be send from the brick</param> public Command(ByteCodes byteCode, int globalVariables, int localVariables, UInt16 sequenceNumber, bool reply): this(globalVariables, localVariables, sequenceNumber, reply){ this.Append(byteCode); }
public override void ToByteCode( ByteCodes code ) { code.Add( Opcode.CM ); // To Byte codes this Children. ToByteCodeInternal( code ); }
/// <summary> /// To Byte Coded Scripts. /// </summary> /// <param name='code'> /// Code. /// </param> public override void ToByteCode(ByteCodes code) { ToByteCodeInternal(code); }
public void Visit(ASTNode_Literal node) { ByteCodes.Add(ByteCodeEnum.PUSH_LITERAL); ByteCodes.Add(GetLiteralIndex(node.value)); }
void TEST_ADD_CODE( ByteCodes btcodes , BaseNode[] nodes ) { for( int i=0;i<nodes.Length;i++){ FunctionNode sn = nodes[ i ] as FunctionNode; if( sn != this && nodes[ i ].enabled ){ Debug.Log( "node:" + nodes[ i ].name ); nodes[ i ].ToByteCode( btcodes ); } // else{ // Debug.Log( "the Node is Me !" ); // } } btcodes.Add( Opcode.STOP ); }
/// <summary> /// Append a byte code value /// </summary> /// <param name="byteCode">Byte code to append</param> public void Append(ByteCodes byteCode){ Append((byte) byteCode); }
public void InterpretAndPlay( string scenario ) { CheckInstance(); SystemUtility.ClearAllTextBoxMessage(); VM vm = VM.Instance; vm.currentScenarioName = gameObject.name; ViNoToolkit.KAGInterpreter kag = new ViNoToolkit.KAGInterpreter(); List<byte> byteList = kag.Interpret( scenario); ByteCodes btcodes = new ByteCodes( byteList.ToArray() ); btcodes.Add( Opcode.END ); vm.SetCode( btcodes.GetCode() ); vm.Run(); }
public void Visit(ASTNode_Lambda node) { ByteCodes.Add(ByteCodeEnum.PUSH_SCRIPT_PROCEDURE); ByteCodes.Add(GetLiteralIndex(CompileToByteCode(node))); }