public Conversation(XmlElement element, LineCatalogue catalogue)
    {
        persistentConversation = new PersistentConversation();
        persistentConversation.name = element.GetAttribute("name");

        if(SaveLoad.SaveExits()) {
            PersistentConversation tmp = (PersistentConversation)SaveLoad.ReadSaveFile(PersistentConversation.GetSaveFileName(persistentConversation.name));
            if(tmp != null) {
                persistentConversation = tmp;
            }
            else {
                SaveLoad.ResetSave();
            }

        }

        //Debug.Log("Conversation.Conversation() name=" + persistentConversation.name );
        participants = new ArrayList();
        XmlNodeList participantNodeList = element.GetElementsByTagName("participant");
        foreach (XmlElement participantElement in participantNodeList){
            string participantName = participantElement.GetAttribute("name");
            participants.Add(CharacterManager.GetCharacter(participantName));
        }

        XmlElement rootLineElement = (XmlElement)element.GetElementsByTagName("root_line").Item(0);
        rootLine = new RootLine(rootLineElement, catalogue, this);
        rootLine.ConnectLinks(catalogue);
        currentController = null;
    }
 public RegularLine(XmlElement element, LineCatalogue catalogue, Conversation conversation)
     : base(element, catalogue, conversation)
 {
     text = element.GetAttribute("text");
     speakerName = element.GetAttribute("speaker");
     if (speakerName.Equals("")){
         speakerName = "Abby";
     }
     prerequisite = new Prerequisite(element.GetAttribute("prerequisite"), speakerName, conversation);
     consequence = new Consequence(element.GetAttribute("consequence"), speakerName, conversation);
     cameraAngle = CameraAngle.GetCameraAngle(element.GetAttribute("camera_angle"));
     emotion = Emotion.GetEmotion(element.GetAttribute("expression"));
     id = element.GetAttribute("id");
 }
 public ArrayList ConnectLinks(LineCatalogue catalogue)
 {
     if (!haveConnectedLinks){
         ArrayList originalResponses = new ArrayList(responses);
         for (int i = 0; i < originalResponses.Count; i++){
             //Debug.Log("ConnectLinks: " + GetText() + ": Iterating: " + i);
             LineInLoading response = (LineInLoading)originalResponses[i];
             //Debug.Log("ConnectLinks: " + GetText() + ": response = " + response);
             ArrayList replacingList = response.ConnectLinks(catalogue);
             //Debug.Log("ConnectLinks: " + GetText() + ": replacingList size: " + replacingList.Count);
             int index = responses.IndexOf(response);
             //Debug.Log("ConnectLinks: " + GetText() + ": index to remove at = " + index);
             responses.RemoveAt(index);
             responses.InsertRange(index, replacingList);
         }
         haveConnectedLinks = true;
     }
     ArrayList ownList = new ArrayList();
     ownList.Add(this);
     return ownList;
 }
 public AbstractLine(XmlElement element, LineCatalogue catalogue, Conversation conversation)
 {
     responses = new ArrayList();
     int lineId = Int32.Parse(element.GetAttribute("id"));
     catalogue.AddLine(lineId, this);
     string responseSpeakerTypeString = element.GetAttribute("response_speaker_type");
     if (responseSpeakerTypeString.Equals("PC")){
         responseSpeakerType = SpeakerType.PC;
     } else if (responseSpeakerTypeString.Equals("NPC")){
         responseSpeakerType = SpeakerType.NPC;
     }
     XmlNodeList nodeList = element.ChildNodes;
     for (int i = 0; i < nodeList.Count; i++){
         XmlElement responseElement = (XmlElement)nodeList.Item(i);
         //Debug.Log("AbstractLine.AbstractLine(): responceElement=" + responseElement.ToString());
         if (responseElement.Name.Equals("regular_line")){
             responses.Add(new RegularLine(responseElement, catalogue, conversation));
         } else {
             responses.Add(new Link(responseElement, catalogue));
         }
     }
     haveConnectedLinks = false;
 }
Beispiel #5
0
 public ArrayList ConnectLinks(LineCatalogue catalogue)
 {
     if (linkedLines == null){
         Line line = catalogue.GetLine(linkedID);
         linkedLines = new ArrayList();
         if (choiceOnly){
             ArrayList responses = line.GetResponses();
             ArrayList originalResponses = new ArrayList(responses);
             for (int i = 0; i < originalResponses.Count; i++){
                 LineInLoading response = (LineInLoading)originalResponses[i];
                 if (response.IsLink()){
                     ArrayList replacingList = response.ConnectLinks(catalogue);
                     int index = responses.IndexOf(response);
                     responses.RemoveAt(index);
                     responses.InsertRange(i, replacingList);
                 }
             }
             linkedLines.AddRange(responses);
         } else {
             linkedLines.Add(line);
         }
     }
     return linkedLines;
 }
 public ArrayList ConnectLinks(LineCatalogue catalogue)
 {
     Debug.LogError("VariantLine.ConnectLinks called!");
     return null;
 }
 private static Hashtable LoadConversations(XmlElement rootElement, ArrayList impressions)
 {
     Hashtable conversations = new Hashtable();
     XmlNodeList conversationNodeList = rootElement.GetElementsByTagName("conversation");
     foreach (XmlElement conversationElement in conversationNodeList){
         string name = conversationElement.GetAttribute("name");
         LineCatalogue catalogue = new LineCatalogue();
         conversations.Add(name, new Conversation(conversationElement, catalogue));
     }
     return conversations;
 }
 public RootLine(XmlElement element, LineCatalogue catalogue, Conversation conversation)
     : base(element, catalogue, conversation)
 {
 }
Beispiel #9
0
 public Link(XmlElement element, LineCatalogue catalogue)
 {
     choiceOnly = element.GetAttribute("choice_only").Equals("true");
     linkedID = Int32.Parse(element.GetAttribute("linked_id"));
     linkedLines = null;
 }