Exemple #1
0
    // RefreshDisplay prompts the prompt text and response buttons to be updated
    // depending on a supplied DialogPromptNode
    public void RefreshDisplay(DialogPromptNode nextPrompt)
    {
        this.AssignControllers();
        currentTreeObj = dialogCtrl.GetDemoTree();

        promptText.text = "";
        foreach (ResponseButton button in buttons)
        {
            Destroy(button.gameObject);
        }
        buttons.Clear();

        if (index == 0)
        {
            Debug.Log("index is 0!");
            this.AssignControllers();
            prompts = dialogCtrl.GetDemoTreePrompts(currentTreeObj);
            this.ShowPromptAndResponses(prompts[index]);
        }
        else if (nextPrompt != null)
        {
            this.AssignControllers();
            this.ShowPromptAndResponses(nextPrompt);
        }
    }
Exemple #2
0
 // UpdatePromptResponse modifies the response key-phrase associated with the prompt
 public void UpdatePromptResponse(DialogPromptNode prompt, DialogResponse resp, string newPhrase)
 {
     if (promptIds.Contains(prompt.GetNodeID()))
     {
         Debug.Log("updating prompt response phrase from " + resp.GetKeyPhrase() + " to " + newPhrase);
         prompt.UpdateResponse(resp, newPhrase);
     }
 }
Exemple #3
0
 // RemovePromptResponse removes the response from the speciifed prompt
 public void RemovePromptResponse(DialogPromptNode prompt, DialogResponse resp)
 {
     if (promptIds.Contains(prompt.GetNodeID()))
     {
         Debug.Log("removing prompt response " + resp.GetKeyPhrase() + " from prompt " + prompt.GetKeyPhrase());
         prompt.RemoveResp(resp);
     }
 }
Exemple #4
0
 // EditPromptPhrase updates the specified prompt key-phrase
 public void EditPromptPhrase(DialogPromptNode prompt, string phrase)
 {
     if (promptIds.Contains(prompt.GetNodeID()))
     {
         Debug.Log("editing prompt phrase from " + prompt.GetKeyPhrase() + " to " + phrase);
         prompt.SetDialogText(phrase);
     }
 }
Exemple #5
0
 // AddPromptResponse adds a blank response to the prompt specified
 public void AddPromptResponse(DialogPromptNode prompt)
 {
     if (promptIds.Contains(prompt.GetNodeID()))
     {
         Debug.Log("adding a prompt response for prompt " + prompt.GetKeyPhrase());
         prompt.AddResponse("unset");
     }
 }
Exemple #6
0
    // UpdateRespPhrase updates the response key-phrase associated with the given prompt
    public void UpdateRespPhrase(DialogPromptNode prompt, DialogResponse resp, int index)
    {
        string newPhrase = this.GetKeyPhrases()[index];

        this.getTree(editingTreeName).UpdatePromptResponse(prompt, resp, newPhrase);

        this.raiseTreeUpdate();
    }
Exemple #7
0
 // UpdatePromptRespGoTo updates the go-to value associated with the specified prompt's response value
 public void UpdatePromptRespGoTo(DialogPromptNode prompt, DialogResponse resp, string goToPrompt)
 {
     if (promptIds.Contains(prompt.GetNodeID()))
     {
         Debug.Log("updating prompt resp go to from " + resp.GetNext() + " to " + goToPrompt);
         prompt.SetRespNext(resp, goToPrompt);
     }
 }
Exemple #8
0
    // UpdatePromptPhrase updates the key-phrase associated with the specified prompt
    public void UpdatePromptPhrase(DialogPromptNode prompt, int index)
    {
        string newPhrase = this.GetKeyPhrases()[index];

        this.getTree(editingTreeName).EditPromptPhrase(prompt, newPhrase);

        this.raiseTreeUpdate();
    }
Exemple #9
0
 // RemovePrompt removes the DialogPromptNode from the collection of prompts
 public void RemovePrompt(DialogPromptNode promptNode)
 {
     if (promptIds.Contains(promptNode.GetNodeID()))
     {
         Debug.Log("removed prompt " + promptNode.GetNodeID() + " from " + this.treeId);
         promptIds.Remove(promptNode.GetNodeID());
         promptNodes.Remove(promptNode);
     }
 }
Exemple #10
0
    // UpdateRespGoTo updates the go-to value of the selected response associated with the prompt
    public void UpdateRespGoTo(DialogPromptNode prompt, DialogResponse resp, int index)
    {
        List <DialogPromptNode> l = this.getTree(editingTreeName).GetPrompts();
        string goTo = l[index].GetNodeID();

        this.getTree(editingTreeName).UpdatePromptRespGoTo(prompt, resp, goTo);

        this.raiseTreeUpdate();
    }
Exemple #11
0
 // AddPrompt adds a prompt with treeId 'id' to the collection of prompts for this tree
 public void AddPrompt(string id)
 {
     if (!promptIds.Contains(id))
     {
         Debug.Log("added prompt " + id + " to tree " + this.treeId);
         DialogPromptNode p = new DialogPromptNode(id);
         promptNodes.Add(p);
         promptIds.Add(id);
     }
 }
Exemple #12
0
    // ShowPromptAndResponses instantiates any buttons and sets up the UI
    private void ShowPromptAndResponses(DialogPromptNode prompt)
    {
        this.AssignControllers();
        promptText.text = langCtrl.GetValue(prompt.GetKeyPhrase());
        yPosition       = 600f;
        Debug.Log("there are " + prompt.GetResponses().Count + " responses");
        foreach (DialogResponse resp in prompt.GetResponses())
        {
            ResponseButton button = Instantiate(respButton) as ResponseButton;
            button.Setup(this, resp, canvas, yPosition, langCtrl.GetValue(resp.GetKeyPhrase()));
            buttons.Add(button);
            yPosition -= 100f;
        }

        index++;
    }
Exemple #13
0
    // RemoveResponse removes the response from the list of DialogResponses held by the DialogPromptNode
    public void RemoveResponse(DialogPromptNode prompt, DialogResponse response)
    {
        this.getTree(editingTreeName).RemovePromptResponse(prompt, response);

        this.raiseTreeUpdate();
    }
Exemple #14
0
    // AddPromptResponse adds a new unset response to the set of responses associated with the prompt
    public void AddPromptResponse(DialogPromptNode prompt)
    {
        this.getTree(editingTreeName).AddPromptResponse(prompt);

        this.raiseTreeUpdate();
    }
Exemple #15
0
    // RemoveNode removes the specified DialogPromptNode from the current dialog tree's prompt list
    public void RemoveNode(DialogPromptNode promptNode)
    {
        this.getTree(editingTreeName).RemovePrompt(promptNode);

        this.raiseTreeUpdate();
    }