public override bool Act(DialogueScene scene, DialogueJsonItem data)
    {
        scene.talkingChar.value = data.entry;
        scene.talkingPose.value = data.value;

        return(true);
    }
Example #2
0
    public override bool Act(DialogueScene scene, DialogueActionData data)
    {
        scene.effectStartDuration.value = data.values[0] * 0.001f;
        scene.effectEndDuration.value   = 0;

        return(true);
    }
 void LoadDialogue(DialogueScene scene, XmlNode node, Quest quest)
 {
     foreach (XmlNode child in node.ChildNodes)
     {
         string attribute = child.Name;
         //Debug.Log("Dialogue Node: " + attribute + " " + child.InnerText);
         if (attribute.Equals("Line"))
         {
             string lineText = "";
             foreach (XmlNode response in child.ChildNodes)
             {
                 if (response.Name.Equals("Response"))
                 {
                     //Debug.Log("Adding line: " + lineText + " flag " + response.InnerText);
                     scene.AddDialogueLine(new DialogueLine(lineText, questFlags.questResponseFlags[response.InnerText]));
                     lineText = "";
                 }
                 else
                 {
                     lineText = response.InnerText;
                 }
             }
         }
     }
 }
Example #4
0
    public override bool Act(DialogueScene scene, DialogueJsonItem data)
    {
        scene.characters[data.position1].value = data.entry;
        scene.poses[data.position1].value      = data.value;

        return(true);
    }
Example #5
0
    public override bool Act(DialogueScene scene, DialogueActionData data)
    {
        scene.effectStartDuration.value = data.values[0] * 0.001f;
        scene.effectEndDuration.value   = 0;

        ScrObjLibraryEntry[] originalCharacters = new ScrObjLibraryEntry[Utility.DIALOGUE_PLAYERS_COUNT + Utility.DIALOGUE_PLAYERS_OUTSIDE_COUNT];
        int[] originalPoses = new int[Utility.DIALOGUE_PLAYERS_COUNT + Utility.DIALOGUE_PLAYERS_OUTSIDE_COUNT];
        for (int i = 0; i < scene.characters.Length; i++)
        {
            originalCharacters[i] = scene.characters[i].value;
            originalPoses[i]      = scene.poses[i].value;
        }

        for (int i = 1; i < data.values.Count; i += 2)
        {
            scene.characters[data.values[i + 1]].value = originalCharacters[data.values[i]];
            scene.poses[data.values[i + 1]].value      = originalPoses[data.values[i]];

            if (scene.characters[data.values[i]].value.IsEqual(originalCharacters[data.values[i]]))
            {
                scene.characters[data.values[i]].value = null;
                scene.poses[data.values[i]].value      = -1;
            }

            scene.characterTransforms[data.values[i + 1]].SetMoveDirection(scene.characterTransforms[data.values[i]].transform.position, data.values[i]);
        }

        return(true);
    }
 public void CloseDialogue()
 {
     gameObject.SetActive(false);
     currentLineIndex = 0;
     currentScene     = null;
     currentQuestID   = -1;
 }
Example #7
0
    public override bool Act(DialogueScene scene, DialogueJsonItem data)
    {
        MusicEntry me = (MusicEntry)data.entry;

        scene.bkgMusic.value = me.clip;

        return(true);
    }
Example #8
0
	public override bool Act(DialogueScene scene, DialogueActionData data) {

		scene.flashBackground.value = data.entries[0];
		scene.effectStartDuration.value = data.values[0] * 0.001f;
		scene.effectEndDuration.value = data.values[1] * 0.001f;

		return true;
	}
    public override bool Act(DialogueScene scene, DialogueJsonItem data)
    {
        ScrObjLibraryEntry temp = scene.characters[data.position1].value;

        scene.characters[data.position1].value = scene.characters[data.position2].value;
        scene.characters[data.position2].value = temp;

        return(true);
    }
Example #10
0
 public DialogueHub(ScrObjLibraryVariable bkg, ScrObjLibraryVariable chars, ScrObjLibraryVariable dialogue, DialogueEntry de)
 {
     backgroundLibrary = bkg;
     characterLibrary  = chars;
     dialogueLibrary   = dialogue;
     dialogueValues    = de;
     currentState      = GameObject.FindObjectOfType <DialogueScene>();
     dvc = GameObject.FindObjectOfType <DialogueVisualContainer>();
 }
Example #11
0
    public override bool Act(DialogueScene scene, DialogueActionData data)
    {
        scene.background.value = data.entries[0];

        scene.effectStartDuration.value = 0;
        scene.effectEndDuration.value   = 0;

        return(true);
    }
    public void OpenDialogue(int questID)
    {
        gameObject.SetActive(true);                                                        //open the dialogue screen

        currentScene   = QuestDB.Instance.GetQuestByID(questID).GetCurrentDialogueScene(); //get the scene that we clicked on
        currentQuestID = questID;
        dialogueNPCText.SetText(NPCDB.Instance.GetNpcName(QuestDB.Instance.GetQuestByID(questID).NPCID));
        UpdateDialogueText();
        SetupResponse();
    }
    public override bool Act(DialogueScene scene, DialogueActionData data)
    {
        for (int i = 0; i < Constants.DIALOGUE_PLAYERS_COUNT; i++)
        {
            scene.characters[i].value = data.entries[i];
            scene.poses[i].value      = data.values[i];
        }

        scene.effectStartDuration.value = 0;
        scene.effectEndDuration.value   = 0;

        return(true);
    }
Example #14
0
    void Start()
    {
        scene = GetComponent <DialogueScene>();
        dialogueLibrary.GenerateDictionary();
        dialogueEntry      = (DialogueEntry)dialogueLibrary.GetEntry(dialogueUuid.value);
        currentFrame.value = 0;
        scene.SetFromFrame(dialogueEntry.frames[0]);
        Debug.Log("Set frame 0 of dialogue " + dialogueUuid.value);

        backgroundChanged.Invoke();
        bkgMusicChanged.Invoke();
        characterChanged.Invoke();
        closeupChanged.Invoke();
        dialogueTextChanged.Invoke();
    }
    public override bool Act(DialogueScene scene, DialogueActionData data)
    {
        MusicEntry me = (MusicEntry)data.entries[0];

        if (me == null)
        {
            Debug.LogWarning("Empty Music action!");
            return(true);
        }
        scene.bkgMusic.value = me.clip;

        scene.effectStartDuration.value = 0;
        scene.effectEndDuration.value   = 0;

        return(true);
    }
Example #16
0
    public override bool Act(DialogueScene scene, DialogueActionData data)
    {
        SfxEntry sfx = (SfxEntry)data.entries[0];

        if (sfx == null)
        {
            Debug.LogWarning("Empty Sfx action!");
            return(true);
        }

        scene.sfxClip.Enqueue(sfx);
        scene.effectStartDuration.value = data.values[0] * 0.001f;
        scene.effectEndDuration.value   = 0;

        return(true);
    }
Example #17
0
    public override bool Act(DialogueScene scene, DialogueActionData data)
    {
        MusicEntry me = (MusicEntry)data.entries[0];

        if (me == null)
        {
            return(false);
        }
        scene.bkgMusic.value         = me.clip;
        scene.musicFocusSource.value = false;

        scene.effectStartDuration.value = 0;
        scene.effectEndDuration.value   = 0;

        return(true);
    }
Example #18
0
    public override bool Act(DialogueScene scene, DialogueActionData data)
    {
        for (int i = 0; i < Utility.DIALOGUE_PLAYERS_COUNT + Utility.DIALOGUE_PLAYERS_OUTSIDE_COUNT; i++)
        {
            scene.characters[i].value = data.entries[i];
            if (data.entries[i] != null && ((PortraitEntry)data.entries[i]).customValue != 0)
            {
                scene.characters[i].value = scene.villageVisitor1.value;
            }
            scene.poses[i].value = data.values[i];
        }

        scene.effectStartDuration.value = 0;
        scene.effectEndDuration.value   = 0;

        return(true);
    }
Example #19
0
    /// <summary>
    /// Tally up all the different items
    /// </summary>
    private void BuildPurchaseString()
    {
        //exit early: avoid dialogue when in dialogue
        DialogueManager dialogue = FindObjectOfType <DialogueManager>();

        if (dialogue.inDialogue)
        {
            return;
        }

        //get total cost
        Counter counter    = FindObjectOfType <Counter>();
        float   totalPrice = counter.GetTotalCost();

        //get items list
        string purchases = "You are going to purchase ";

        ItemData[]    items     = counter.GetAllCurrentItems();
        List <string> itemNames = new List <string>();

        foreach (var item in items)
        {
            itemNames.Add(item.itemName);
        }

        //add commas to the items string and a period
        string itemsString = Commaize(itemNames);

        purchases += itemsString + ".";

        //format the price float ###,###.##
        string formattedPrice = totalPrice.ToString("N");
        string costString     = "Which will cost you " + formattedPrice + "€ alltogether.";


        //create dialogue scene by building it from dialogue segments
        DialogueSegment segment1 = new DialogueSegment(purchases);
        DialogueSegment segment2 = new DialogueSegment(costString);

        //combine the scene
        DialogueScene scene = new DialogueScene(new DialogueSegment[] { segment1, segment2 });

        //display the dialogue
        dialogue.LoadDialogueScene(scene);
        dialogue.EnterDialogue();
    }
Example #20
0
    public override bool Act(DialogueScene scene, DialogueActionData data)
    {
        scene.talkingIndex.value = data.values[0];
        scene.talkingName.value  = (data.text[0] != "###") ? data.text[0] : scene.characters[scene.talkingIndex.value].value.entryName;
        scene.inputText.value    = data.text[1];
        if (data.boolValue)
        {
            scene.dialogueText.value = "";
        }
        if (data.autoContinue)
        {
            scene.inputText.value += " £";
        }

        scene.effectStartDuration.value = 0;
        scene.effectEndDuration.value   = 0;

        return(true);
    }
Example #21
0
    //Entry 0	BattleEntry
    //Entry 1	DialogueEntry

    /*  Values
     * 0	NextLocation
     * 1	Changed pos - bool
     * 2	Next area index
     * 3	Player xpos
     * 4	Player ypos
     */

    public override bool Act(DialogueScene scene, DialogueActionData data)
    {
        scene.background.value = null;

        for (int i = 0; i < Utility.DIALOGUE_PLAYERS_COUNT + Utility.DIALOGUE_PLAYERS_OUTSIDE_COUNT; i++)
        {
            scene.characters[i].value = null;
        }

        scene.talkingIndex.value = -1;
        scene.talkingName.value  = "";
        scene.inputText.value    = "";
        scene.dialogueText.value = "";

        scene.flashBackground.value     = null;
        scene.effectStartDuration.value = 0;
        scene.effectEndDuration.value   = 0;
        return(false);
    }
Example #22
0
    public override bool Act(DialogueScene scene, DialogueActionData data)
    {
        scene.talkingName.value = data.text[0];
        scene.inputText.value   = data.text[1];
        if (data.boolValue)
        {
            scene.dialogueText.value = "";
        }
        if (data.autoContinue)
        {
            scene.inputText.value += " £";
        }

        scene.SetTalkingCharacter(data.values[0]);

        scene.effectStartDuration.value = 0;
        scene.effectEndDuration.value   = 0;

        return(true);
    }
Example #23
0
    /// <summary>
    /// Notify the player that they have placed too many items on the counter
    /// </summary>
    public void NotifyTooManyItems()
    {
        //create dialogue scene by building it from dialogue segments
        DialogueManager dialogue = FindObjectOfType <DialogueManager>();

        //avoid dialogue while in dialogue
        if (dialogue.inDialogue)
        {
            return;
        }

        DialogueSegment segment1 = new DialogueSegment("You can only have five items at once.");
        DialogueSegment segment2 = new DialogueSegment("Please remove an item on the counter by clicking on it.");

        //combine the scene
        DialogueScene scene = new DialogueScene(new DialogueSegment[] { segment1, segment2 });

        //display the dialogue
        dialogue.LoadDialogueScene(scene);
        dialogue.EnterDialogue();
    }
Example #24
0
    private void InformToAddItems()
    {
        //create dialogue scene by building it from dialogue segments
        DialogueManager dialogue = FindObjectOfType <DialogueManager>();

        //avoid dialogue while in dialogue
        if (dialogue.inDialogue)
        {
            return;
        }

        DialogueSegment segment1 = new DialogueSegment("You need to add something to the counter first.");
        DialogueSegment segment2 = new DialogueSegment("Click the items in the shelf on the left to add them.");

        //combine the scene
        DialogueScene scene = new DialogueScene(new DialogueSegment[] { segment1, segment2 });

        //display the dialogue
        dialogue.LoadDialogueScene(scene);
        dialogue.EnterDialogue();
    }
        /// <summary>
        /// Build a DialogueScene from this ImmersiveMonologue
        /// </summary>
        public DialogueScene BuildDialogueScene()
        {
            string defaultFrameName = "f_0";

            Dictionary <string, Frame> frames = new Dictionary <string, Frame>();
            DialogueScene dialogueScene       = new DialogueScene(frames, defaultFrameName, Music);

            for (int i = 0; i < Nodes.Length; i++)
            {
                var node = Nodes[i];

                string       next    = (i == (Nodes.Length - 1)) ? "meta.return" : $"f_{i+1}";
                FrameOptions options = new FrameOptions(new Dictionary <string, object>()
                {
                    { nameof(FrameOptions.HideNameText), HideNameText },
                    { nameof(FrameOptions.VoiceOverride), node.VoiceOverride },
                    { nameof(FrameOptions.PanelHeight), node.PanelHeight != ChoicePanelHeight.Default ? node.PanelHeight : PanelHeight },
                    { nameof(FrameOptions.PanelHeightPixels), node.PanelHeightPixels }
                });

                TextFrame frame = new TextFrame(null, null, next, null, null, node.Text, node.NextText, null, default, node.AllowSkip, node.TimeToShow, node.TimeToShow > 0, null, null, options, null, dialogueScene, null, JValue.CreateNull(), null);
Example #26
0
    public override bool Act(DialogueScene scene, DialogueActionData data)
    {
        scene.background.value = data.entries[0];

        MusicEntry me = (MusicEntry)data.entries[1];

        if (me != null)
        {
            scene.bkgMusic.value = me.clip;
        }
        else
        {
            Debug.LogWarning("No music set for the scene");
        }

        for (int i = 0; i < Utility.DIALOGUE_PLAYERS_COUNT; i++)
        {
            scene.characters[i].value = data.entries[i + 2];
        }

        return(true);
    }
    void Start()
    {
        scene = GetComponent <DialogueScene>();
        dialogueLibrary.initialized = false;
        dialogueLibrary.GenerateDictionary();
        dialogueEntry = (DialogueEntry)dialogueLibrary.GetEntry(dialogueUuid.value);
        if (!overrideActionNumber.value)
        {
            currentAction.value = 0;
            scene.Reset();
        }
        else
        {
            overrideActionNumber.value = false;
        }
        NextFrame();

        scene.backgroundChanged.Invoke();
        scene.bkgMusicChanged.Invoke();
        scene.characterChanged.Invoke();
        scene.closeupChanged.Invoke();
        scene.dialogueTextChanged.Invoke();
    }
Example #28
0
    public override bool Act(DialogueScene scene, DialogueJsonItem data)
    {
        DialogueEntry de = (DialogueEntry)data.entry;

        switch (de.nextLocation)
        {
        case BattleEntry.NextLocation.OVERWORLD:
            scene.paused.value = false;
            if (de.changePosition)
            {
                if (de.nextArea != Constants.OverworldArea.DEFAULT)
                {
                    scene.playerArea.value = (int)de.nextArea;
                }
                scene.playerPosX.value = de.playerPosition.x;
                scene.playerPosY.value = de.playerPosition.y;
            }
            scene.currentArea.value = scene.playerArea.value;
            scene.mapChangeEvent.Invoke();
            break;

        case BattleEntry.NextLocation.DIALOGUE:
            scene.currentArea.value  = (int)Constants.SCENE_INDEXES.DIALOGUE;
            scene.dialogueUuid.value = de.nextEntry.uuid;
            scene.mapChangeEvent.Invoke();
            break;

        case BattleEntry.NextLocation.BATTLE:
            scene.currentArea.value = (int)Constants.SCENE_INDEXES.BATTLE;
            scene.battleUuid.value  = de.nextEntry.uuid;
            scene.mapChangeEvent.Invoke();
            break;
        }

        return(false);
    }
    // public override bool Act(DialogueScene scene, DialogueActionData data) {
    //  DialogueEntry de = (DialogueEntry)data.entries[0];
    //  switch (de.nextLocation)
    //  {
    //      case BattleEntry.NextLocation.OVERWORLD:
    //          // scene.paused.value = false;
    //          if (de.changePosition) {
    //              if (de.nextArea != Constants.OverworldArea.DEFAULT)
    //                  scene.playerArea.value = (int)de.nextArea;
    //              scene.playerPosX.value = de.playerPosition.x;
    //              scene.playerPosY.value = de.playerPosition.y;
    //          }
    //          scene.currentArea.value = scene.playerArea.value;
    //          Debug.Log("Moving to area  " + scene.currentArea.value);
    //          scene.mapChangeEvent.Invoke();
    //          break;
    //      case BattleEntry.NextLocation.DIALOGUE:
    //          scene.currentArea.value = (int)Constants.SCENE_INDEXES.DIALOGUE;
    //          scene.dialogueUuid.value = de.dialogueEntry.uuid;
    //          scene.mapChangeEvent.Invoke();
    //          break;
    //      case BattleEntry.NextLocation.BATTLE:
    //          scene.currentArea.value = (int)Constants.SCENE_INDEXES.BATTLE;
    //          scene.battleUuid.value = de.battleEntry.uuid;
    //          scene.mapChangeEvent.Invoke();
    //          break;
    //  }

    //  return false;
    // }

    //Entry 0	BattleEntry
    //Entry 1	DialogueEntry

    /*  Values
     * 0	NextLocation
     * 1	Changed pos - bool
     * 2	Next area index
     * 3	Player xpos
     * 4	Player ypos
     */

    public override bool Act(DialogueScene scene, DialogueActionData data)
    {
        BattleEntry.NextLocation next = (BattleEntry.NextLocation)data.values[0];
        switch (next)
        {
        case BattleEntry.NextLocation.OVERWORLD:
            // scene.paused.value = false;
            if (data.values[1] == 1)                       //Changed pos
            {
                if ((Constants.OverworldArea)data.values[2] != Constants.OverworldArea.DEFAULT)
                {
                    scene.playerArea.value = data.values[2];
                }
                scene.playerPosX.value = data.values[3];
                scene.playerPosY.value = data.values[4];
            }
            scene.currentArea.value = scene.playerArea.value;
            Debug.Log("Moving to area  " + scene.currentArea.value);
            scene.mapChangeEvent.Invoke();
            break;

        case BattleEntry.NextLocation.DIALOGUE:
            scene.currentArea.value  = (int)Constants.SCENE_INDEXES.DIALOGUE;
            scene.dialogueUuid.value = data.entries[0].uuid;
            scene.mapChangeEvent.Invoke();
            break;

        case BattleEntry.NextLocation.BATTLE:
            scene.currentArea.value = (int)Constants.SCENE_INDEXES.BATTLE;
            scene.battleUuid.value  = data.entries[1].uuid;
            scene.mapChangeEvent.Invoke();
            break;
        }

        return(false);
    }
 protected override IEnumerator UnloadScene(DialogueScene scene, Action<float, string> progressDelegate) {
     yield break;
 }
 public void LoadDialogueScene(DialogueScene newDialogueScene)
 {
     dialogueScene = newDialogueScene;
 }
	protected void DialogueSceneLoaded(DialogueScene scene){
		//UIContainer = scene.UIContainer;
	}