Exemplo n.º 1
0
    void BuildElement(int toNode, string text, bool isActiveButton, DialogueInteract dialogueInteract)
    {
        ButtonComponent clone = buttonsObjectPool.First(b => !b.gameObject.activeSelf);

        clone.gameObject.SetActive(true);
        clone.text.text           = text;
        clone.rect.sizeDelta      = new Vector2(clone.rect.sizeDelta.x, clone.text.preferredHeight + offset);
        clone.button.interactable = isActiveButton;
        height = clone.rect.sizeDelta.y;
        clone.rect.anchoredPosition = new Vector2(0, -height / 2 - curY);

        if (toNode > 0)
        {
            clone.button.onClick.AddListener(() => BuildDialogue(toNode));
        }

        switch (dialogueInteract)
        {
        case DialogueInteract.None:
            break;

        case DialogueInteract.Exit:
            clone.button.onClick.AddListener(() => CloseDialogue());
            break;

        case DialogueInteract.Trade:
            clone.button.onClick.AddListener(() => StartTrade());
            break;

        case DialogueInteract.StartCutScene:
            clone.button.onClick.AddListener(() => StartCutScene());
            break;

        case DialogueInteract.Affect:
            break;

        case DialogueInteract.Required:
            break;
        }

        buttons.Add(clone.rect);
    }
Exemplo n.º 2
0
 public void Setup(DialogueInteract _dialogueInteract, DialogueObject _dialogueObject, string _dialogueText)
 {
     dialogueInteract  = _dialogueInteract;
     dialogueObject    = _dialogueObject;
     dialogueText.text = _dialogueText;
 }
Exemplo n.º 3
0
 void AddToList(int toNode, string text, bool isActive, DialogueInteract dialogueInteract)
 {
     BuildElement(toNode, text, isActive, dialogueInteract);
     curY += height + offset;
     RectContent();
 }