Exemple #1
0
    private void Update()
    {
        if (DialogueON && Input.GetKeyDown("c"))
        {
            DialogueID += 1;
            if (DialogueID > DialogueText.Length - 1)
            {
                CloseDialogue();
                //關閉提示訊息
                Destroy(gameObject);
            }

            else
            {
                DialogueScreen.GetComponentInChildren <Text>().text = DialogueText[DialogueID];
            }
        }

        if (DialogueON && Input.GetKeyDown("s"))
        {
            CloseDialogue();
            //關閉提示訊息
            Destroy(gameObject);
        }
    }
Exemple #2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (!Re || GM.Herb_No == 4)
        {
            if (collision.tag == "Player" && this.enabled)
            {
                if (GM.Herb_No == 4)
                {
                    DialogueText = new string[] {
                        "男:\n" + "" + "感謝你的協助,城堡的門已經打開了",
                        "女:\n" + "" + "順便為你進行治療",
                        "女:\n" + "" + "……希望服用這些藥草後她的病情會好轉",
                    };
                }
                else
                {
                    DialogueText = new string[] {
                        "???:\n" + "" + "數量不夠,總共需要4份",
                    };
                    Re = true;
                }

                OpenDialogue();
                DialogueScreen.GetComponentInChildren <Text>().text = DialogueText[DialogueID];
            }
        }
    }
Exemple #3
0
        private void PlayBtn(object sender, EventArgs e)
        {
            this.Hide();
            DialogueScreen form1 = new DialogueScreen(player, 0);

            form1.Show();
        }
Exemple #4
0
 private void finishDialogue()
 {
     DialogueScreen.GetComponentsInChildren <Text>()[1].text = "";
     CloseDialogue();
     //小屋傳送點開啟
     Trans0.GetComponent <Trans>().enabled = true;
     Destroy(gameObject);
 }
Exemple #5
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Player"))
     {
         OpenDialogue();
         DialogueScreen.GetComponentInChildren <Text>().text = DialogueText[DialogueID];
     }
 }
Exemple #6
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player" && this.enabled)
     {
         OpenDialogue();
         DialogueScreen.GetComponentInChildren <Text>().text = DialogueText[DialogueID];
     }
 }
Exemple #7
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         OpenDialogue();
         DialogueScreen.GetComponentsInChildren <Text>()[1].text = "按下C繼續,按下S跳過對話";
         DialogueScreen.GetComponentInChildren <Text>().text     = DialogueText[DialogueID];
     }
 }
Exemple #8
0
 void OnEnable()
 {
     if (_screen == null)
     {
         _screen         = gameObject.GetComponent <Screen>();
         _dialogueScreen = gameObject.GetComponent <DialogueScreen>();
         _screen.OnActiveChange.AddListener(OnScreenActiveChange);
     }
 }
        private void UpdateDialogue(DialogueScreen screen)
        {
            _output.Text = OutputHelpers.ProcessOutput(screen.Says.Trim());

            _choices.Items.Clear();
            _choices.Items.AddRange(
                screen.Choices.Where(c => string.IsNullOrEmpty(c.DisplayCondition) ||
                                     EmbeddedFunctionsHelper.Conditional(c.DisplayCondition).Success));
        }
Exemple #10
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         Canvas tmp = FindObjectOfType <Canvas>();
         family_pictrue_tmp = Instantiate(family_pictrue, tmp.transform);
         OpenDialogue();
         DialogueScreen.GetComponentInChildren <Text>().text = DialogueText[DialogueID];
     }
 }
Exemple #11
0
 IEnumerator end(int A, int B)
 {
     SoundManager.clip   = final;
     SoundManager.volume = 0.5f;
     SoundManager.Play();
     for (int i = A; i < B; i++)
     {
         blackscreen.color = new Vector4(0, 0, 0, 0.1f * i);
         yield return(WAS4);
     }
     OpenDialogue();
     DialogueScreen.GetComponentInChildren <Text>().text = DialogueText[DialogueID];
 }
Exemple #12
0
        private static void GoTo_AddDialogueHistory(DialogueScreen screen, ScreenAction action)
        {
            (string line, bool isPlayerLine, bool isTechnical)historyEntry = ("", true, false);
            var dialogue = action.Dialogue?.Invoke();

            if (string.IsNullOrWhiteSpace(dialogue))
            {
                historyEntry.line = $"\"{dialogue}\"";
            }
            else
            {
                historyEntry.line = action.Description?.Invoke() ?? "";
            }

            screen.DialogueHistory.Add(historyEntry);
        }
    public void LoadPressed()
    {
        var dialogueName = DialogueInput.text;
        var packageName  = PackageInput.text;

        if (string.IsNullOrEmpty(dialogueName))
        {
            dialogueName = "default";
        }

        if (string.IsNullOrEmpty(packageName))
        {
            packageName = "default";
        }

        DialogueScreen.StartDialogue(package: packageName, name: dialogueName);
    }
    public void ButtonPressed(int index)
    {
        switch (index)
        {
        case 0:
            DialogueScreen.StartDialogue(package: "test", name: "default");
            break;

        case 1:
            DialogueScreen.StartDialogue(package: "test", name: "dialogue2");
            break;

        case 2:
            DialogueScreen.StartDialogue(package: "romance", name: "default");
            break;
        }
    }
Exemple #15
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        //生成怪物

        if (!SpawnON && collision.tag == "Player")
        {
            createEnemy(collision.transform);
            SpawnON = true;
        }


        //開啟對話
        if (collision.tag == "Player")
        {
            Invoke("OpenDialogue", 0.5f);
            DialogueScreen.GetComponentInChildren <Text>().text = DialogueText[DialogueID];
        }
    }
Exemple #16
0
    void Start()   // not Awake to give the player controller time to hook itself up
    {
        if (Instance == null)
        {
            Instance = this;
        }
        TriggerUIUpdate();

        dialogueScreenScript = dialogueScreen.GetComponent <DialogueScreen>();
        dialogueScreenScript.listenerCallback = OnDialogueChoiceSelectedCallback;


        deathPanel.gameObject.SetActive(false);
        charScreen.gameObject.SetActive(false);
        infoPanel.gameObject.SetActive(true);


        // Audio: start a track and the rain sound
        audioController.ToggleRainNoise(true);
        audioController.ToggleGuitarTrack(true);
    }
Exemple #17
0
    private void Update()
    {
        if (DialogueON && Input.GetKeyDown("c"))
        {
            DialogueID += 1;

            if (DialogueID > DialogueText.Length - 1)
            {
                finishDialogue();
            }

            else
            {
                DialogueScreen.GetComponentInChildren <Text>().text = DialogueText[DialogueID];
            }
        }

        if (DialogueON && Input.GetKeyDown("s"))
        {
            finishDialogue();
        }
    }
Exemple #18
0
 public void DisplayText(DialogueScreen content)
 {
     text.text            = content.text;
     speakerNameText.text = content.name;
 }
 private void Awake()
 {
     instance = this;
 }
Exemple #20
0
    IEnumerator Opening()
    {
        player1.Stop = true;
        FindObjectOfType <Menu>().StopMenu = true;
        player1.transform.eulerAngles      = new Vector3(0, 0, 0);
        player1.transform.Rotate(Vector3.forward * -90);
        yield return(WAS2);

        player1.transform.Rotate(Vector3.forward * 90);

        //player1.transform.Translate(Vector3.up * 2);
        player1.rig.AddForce(new Vector2(0, 600));

        yield return(WAS);

        player1.rig.velocity = new Vector2(1.3f, 0);
        while (player1.transform.position.x < -10)
        {
            yield return(WAS3);
        }

        player1.rig.velocity = new Vector2(0, 0);

        OpenDialogue();
        DialogueON     = false;
        Time.timeScale = 1;
        for (int i = 0; i < 2; i++)
        {
            DialogueScreen.GetComponentInChildren <Text>().text = DialogueText[DialogueID];
            DialogueID += 1;
            yield return(WAS2);
        }
        CloseDialogue();
        FindObjectOfType <Menu>().StopMenu = true;
        player1.Stop                  = true;
        player1.rig.velocity          = new Vector2(-3, 0);
        player1.transform.eulerAngles = new Vector3(0, 180, 0);
        while (player1.transform.position.x > -13.4)
        {
            yield return(WAS3);
        }

        player1.rig.velocity = new Vector2(0, 0);

        OpenDialogue();
        DialogueON     = false;
        Time.timeScale = 1;
        for (int i = 0; i < 2; i++)
        {
            DialogueScreen.GetComponentInChildren <Text>().text = DialogueText[DialogueID];
            DialogueID += 1;
            yield return(WAS2);

            yield return(WAS2);
        }

        DialogueON = true;
        GM.GetItem(0);
        DialogueScreen.GetComponentInChildren <Text>().text     = DialogueText[DialogueID];
        DialogueScreen.GetComponentsInChildren <Text>()[1].text = "按下C繼續";
    }
Exemple #21
0
 public UIManager(Game context)
 {
     Context  = context;
     Elements = new List <UI>();
     Dialogue = new DialogueScreen(this);
 }
Exemple #22
0
        private static void GoTo_DialogueScreen(DialogueScreen screen)
        {
            foreach (var(line, isPlayerLine, isTechnical) in screen.DialogueHistory)
            {
                WriteLine(line, isPlayerLine ? ConsoleColor.Gray : isTechnical?ConsoleColor.DarkGray: ConsoleColor.White);
            }

            var currentPart = screen.Dialogues[screen.CurrentPartId];

            var currentLine = currentPart.Line?.Invoke();

            if (!string.IsNullOrWhiteSpace(currentLine))
            {
                WriteLine(currentLine, currentPart.IsTechnical?.Invoke() ?? false ? ConsoleColor.DarkGray : ConsoleColor.White);
                screen.DialogueHistory.Add((currentLine, false, currentPart.IsTechnical?.Invoke() ?? false));
            }

            var currentPartType = currentPart.Type?.Invoke() ?? DialoguePart.PartType.Actions;

            if (currentPartType == DialoguePart.PartType.Actions)
            {
                RenderActions(currentPart.Actions);
                Write("> ", ConsoleColor.Cyan);
                string input = Console.ReadLine() ?? "";
                if (int.TryParse(input, out int result))
                {
                    int actionID = result - 1;

                    if (actionID < 0 || actionID >= currentPart.Actions.Count)
                    {
                        ErrorString = "This action does not exist!";
                        GoTo(CurrentScreen);
                    }

                    var action = currentPart.Actions[actionID];
                    action.Screen = screen;

                    (string line, bool isPlayerLine, bool isTechnical)historyEntry = ("", true, false);
                    var dialogue = action.Dialogue?.Invoke();
                    if (string.IsNullOrWhiteSpace(dialogue))
                    {
                        historyEntry.line = $"\"{dialogue}\"";
                    }
                    else
                    {
                        historyEntry.line = action.Description?.Invoke() ?? "";
                    }

                    screen.DialogueHistory.Add(historyEntry);

                    action.Screen = screen;

                    var jumpTo2 = currentPart.JumpTo?.Invoke() ?? screen.CurrentPartId + 1;
                    if (jumpTo2 >= screen.Dialogues.Count)
                    {
                        GoTo(screen.NextScreen?.Invoke() ?? CurrentScreen);
                    }
                    else
                    {
                        screen.CurrentPartId = jumpTo2;
                        GoTo(CurrentScreen);
                    }

                    var screenToGoTo = action.Execute(result - 1);
                    GoTo(screenToGoTo);
                    // TODO Line 242-248. action.Execute does not take that into account, it just GoTos to another point.
                }
                else if (string.IsNullOrWhiteSpace(input))
                {
                    GoTo(CurrentScreen);
                }
                else
                {
                    ErrorString = $"Invalid input: {input}\nTry again.";
                    GoTo(CurrentScreen);
                }
            }
            else if (currentPartType == DialoguePart.PartType.InputText)
            {
                Write("> ", ConsoleColor.Cyan);
                var text = Console.ReadLine();

                (string line, bool isPlayerLine, bool isTechnical)historyEntry = ($"{Player.Name}: {text}", true, false);
                screen.DialogueHistory.Add(historyEntry);

                currentPart.ActionOnInput?.Invoke(text);
            }

            var jumpTo = currentPart.JumpTo?.Invoke() ?? screen.CurrentPartId + 1;

            if (jumpTo >= screen.Dialogues.Count)
            {
                GoTo(screen.NextScreen?.Invoke() ?? CurrentScreen);
            }
            else
            {
                screen.CurrentPartId = jumpTo;
                GoTo(CurrentScreen);
            }
        }