private void ClearMessage() { AddToBacklog(); ClearTextBuilder(); SystemUtility.ClearAllTextBoxMessage(); }
/// <summary> /// Load the specified info. /// </summary> /// <returns> /// If Load Succeed return true , Load Failed return false. /// </returns> static public bool Load(ViNoSaveInfo info) { bool levelNameNotMatchThisScene = !info.data.m_LoadedLevelName.Equals(Application.loadedLevelName); if (levelNameNotMatchThisScene) { ViNoDebugger.LogError("SaveData Level Name is : \"" + info.data.m_LoadedLevelName + "\" but this level is \"" + Application.loadedLevelName + "\""); return(false); } // Load Scene from XML. if (ViNoSceneManager.Instance != null) { ViNoSceneManager.Instance.Load(info); } bool haveLevelName = !string.IsNullOrEmpty(info.data.m_LoadedLevelName); bool haveNodeName = !string.IsNullOrEmpty(info.data.m_NodeName); bool isLoad = (haveLevelName && haveNodeName); if (isLoad) { // Deserialize VM. VM vm = VM.Instance; if (vm != null) { vm.ClearTextBuilder(); SystemUtility.ClearAllTextBoxMessage(); vm.Deserialize(info.data.m_NodeName); GameObject scenarioObj = GetScenarioObject(info); // Play from File ?. ScenarioNode scenario = scenarioObj.GetComponent <ScenarioNode>(); scenario.startFromSave = true; scenario.PlayFrom(info.data.m_NodeName); } // Load Sound. if (ISoundPlayer.Instance != null) { ISoundPlayer pl = ISoundPlayer.Instance; pl.OnLoad(info.data); } // Deactivate Selections. if (ISelectionsCtrl.Instance != null) { ISelectionsCtrl.Instance.ChangeActive(false); } } return(isLoad); }
static public bool DoQuickLoad() { SystemUtility.ClearAllTextBoxMessage(); ViNoSaveInfo info = ScenarioCtrl.Instance.quickSaveSlot; if (info != null) { return(ViNo.LoadData("QSaveData", ref info)); } else { Debug.LogError("ScenarioCtrl not attached QuickSaveSlot. couldn't Load."); return(false); } }
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(); }
/// <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(); } } } }