/// <summary> /// Constructor. /// </summary> /// <param name="id">The GUID of the <see cref="NPCPrompt"/>NPCPrompt</see> in the database.</param> public DialogueScreen(Guid id) : base() { this.scale = 0.75f; this.prompt = FindEntry(id); this.responses = new List<Response>(); IsPopup = false; InitializeActions(); }
/// <summary> /// Retrieves the appropriate <see cref="NPCPrompt"/>NPCPrompt</see> from the database. /// </summary> /// <param name="id">The GUID of the <see cref="NPCPrompt"/>NPCPrompt</see></param> /// <returns>The <see cref="NPCPrompt"/>NPCPrompt</see></returns> private Entry FindEntry(Guid id) { try { DataTable entry; String query = "select Body \"Body\" "; query += "from Entry where id = \"" + id.ToString() + "\";"; entry = StarterGame.Instance.database.GetDataTable(query); // only take the first result (there should only be one anyway) DataRow result = entry.Rows[0]; String body = (String)result["Body"]; Entry prompt = new Entry(id, body); return prompt; } catch (Exception e) { String error = "The following error has occurred:\n"; error += e.Message.ToString() + "\n"; Console.WriteLine(error); return new Entry(id, error); } }