public override string ErrorCheck()
        {
            Variable variable = null;

            if (IsGlobal.Value)
            {
                variable = DialogueSystem.GetGlobalVariable(VariableName.Value);
            }
            else
            {
                var go = Fsm.GetOwnerDefaultTarget(Actor);
                if (go == null)
                {
                    return("Actor is needed for getting a local variable!");
                }
                DialogueBehaviour b = go.GetComponent <DialogueBehaviour>();
                variable = b.GetLocalVariable(VariableName.Value);
            }

            // Variable doesn't exists
            if (variable == null)
            {
                return(VariableName.Value + " doesn't exists in the " + ((IsGlobal.Value) ? "Dialogue Editor Global Variables" : ""));
            }

            // Variable type is not the right one
            if (!FsmVariableUtils.CheckType(variable, typeof(T)))
            {
                return("The value type should be " + variable.type);
            }

            return(base.ErrorCheck());
        }
        DialogueSystemUISkin ActivateSkin(DialogueBehaviour behaviour, string skinName)
        {
            if (_activeSkins.ContainsKey(behaviour))
            {
                Destroy(_activeSkins[behaviour]);
            }
            else
            {
                _activeSkins.Add(behaviour, null);
            }

            DialogueSystemUISkin skin = null;

            if (_skins.ContainsKey(skinName))
            {
                var go = Instantiate(_skins[skinName].gameObject);
                skin = go.GetComponent <DialogueSystemUISkin>();
                go.transform.SetParent(transform);
                go.transform.localScale = Vector3.one;
                go.SetActive(true);
            }

            _activeSkins[behaviour] = skin;
            return(skin);
        }
 public void OnDialogueFinished(DialogueBehaviour owner)
 {
     if (_activeSkins.ContainsKey(owner) && _activeSkins[owner] != null)
     {
         Destroy(_activeSkins[owner].gameObject);
         _activeSkins.Remove(owner);
     }
 }
Exemple #4
0
 public void ApplyChanges(DialogueBehaviour dialogue)
 {
     // Generalization is hard
     //dialogue.bust.GetComponent<Animation>() = animation;
     //Debug.Log(dialogue.bust.GetComponent<Animator>().runtimeAnimatorController.animationClips[0]);
     //dialogue.bust.GetComponent<Animator>().runtimeAnimatorController.animationClips[0] = animation.clip;
     // dialogue.bust.GetComponent<Animator>().Play(animationName);
 }
 public void ApplyChanges(DialogueBehaviour dialogue)
 {
     // Applies the changes.
     foreach (IDialogueElement element in elements)
     {
         element.ApplyChanges(dialogue);
     }
 }
        public override void OnEnter()
        {
            var go = Fsm.GetOwnerDefaultTarget(Actor);
            DialogueBehaviour b = go.GetComponent <DialogueBehaviour>();

            b.StartDialogue(b.Conversation, Trigger.Modes.Custom);

            Finish();
        }
Exemple #7
0
        public override void OnEnter()
        {
            var go = Fsm.GetOwnerDefaultTarget(Actor);
            DialogueBehaviour b = go.GetComponent <DialogueBehaviour>();

            b.StopDialogue(b.AmbientDialogue);

            Finish();
        }
Exemple #8
0
 public void ApplyChanges(DialogueBehaviour dialogue)
 {
     /* This one doesn't work right now, hehe
      * To-do: a conditional (maybe a switch) that changes the transforms
      * of the texts and the bust depending on whether side.ToUpper is "LEFT",
      * "RIGHT", or (maybe) "SWAP"
      *
      * I'll need access to the name panel too, but psssshhhh
      * I'll worry about that later
      */
 }
        /// <summary>
        /// Closes the UI.
        /// </summary>
        public void OnDialogueFinished(DialogueBehaviour owner)
        {
            //Debug.Log("On dialogue finished");

            if (owner.Conversation.ExitDelay > 0)
            {
                _closeTime = Time.time + owner.Conversation.ExitDelay;
            }
            else
            {
                CloseDialogue();
            }
        }
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         if (!_begin)
         {
             begin();
             _begin = true;
         }
         else
         {
             DialogueBehaviour.onClick();
         }
     }
 }
Exemple #11
0
 public override void OnEnter()
 {
     if (IsGlobal.Value)
     {
         var variable = DialogueSystem.GetGlobalVariable(VariableName.Value);
         FsmVariableUtils.SetFsmVariable(result, variable);
     }
     else
     {
         var go = Fsm.GetOwnerDefaultTarget(Actor);
         if (go != null)
         {
             DialogueBehaviour b = go.GetComponent <DialogueBehaviour>();
             var variable        = b.GetLocalVariable(VariableName.Value);
             FsmVariableUtils.SetFsmVariable(result, variable);
         }
     }
     Finish();
 }
Exemple #12
0
 public override void OnPlayableCreate(Playable playable)
 {
     base.OnPlayableCreate(playable);
     dialoguePlayable = behaviour as DialogueBehaviour;
 }
Exemple #13
0
 public void ApplyChanges(DialogueBehaviour dialogue)
 {
     dialogue.voice.clip = voice;
 }
Exemple #14
0
 public void ApplyChanges(DialogueBehaviour dialogue)
 {
     dialogue.speech = line;
 }
Exemple #15
0
 public void ApplyChanges(DialogueBehaviour dialogue)
 {
     dialogue.speed = speed;
 }
Exemple #16
0
 public void ApplyChanges(DialogueBehaviour dialogue)
 {
     dialogue.speakerName.text = name;
 }
    void begin()
    {
        var ds = DialogueModel.getInstance().dialogues;

        DialogueBehaviour.onShowDialogue(ds[0]);
    }
        public void OnTextChanged(DialogueFlow dialogue, TextData text, List <TextAnswerData> answers, SettingsData settings)
        {
            _behaviour = dialogue.Behaviour;

            // Select and open a skin
            if (settings.Skin == "")
            {
                settings.Skin = (dialogue.DefaultSkin != "") ? dialogue.DefaultSkin : DefaultSkin;
            }

            SelectSkin(settings.Skin);
            if (_activeSkin == null)
            {
                RunemarkDebug.Warning(settings.Skin + " skin doesn't exists in this canvas: " + gameObject.name);
                return;
            }

            // Stop the audio if currently playing
            if (_audioSource.isPlaying)
            {
                _audioSource.Stop();
            }

            // Set the actor's name and portrait
            string name     = text.Name;
            Sprite portrait = text.Portrait;

            _activeSkin.SetText(name, portrait, text.Text);
            _activeSkin.HideInputAnswer();

            _activeSkin.HideAnswers(0);

            // Set the answers
            int cnt = 0;

            foreach (var a in answers)
            {
                if (a.UseCustomUI)
                {
                    _activeSkin.SetCustomAnswer(a.UIElementName, a);
                }
                else if (answers.Count > cnt)
                {
                    _activeSkin.SetAnswer(cnt, a);
                    cnt++;
                }
            }
            // _activeSkin.HideAnswers(cnt);

            // Play Audio if any
            if (text.Audio != null)
            {
                _audioStopTime    = text.AudioEndTime;
                _audioSource.clip = text.Audio;
                _audioSource.time = text.AudioStartTime;

                if (text.AudioDelay > 0)
                {
                    _audioSource.PlayDelayed(text.AudioDelay);
                }
                else
                {
                    _audioSource.Play();
                }
            }

            // Set the timer
            if (_behaviour.Timer != null && cnt > 0)
            {
                _activeSkin.StartTimer(_behaviour.Timer.Seconds);
            }
            else
            {
                _activeSkin.HideTimer();
            }
        }
 public void OnDialogueStart(DialogueBehaviour owner)
 {
     //  Debug.LogFormat("{0} - Conversation Controller.OnDialogueStart()", name);
 }
Exemple #20
0
 public void ApplyChanges(DialogueBehaviour dialogue)
 {
     dialogue.bust.sprite = bust;
     // Stop the current animation
     // dialogue.bust.GetComponent<Animator>().Play("Don't");
 }
Exemple #21
0
 public void ApplyChanges(DialogueBehaviour dialogue)
 {
     dialogue.font = font;
 }
 public void OnDialogueStart(DialogueBehaviour owner)
 {
 }