Example #1
0
    public string[] choiceFor_dennis1; //string holding the dialogue

    private void Start()
    {
        MainCamera = GameObject.FindWithTag("MainCamera");
        nm         = MainCamera.GetComponent <NarrativeManager>();
        dh         = GetComponent <DialogHolder>();
        StartCoroutine(tempCombatCaller());
    }
Example #2
0
    void ShowCharacterDialog()
    {
        isChangingSpeech = false;

        switch (CurrentSpeech.character)
        {
        case Assets.CHARACTER_PLAYER:
            currentDialog = playerDialog;
            break;

        case Assets.CHARACTER_NARRATOR:
            currentDialog = narratorDialog;
            break;

        default:
            currentDialog = opponentDialog;
            currentDialog.nameText.text = CurrentSpeech.character;
            break;
        }

        currentDialog.text.text = CurrentSpeech.text;

        currentDialog.Show();

        if (Assets.CHARACTER_PLAYER.Equals(CurrentSpeech.character))
        {
            UpdateChoisesUI();
        }
    }
    void Start()
    {
        gameState    = GameState.instance;
        dialogHolder = DialogHolder.instance;

        title       = dialogHolder.GetTitle();
        image       = dialogHolder.GetImage();
        description = dialogHolder.GetDescription();
    }
Example #4
0
 private void Awake()
 {
     continueButton.onClick.AddListener(delegate { ContinueDialogue(); });
     if (Instance != null && Instance != this)
     {
         Destroy(gameObject);
     }
     else
     {
         Instance = this;
     }
 }
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        canvasObject = GameObject.Find("DialogCanvas");
        if (canvasObject == null)
        {
            Debug.LogError("Missing DialogCanvas in scene");
        }

        title       = GameObject.Find("DialogTitle").GetComponent <Text>();
        image       = GameObject.Find("DialogImage").GetComponent <Image>();
        description = GameObject.Find("DialogDescription").GetComponent <Text>();

        canvasObject.SetActive(false);
    }
        private void LoadConversation(int convotoload)
        {
            //Prep to draw new conversation.
            currentNode = "";
            tcMain.Clear();
            IDs.Clear();

            //Draw 'em
            foreach (DialogEntry d in projie.Assets.Conversations[convotoload].DialogEntries)
            {
                List<int> childs = new List<int>();
                foreach (Link link in d.OutgoingLinks)
                {
                    if (link.DestinationConvoID == link.OriginConvoID && link.IsConnector == false)
                        childs.Add(link.DestinationDialogID);
                }
                DialogHolder dh = new DialogHolder();
                dh.ID = d.ID;
                dh.ChildNodes = childs;
                IDs.Add(dh);
            }
            foreach (DialogHolder dh in IDs)
            {
                DrawConversationTree(dh);
            }
            tcMain.Children.OfType<TreeNode>().First(node => node.Name == "node_0").BringIntoView();

            //Clear the nodes for the next draw cycle since we don't use it for anything else.
            handledNodes.Clear();
        }
        private void DrawConversationTree(DialogHolder dh)
        {
            if (!handledNodes.Contains(dh.ID))
            {

                handledNodes.Add(dh.ID);
                int parentNode = -1;
                DialogEntry de = projie.Assets.Conversations[loadedConversation].DialogEntries.First(d => d.ID == dh.ID);
                NodeControl ndctl = new NodeControl();
                BrushConverter bc = new BrushConverter();
                switch(de.NodeColor)
                {
                    case "Red":
                        ndctl.grid.Background = (Brush)bc.ConvertFrom("#CC4452");
                        ndctl.border.BorderBrush = (Brush)bc.ConvertFrom("#723147");
                        break;
                    case "Green":
                        ndctl.grid.Background = (Brush)bc.ConvertFrom("#FFA5C77F");
                        ndctl.border.BorderBrush = (Brush)bc.ConvertFrom("#002F32");
                        break;
                }
                ndctl.lblID.Content = de.ID;
                ndctl.lblNodeColor.Content = de.NodeColor;
                ndctl.Name = "_node_" + de.ID;
                ndctl.lblUserScript.Content = de.UserScript;
                ndctl.lblConditionsString.Content = de.ConditionsString;
                ndctl.lblConversationID.Content = loadedConversation;
                ndctl.lblFalseCondition.Content = de.FalseCondtionAction;
                Console.WriteLine("Setting Bindings...");
                foreach(Link lanks in de.OutgoingLinks)
                {
                    if (lanks.IsConnector == true)
                    {
                        ndctl.lblLinkTo.Content = lanks.DestinationDialogID;
                        ndctl.btnAdd.Visibility = Visibility.Hidden;
                        ndctl.faLink.Visibility = Visibility.Visible;
                    }
                }
                foreach (Field field in de.Fields)
                {
                    switch (field.Title)
                    {
                        case "Title":
                            ndctl.lblDialogueName.Text = field.Value;
                            break;
                        case "Actor":
                            ndctl.lblActorID.Content = field.Value;
                            CharacterItem chara = lstCharacters.Items[Convert.ToInt16(field.Value) - 1] as CharacterItem;
                            ndctl.imgActor.Source = chara.imgActorImage.Source;
                            ndctl.lblActor.Text = chara.lblActorName.Text;
                            break;
                        case "Conversant":
                            ndctl.lblConversantID.Content = field.Value;
                            chara = lstCharacters.Items[Convert.ToInt16(field.Value) - 1] as CharacterItem;
                            ndctl.lblConversant.Text = chara.lblActorName.Text;
                            break;
                        case "Menu Text":
                            ndctl.lblMenuText.Text = field.Value;
                            break;
                        case "Dialogue Text":
                            ndctl.txtDialogue.Text = field.Value;
                            break;
                        case "Sequence":
                            ndctl.lblSequence.Content = field.Value;
                            break;
                    }
                }
                foreach(DialogHolder dhParent in IDs)
                {
                    if (dhParent.ChildNodes.Contains(dh.ID))
                        parentNode = dhParent.ID;
                }
                if (parentNode == -1)
                {
                    ConversationItem convo = lstConversations.Items[loadedConversation] as ConversationItem;
                    ndctl.grdNodeImage.Height = new GridLength(0);
                    ndctl.grdNodeText.Height = new GridLength(0);
                    ndctl.lblDialogueName.Text = convo.lblConvTitle.Text;
                    tcMain.AddRoot(ndctl, "node_" + dh.ID);
                    Console.WriteLine("Writing root: " + dh.ID);
                }
                else
                {
                    tcMain.AddNode(ndctl, "node_" + dh.ID, "node_" + parentNode);
                    Console.WriteLine("Writing node: " + dh.ID);
                }
            }
        }