public void LoadDLG(AuroraDLG dlg) { // Clear the graph Clear(); Dictionary <AuroraDLG.AEntry, XNode.Node> entries = new Dictionary <AuroraDLG.AEntry, XNode.Node>(); Dictionary <AuroraDLG.AReply, XNode.Node> replies = new Dictionary <AuroraDLG.AReply, XNode.Node>(); Dictionary <(AuroraDLG.AEntry, AuroraDLG.AEntry.AReplies), XNode.Node> entryReplies = new Dictionary <(AuroraDLG.AEntry, AuroraDLG.AEntry.AReplies), XNode.Node>(); Dictionary <(AuroraDLG.AReply, AuroraDLG.AReply.AEntries), XNode.Node> replyEntries = new Dictionary <(AuroraDLG.AReply, AuroraDLG.AReply.AEntries), XNode.Node>(); // Add all entry nodes foreach (AuroraDLG.AEntry entry in dlg.EntryList) { entries[entry] = AddNode <EntryNode>(); ((EntryNode)entries[entry]).entry = entry; } // Add all reply nodes foreach (AuroraDLG.AReply reply in dlg.ReplyList) { replies[reply] = AddNode <ReplyNode>(); ((ReplyNode)replies[reply]).reply = reply; } // Add all the edges foreach (AuroraDLG.AEntry entry in dlg.EntryList) { foreach (AuroraDLG.AEntry.AReplies reply in entry.RepliesList) { // Create a new EntryToReply node EntryToReply e2r = AddNode <EntryToReply>(); e2r.e2r = reply; entryReplies[(entry, reply)] = e2r;
public void LoadDLG(AuroraDLG dlg) { curEntry = null; curReply = null; this.dlg = dlg; mode = DialogState.STARTING; }
void LoadFile() { loadLoc = EditorUtility.OpenFilePanel("Load LIP file", "", ""); using (FileStream stream = new FileStream(loadLoc, FileMode.Open)) { dlg = (AuroraDLG) new GFFLoader(stream).GetObject().Serialize <AuroraDLG>(); } }
public void LoadDLGFromFile() { // Ask for a filename string filename = EditorUtility.OpenFilePanel("Select a DLG file", "", ""); using (FileStream fs = new FileStream(filename, FileMode.Open)) { AuroraDLG dlg = (AuroraDLG) new GFFLoader(fs).GetObject().Serialize <AuroraDLG>(); LoadDLG(dlg); } }
void StartDialog(AuroraDLG dlg, AuroraObject owner) { // TODO: Find the appropriate starting point by running // the relevant NCS scripts dialogue = dlg; if (owner.GetType() == typeof(Creature)) { ((Creature)owner).OnDialogue(); } AuroraDLG.AStarting starter = null; foreach (AuroraDLG.AStarting option in dlg.StartingList) { string scriptName = option.Active; if (scriptName == "") { starter = option; break; } if (stateManager.RunConditionalScript(scriptName, owner) > 0) { starter = option; break; } } if (starter == null) { // Could not find a starter throw new System.Exception("Failed to find a successful starting option for dialog"); } AuroraDLG.AEntry startEntry = dlg.EntryList[(int)starter.Index]; Debug.Log("Start entry: " + startEntry); curEntry = startEntry; if (curEntry.Script != "") { stateManager.RunScript(curEntry.Script, owner); } curMode = DialogMode.NPC; this.owner = owner; }
public void StartDialog(string resref, AuroraObject owner) { Debug.Log("Starting dialog " + resref); AuroraDLG dlg = AuroraEngine.Resources.LoadDialogue(resref); // Create the camera model if one exists for this dialog if (dlg.CameraModel != null && dlg.CameraModel != "") { if (cameraModel != null) { GameObject.Destroy(cameraModel); } cameraModel = AuroraEngine.Resources.LoadModel(dlg.CameraModel); } StartDialog(dlg, owner); }
void SaveFile() { ConvertDLG(); AuroraDLG transitionDLG = CreateTransitionDLG(); //string transitionNSS = GenerateScript(); string saveLoc = EditorUtility.SaveFolderPanel("Choose Output Folder", "", ""); string filename = Path.GetFileNameWithoutExtension(loadLoc); string ext = Path.GetExtension(loadLoc); string new_filename = TrimPath(12) + "aivo"; KModuleEditor.CreateGFFFile(saveLoc + "\\", new_filename, dlg, "dlg"); KModuleEditor.CreateGFFFile(saveLoc + "\\", filename, transitionDLG, "dlg"); //File.WriteAllText(saveLoc + "\\" + filename + "_s.nss", transitionNSS); }
void ConvertDLG(string filepath, string outpath) { // Takes a DLG file and converts it to PCVO // Load the DLG loadLoc = filepath; using (FileStream stream = new FileStream(loadLoc, FileMode.Open)) { dlg = (AuroraDLG) new GFFLoader(stream).GetObject().Serialize <AuroraDLG>(); } // Make the conversions ConvertDLG(); AuroraDLG transitionDLG = CreateTransitionDLG(); string new_filename = TrimPath(12) + "aivo"; // Save the files KModuleEditor.CreateGFFFile(Path.GetDirectoryName(outpath) + "/" + new_filename + ".dlg", "", dlg, ""); KModuleEditor.CreateGFFFile(outpath, "", transitionDLG, ""); }
AuroraDLG CreateTransitionDLG() { // The transition DLG consists of a single entry, which // runs a script that starts the new dialog AuroraDLG transitionDLG = new AuroraDLG(); transitionDLG.EntryList.Add(new AuroraDLG.AEntry() { structid = 0, Text = new GFFObject.CExoLocString() { stringref = 4294967295 }, Script = "aivo_start", ActionParamStrA = TrimPath(12) + "aivo" }); transitionDLG.StartingList.Add(new AuroraDLG.AStarting() { structid = 0, Index = 0 }); return(transitionDLG); }
public static AuroraDLG LoadDialogue(string resref) { AuroraDLG ad = data.Get <AuroraDLG>(resref, ResourceType.DLG); return(ad); }