Example #1
0
 // Start is called before the first frame update
 void Start()
 {
     rpgtalk = GetComponent <RPGTalk>();
     rpgtalk.OnEndAnimating += CanPass;
     rpgtalk.OnPlayNext     += Passed;
     rpgtalk.OnEndTalk      += Passed;
 }
    // Start is called before the first frame update
    void Start()
    {
        SpawnUnits();

        Debug.Log("Start combat maager");
        GameObject dm = GameObject.FindGameObjectWithTag("TextboxManager");

        dialogue     = dm.GetComponent <RPGTalk>();
        tensionGauge = GameObject.FindGameObjectWithTag("TensionGauge").GetComponent <Slider>();

        dialogue.OnNewTalk    += NewTalkExists;
        dialogue.OnMadeChoice += OnMadeChoice;

        turnActions = new List <CombatAction>();

        SetRPGTalkVariables();

        dialogue.callback.AddListener(IntroTextEnd);

        foreach (CombatUnit cu in player)
        {
            CreateHealthBar(cu, playerHealthBase);
        }

        Debug.Log("Start coroutine");
        StartCoroutine(IntroTextLater());
    }
Example #3
0
 //private GameObject cam;
 private void Awake()
 {
     animator = gameObject.GetComponentInChildren <Animator>();
     controls = MetaScript.GetControls();
     rpgtalk  = GameObject.FindObjectOfType <RPGTalk>();
     // cam = GameObject.Find("MainCam");
 }
 private void Start()
 {
     rpgtalk            = GetComponent <RPGTalk>();
     timeline           = GetComponent <RPGTalkTimeline>();
     rpgtalk.OnNewTalk += OnTalkStart;
     rpgtalk.OnEndTalk += OnTalkFinish;
 }
Example #5
0
    //Each frame of the behaviour
    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
    {
        m_TrackBinding = playerData as RPGTalk;
        if (!m_FirstFrameHappened)
        {
            OnBehaviourPlay(playable, info);
            return;
        }



        //for now, we wont support spped changes into timeline
        if (m_TrackBinding.actualTextSpeed != textSpeed)
        {
            m_TrackBinding.actualTextSpeed = textSpeed;
        }

        //The current character will be calculated based on the textspeed and the time of the playable
        float currentChar = m_TrackBinding.actualTextSpeed * (float)playable.GetTime();



        //only change it if there is something new to change and we are not paused
        if (m_TrackBinding.rpgtalkElements.Count > m_TrackBinding.cutscenePosition - 1 &&
            Mathf.Min(currentChar, m_TrackBinding.rpgtalkElements [m_TrackBinding.cutscenePosition - 1].dialogText.Length)
            != m_TrackBinding.currentChar)
        {
            if (!rpgTime || !rpgTime.isPaused)
            {
                m_TrackBinding.currentChar = currentChar;
                m_TrackBinding.PutRightTextToShow();
            }
        }

        //If we reached the final, check if we should pause the timeline until the player finish the talk
        if (playable.GetTime() >= playable.GetDuration() - (double)0.1)
        {
            if (!reachedFinal)
            {
                reachedFinal = true;
                if (pauseUntilTalkEnd)
                {
                    if (!rpgTime)
                    {
                        Debug.LogError("To use the option 'Pause Until Talk End' the RpgTalk must contain a RPGTalkTimeline Component");
                    }
                    else
                    {
                        rpgTime.Pause();
                    }
                }
            }
        }
        else
        {
            reachedFinal = false;
        }
    }
Example #6
0
 public StoryFlow(TalkCallback talkCallback, InputHandler input, Settings settings, RPGTalk talk,
                  CountDeadSquires countDeadSquires, CameraFade cameraFade)
 {
     _talkCallback     = talkCallback;
     _input            = input;
     _settings         = settings;
     _talk             = talk;
     _countDeadSquires = countDeadSquires;
     _cameraFade       = cameraFade;
 }
 // Start is called before the first frame update
 void Start()
 {
     Player = GameObject.FindWithTag("Player");
     _nva   = GetComponent <NavMeshAgent>();
     _rpgt  = GetComponentInChildren <RPGTalk>();
     _rpgt.callback.AddListener(StopTalking);
     Level       = GameObject.FindGameObjectWithTag("Level");
     TargetPoint = new Vector3();
     StartCoroutine(MoveEnemy());
 }
Example #8
0
 // Start is called before the first frame update
 void Awake()
 {
     rpgTalk            = GetComponent <RPGTalk>();
     rpgTalk.OnNewTalk += BeginMove;
     rpgTalk.OnEndTalk += EndMove;
     if (pointer != null)
     {
         smartPointer = pointer.GetComponent <RPGTalkSmartPointer>();
     }
 }
    void StartDialogue(RPGTalk dialogue)
    {
        // RPGTalk doesn't like multiple RPGTalk instances using the same
        // dialogue text instance. So we need to ensure all other dialogues are
        // stopped before starting this new one.
        StopDialogue(dialogueIntroduction);
        StopDialogue(dialogueBetweenLevels);
        StopDialogue(dialogueIntroduction);

        dialogue.gameObject.SetActive(true);
        dialogue.NewTalk();
    }
Example #10
0
    // Use this for initialization
    private void Awake()
    {
        rpgTalk = GameObject.Find("RPGTalk Holder").GetComponent <RPGTalk>();

        if (_instance != null && _instance != this)
        {
            Destroy(this.gameObject);
        }
        else
        {
            _instance = this;
        }
    }
Example #11
0
    protected new void Start()
    {
        base.Start();
        CurrentPain = BasePain;

        // Set Canvas & Gauges sizes depending on Base Pain.
        PainBar.GetComponent <RectTransform>().sizeDelta = new Vector2(BasePain * 10, PainBar.GetComponent <RectTransform>().rect.height);
        CurrentPainGauge.rectTransform.sizeDelta         = new Vector2(BasePain * 10, CurrentPainGauge.rectTransform.rect.height);
        PainGaugeBG.rectTransform.sizeDelta = new Vector2(BasePain * 10, PainGaugeBG.rectTransform.rect.height);

        // Get RPGTalk instance and text file
        rpgTalk = GetComponent <RPGTalk>();
    }
Example #12
0
    // Use this for initialization
    private void Start()
    {
        _rpgTalkContainer                     = Instantiate(_rpgTalkContainer);
        _rpgTalkContainer.dialoger            = true;
        _rpgTalkContainer.textUI              = _rpgTalkContainer.gameObject.FindComponentsInChildrenWithTag <Text>("Text")[0];
        _rpgTalkContainer.dialogerUI          = _rpgTalkContainer.gameObject.FindComponentsInChildrenWithTag <Text>("Name")[0];
        _rpgTalkContainer.passWithMouse       = false;
        _rpgTalkContainer.enableQuickSkip     = true;
        _rpgTalkContainer.passWithInputButton = "Interact";
        _rpgTalkContainer.GetComponentInChildren <Canvas>().worldCamera = GameObject.FindWithTag("MainCamera").GetComponent <Camera>();
        _rpgTalkContainer.txtToParse = _textAssets[0];

        print(_talkAreas.Count);
        for (int i = 0; i < _talkAreas.Count; ++i)
        {
            _talkAreas[i] = Instantiate(_talkAreas[i]);
            _talkAreas[i].rpgtalkTarget = _rpgTalkContainer;
            _talkAreas[i].txtToParse    = _textAssets[1];
        }
    }
Example #13
0
 // Use this for initialization
 void Start()
 {
     text = GetComponent <RPGTalk>();
 }
 public void Start()
 {
     myTalk = gm.myTalk;
     txt    = gm.myTalk.txtToParse;
 }
Example #15
0
    override public void OnInspectorGUI()
    {
        serializedObject.Update();

        //Instance of our RPGTalk class
        RPGTalk rpgTalk = (RPGTalk)target;

        EditorGUI.BeginChangeCheck();

        EditorGUILayout.LabelField("Put below the Text file to be parsed and become the talks!");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("txtToParse"), GUIContent.none);
        if (serializedObject.FindProperty("txtToParse").objectReferenceValue == null)
        {
            EditorGUILayout.HelpBox("RPGTalk needs a TXT file to retrieve the lines from", MessageType.Error, true);
        }

        EditorGUILayout.PropertyField(serializedObject.FindProperty("showWithDialog"), true);
        if (serializedObject.FindProperty("showWithDialog").arraySize == 0)
        {
            EditorGUILayout.HelpBox("Not a single element to be shown with the Talk? Not even the Canvas?" +
                                    "Are you sure that is the correct bahaviour?", MessageType.Warning, true);
        }

        EditorGUILayout.BeginVertical((GUIStyle)"HelpBox");

        EditorGUILayout.LabelField("Regular Options:", EditorStyles.boldLabel);
        rpgTalk.startOnAwake       = GUILayout.Toggle(rpgTalk.startOnAwake, "Start On Awake?");
        rpgTalk.dialoger           = GUILayout.Toggle(rpgTalk.dialoger, "Should show the name of the talker?");
        rpgTalk.shouldUsePhotos    = GUILayout.Toggle(rpgTalk.shouldUsePhotos, "Should there be the photo of the talker?");
        rpgTalk.shouldStayOnScreen = GUILayout.Toggle(rpgTalk.shouldStayOnScreen, "Should the canvas stay on screen after the talk ended?");
        rpgTalk.shouldFollow       = GUILayout.Toggle(rpgTalk.shouldFollow, "Should the canvas follow someone?");
        if (rpgTalk.shouldFollow)
        {
            EditorGUI.indentLevel++;
            EditorGUILayout.LabelField("Who should it follow? Should there be an Offset?");
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(serializedObject.FindProperty("follow"), true);
            //EditorGUILayout.PropertyField (serializedObject.FindProperty("followOffset"),GUIContent.none);
            EditorGUILayout.EndHorizontal();

            if (rpgTalk.shouldFollow && rpgTalk.follow.Length == 0)
            {
                EditorGUILayout.HelpBox("You didn't set anyone to follow!", MessageType.Error, true);
            }

            EditorGUILayout.LabelField("The object that follows should be Billboard? Based on which camera?");
            EditorGUILayout.BeginHorizontal();
            rpgTalk.billboard = GUILayout.Toggle(rpgTalk.billboard, "Billboard?");
            if (rpgTalk.billboard)
            {
                rpgTalk.mainCamera = GUILayout.Toggle(rpgTalk.mainCamera, "Based on Main Camera?");
            }
            EditorGUILayout.EndHorizontal();
            if (rpgTalk.billboard && !rpgTalk.mainCamera)
            {
                EditorGUILayout.LabelField("What camera should the Billboard be based on?");
                EditorGUILayout.PropertyField(serializedObject.FindProperty("otherCamera"), GUIContent.none);
            }
            EditorGUI.indentLevel--;
        }
        rpgTalk.enableQuickSkip = GUILayout.Toggle(rpgTalk.enableQuickSkip, "Enable QuickStep (the player can jump the animation)?");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("textSpeed"));

        rpgTalk.passWithMouse = GUILayout.Toggle(rpgTalk.passWithMouse, "Pass the Talk with Mouse Click?");
        EditorGUILayout.LabelField("The Talk can also be passed with some button set on Project Settings > Input:");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("passWithInputButton"), GUIContent.none);
        if (!rpgTalk.passWithMouse && serializedObject.FindProperty("passWithInputButton").stringValue == "")
        {
            EditorGUILayout.HelpBox("There is no condition to pass the Talk. Is it really the expected behaviour?", MessageType.Warning, true);
        }

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("RPGTalk can try to make a Word Wrap for long texts in the same line.");
        rpgTalk.wordWrap = GUILayout.Toggle(rpgTalk.wordWrap, "Word Wrap?");
        if (rpgTalk.wordWrap)
        {
            EditorGUILayout.LabelField("Set manually the maximum chars in Width/Height that fit in the screen:");
            EditorGUI.indentLevel++;
            EditorGUILayout.PropertyField(serializedObject.FindProperty("maxCharInWidth"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("maxCharInHeight"));
            EditorGUI.indentLevel--;
        }

        EditorGUILayout.EndVertical();


        //create a nice box with round edges.
        EditorGUILayout.BeginVertical((GUIStyle)"HelpBox");
        EditorGUILayout.LabelField("Interface:", EditorStyles.boldLabel);
        EditorGUILayout.LabelField("Put below the UI for the text itself:");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("textUI"));
        if (serializedObject.FindProperty("textUI").objectReferenceValue == null)
        {
            EditorGUILayout.HelpBox("There should be a Text, inside of a Canvas, to show the Talk.", MessageType.Error, true);
        }
        if (rpgTalk.dialoger)
        {
            EditorGUILayout.LabelField("Put below the UI for the name of the talker:");
            EditorGUILayout.PropertyField(serializedObject.FindProperty("dialogerUI"));
            if (serializedObject.FindProperty("dialogerUI").objectReferenceValue == null)
            {
                EditorGUILayout.HelpBox("There should be a Text, inside of a Canvas, to show the talker's name.", MessageType.Warning, true);
            }
        }
        if (rpgTalk.shouldUsePhotos)
        {
            EditorGUILayout.LabelField("Put below the UI for the photo of the talker:");
            EditorGUILayout.PropertyField(serializedObject.FindProperty("UIPhoto"));
            if (serializedObject.FindProperty("UIPhoto").objectReferenceValue == null)
            {
                EditorGUILayout.HelpBox("There should be a Image, inside of a Canvas, to show the talker's photo.", MessageType.Warning, true);
            }
        }
        EditorGUILayout.LabelField("An object can blink when expecting player action:");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("blinkWhenReady"), GUIContent.none);
        EditorGUILayout.EndVertical();


        EditorGUILayout.BeginVertical((GUIStyle)"HelpBox");
        EditorGUILayout.LabelField("Callback, Breaks & Variables:", EditorStyles.boldLabel);
        EditorGUILayout.LabelField("Any script should be called when the Talk is done?");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("callbackScript"), GUIContent.none);
        if (serializedObject.FindProperty("callbackScript").objectReferenceValue != null)
        {
            EditorGUILayout.LabelField("What function on that script should be called?");
            EditorGUILayout.PropertyField(serializedObject.FindProperty("callbackFunction"), GUIContent.none);
            if (serializedObject.FindProperty("callbackFunction").stringValue == "")
            {
                EditorGUILayout.HelpBox("You said that a script should be called as callback, but didn't set the name of the functions to be called in that script", MessageType.Error, true);
            }
        }

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("What line of the text should the Talk start? And in what line shoult it end?");
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PropertyField(serializedObject.FindProperty("lineToStart"), GUIContent.none);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("lineToBreak"), GUIContent.none);
        EditorGUILayout.EndHorizontal();
        string lineToStart       = serializedObject.FindProperty("lineToStart").stringValue;
        int    actualLinaToStart = -2;

        if (int.TryParse(lineToStart, out actualLinaToStart) && actualLinaToStart < 1)
        {
            EditorGUILayout.HelpBox("The line that the Text should start must be 1 or greater!", MessageType.Error, true);
        }
        string lineToBreak       = serializedObject.FindProperty("lineToBreak").stringValue;
        int    actualLinaToBreak = -2;

        if (int.TryParse(lineToBreak, out actualLinaToBreak) && actualLinaToBreak != -1 &&
            actualLinaToBreak < actualLinaToStart)
        {
            EditorGUILayout.HelpBox("The line of the Text to stop the Talk comes before the line of the Text to start the Talk? " +
                                    "That makes no sense! If you want to read the Text file until the end, leave the line to break as '-1'", MessageType.Error, true);
        }
        EditorGUILayout.HelpBox("The line to start or to end might be set as strings! For instance, you can set lineToStart as 'MyString' and in your text, RPGTalk will start reading the line just after the tag [title=MyString].", MessageType.Info, true);

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Variables can be set to change some word in the text");
        EditorGUI.indentLevel++;
        EditorGUILayout.PropertyField(serializedObject.FindProperty("variables"), true);
        EditorGUI.indentLevel--;

        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical((GUIStyle)"HelpBox");
        EditorGUILayout.LabelField("Photos and Sprites:", EditorStyles.boldLabel);

        if (rpgTalk.shouldUsePhotos)
        {
            EditorGUILayout.LabelField("Change photo for different talkers:");
            EditorGUI.indentLevel++;
            EditorGUILayout.PropertyField(serializedObject.FindProperty("photos"), true);
            EditorGUI.indentLevel--;
            EditorGUILayout.Space();
        }

        EditorGUILayout.LabelField("Add sprites that can be used inside the text:");
        EditorGUI.indentLevel++;
        EditorGUILayout.PropertyField(serializedObject.FindProperty("sprites"), true);
        EditorGUI.indentLevel--;
        if (rpgTalk.sprites != null && rpgTalk.sprites.Count > 0)
        {
            EditorGUILayout.HelpBox("To use sprites inside the text, write the tag [sprite=X] and RPGTalk will replace it with the corresponding sprite above", MessageType.Info, true);
        }


        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical((GUIStyle)"HelpBox");
        EditorGUILayout.LabelField("Animation:", EditorStyles.boldLabel);
        EditorGUILayout.LabelField("A Animator can be manipulated when talking:");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("animatorWhenTalking"), GUIContent.none);
        if (serializedObject.FindProperty("animatorWhenTalking").objectReferenceValue != null)
        {
            EditorGUILayout.LabelField("A Boolean to be set true when the character is talking:");
            EditorGUILayout.PropertyField(serializedObject.FindProperty("animatorBooleanName"), GUIContent.none);
            EditorGUILayout.LabelField("A int can be set with the number of the talker, based on the list of photos:");
            EditorGUILayout.PropertyField(serializedObject.FindProperty("animatorIntName"), GUIContent.none);
        }
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical((GUIStyle)"HelpBox");
        EditorGUILayout.LabelField("Audio:", EditorStyles.boldLabel);
        EditorGUILayout.LabelField("The audio to be played by each letter:");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("textAudio"), GUIContent.none);
        EditorGUILayout.LabelField("The audio to be played when the player passes the Talk:");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("passAudio"), GUIContent.none);
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical((GUIStyle)"HelpBox");
        EditorGUILayout.LabelField("Choices:", EditorStyles.boldLabel);
        EditorGUILayout.LabelField("Put below a Button prefab that will be instantiated when the player has choices");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("choicePrefab"), GUIContent.none);
        EditorGUILayout.LabelField("Put below a object that the choice buttons will be instantiated to:");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("choicesParent"), GUIContent.none);
        if (serializedObject.FindProperty("choicePrefab").objectReferenceValue != null && serializedObject.FindProperty("choicesParent").objectReferenceValue == null)
        {
            EditorGUILayout.HelpBox("There should be a parent to instantiate the choices to. Usually, it as an object inside the dialog box with a 'Layout Group' element.", MessageType.Warning, true);
        }
        EditorGUILayout.EndVertical();

        EditorGUILayout.Separator();

        EditorGUILayout.BeginVertical((GUIStyle)"HelpBox");
        EditorGUILayout.LabelField("So, I heard you like free stuff, hum?", EditorStyles.boldLabel);
        GUIStyle style = new GUIStyle();

        style.richText = true;
        string color = "#cc0000";

        GUILayout.Label(string.Format("Be sure to show your support by following <b><color={0}>Seize Studios</color></b> on social medias!", color), style);
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Like our page on Facebook!"))
        {
            Application.OpenURL(@"https://www.facebook.com/seizestudios/");
        }
        if (GUILayout.Button("Follow us on Twitter!"))
        {
            Application.OpenURL(@"https://twitter.com/seizestudios");
        }
        EditorGUILayout.EndHorizontal();
        GUIStyle centeredStyle = GUI.skin.GetStyle("Label");

        centeredStyle.alignment = TextAnchor.UpperCenter;
        EditorGUILayout.LabelField("www.seizestudios.com", centeredStyle);
        EditorGUILayout.EndVertical();



        if (EditorGUI.EndChangeCheck())
        {
            serializedObject.ApplyModifiedProperties();
        }
        //EditorGUIUtility.LookLikeControls();
    }
Example #16
0
 // Use this for initialization
 void Start()
 {
     talk = GetComponent <RPGTalk>();
 }
Example #17
0
 // Use this for initialization
 void Start()
 {
     sign = GetComponent <RPGTalk>();
 }
Example #18
0
 private void Awake()
 {
     rpgtalkTarget = RPGTalk.Instance;
 }
Example #19
0
    override public void OnInspectorGUI()
    {
        serializedObject.Update();

        //Instance of our RPGTalk class
        RPGTalk rpgTalk = (RPGTalk)target;

        EditorGUI.BeginChangeCheck();

        EditorGUILayout.LabelField("Put below the Text file to be parsed and become the talks!");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("txtToParse"), GUIContent.none);
        if (serializedObject.FindProperty("txtToParse").objectReferenceValue == null)
        {
            EditorGUILayout.HelpBox("RPGTalk needs a TXT file to retrieve the lines from", MessageType.Error, true);
        }

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("What line of the text should the Talk start? And in what line shoult it end?");
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PropertyField(serializedObject.FindProperty("lineToStart"), GUIContent.none);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("lineToBreak"), GUIContent.none);
        EditorGUILayout.EndHorizontal();
        string lineToStart       = serializedObject.FindProperty("lineToStart").stringValue;
        int    actualLinaToStart = -2;

        if (int.TryParse(lineToStart, out actualLinaToStart) && actualLinaToStart < 1)
        {
            EditorGUILayout.HelpBox("The line that the Text should start must be 1 or greater!", MessageType.Error, true);
        }
        string lineToBreak       = serializedObject.FindProperty("lineToBreak").stringValue;
        int    actualLinaToBreak = -2;

        if (int.TryParse(lineToBreak, out actualLinaToBreak) && actualLinaToBreak != -1 &&
            actualLinaToBreak < actualLinaToStart)
        {
            EditorGUILayout.HelpBox("The line of the Text to stop the Talk comes before the line of the Text to start the Talk? " +
                                    "That makes no sense! If you want to read the Text file until the end, leave the line to break as '-1'", MessageType.Error, true);
        }
        EditorGUILayout.HelpBox("The line to start or to end might be set as strings! For instance, you can set lineToStart as 'MyString' and in your text, RPGTalk will start reading the line just after the tag [title=MyString].", MessageType.Info, true);


        EditorGUILayout.PropertyField(serializedObject.FindProperty("showWithDialog"), true);
        if (serializedObject.FindProperty("showWithDialog").arraySize == 0)
        {
            EditorGUILayout.HelpBox("Not a single element to be shown with the Talk? Not even the Canvas?" +
                                    "Are you sure that is the correct bahaviour?", MessageType.Warning, true);
        }

        EditorGUILayout.BeginVertical((GUIStyle)"HelpBox");

        EditorGUILayout.LabelField("Regular Options:", EditorStyles.boldLabel);
        rpgTalk.startOnAwake       = GUILayout.Toggle(rpgTalk.startOnAwake, "Start On Awake?");
        rpgTalk.dialoger           = GUILayout.Toggle(rpgTalk.dialoger, "Should try to read the name of the talker?");
        rpgTalk.shouldUsePhotos    = GUILayout.Toggle(rpgTalk.shouldUsePhotos, "Should there be the photo of the talker?");
        rpgTalk.shouldStayOnScreen = GUILayout.Toggle(rpgTalk.shouldStayOnScreen, "Should the canvas stay on screen after the talk ended?");


        rpgTalk.enableQuickSkip = GUILayout.Toggle(rpgTalk.enableQuickSkip, "Enable QuickStep (the player can jump the animation)?");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("textSpeed"));

        rpgTalk.passWithMouse = GUILayout.Toggle(rpgTalk.passWithMouse, "Pass the Talk with Mouse Click?");
        EditorGUILayout.LabelField("The Talk can also be passed with some button set on Project Settings > Input:");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("passWithInputButton"), GUIContent.none);
        EditorGUILayout.LabelField("The Talk can also be passed with some key:");
        rpgTalk.passWithKey = (KeyCode)EditorGUILayout.EnumPopup(rpgTalk.passWithKey);
        rpgTalk.autoPass    = GUILayout.Toggle(rpgTalk.autoPass, "Automatically Pass the Talk?");
        if (rpgTalk.autoPass)
        {
            EditorGUILayout.PropertyField(serializedObject.FindProperty("secondsAutoPass"));
        }
        if (!rpgTalk.passWithMouse && serializedObject.FindProperty("passWithInputButton").stringValue == "" && !rpgTalk.autoPass)
        {
            EditorGUILayout.HelpBox("There is no condition to pass the Talk. Is it really the expected behaviour?", MessageType.Warning, true);
        }

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("RPGTalk can try to make a Word Wrap for long texts in the same line.");
        rpgTalk.wordWrap = GUILayout.Toggle(rpgTalk.wordWrap, "Word Wrap?");
        if (rpgTalk.wordWrap)
        {
            EditorGUILayout.LabelField("Set manually the maximum chars in Width/Height that fit in the screen:");
            EditorGUI.indentLevel++;
            EditorGUILayout.PropertyField(serializedObject.FindProperty("maxCharInWidth"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("maxCharInHeight"));
            EditorGUI.indentLevel--;
        }
        EditorGUILayout.LabelField("If lines to start and break were changed during the talk:");
        rpgTalk.goBackToOriginalStartAndBreak = GUILayout.Toggle(rpgTalk.goBackToOriginalStartAndBreak, "They should be changed back when it finish");

        EditorGUILayout.EndVertical();


        if (rpgTalk.dialoger)
        {
            //create a nice box with round edges.
            EditorGUILayout.BeginVertical((GUIStyle)"HelpBox");

            EditorGUILayout.LabelField("Characters Settings:", EditorStyles.boldLabel);

            rpgTalk.shouldFollow = GUILayout.Toggle(rpgTalk.shouldFollow, "Should the canvas follow someone?");
            if (rpgTalk.shouldFollow && !rpgTalk.GetComponent <RPGTALK.Snippets.RPGTalkFollowCharacter>())
            {
                EditorGUILayout.HelpBox("There should be a RPGtalkFollowCharacter Snippet on this object to make the follow work the way it should", MessageType.Error, true);

                /*EditorGUI.indentLevel++;
                *  EditorGUILayout.LabelField("The object that follows should be Billboard? Based on which camera?");
                *  EditorGUILayout.BeginHorizontal();
                *  rpgTalk.billboard = GUILayout.Toggle(rpgTalk.billboard, "Billboard?");
                *  if (rpgTalk.billboard)
                *  {
                *   rpgTalk.mainCamera = GUILayout.Toggle(rpgTalk.mainCamera, "Based on Main Camera?");
                *  }
                *  EditorGUILayout.EndHorizontal();
                *  if (rpgTalk.billboard && !rpgTalk.mainCamera)
                *  {
                *   EditorGUILayout.LabelField("What camera should the Billboard be based on?");
                *   EditorGUILayout.PropertyField(serializedObject.FindProperty("otherCamera"), GUIContent.none);
                *  }
                *  EditorGUI.indentLevel--;*/
            }


            EditorGUILayout.LabelField("Who are the characters that may appear on that conversation?");
            EditorGUI.indentLevel++;
            if (!hideCharacters)
            {
                if (rpgTalk.characters != null)
                {
                    for (int i = 0; i < rpgTalk.characters.Length; i++)
                    {
                        EditorGUILayout.LabelField("Who is this character?");
                        EditorGUILayout.BeginHorizontal();
                        rpgTalk.characters[i].character = (RPGTalkCharacter)EditorGUILayout.ObjectField(rpgTalk.characters[i].character, typeof(RPGTalkCharacter), false);
                        if (GUILayout.Button(" - "))
                        {
                            serializedObject.FindProperty("characters").DeleteArrayElementAtIndex(i);
                        }
                        EditorGUILayout.EndHorizontal();
                        EditorGUI.indentLevel += 2;
                        EditorGUILayout.LabelField("Should an different Animator be set for it?");
                        rpgTalk.characters[i].animatorOverwrite = (Animator)EditorGUILayout.ObjectField(rpgTalk.characters[i].animatorOverwrite, typeof(Animator), true);
                        if (rpgTalk.shouldFollow)
                        {
                            EditorGUILayout.LabelField("What Transform should the canvas follow? Should there be an offset?");
                            EditorGUILayout.BeginHorizontal();
                            rpgTalk.characters[i].follow       = (Transform)EditorGUILayout.ObjectField(rpgTalk.characters[i].follow, typeof(Transform), true);
                            rpgTalk.characters[i].followOffset = EditorGUILayout.Vector3Field(GUIContent.none, rpgTalk.characters[i].followOffset);
                            EditorGUILayout.EndHorizontal();
                        }
                        EditorGUI.indentLevel -= 2;
                        EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
                    }
                }
            }
            EditorGUILayout.BeginHorizontal();
            if (!hideCharacters)
            {
                if (GUILayout.Button(" + "))
                {
                    serializedObject.FindProperty("characters").InsertArrayElementAtIndex(serializedObject.FindProperty("characters").arraySize);
                }
            }
            if (GUILayout.Button(hideCharacters ? "Show " + rpgTalk.characters.Length + " characters" : "Hide Characters"))
            {
                hideCharacters = !hideCharacters;
            }
            EditorGUILayout.EndHorizontal();

            if (rpgTalk.shouldFollow && rpgTalk.characters.Length == 0)
            {
                EditorGUILayout.HelpBox("You need to set a Character and its Transform so that the Canvas can follow someone", MessageType.Error, true);
            }


            EditorGUI.indentLevel--;



            EditorGUILayout.EndVertical();
        }


        //create a nice box with round edges.
        EditorGUILayout.BeginVertical((GUIStyle)"HelpBox");
        EditorGUILayout.LabelField("Interface:", EditorStyles.boldLabel);
        EditorGUILayout.LabelField("Put below the UI for the text itself:");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("textUIObj"));

        if (serializedObject.FindProperty("textUIObj").objectReferenceValue == null)
        {
            EditorGUILayout.HelpBox("There should be a Text, inside of a Canvas, to show the Talk.", MessageType.Error, true);
        }
        else if (!TMP_Translator.IsValidType(serializedObject.FindProperty("textUIObj").objectReferenceValue as GameObject))
        {
            EditorGUILayout.HelpBox("The object must be a Text or a Text Mesh Pro UGUI Type", MessageType.Error, true);
        }
        if (rpgTalk.dialoger)
        {
            EditorGUILayout.LabelField("Put below the UI for the name of the talker:");
            EditorGUILayout.PropertyField(serializedObject.FindProperty("dialogerObj"));
            if (serializedObject.FindProperty("dialogerObj").objectReferenceValue == null)
            {
                EditorGUILayout.HelpBox("There should be a Text, inside of a Canvas, to show the name of the talker.", MessageType.Warning, true);
            }
            else if (!TMP_Translator.IsValidType(serializedObject.FindProperty("dialogerObj").objectReferenceValue as GameObject))
            {
                EditorGUILayout.HelpBox("The object must be a Text or a Text Mesh Pro UGUI Type", MessageType.Error, true);
            }
        }
        if (rpgTalk.shouldUsePhotos)
        {
            EditorGUILayout.LabelField("Put below the UI for the photo of the talker:");
            EditorGUILayout.PropertyField(serializedObject.FindProperty("UIPhoto"));
            if (serializedObject.FindProperty("UIPhoto").objectReferenceValue == null)
            {
                EditorGUILayout.HelpBox("There should be a Image, inside of a Canvas, to show the talker's photo.", MessageType.Warning, true);
            }
        }
        EditorGUILayout.EndVertical();


        EditorGUILayout.BeginVertical((GUIStyle)"HelpBox");
        EditorGUILayout.LabelField("Callback & Variables:", EditorStyles.boldLabel);
        EditorGUILayout.LabelField("Any script should be called when the Talk is done?");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("callback"), GUIContent.none);


        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Variables can be set to change some word in the text");
        EditorGUI.indentLevel++;
        EditorGUILayout.PropertyField(serializedObject.FindProperty("variables"), true);
        EditorGUI.indentLevel--;

        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical((GUIStyle)"HelpBox");
        EditorGUILayout.LabelField("Photos and Sprites:", EditorStyles.boldLabel);


        if (rpgTalk.textUIObj != null && TMP_Translator.IsText(rpgTalk.textUIObj))
        {
            EditorGUILayout.LabelField("Add sprites that can be used inside the text:");
            EditorGUI.indentLevel++;
            EditorGUILayout.PropertyField(serializedObject.FindProperty("sprites"), true);
            EditorGUI.indentLevel--;
            if (rpgTalk.sprites != null && rpgTalk.sprites.Count > 0)
            {
                EditorGUILayout.HelpBox("To use sprites inside the text, write the tag [sprite=X] and RPGTalk will replace it with the corresponding sprite above", MessageType.Info, true);
            }
        }
        else if (rpgTalk.textUIObj != null)
        {
            EditorGUILayout.LabelField("Write below the name of the Sprite Atlas Asset you want Text Mesh Pro to use:");
            EditorGUILayout.PropertyField(serializedObject.FindProperty("tmpSpriteAtlas"), true);
            EditorGUILayout.HelpBox("To use sprites inside the text, write the tag [sprite=X] in your TXT and RPGTalk will replace it with the  Text Mesh Pro tag", MessageType.Info, true);
        }



        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical((GUIStyle)"HelpBox");
        EditorGUILayout.LabelField("Animation:", EditorStyles.boldLabel);
        EditorGUILayout.LabelField("A Animator can be manipulated when talking:");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("animatorWhenTalking"), GUIContent.none);
        if (serializedObject.FindProperty("animatorWhenTalking").objectReferenceValue != null)
        {
            EditorGUILayout.LabelField("A Boolean to be set true when the character is talking:");
            EditorGUILayout.PropertyField(serializedObject.FindProperty("animatorBooleanName"), GUIContent.none);
            EditorGUILayout.LabelField("A int can be set with the number of the talker, based on the list of photos:");
            EditorGUILayout.PropertyField(serializedObject.FindProperty("animatorIntName"), GUIContent.none);
        }
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical((GUIStyle)"HelpBox");
        EditorGUILayout.LabelField("Audio:", EditorStyles.boldLabel);
        EditorGUILayout.LabelField("The audio to be played by each letter:");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("textAudio"), GUIContent.none);
        EditorGUILayout.LabelField("The audio to be played when the player passes the Talk:");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("passAudio"), GUIContent.none);
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical((GUIStyle)"HelpBox");
        EditorGUILayout.LabelField("Choices:", EditorStyles.boldLabel);
        EditorGUILayout.LabelField("Put below a Button prefab that will be instantiated when the player has choices");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("choicePrefab"), GUIContent.none);
        EditorGUILayout.LabelField("Put below a object that the choice buttons will be instantiated to:");
        EditorGUILayout.PropertyField(serializedObject.FindProperty("choicesParent"), GUIContent.none);
        if (serializedObject.FindProperty("choicePrefab").objectReferenceValue != null && serializedObject.FindProperty("choicesParent").objectReferenceValue == null)
        {
            EditorGUILayout.HelpBox("There should be a parent to instantiate the choices to. Usually, it as an object inside the dialog box with a 'Layout Group' element.", MessageType.Warning, true);
        }
        EditorGUILayout.EndVertical();

        EditorGUILayout.Separator();

        EditorGUILayout.BeginVertical((GUIStyle)"HelpBox");
        EditorGUILayout.LabelField("So, I heard you like free stuff, hum?", EditorStyles.boldLabel);
        GUIStyle style = new GUIStyle();

        style.richText = true;
        string color = "#cc0000";

        GUILayout.Label(string.Format("Be sure to show your support by following <b><color={0}>Seize Studios</color></b> on social medias!", color), style);
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Like our page on Facebook!"))
        {
            Application.OpenURL(@"https://www.facebook.com/seizestudios/");
        }
        if (GUILayout.Button("Follow us on Twitter!"))
        {
            Application.OpenURL(@"https://twitter.com/seizestudios");
        }
        EditorGUILayout.EndHorizontal();
        GUIStyle centeredStyle = GUI.skin.GetStyle("Label");

        centeredStyle.alignment = TextAnchor.UpperCenter;
        EditorGUILayout.LabelField("www.seizestudios.com", centeredStyle);
        EditorGUILayout.EndVertical();



        if (EditorGUI.EndChangeCheck())
        {
            serializedObject.ApplyModifiedProperties();
        }
        //EditorGUIUtility.LookLikeControls();
    }
Example #20
0
 // Use this for initialization
 void Start()
 {
     talk = GameObject.FindGameObjectWithTag("rpgtalk").GetComponent <RPGTalk>();
 }
Example #21
0
 private void Awake()
 {
     anim = GetComponentInChildren <Animator>();
     //anim = GetComponent<Animator>();
     rpgTalk = GameObject.Find("RPGTalk Holder").GetComponent <RPGTalk>();
 }
 // Start is called before the first frame update
 void Start()
 {
     rpgTalk = GetComponent <RPGTalk>();
     rpgTalk.OnMadeChoice += SaveData;
 }
 void StopDialogue(RPGTalk dialogue)
 {
     dialogue.gameObject.SetActive(false);
 }