Beispiel #1
0
    private void ShowNextLine()
    {
        if (currentLineIndex == dialogLines.Length)
        {
            Time.timeScale = 1;
            Destroy(dialogWindow.gameObject);
            Destroy(gameObject);

            if (nextSceneAfterDialog)
            {
                FaderAndMusicPlayer.instance.FadeOutAndPlayNextScene();
            }

            return;
        }

        DialogLine currentLine = dialogLines [currentLineIndex];

        if (currentLine.actor == DialogActor.ACTOR_1)
        {
            dialogWindow.ShowLeftText(currentLine.line, color1);
        }
        else
        {
            dialogWindow.ShowRightText(currentLine.line, color2);
        }

        currentLineIndex++;
    }
Beispiel #2
0
        public DialogLineInfo(DialogLine dialogLine, AssetProvider assetProvider)
        {
            if (dialogLine == null)
            {
                throw new ArgumentNullException(nameof(dialogLine));
            }
            if (assetProvider == null)
            {
                throw new ArgumentNullException(nameof(assetProvider));
            }

            DialogText      = dialogLine.dialogText;
            Yuri            = dialogLine.yuri;
            YuriDialogText  = dialogLine.yuriDialogText;
            StartExpression = dialogLine.startExpression;
            Expressions     = dialogLine.expressions;
            EndExpression   = dialogLine.endExpression;

            if (dialogLine.yuriAudioClip != null)
            {
                YuriAudioClipInfo = new AudioClipInfo(dialogLine.yuriAudioClip, assetProvider);
            }
            if (dialogLine.audioClip != null)
            {
                AudioClipInfo = new AudioClipInfo(dialogLine.audioClip, assetProvider);
            }
        }
    public states_PaperObject()
    {
        g  = GameObject.FindGameObjectWithTag("GameManager");
        gm = (GameController)g.GetComponent(typeof(GameController));
        setInitState(0);

        //********************************************
        //*****      Papel - Estado 0       **********
        //********************************************
        state PapelState0 = new state(0);

        //=================================
        //  Acoes Settings do estado 0
        //=================================

        PapelState0.SettingActions.Add(new InicializarPosicaoGlobal(gm, "Papel"));

        //=================================
        //  Acoes OnExamine do estado 0
        //=================================
        DialogLine papelDialog = new DialogLine("Papel", "Voce achou um papel!", -1);
        //ArrayList dialogosPapel = new ArrayList();
        //dialogosPapel.Add (papelDialog);
        Conversa c0 = new Conversa("Papel", papelDialog);
        Acao     mostrarDialogoPapel = new  MostrarDialogos(gm, c0);

        PapelState0.OnExamineAction.Add(mostrarDialogoPapel);
        PapelState0.OnExamineAction.Add(new AtivarEvento(gm, 1));
        PapelState0.OnExamineAction.Add(new MudarEstado(gm, "Eduardo", 2, "(1 & !0)"));
        PapelState0.OnExamineAction.Add(new AdicionarItem(gm, "Papel", "sprites/Paper item", true));

        AddStateTo(PapelState0);
        //acoesHashtable.Add("Papel-0", PapelState0);
    }
Beispiel #4
0
 private void PrepareVariablesForNewLine()
 {
     _currentText        = "";
     _remainingText      = _allDialogLines[_textId].text;
     _currentDialogLine  = _allDialogLines[_textId];
     displayTextFinished = false;
 }
Beispiel #5
0
    public void DisplayChoice(string name, DialogLine parent, params DialogLine[] lines)
    {
        npcName.text = name;
        ClearButtons();

        npcText.text = parent.text;

        foreach (var dialogLine in lines)
        {
            var button = Instantiate(buttonToInstantiate, choicesParent);
            button.transform.GetChild(0).GetComponent <Text>().text = dialogLine.text;

            var line = dialogLine;
            button.onClick.AddListener(() =>
            {
                if (line.choices.Count == 0)
                {
                    dialogManager.PickChoice(-1);
                }
                else
                {
                    dialogManager.PickChoice(line.choices[0]);
                }
            });
        }
    }
Beispiel #6
0
    // Reads and Serializes a specific XML file
    private void LoadXmlFileData(string fileName)
    {
        string xmlPath = Path.Combine(xmlDirectory, fileName);

        if (Path.GetExtension(xmlPath) == string.Empty)
        {
            xmlPath += ".xml";
        }
        else if (Path.GetExtension(xmlPath) != ".xml")
        {
            Path.ChangeExtension(xmlPath, ".xml");
        }

        if (File.Exists(Path.Combine(Application.dataPath, xmlPath)))
        {
            currentSceneDialog = XML_Loader.Deserialize <SceneDialogs> ((Path.Combine(Application.dataPath, xmlPath)));
            if (currentSceneDialog.allDialogsInScene [0] != null)
            {
                SelectDialogByID(0);
                selectedDialogLine = null;

                /*if (selectedDialog.DialogLines.Count != 0) {
                 *      SelectDialogLine (0);
                 * }*/
            }
        }
        else
        {
            Debug.LogError("XML File: " + (Path.Combine(Application.dataPath, xmlPath)) + " is not found.");
        }
    }
Beispiel #7
0
    // Called from the Dialog-Selection-List Buttons; sets the selected Dialog.
    private void SelectDialogByID(int id)
    {
        foreach (Dialog d in currentSceneDialog.allDialogsInScene)
        {
            if (d.ID == id)
            {
                selectedDialog = d;
            }
        }

        dialogDescriptionInput = selectedDialog.dialogDescription;
        dialogIDInput          = selectedDialog.ID;

        gridNodes.Clear(); windows.Clear();
        int i = 0;                      // Creates the associated grid-windows for each DialogLine

        foreach (DialogLine line in selectedDialog.DialogLines)
        {
            Rect r = new Rect(10 + 100 * i, 70, 100, 100);
            windows.Add(r);
            gridNodes.Add(new DialogGridNode(line, r, SelectDialogLine));
            i++;
        }
        selectedDialogLine = null;

        /*if (selectedDialog.DialogLines.Count > 0) {
         *      SelectDialogLine (0);
         * }*/
    }
 public Node_DialogLine(DialogLine d, int posX = 20, int posY = 60, int width = 300, int height = 75)
 {
     dialog    = d;
     window    = new Rect(posX, posY, width, height);
     this.posX = posX;
     this.posY = posY;
 }
Beispiel #9
0
 public void AddLine(string tag, string text, Action action, string nextTag)
 {
     lines[tag] = new DialogLine()
     {
         text = text, answers = new Answer[] { new Answer("", nextTag, action) }
     };
 }
Beispiel #10
0
 public void AddLine(string tag, string text, params Answer[] answers)
 {
     lines[tag] = new DialogLine()
     {
         text = text, answers = answers
     };
 }
Beispiel #11
0
 public void AddLine(string tag, Action action)
 {
     lines[tag] = new DialogLine()
     {
         text = "", answers = new Answer[] { new Answer(action) }
     };
 }
Beispiel #12
0
 public void AddLine(string tag, string text, string nextTag)
 {
     lines[tag] = new DialogLine()
     {
         text = text, answers = new Answer[] { new Answer(nextTag) }
     };
 }
Beispiel #13
0
    private void PopulateDialogOptions(DialogLine _dialogLine)
    {
        //Clean up old options in game
        foreach (Transform _child in eventOptionsParent.transform)
        {
            Destroy(_child.gameObject);
        }

        //Clean up old options in List
        currentEventOptions.Clear();

        //Create a single button to continue the dialog if there are no options
        if (_dialogLine.Options.Count == 0)
        {
            GameObject _obj = Instantiate(eventOptionPrefab, eventOptionsParent);
            _obj.GetComponent <Button>().onClick.AddListener(GameManager.Instance.EventManager.InvokeNextEventLine);

            _obj.GetComponentInChildren <TextMeshProUGUI>().text = "Doorgaan";
        }

        //Create all options
        else
        {
            foreach (var _option in _dialogLine.Options)
            {
                GameObject _obj = Instantiate(eventOptionPrefab, eventOptionsParent);
                _obj.GetComponent <Button>().onClick.AddListener(_option.InvokeOption);

                _obj.GetComponentInChildren <TextMeshProUGUI>().text = _option.Text;
            }
        }
    }
 public IEnumerator Show(DialogLine dialogLine)
 {
     return(Show(new List <DialogLine>()
     {
         dialogLine
     }));
 }
Beispiel #15
0
 void ToNextLine()
 {
     currentLine = set.NextLine();
     if (currentLine == null)
     {
         EndDialog();
         return;
     }
     if (set.isInteractive && !currentLine.hasOptions)
     {
         //nextBtn.enabled = true;
         //optionsPanel.SetActive(false);
     }
     else
     {
         //nextBtn.enabled = false;
         //optionsPanel.SetActive(true);
     }
     nameTmp.SetText(currentLine.name);
     lineTmp.SetText(currentLine.line);
     //if(currentLine.spriteName != null){
     //    charImg.enabled = true;
     //    charImg.sprite = Resources.Load<Sprite>("Sprites/Characters/Thumbnails/"+currentLine.spriteName);
     //}else{
     //    charImg.enabled = false;
     //}
 }
    public states_TableObject()
    {
        g  = GameObject.FindGameObjectWithTag("GameManager");
        gm = (GameController)g.GetComponent(typeof(GameController));
        setInitState(0);

        //********************************************
        //*****      Tapete - Estado 0       *********
        //********************************************
        state TapeteState0 = new state(0);

        //=================================
        //  Acoes Settings do estado 0
        //=================================
        TapeteState0.SettingActions.Add(new InicializarPosicaoGlobal(gm, "Mesa"));

        //=================================
        //  Acoes OnExamine do estado 0
        //=================================
        DialogLine tapete1        = new DialogLine("Mesa", "Voce achou um papel secreto", -1);
        DialogLine tapete2        = new DialogLine("Mesa", "O papel foi adicionado no seu inventorio", -1);
        ArrayList  dialogosTapete = new ArrayList();

        dialogosTapete.Add(tapete1);
        dialogosTapete.Add(tapete2);
        Conversa c0 = new Conversa("Examinando a mesa...", dialogosTapete);
        Acao     mostrarDialogoTapete = new  MostrarDialogos(gm, c0);

        TapeteState0.OnExamineAction.Add(mostrarDialogoTapete);
        TapeteState0.OnExamineAction.Add(new CarregarAudio(gm, 6));
        TapeteState0.OnExamineAction.Add(new TocarAudio(gm));
        //TapeteState0.OnExamineAction.Add(new MudarEstadoEduardo(1));
        TapeteState0.OnExamineAction.Add(new AdicionarItem(gm, "Papel", "sprites/Paper item", false));
        TapeteState0.OnExamineAction.Add(new AtivarEvento(gm, 1));
        TapeteState0.OnExamineAction.Add(new MudarEstado(gm, "Eduardo", 2, "(!0 & 1)"));
        TapeteState0.OnExamineAction.Add(new TornarExaminavel(gm, "Mesa", false));
        TapeteState0.OnExamineAction.Add(new MudarEstado(gm, "Mesa", 1));

        AddStateTo(TapeteState0);
        //acoesHashtable.Add("Tapete-0", TapeteState0);

        //********************************************
        //*****      Tapete - Estado 1       *********
        //********************************************
        state TapeteState1 = new state(1);

        TapeteState1.SettingActions.Add(new TornarExaminavel(gm, "Mesa", false));
        //=================================
        //  Acoes OnExamine do estado 1
        //=================================
        //DialogLine dialogoTapeteVazio = new DialogLine ("Mesa", "Nao ha nada aqui", -1);
        //ArrayList dialogosTapeteVazio = new ArrayList();
        //dialogosTapeteVazio.Add (tapetevazio);
        //Conversa c1 = new Conversa ("Dialogo tapete vazio", dialogoTapeteVazio);
        //Acao mostrarDialogoTapeteVazio = new MostrarDialogos(gm, c1);
        //TapeteState1.OnExamineAction.Add(mostrarDialogoTapeteVazio);

        AddStateTo(TapeteState1);
        //acoesHashtable.Add("Tapete-1", TapeteState1);
    }
Beispiel #17
0
    public override bool Update()
    {
        gm.lockplayer();
        if (falaAtual == 0)
        {
            //backlogManager.addToBacklog (conversa);
            DialogLine dl = ((DialogLine)dialogos[falaAtual]);
            //backlogManager.addToBacklog(dl);
            string texto = dl.getTexto();
            gm.GameInterface.showdialogbox();
            gm.GameInterface.LoadShowTxt(texto);
            if (dl.getSprite() != -1)
            {
                gm.GameInterface.showface(dl.getPos(), dl.getSprite(), 0);
            }
            falaAtual++;
        }
        else if (Input.GetKeyDown(Teclas.Confirma))
        {
            //gm.lockplayer();
            if (!gm.GameInterface.ShowingDialog)            //.isShowingDialog())
            {
                if (falaAtual == dialogos.Count)
                {
                    //Debug.Log("Terminou");
                    if (conversa != null)
                    {
                        backlogManager.addToBacklog(conversa.getRotulo());
                    }
                    falaAtual = 0;
                    gm.GameInterface.hideface(0);
                    gm.GameInterface.hideface(1);
                    gm.GameInterface.hidedialogbox();
                    gm.unlockplayer();

                    return(true);
                }
                DialogLine dl = ((DialogLine)dialogos[falaAtual]);
                //backlogManager.addToBacklog(dl);
                string texto = dl.getTexto();

                if (dl.getSprite() != -1)
                {
                    //gm.hideface(1 - dl.getSprite ());
                    gm.GameInterface.showface(dl.getPos(), dl.getSprite(), 0);
                }
                gm.GameInterface.showdialogbox();
                gm.GameInterface.LoadShowTxt(texto);
                //Debug.Log (texto);

                falaAtual++;
            }
            else
            {
                gm.GameInterface.quickPassTxt();
            }
        }
        return(false);
    }
Beispiel #18
0
 public MostrarDialogos(GameController gm, DialogLine dialogo)
 {
     this.dialogos = new ArrayList();
     this.dialogos.Add(dialogo);
     falaAtual      = 0;
     backlogManager = BacklogManager.getInstance();
     this.gm        = gm;
 }
 public Conversa(string rotulo, DialogLine dialog)
 {
     this.rotulo   = rotulo;
     this.dialogos = new ArrayList();
     this.dialogos.Add(dialog);
     personagens = new ArrayList();
     Debug.Log("Personagem: " + dialog.getPersonagem());
     personagens.Add(dialog.getPersonagem());
 }
Beispiel #20
0
    private void dialog(DialogLine root)
    {
        display(root.text);

        if (root.eventName != null)
        {
            //Call event by name
        }
    }
 public MostrarEscolhas(GameController gm, DialogLine dialogLine, ArrayList escolhas, int[] RepitaSe)
 {
     this.dialogLine  = dialogLine;
     this.escolhas    = escolhas;
     this.gm          = gm;
     this.choiceindex = -1;
     this.prox_action = 0;
     this.ListaAcoes  = new ArrayList();
     this.repeat_on   = RepitaSe;
 }
Beispiel #22
0
    private void SelectDialogLine(int id)
    {
        selectedDialogLine = selectedDialog.DialogLines [id];

        // Selecting the Actor
        if (availibleActorsList.Count != 0)
        {
            selectedActor = availibleActorsList [0];
            int i = 0;
            foreach (Actors a in availibleActorsList)
            {
                if (a.actorName == selectedDialogLine.actorObjectName)
                {
                    selectedActor   = a;
                    actorInputIndex = i;
                    break;
                }
                i++;
            }

            // Selecting the sprite
            if (selectedActor.actorSprites.Count != 0)
            {
                selectedSprite = new KeyValuePair <string, Sprite> (selectedActor.actorSpriteNames [0], selectedActor.actorSprites [0]);

                int x = 0;
                foreach (string s in selectedActor.actorSpriteNames)
                {
                    if (s == selectedDialogLine.spriteObjectName && selectedActor.actorSprites[x] != null)
                    {
                        selectedSprite   = new KeyValuePair <string, Sprite> (selectedActor.actorSpriteNames [0], selectedActor.actorSprites [0]);;
                        spriteInputIndex = x;
                        break;
                    }
                    x++;
                }
            }
        }
        else
        {
            selectedActor = null;
        }

        lineTextInput      = selectedDialogLine.text;
        responseCountInput = selectedDialogLine.responses.Count;
        followUpLineInput  = selectedDialogLine.followUpLine;

        responseTextInput.Clear();
        responseFollowUpIDInput.Clear();
        foreach (Response r in selectedDialogLine.responses)
        {
            responseTextInput.Add(r.text);
            responseFollowUpIDInput.Add(r.followupLine);
        }
    }
    public virtual void HandleDialog()
    {
        DialogLine dLine = new DialogLine();

        string[]      tokens     = currentDialogText.Trim().Split(':');
        List <string> tempTokens = new List <string>();

        for (int i = 0; i < tokens.Length; i++)
        {
            if (tokens[i].EndsWith("\\"))
            {
                //Debug.Log(i);
                //LOL IDK
                ///tempTokens.Add((tokens[i] + ":" + tokens[i + i]).Trim());
            }
            else
            {
                tempTokens.Add(tokens[i].Trim());
            }
        }

        tokens = tempTokens.ToArray();
        switch (tokens.Length)
        {
        case 4:
            dLine.character = tokens[1];
            dLine.emote     = tokens[2];
            dLine.line      = tokens[3];
            break;

        case 3:
            dLine.character = tokens[0];
            dLine.emote     = tokens[1];
            dLine.line      = tokens[2];
            break;

        case 2:
            dLine.character = tokens[0];
            dLine.line      = tokens[1];
            break;

        case 1:
            dLine.line = tokens[0];
            break;
        }

        if (dLine.line == "EMPTY_LINE")
        {
            Continue();
        }
        else
        {
            DisplayDialogLine(dLine);
        }
    }
Beispiel #24
0
    }//end of PopulateDialogLines

    /// <summary>
    /// Parses kvps from text file into kvp string,MoodTypes. Being as this method is called at the end of each chunk being built, it can be used in the future for additional/broader parsing
    /// </summary>
    /// <param name="targetMoods">list of raw strings from text files</param>
    /// <param name="buffer">buffer ref used to add parsed kvps to</param>
    static void ParseTargetIDMoodPairs(List<string> targetMoods, DialogLine buffer)
    {
        foreach (string targetMood in targetMoods)
        {
            int separatorIndex = targetMood.IndexOf('|');
            string target = targetMood.Substring(0, separatorIndex);
            MoodTypes mood = (MoodTypes)Enum.Parse(typeof(MoodTypes), targetMood.Substring(separatorIndex + 1));
            buffer.TargetMoods.Add(new KeyValuePair<string, MoodTypes>(target, mood));
        }
        //string targetID = line.Substring()
    }//end of ParseTargetIDMoodPairs
Beispiel #25
0
        private void DialogSay()
        {
            int        randomValue = (int)(Random.value * m_DialogInfo.linesInfo.Length);
            DialogLine line        = m_DialogInfo.linesInfo[randomValue];

            m_CurLine   = line;
            m_TimeCount = Time.time + m_CurLine.continueTime;
            text.text   = m_CurLine.dialogConversation.Replace('#', '\n');
            CountBubbleSize();
            showing = true;
        }
    void ToNextLine()
    {
        currentLine = set.NextLine();
        if (currentLine == null)
        {
            EndDialog();
            return;
        }

        nameTmp.SetText(currentLine.name);
        lineTmp.SetText(currentLine.line);
    }
Beispiel #27
0
    private void CreateNewDialogLine()
    {
        DialogLine newLine = new DialogLine(selectedDialog.DialogLines.Count);

        selectedDialog.DialogLines.Add(newLine);
        // ZORG DAT DE NIEUWE DIALOG ID NIET EEN ANDER KAN OVERWRITEN

        Rect r = new Rect(110, 250, 100, 100);

        windows.Add(r);
        gridNodes.Add(new DialogGridNode(newLine, r, SelectDialogLine));
    }
Beispiel #28
0
    public void DisplayLine(DialogLine storyLine)
    {
        if (nameText != null && storyLine.character != null)
        {
            nameText.text = textInfo.ToTitleCase(storyLine.character.ToLower());
        }

        if (gameObject.activeInHierarchy && storyLine.line.Length > 0)
        {
            _typer.TypeText(storyLine.line);
        }
    }
Beispiel #29
0
 // Start is called before the first frame update
 private void Start()
 {
     canvas          = transform.Find("Canvas").gameObject.GetComponent <Canvas>();
     portraitA       = transform.Find("Canvas/PortraitA").gameObject;
     portraitB       = transform.Find("Canvas/PortraitB").gameObject;
     text            = transform.Find("Canvas/Text").gameObject.GetComponent <UnityEngine.UI.Text>();
     eventManagement = eventManager.GetComponent <EventManagement>();
     root            = new DialogLine('b', "Welcome to the pre-pre-pre-pre-pre-\npre-pre-pre-pre-pre-pre-pre-pre-pre-\npre-pre-pre-pre-pre-pre-pre-pre-pre-\npre-pre-pre-pre-pre-pre-pre-alpha");
     exit            = new DialogLine('b', "See ya");
     exit.eventName  = "exit";
     root.response0  = exit;
 }
 void EndDialog()
 {
     set         = null;
     currentLine = null;
     isActive    = false;
     nameTmp.SetText("");
     lineTmp.SetText("");
     dialogPanel.SetActive(false);
     Static.Pause(false);
     if (OnDialogEnded != null)
     {
         OnDialogEnded();
     }
 }
    void OnTriggerEnter(Collider other)
    {
        if (other.GetComponent<PlayerController>() && m_Interractable)
        {
            //other.GetComponent<AudioSource>().Play();
            m_Dialog = new DialogLine();
            m_Dialog.m_Line = m_Line;
            m_Dialog.m_Source = m_Source;
            m_Dialog.m_Subtitles = m_Subtitles;
            m_Dialog.m_Time = m_Time;

            m_Dialog.Trigger(other.GetComponent<PlayerController>().Screen.transform.GetChild(0).GetComponent<TextMessageHandler>());
            m_Interractable = false;
        }
    }
Beispiel #32
0
    void LoadDialog(string[] questDialog)
    {
        ParseMode parseMode = ParseMode.None;

        DialogBase currentDialogEvent = null;
        characterList = new List<Character>();

        int currentBranch = 0;

        int currentChoiceIndex = 0;
        int maxBranch = currentBranch;

        List<int> branchQueue = new List<int> ();
        List<int> priorityQueue = new List<int> ();
        List<int> finishedQueue = new List<int> (); //for pending branches to be merged later

        bool mergePending = false;
        priorityQueue.Add (currentBranch);

        foreach (string dataLine in questDialog) {
            if (dataLine == "<Chara>"){
                parseMode = ParseMode.Character;
                continue;
            } else if (dataLine == "<Dialog>"){
                parseMode = ParseMode.Dialog;
                continue;
            } else if (dataLine == "<Choice>"){
                parseMode = ParseMode.Choice;
                continue;
            } else if (dataLine == "<ChoiceOptions>"){
                parseMode = ParseMode.ChoiceOptions;
                continue;
            }else if (dataLine == "<End>"){
                break;
            } else if (dataLine == "<ChoiceEnd>"){
                finishedQueue.Insert (0, currentBranch);
                priorityQueue.RemoveAt (0);
                currentBranch = priorityQueue[0];

                if (currentBranch == branchQueue[0])
                    mergePending = true;

                continue;
            }

            DialogBase nextEvent = null;
            switch (parseMode){
            case ParseMode.Character:
            {
                string[] parts = dataLine.Split(new char[] {',',':'});
                characterList.Add(new Character(int.Parse(parts[0]), parts[1]));
            }
                break;

            case ParseMode.Dialog:
            {
                string[] parts = dataLine.Split(new char[] {'^'});

                DialogLine newDialogLine = new DialogLine();
                newDialogLine.eventGroup = currentBranch;

                newDialogLine.characterID = int.Parse(parts[0]);
                newDialogLine.dialogLine = parts[1].Replace("<playername>", PlayerProfile.Get ().playerName).Replace("\\n", System.Environment.NewLine);
                newDialogLine.anims = null;

                if (parts.Length > 2){
                    string[] anims = parts[2].Split (new char[]{','});
                    newDialogLine.anims = new string[anims.Length];
                    for (int i = 0; i < anims.Length; ++i){
                        newDialogLine.anims[i] = anims[i];
                    }

                    if (parts.Length > 3){
                        newDialogLine.isLoopAnim = (parts[3] == "L");
                    }
                }

                nextEvent = newDialogLine;
            }
                break;

            case ParseMode.Choice:
            {
                string[] parts = dataLine.Split(new char[] {'^'});

                DialogChoice newChoice = new DialogChoice();

                int branchCount = int.Parse(parts[1]);
                newChoice.eventGroup = currentBranch;

                newChoice.choiceOptions = new string[branchCount];
                newChoice.choiceCost = new int[branchCount];
                newChoice.choiceReward = new int[branchCount];
                newChoice.choiceEnergyReward = new int[branchCount];
                newChoice.choiceMoneyReward = new int[branchCount];

                parseMode = ParseMode.ChoiceOptions;

                currentChoiceIndex = 0;

        //				newChoice.eventGroup = currentBranch;
        //				newChoice.choiceOptions = new string[parts.Length];
        //				newChoice.choiceCost = new int[parts.Length];
        //				newChoice.choiceReward = new int[parts.Length];
        //
        //				int i = 0;
        //
        //				foreach (string choiceLine in parts){
        //					string[] lineParts = choiceLine.Split(new string[]{"::"}, System.StringSplitOptions.None);
        //					newChoice.choiceCost[i] = int.Parse(lineParts[0].Split (':')[1]);
        //					newChoice.choiceReward[i] = int.Parse(lineParts[2].Split (':')[1]);
        //					newChoice.choiceOptions[i++] = lineParts[1];
        //					maxBranch = maxBranch + i;
        //					priorityQueue.Insert(0, maxBranch);
        //				}
        //
        //				branchQueue.Insert(0, currentBranch); //store last branch node
        //				currentBranch = priorityQueue[0]; //remove first node from pq
        //
        //				parseMode = ParseMode.Dialog;
        //				branchQueue.Add (currentBranch);

                nextEvent = newChoice;
            }
                break;

            case ParseMode.ChoiceOptions:
            {
                DialogChoice currentChoice = currentDialogEvent as DialogChoice;

                string[] parts = dataLine.Split(new char[] {'^'});

                currentChoice.choiceCost[currentChoiceIndex] = int.Parse(parts[0]);
                currentChoice.choiceOptions[currentChoiceIndex] = parts[1];
                currentChoice.choiceReward[currentChoiceIndex] = int.Parse (parts[2]);

                currentChoice.choiceMoneyReward[currentChoiceIndex] = int.Parse (parts[3]);
                currentChoice.choiceEnergyReward[currentChoiceIndex] = int.Parse (parts[4]);

                currentChoiceIndex++;
                maxBranch = maxBranch + currentChoiceIndex;
                priorityQueue.Insert(0, maxBranch);

                if (currentChoiceIndex >= currentChoice.choiceCost.Length){

                    branchQueue.Insert(0, currentBranch); //store last branch node
                    currentBranch = priorityQueue[0]; //remove first node from pq

                    parseMode = ParseMode.Dialog;
                }
                continue;

            }
                break;
            }

            if (currentDialogEvent == null){
                    openingDialogEvent = nextEvent;
                }
            else{
                if (currentDialogEvent.eventGroup == nextEvent.eventGroup)
                    currentDialogEvent.nextEvent = nextEvent;
                else{

                    int lastBranch = branchQueue[0];
                    if (lastBranch != priorityQueue[0]) //branch splitting
                    {
                        currentDialogEvent = openingDialogEvent.FindBranch(lastBranch);
        //						while (currentDialogEvent.eventGroup != lastBranch && currentDialogEvent.eventType != DialogBase.EventType.Choice){
        //							currentDialogEvent = currentDialogEvent.nextEvent;
        //						}
                        DialogChoice branchEvent = (DialogChoice)currentDialogEvent;
                        branchEvent.nextEvents.Add (nextEvent);
                    }else{ //branch merging

                        foreach (int finishedIndex in finishedQueue){
                            currentDialogEvent = openingDialogEvent.FindLeaf(finishedIndex);
                            currentDialogEvent.nextEvent = nextEvent;
                        }
                        finishedQueue.Clear ();
                        branchQueue.RemoveAt(0);
                    }
                }

            }
            currentDialogEvent = nextEvent;
        }

        charactersInScene = characterList.ToArray ();

        currentDialogEvent = openingDialogEvent;
        currentDialogEvent.DumpContents ();
        //		while (currentDialogEvent != null) {
        //			DialogLine dialog = currentDialogEvent as DialogLine;
        //			Debug.Log(dialog.dialogLine + "\n");
        //
        //			currentDialogEvent = currentDialogEvent.nextEvent;
        //		}
    }