public DlgEvent(Josscript _data = null) { if (null == _data) { _data = new Josscript(); } data = _data; }
virtual public bool Join(Josscript other, JossCopyMode copy_mode = JossCopyMode.no_id) { if (null == other || other.Count == 0) { return(false); } foreach (JossData d in other) { Elements.Add(d.Copy(copy_mode, Elements.Count.ToString())); } return(true); }
string m_typewriterText; // text to build towards during typewriter mode //initialize the class //since nothing can be done until a file is loaded, //all that needs to be done is for the static array to be created //according to the specified value for maxLinesToShow public DlgManager() { if (GameKeys == null) { GameKeys = new JosscriptGameKeys(); } State = DlgState.Inactive; linesToShow = new string[maxLinesToShow]; lines = new List <JossData> (); actors = new List <JossData> (); event_data = new Josscript(); event_data.AddNode("DlgEvent", "DlgManager Version=" + DlgManager_version); event_data.AddNode("EventDetails"); }
bool OpenFile(string fn, int startAt) { try { string lastActorToSpeak = "0"; m_fileIsLoaded = false; Josscript sections = new Josscript(fn); actors = sections.AllDataOfType("actor"); lines = sections.AllDataOfType("turn"); for (int i = 0; i < lines.Count; i++) { if (!lines[i].defined.ContainsKey("who")) { lines[i].Set("who", lastActorToSpeak); } if (!lines[i].defined.ContainsKey("next")) { if (i < lines.Count - 1) { lines[i].Set("next", (lines[i + 1].ID).ToString()); } else { lines[i].Set("next", lines[0].ID.ToString()); } } if (!lines[i].defined.ContainsKey("choice")) { lines[i].Set("choice", "false"); } lastActorToSpeak = lines[i]["who"]; } event_data[1].defined.Clear(); if (lines.Count == 0) { throw new NoDialogueDefinedException(); } if (actors.Count == 0) { throw new NoActorsDefinedException(); } //set so Speak's event handlers will have a valid response m_fileIsLoaded = true; //set again in response to Speak m_fileIsLoaded = (Speak(startAt) > -1); event_data[1].defined.Clear(); if (!FileIsLoaded) { event_data[1].Set("message", "Unable to start dialogue"); } } catch (NoDialogueDefinedException) { event_data[1].Set("message", "No dialogue was defined for this dialogue"); } catch (NoActorsDefinedException) { event_data[1].Set("message", "No actors were defined for participation in this dialogue"); } return(FileIsLoaded); }
public virtual bool Join(Josscript other, JossCopyMode copy_mode = JossCopyMode.no_id) { if (null == other || other.Count == 0) return false; foreach(JossData d in other) { Elements.Add( d.Copy(copy_mode, Elements.Count.ToString()) ); } return true; }
int startAtIncrement = -1; // if continuing a dialogue turn, skip the previous text #endregion Fields #region Constructors //initialize the class //since nothing can be done until a file is loaded, //all that needs to be done is for the static array to be created //according to the specified value for maxLinesToShow public DlgManager() { if (GameKeys == null) GameKeys = new JosscriptGameKeys(); State = DlgState.Inactive; linesToShow = new string[maxLinesToShow]; lines = new List<JossData> (); actors = new List<JossData> (); event_data = new Josscript(); event_data.AddNode("DlgEvent", "DlgManager Version="+DlgManager_version); event_data.AddNode("EventDetails"); }
bool OpenFile(string fn, int startAt) { try { string lastActorToSpeak = "0"; m_fileIsLoaded = false; Josscript sections = new Josscript(fn); actors = sections.AllDataOfType("actor"); lines = sections.AllDataOfType("turn"); for (int i = 0; i < lines.Count; i++) { if (!lines[i].defined.ContainsKey("who")) lines[i].Set("who", lastActorToSpeak); if (!lines[i].defined.ContainsKey("next")) { if (i < lines.Count - 1) lines[i].Set("next", (lines[i+1].ID).ToString() ); else lines[i].Set("next", lines[0].ID.ToString() ); } if (!lines[i].defined.ContainsKey("choice")) lines[i].Set("choice", "false"); lastActorToSpeak = lines[i]["who"]; } event_data[1].defined.Clear(); if (lines.Count == 0) throw new NoDialogueDefinedException(); if (actors.Count == 0) throw new NoActorsDefinedException(); //set so Speak's event handlers will have a valid response m_fileIsLoaded = true; //set again in response to Speak m_fileIsLoaded = (Speak (startAt) > -1); event_data[1].defined.Clear(); if (!FileIsLoaded) event_data[1].Set("message", "Unable to start dialogue"); } catch (NoDialogueDefinedException) { event_data[1].Set("message", "No dialogue was defined for this dialogue"); } catch(NoActorsDefinedException){ event_data[1].Set("message", "No actors were defined for participation in this dialogue"); } return FileIsLoaded; }
public DlgEvent(Josscript _data = null) { if (null == _data) _data = new Josscript(); data = _data; }