public string GetDialogue(MissionNPC npc, Stage stage) { try { XmlDocument xdoc = new XmlDocument(); xdoc.Load(filepath); string key = parseKey(npc.GetName(), npc.GetMissionType(), stage); if (xdoc.SelectSingleNode(key) == null) { return "Can't find dialogue for key:\n "+key; } return xdoc.SelectSingleNode(key).InnerText; } catch (FileNotFoundException e) { UI.Notify(e.Message); UI.ShowSubtitle(e.StackTrace + "\n" + e.Message, 7000); } catch (Exception e) { UI.Notify(e.Message); UI.ShowSubtitle(e.StackTrace+"\n"+ e.Message, 7000); } return "Can't find key"; }
public void Reload(MissionNPC qm) { missionNpc = qm; missionNpc.Interact(); lName.Caption = missionNpc.GetName(); lMission.Caption = getStartDialogue(); acceptButton.SetVisible(true); declineButton.SetVisible(true); isEnabled = true; }
/// <summary> /// Creates a new MissionNPC /// </summary> /// <param name="fam">The family</param> /// <param name="model">The model</param> /// <param name="pos">The position</param> /// <param name="heading">The way the npc is facing</param> /// <param name="name">The name of the npc</param> /// <param name="mtype">The mission type this npc gives</param> /// <param name="rep">The repetition needed to start a mission</param> /// <returns>Returns a new MissionNPC</returns> protected MissionNPC CreateMissionNPC(Family fam, PedHash model, Vector3 pos, float heading, string name, Mission.Type mtype, int rep) { MissionNPC qm = new MissionNPC(model, fam, pos, heading, name, mtype, rep); for (int i = questMembers.Count-1; i >= 0 ; i--) { if (questMembers[i] == null) { continue; } MissionNPC qmem = questMembers[i]; if (qmem.Equals(qm)) { qmem.Dispose(); questMembers.Remove(qmem); break; } } questMembers.Add(qm); return qm; }