Esempio n. 1
0
        private static void OpenDialog(DialogUI Dialog)
        {
            CurrentUI_ = Dialog;
            var Root = UIHelper.FindChild(Dialog.UITransform, "Dialog");

            if (Root == null)
            {
                Dialog.OnDialogPopup();
                return;
            }

            var PopupAct = MotionHelper.Sequence()
                           .Callback(MaskLayerHelper.CreateMaskLayer)
                           .Scale(0.2f, new Vector3(1.1f, 1.1f), false)
                           .Scale(0.05f, new Vector3(1.0f, 1.0f), false)
                           .Callback(() =>
            {
                Dialog.OnDialogPopup();
                MaskLayerHelper.DeleteMaskLayer();
            })
                           .Flush();

            Root.localScale = Vector3.zero;
            Root.ExecuteMotion(PopupAct);
        }
Esempio n. 2
0
        public static void CloseDialog(BaseUI Dialog)
        {
            if (Dialog == null)
            {
                return;
            }

            var Root = UIHelper.FindChild(Dialog.UITransform, "Dialog");

            if (Root == null)
            {
                UIManager.CloseUI(Dialog);
                CurrentUI_ = null;
                CheckDialogQueueList();
                return;
            }

            var CloseAct = MotionHelper.Sequence()
                           .Callback(MaskLayerHelper.CreateMaskLayer)
                           .Scale(0.05f, new Vector3(1.1f, 1.1f), false)
                           .Scale(0.2f, new Vector3(0.0f, 0.0f), false)
                           .Callback(() =>
            {
                UIManager.CloseUI(Dialog);
                MaskLayerHelper.DeleteMaskLayer();
                CurrentUI_ = null;
                CheckDialogQueueList();
            })
                           .Flush();

            Root.ExecuteMotion(CloseAct);
        }
Esempio n. 3
0
 void Awake()
 {
     chimera = Chimera.GetInstance();
     overlay = chimera.overlay.GetComponent <Overlay>();
     sfx     = SoundEffects.GetInstance();
     dialog  = chimera.chatScreen.GetComponent <DialogUI>();
     cam     = Camera.main.GetComponent <Animator>();
 }
Esempio n. 4
0
 public override void Use(GameObject userPlayer)
 {
     if (!dialogUI)
     {
         dialogUI = GameObject.Find(canvasName).GetComponent <HudController>().Dialog;
     }
     base.Use(userPlayer);
     dialogUI.Display(text);
 }
Esempio n. 5
0
    void Start()
    {
        this.dialogUI = FindObjectOfType<DialogUI>();
        this.dialogUI.Hide();

        this.dialogLines = new Queue<string>();

        this.hasDialog = false;
    }
Esempio n. 6
0
 public static void Clear()
 {
     foreach (var Dialog in OpenQueueList_)
     {
         UIManager.CloseUI(Dialog);
     }
     OpenQueueList_.Clear();
     CurrentUI_ = null;
 }
Esempio n. 7
0
    public void Introduce()
    {
        CaseData openedCase = InvestigationManager.GetCase();

        Files files = Files.Load();
        bool  added = files.GetCaseStatus().AddWitness(openedCase.GetWitnessIndexFromData(data));

        files.Save();
        DialogUI.StartDialog(data.introducingDialog, added, DialogType.WITNESS);
    }
Esempio n. 8
0
    public void Investigate()
    {
        CaseData openedCase = InvestigationManager.GetCase();

        Files files = Files.Load();
        bool  added = files.GetCaseStatus().AddClue(openedCase.clues.IndexOf(clueData));

        files.Save();
        DialogUI.StartDialog(clueData.findingDialog, added, DialogType.CLUE);
    }
Esempio n. 9
0
    private void Start()
    {
        dialogUI = FindObjectOfType <DialogUI>();
        if (dialogUI == null)
        {
            Debug.LogError($"{nameof(dialogUI)} not found in the scene");
        }

        dialogUI.onOptionSelected.AddListener(OnOptionSelected);
        currentNode = dialogue.GetRootNode();
    }
    protected void FoundCase(CaseData caseData)
    {
        int caseIndex = InvestigationManager.me.storage.cases.IndexOf(caseData);

        InvestigationManager.SetCase(caseIndex);
        Files files = Files.Load();

        files.SetInitialClues(caseData.initialClues, caseIndex);
        files.Save();
        DialogUI.StartDialog(caseData.findingDialog, InvestigationManager.me.currentCase != caseIndex, DialogType.CASE);
    }
Esempio n. 11
0
    public IEnumerator HideDialog()
    {
        yield return(new WaitForSeconds(.5f));

        DialogUI dialog = GetComponent <DialogUI>();

        username.text = null;
        pass1.text    = null;
        pass2.text    = null;
        email.text    = null;
        dialog.Cancel();
    }
Esempio n. 12
0
    public void DialogEnter(int _point)
    {
        if (dialog == null)
        {
            GameObject _uiprefab = Resources.Load("Prefab/UI/DialogUI") as GameObject;

            dialog   = Instantiate(_uiprefab, transform.position, Quaternion.identity);
            dialogUI = dialog.GetComponent <DialogUI>();
        }

        DialogProfileChanger(curDialogPoint);
    }
Esempio n. 13
0
    void Start()
    {
        move       = FindObjectOfType <PlayerMovement>();
        chatBubble = GameObject.Find("Chat Bubble");

        anim = chatBubble.GetComponentInChildren <Animator>();

        dialogUI = conversation.GetComponent <DialogUI>();

        dialogUI.Speaker = dialog.character;

        chatBubble.SetActive(false);

        dialogUI.HideNextSymbol();
    }
Esempio n. 14
0
    public void Ask(WitnessData witness)
    {
        CaseData openedCase = InvestigationManager.GetCase();

        foreach (var rumor in data.rumors)
        {
            if (rumor.target == witness)
            {
                Files files = Files.Load();
                bool  added = files.GetCaseStatus().AddRumor(openedCase.GetRumorFromData(rumor));
                files.Save();
                DialogUI.StartDialog(rumor.findingDialog, added, DialogType.RUMOR);
                return;
            }
        }
        DialogUI.StartDialog(data.genericNegativeAnswers[Random.Range(0, data.genericNegativeAnswers.Count)]);
    }
Esempio n. 15
0
    public void Ask(ClueData clue)
    {
        CaseData openedCase = InvestigationManager.GetCase();

        foreach (var testimony in data.testimonys)
        {
            if (testimony.clue == clue)
            {
                Files files = Files.Load();
                bool  added = files.GetCaseStatus().AddTestimony(openedCase.GetTestimonyFromData(testimony));
                files.Save();
                DialogUI.StartDialog(testimony.findingDialog, added, DialogType.TESTIMONY);
                return;
            }
        }
        DialogUI.StartDialog(data.genericNegativeAnswers[Random.Range(0, data.genericNegativeAnswers.Count)]);
    }
    protected void FoundClue(ClueData clue)
    {
        CaseData openedCase = InvestigationManager.GetCase();
        int      clueIndex  = openedCase.GetClueIndexFromData(clue);

        if (clueIndex >= 0)
        {
            Files files = Files.Load();
            bool  added = files.GetCaseStatus().AddClue(openedCase.GetClueIndexFromData(clue));
            files.Save();
            Debug.Log("ADDED: " + added);
            DialogUI.StartDialog(clue.findingDialog, added, DialogType.CLUE);
        }
        else
        {
            NoClueFound();
        }
    }
Esempio n. 17
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        var dialogSpot = collision.gameObject.GetComponent <DialogSpot>();

        if (dialogSpot != null)
        {
            bool available = (dialogSpot.oneTimeOnly && !dialogSpot.played) || !dialogSpot.oneTimeOnly;
            if (dialogSpot.autoStart && available)
            {
                DialogUI.StartDialog(dialogSpot.data, false);
                dialogSpot.Play();
            }
            else if (!dialogSpot.autoStart)
            {
                VerbUI.Show(VerbType.ASK);
            }
        }
    }
Esempio n. 18
0
    public List <string> deletedObjects = new List <string>(); //list of ID of the deleted items for savegame


    public void save()
    {
        try
        {
            string data     = JsonUtility.ToJson(this);
            string filepath = Path.Combine(Application.persistentDataPath, "savegame.save");
            File.WriteAllText(filepath, data);
            DialogUI dr = Object.FindObjectOfType <DialogUI>();
            if (dr != null)
            {
                dr.showSavedInfo();
            }
        }
        catch (System.Exception ex)
        {
            Debug.LogError("Can't save file.");
        }
    }
Esempio n. 19
0
    private void Start()
    {
        if (interactMarker == null)
        {
            Debug.LogError("Interact marker not set for: " + transform.name);
        }

        if (UI == null)
        {
            Debug.LogError("UI not set for: " + transform.name);
        }
        else
        {
            dialogUI = UI.GetComponent <DialogUI>();
        }

        if (dialogUI == null)
        {
            Debug.LogError("UI has no DialogUI");
        }
    }
Esempio n. 20
0
    public void Relate()
    {
        CaseData openedCase = InvestigationManager.GetCase();

        var clue1 = (ClueData)firstSpace.GetSelectedObject();
        var clue2 = (ClueData)secondSpace.GetSelectedObject();

        foreach (InsightData i in openedCase.insights)
        {
            if ((i.firstClue == clue1 && i.secondClue == clue2) ||
                (i.firstClue == clue2 && i.secondClue == clue1))
            {
                int   insightIndex = openedCase.GetInsightIndexFromData(i);
                Files files        = Files.Load();
                bool  added        = files.GetCaseStatus().AddInsight(insightIndex);
                files.Save();
                DialogUI.StartDialog(i.findingDialog, added, DialogType.INSIGHT);
                return;
            }
        }
        DialogUI.StartDialog(marthaData.genericNegativeAnswers[Random.Range(0, marthaData.genericNegativeAnswers.Count)]);
    }
Esempio n. 21
0
    IEnumerator SetDialog(DialogUI activeDUI, string text, float t)
    {
        activeDUI.Dialog = "";
        activeDUI.Show();
        int i = 0;

        foreach (char letter in text.ToCharArray())
        {
            canSkip           = false;
            activeDUI.Dialog += letter;
            if (i > 0 && Input.GetKeyDown(KeyCode.E))
            {
                activeDUI.Dialog = "";
                activeDUI.Dialog = text;
            }
            else
            {
                yield return(new WaitForSecondsRealtime(t));
            }
            i++;
        }
        canSkip = true;
    }
    private IEnumerator PlayConversation(List <string> dialogComponents)
    {
        conversationFinished = false;
        string speaker = "";
        string dialog  = "";
        bool   waitForAdvance;

        //Initializing all of the colors
        dialogUIActor1.dialogBox.color    = Color.white;
        dialogUIActor1.dialogField.color  = new Color(58.0f / 255.0f, 58.0f / 255.0f, 58.0f / 255.0f, 0.5f);
        dialogUIActor1.speakerField.color = new Color(58.0f / 255.0f, 58.0f / 255.0f, 58.0f / 255.0f, 0.5f);

        dialogUIActor2.dialogBox.color    = Color.white;
        dialogUIActor2.dialogField.color  = new Color(58.0f / 255.0f, 58.0f / 255.0f, 58.0f / 255.0f, 0.5f);
        dialogUIActor2.speakerField.color = new Color(58.0f / 255.0f, 58.0f / 255.0f, 58.0f / 255.0f, 0.5f);

        selfAnimator.SetTrigger("OpenDialog");
        yield return(new WaitForSeconds(1.4f)); //Used to offset the dialog bar appearance time

        for (int i = 0; i < dialogComponents.Count; i++)
        {
            string currentDialog = dialogComponents[i];
            print(currentDialog);
            string[] instructionPieces = new string[0];
            if (dialogComponents[i].Split('[', ']').Count() >= 3 && dialogComponents[i].Split('[', ']')[0] == "")
            {
                instructionPieces = currentDialog.Split('[', ']')[1].Split(',');
                currentDialog     = currentDialog.Split('[', ']')[2].Trim();
            }

            string[] dialogPieces = currentDialog.Split(':');

            if (dialogPieces.Length > 1)
            {
                speaker = dialogPieces[0];
                dialog  = dialogPieces[1];
            }
            else
            {
                speaker = "";
                dialog  = dialogPieces[0];
            }
            speaker = speaker.Trim();
            dialog  = dialog.Trim();



            //Parsing instructions??
            //Filler
            foreach (string rawInstruction in instructionPieces)
            {
                string instruction = rawInstruction.Trim();

                if (instruction.Contains("Pan"))
                {
                    if (instruction.Contains("Player"))
                    {
                        CameraControlsTopDown3D.instance.Target(ShmupGameManager.instance.player.gameObject);
                    }
                    else if (instruction.Contains("Focus"))
                    {
                        GameObject focus = GameObject.FindObjectsOfType <FocalPoint>().Where(x => x.gameObject.activeSelf).ToList()[0].gameObject;
                        CameraControlsTopDown3D.instance.Target(focus);
                        focus.SetActive(false);
                    }
                }
                if (instruction.Contains("Resume Gameplay"))
                {
                    print("Resuming Game");
                    ShmupGameManager.instance.ResumeGameplay();
                }
                else if (instruction.Contains("Pause Game"))
                {
                    print("Pausing Game");
                    ShmupGameManager.instance.PauseGameplay();
                }
            }

            //parsing speaker
            DialogUI dialogUI = null;
            if (speaker == NAME_ACTOR_1)
            {
                //selfAnimator.SetBool("SpeakingActor1", true);
                //selfAnimator.SetBool("SpeakingActor2", false);
                dialogUIActor1.dialogBox.color    = new Color(148.0f / 255.0f, 171.0f / 255.0f, 255.0f / 255.0f);
                dialogUIActor1.dialogField.color  = new Color(58.0f / 255.0f, 58.0f / 255.0f, 58.0f / 255.0f);
                dialogUIActor1.speakerField.color = new Color(58.0f / 255.0f, 58.0f / 255.0f, 58.0f / 255.0f);

                dialogUIActor2.dialogBox.color    = Color.white;
                dialogUIActor2.dialogField.color  = new Color(58.0f / 255.0f, 58.0f / 255.0f, 58.0f / 255.0f, 0.5f);
                dialogUIActor2.speakerField.color = new Color(58.0f / 255.0f, 58.0f / 255.0f, 58.0f / 255.0f, 0.5f);

                dialogUI = dialogUIActor1;
            }
            else if (speaker == NAME_ACTOR_2)
            {
                //selfAnimator.SetBool("SpeakingActor1", false);
                //selfAnimator.SetBool("SpeakingActor2", true);
                dialogUIActor1.dialogBox.color    = Color.white;
                dialogUIActor1.dialogField.color  = new Color(58.0f / 255.0f, 58.0f / 255.0f, 58.0f / 255.0f, 0.5f);
                dialogUIActor1.speakerField.color = new Color(58.0f / 255.0f, 58.0f / 255.0f, 58.0f / 255.0f, 0.5f);

                dialogUIActor2.dialogBox.color    = new Color(148.0f / 255.0f, 171.0f / 255.0f, 255.0f / 255.0f);
                dialogUIActor2.dialogField.color  = new Color(58.0f / 255.0f, 58.0f / 255.0f, 58.0f / 255.0f);
                dialogUIActor2.speakerField.color = new Color(58.0f / 255.0f, 58.0f / 255.0f, 58.0f / 255.0f);

                dialogUI = dialogUIActor2;
            }
            else if (!(speaker == "" && dialog == ""))
            {
                throw new Exception("This dialog is not supported" + dialogComponents[i] + "/" + speaker + "/" + dialog);
            }

            //Showing dialog
            if (!(speaker == "" && dialog == ""))
            {
                waitForAdvance = true;
                dialogUI.displayDialog(dialog, speaker);
                yield return(null);

                while (!dialogUI.dialogCompleted)
                {
                    if (Controls.dialogAdvanceDown())
                    {
                        dialogUI.resolveDialog();
                    }
                    yield return(null);
                }
            }

            else
            {
                waitForAdvance = false;
            }

            float autoAdvanceTimer = 0.0f;
            //Replace this with things in the control set
            while (waitForAdvance)
            {
                autoAdvanceTimer += Time.deltaTime;
                if (Controls.dialogAdvanceDown() || autoAdvanceTimer > AUTO_DIALOG_ADVANCE_TIME)
                {
                    break;
                }
                yield return(null);
            }
        }

        //Resetting all of the colors
        dialogUIActor1.dialogBox.color    = Color.white;
        dialogUIActor1.dialogField.color  = new Color(58.0f / 255.0f, 58.0f / 255.0f, 58.0f / 255.0f, 0.5f);
        dialogUIActor1.speakerField.color = new Color(58.0f / 255.0f, 58.0f / 255.0f, 58.0f / 255.0f, 0.5f);

        dialogUIActor2.dialogBox.color    = Color.white;
        dialogUIActor2.dialogField.color  = new Color(58.0f / 255.0f, 58.0f / 255.0f, 58.0f / 255.0f, 0.5f);
        dialogUIActor2.speakerField.color = new Color(58.0f / 255.0f, 58.0f / 255.0f, 58.0f / 255.0f, 0.5f);

        selfAnimator.SetTrigger("CloseDialog");
        conversationFinished = true;

        yield return(null);
    }
 public void Init()
 {
     _dialogUI = Object.FindObjectOfType <DialogUI>();
     _dialogUI.onClickEnter += _dialogUI_onClickEnter;
 }
Esempio n. 24
0
 void Awake()
 {
     Instance = this;
     DialogPanel.SetActive(false);
 }
 protected void Awake()
 {
     dialogUI = GetComponent <DialogUI>();
 }
    private IEnumerator PlayCutscene(List <string> dialogComponents, float autoPlay = 0.0f)
    {
        string speaker = "";
        string dialog  = "";
        bool   waitForAdvance;

        for (int i = 0; i < dialogComponents.Count; i++)
        {
            string currentDialog = dialogComponents[i];

            string[] instructionPieces = new string[0];
            if (dialogComponents[i].Split('[', ']').Count() >= 3 && dialogComponents[i].Split('[', ']')[0] == "")
            {
                instructionPieces = currentDialog.Split('[', ']')[1].Split(',');
                currentDialog     = currentDialog.Split('[', ']')[2].Trim();
            }

            string[] dialogPieces = currentDialog.Split(':');

            if (dialogPieces.Length > 1)
            {
                speaker = dialogPieces[0];
                dialog  = dialogPieces[1];
            }
            else
            {
                speaker = "";
                dialog  = dialogPieces[0];
            }

            speaker = speaker.Trim();
            dialog  = dialog.Trim();



            //Parsing instructions
            foreach (string rawInstruction in instructionPieces)
            {
                string instruction = rawInstruction.Trim();

                if (instruction.Contains("Resume Gameplay"))
                {
                    print("Resuming Game");
                    ShmupGameManager.instance.ResumeGameplay();
                }

                if (instruction.Contains("Show"))
                {
                    if (instruction.Contains("1"))
                    {
                        selfAnimator.SetBool("ShowActor1", true);
                    }
                    if (instruction.Contains("2"))
                    {
                        selfAnimator.SetBool("ShowActor2", true);
                    }
                    if (instruction.Contains("Letterbox"))
                    {
                        OpenCutsceneWindow();
                    }
                }
                if (instruction.Contains("Hide"))
                {
                    if (instruction.Contains("1"))
                    {
                        selfAnimator.SetBool("ShowActor1", false);
                    }
                    if (instruction.Contains("2"))
                    {
                        selfAnimator.SetBool("ShowActor2", false);
                    }
                    if (instruction.Contains("Letterbox"))
                    {
                        HideCutsceneWindow();
                    }
                }
            }

            //parsing speaker
            DialogUI dialogUI = null;
            if (speaker == NAME_ACTOR_1)
            {
                while (!dialogUIActor1.gameObject.activeSelf)
                {
                    yield return(null);
                }
                selfAnimator.SetBool("SpeakingActor1", true);
                selfAnimator.SetBool("SpeakingActor2", false);
                dialogUI = dialogUIActor1;
            }
            else if (speaker == NAME_ACTOR_2)
            {
                while (!dialogUIActor2.gameObject.activeSelf)
                {
                    yield return(null);
                }
                selfAnimator.SetBool("SpeakingActor1", false);
                selfAnimator.SetBool("SpeakingActor2", true);
                dialogUI = dialogUIActor2;
            }
            else if (!(speaker == "" && dialog == ""))
            {
                throw new Exception("This dialog is not supported" + dialogComponents[i] + "/" + speaker + "/" + dialog);
            }

            //Showing dialog
            if (!(speaker == "" && dialog == ""))
            {
                waitForAdvance = true;
                dialogUI.displayDialog(dialog, speaker);
                yield return(null);

                while (!dialogUI.dialogCompleted)
                {
                    if (Controls.dialogAdvanceDown())
                    {
                        dialogUI.resolveDialog();
                    }
                    yield return(null);
                }
            }
            else
            {
                waitForAdvance = false;
            }

            yield return(new WaitForSeconds(0.25f));

            //Replace this with things in the control set
            float autoAdvanceTimer = 0.0f;
            while (waitForAdvance)
            {
                autoAdvanceTimer += Time.deltaTime;
                if (Controls.dialogAdvanceDown() || (autoPlay > 0.0f && autoAdvanceTimer > autoPlay))
                {
                    break;
                }
                yield return(null);
            }
        }

        EndCutscene();
        yield return(null);
    }
Esempio n. 27
0
 void Start()
 {
     ui         = GetComponent <DialogUI>();
     ui.enabled = false;
 }
Esempio n. 28
0
    //Death
    public void onDeathAnimationComplete()
    {
        DialogUI dui = FindObjectOfType <DialogUI>();

        dui.gameOverDialog.SetActive(true);
    }
Esempio n. 29
0
 void Awake()
 {
     uis       = GetComponentsInChildren <HudUI>();
     inventory = GetComponentInChildren <InventoryUI>();
     dialog    = GetComponentInChildren <DialogUI>();
 }
Esempio n. 30
0
    void Update()
    {
        if (planterGraine)
        {
            PlanterGraine(posGraine);
            planterGraine = false;
        }
        else if (placerChamp)
        {
            commencerChamp = false;
            farmCorner2    = SelectionBox.endPos;

            Debug.Log("ON CREE LA FERME");
            CreeChamp(TouchToPos(farmCorner1), TouchToPos(farmCorner2), positionsChamps);
            placerChamp = false;
        }
        else if (commencerChamp)
        {
            corner1Selected = false;

            beginToSelect = true;
            if (SelectionBox.finishedSelecting)
            {
                DialogUI.ShowFarmPanel(2);
            }
        }
        else if (corner1Selected)
        {
            DialogUI.ShowFarmPanel(1);
        }
        else
        {
            if (Player_script.VerifyTouch())
            {
                Touch touch = Player_script.ImportTouch();

                if (touch.phase == TouchPhase.Began)
                {
                    touchBeganTime = Time.time;
                }

                (touchFinished, timeTouchLasted, touchBeganTime) = DetectTouchDuration(touch, touchBeganTime);

                if (touchFinished)
                {
                    if (timeTouchLasted >= longTouchTime)
                    {
                        farmCorner1     = touch;
                        corner1Selected = true;
                    }
                    else
                    {
                        posChamp = ToucheUnChamp(TouchToPos(touch));
                        if (posChamp != Vector3.zero)
                        {
                            DialogUI.ShowFarmPanel(3);
                            posGraine = posChamp;
                        }
                        else if (!DialogUI.panelTouched)
                        {
                            playerAbleToMove = true;
                        }
                    }
                }
            }
        }
    }