Esempio n. 1
0
    public void SetObject(WitnessData witness)
    {
        CaseData openedCase = InvestigationManager.GetCase();

        GetComponent <CanvasGroup>().alpha = 1;
        string fullDescription = "";

        fullDescription += "IDADE: " + witness.age + "\n";
        fullDescription += "PROFISSÃO: " + witness.job + "\n";
        fullDescription += "RUMORES:";
        Files files = Files.Load();

        int witnessIndex = openedCase.GetWitnessIndexFromData(witness);

        foreach (Rumor r in files.GetCaseStatus().rumors)
        {
            if (r.target == witnessIndex)
            {
                RumorData rd = openedCase.GetRumorData(r);
                print(r.from + "/" + r.target);
                fullDescription += "\n" + "* " + rd.from.witnessName + ": " + rd.description;
            }
        }
        description.text = fullDescription;
        title.text       = witness.witnessName;
        icon.sprite      = witness.image;
    }
Esempio n. 2
0
    public void ListAllCollectedClues(ClueSpaceUI caller)
    {
        CaseData openedCase = InvestigationManager.GetCase();

        Open();
        Erase();
        Files files = Files.Load();

        this.caller = caller;
        var l = files.GetCaseStatus().clues;

        for (int i = 0; i < l.Count; i++)
        {
            var      clue = l[i];
            ClueData cd   = openedCase.GetClueData(clue);
            var      go   = Instantiate(cluePrefab, root);
            go.GetComponent <ClueForListUI>().SetInfo(cd);
            go.GetComponent <Button>().onClick.AddListener(
                delegate {
                ClueData c = cd;
                Choose(c);
            });
            if (i == 0)
            {
                go.GetComponent <Button>().Select();
            }
        }
    }
Esempio n. 3
0
    public void UpdateSelection()
    {
        CaseData openedCase = InvestigationManager.GetCase();

        if (InteractionManager.selection.type == SelectionType.CLUE)
        {
            if (!opened)
            {
                SetSelectionUIActive(true);
            }
            header.text    = "PISTA";
            objName.text   = openedCase.clues[InteractionManager.selection.clue].clueName;
            objIcon.sprite = openedCase.clues[InteractionManager.selection.clue].img;
        }
        else if (InteractionManager.selection.type == SelectionType.WITNESS)
        {
            if (!opened)
            {
                SetSelectionUIActive(true);
            }
            header.text    = "TESTEMUNHA";
            objName.text   = openedCase.witnesses[InteractionManager.selection.witness].witnessName;
            objIcon.sprite = openedCase.witnesses[InteractionManager.selection.witness].image;
        }
        else if (InteractionManager.selection.type == SelectionType.NONE)
        {
            if (opened)
            {
                SetSelectionUIActive(false);
            }
            //header.text = "SEM SELEÇÃO";
            //objName.text = "NONE";
            //objIcon.sprite = null;
        }
    }
Esempio n. 4
0
    public void SetInitialClues(List <ClueData> data, int caseIndex)
    {
        var caseData = InvestigationManager.GetCase();

        foreach (var d in data)
        {
            int i = caseData.GetClueIndexFromData(d);
            status[caseIndex].AddClue(i);
        }
    }
Esempio n. 5
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. 6
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. 7
0
 public void Initialize()
 {
     for (int i = answersUI.Count - 1; i >= 0; i--)
     {
         Destroy(answersUI[i].gameObject);
     }
     data      = InvestigationManager.GetCase().report;
     answers   = new List <ScriptableObject>();
     answersUI = new List <Transform>();
 }
Esempio n. 8
0
    public override void OnShow()
    {
        CaseData openedCase = InvestigationManager.GetCase();

        FindObjectOfType <FilesMenu>().SetName(": " + screenName);
        image.sprite     = openedCase.image;
        data.text        = "Localização: " + openedCase.location;
        description.text = openedCase.description;
        base.OnShow();
        firstSelected.Select();
    }
Esempio n. 9
0
 public override void OnOpen()
 {
     HasCase(InvestigationManager.GetCase() != null);
     if (InvestigationManager.GetCase() != null)
     {
         header.text    = "";
         selectedScreen = 1;
         foreach (var s in screens)
         {
             s.Hide(1, 0);
         }
         screens[selectedScreen].Show(1, 0);
     }
 }
Esempio n. 10
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. 11
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. 13
0
    public override void OnShow()
    {
        CaseData openedCase = InvestigationManager.GetCase();

        FindObjectOfType <WitnessInfoUI>().Hide();
        FindObjectOfType <FilesMenu>().SetName(": " + screenName);
        Erase();
        Files files = Files.Load();

        for (int i = 0; i < files.GetCaseStatus().witnesses.Count; i++)
        {
            var go = Instantiate(witnessPrefab, contentRoot);
            go.GetComponent <WitnessUI>().SetInfo(openedCase.witnesses[files.GetCaseStatus().witnesses[i]]);
            if (i == 0)
            {
                go.GetComponent <Selectable>().Select();
            }
        }
    }
Esempio n. 14
0
    public void Loop()
    {
        if (Input.GetKeyDown(KeyCode.X))
        {
            CaseData openedCase = InvestigationManager.GetCase();

            if (clueSensor.collidingClues.Count > 0)
            {
                clueSensor.InvestigateClue();
            }
            else if (witnessSensor.collidingWitness.Count > 0)
            {
                if (selection.type == SelectionType.CLUE)
                {
                    witnessSensor.AskWitness(openedCase.clues[selection.clue]);
                }
                else if (selection.type == SelectionType.WITNESS)
                {
                    witnessSensor.AskWitness(openedCase.witnesses[selection.witness]);
                }
                else if (selection.type == SelectionType.NONE)
                {
                    witnessSensor.IntroduceToWitness();
                }
            }
            else if (portalSensor.collidingPortal.Count > 0)
            {
                portalSensor.EnterPortal();
            }
            else if (spotSensor.collidingSpots.Count > 0)
            {
                spotSensor.OpenInvestigationSpot();
            }
            else if (taxiSpotSensor.collidingTaxiSpot.Count > 0)
            {
                taxiSpotSensor.OpenTaxiMenu();
            }
        }
        else if (Input.GetKeyDown(KeyCode.Escape))
        {
            FindObjectOfType <FilesMenu>().Open();
        }
    }
Esempio n. 15
0
    public bool AnalyseReport(List <ScriptableObject> list)
    {
        List <Question> qa             = InvestigationManager.GetCase().report.questions;
        int             correctAnswers = 0;

        for (int i = 0; i < list.Count; i++)
        {
            for (int j = 0; j < qa[i].possibleAnswers.Count; j++)
            {
                if (list[i] == qa[i].possibleAnswers[j])
                {
                    correctAnswers++;
                    break;
                }
            }
        }
        float r = (float)correctAnswers / list.Count;

        print("REPORT GRADE: " + r);
        return(r >= 0.75f);
    }
Esempio n. 16
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. 17
0
    public void SetObject(ClueData clue, bool full = true)
    {
        CaseData openedCase = InvestigationManager.GetCase();

        GetComponent <CanvasGroup>().alpha = 1;
        string fullDescription = clue.clueDescription;
        Files  files           = Files.Load();

        if (full)
        {
            int clueIndex = openedCase.GetClueIndexFromData(clue);
            fullDescription += "\n\nTESTEMUNHOS:";
            foreach (Testimony t in files.GetCaseStatus().testimonys)
            {
                if (t.clue == clueIndex)
                {
                    TestimonyData td = openedCase.GetTestimonyData(t);
                    fullDescription += "\n" + "* " + td.witness.witnessName + ": " + td.description;
                }
            }
            fullDescription += "\n\nINSIGHTS:";
            foreach (int i in files.GetCaseStatus().insights)
            {
                InsightData id = openedCase.GetInsightData(i);
                if ((openedCase.GetClueIndexFromData(id.firstClue) == clueIndex) ||
                    (openedCase.GetClueIndexFromData(id.secondClue) == clueIndex))
                {
                    fullDescription += "\n* [" + id.firstClue.clueName + ":" + id.secondClue.clueName + "]"
                                       + id.description;
                }
            }
        }
        description.text = fullDescription;
        title.text       = clue.clueName;
        icon.sprite      = clue.img;
    }
Esempio n. 18
0
 public ReportData GetReportData()
 {
     return(InvestigationManager.GetCase().report);
 }
Esempio n. 19
0
    private void OpenTab(DataType type)
    {
        tabTitle.text = "" + type;
        openedTab     = (int)type;
        Erase();
        switch (type)
        {
        case DataType.CLUE:
            List <ClueData> clues = InvestigationManager.GetCase().ListAllCluesIn(Files.Load());
            for (int i = 0; i < clues.Count; i++)
            {
                var go = Instantiate(objectPrefab, root);
                go.GetComponent <ListedObject>().SetInfo(clues[i]);
                if (i == 0)
                {
                    go.GetComponent <Selectable>().Select();
                }
            }
            break;

        case DataType.WITNESS:
            List <WitnessData> witness = InvestigationManager.GetCase().ListAllWitnessIn(Files.Load());
            for (int i = 0; i < witness.Count; i++)
            {
                var go = Instantiate(objectPrefab, root);
                go.GetComponent <ListedObject>().SetInfo(witness[i]);
                if (i == 0)
                {
                    go.GetComponent <Selectable>().Select();
                }
            }
            break;

        case DataType.TESTIMONY:
            List <TestimonyData> testimony = InvestigationManager.GetCase().ListAllTestimonyIn(Files.Load());
            for (int i = 0; i < testimony.Count; i++)
            {
                var go = Instantiate(objectPrefab, root);
                go.GetComponent <ListedObject>().SetInfo(testimony[i]);
                if (i == 0)
                {
                    go.GetComponent <Selectable>().Select();
                }
            }
            break;

        case DataType.RUMOR:
            List <RumorData> rumor = InvestigationManager.GetCase().ListAllRumorIn(Files.Load());
            for (int i = 0; i < rumor.Count; i++)
            {
                var go = Instantiate(objectPrefab, root);
                go.GetComponent <ListedObject>().SetInfo(rumor[i]);
                if (i == 0)
                {
                    go.GetComponent <Selectable>().Select();
                }
            }
            break;

        case DataType.INSIGHT:
            List <InsightData> insight = InvestigationManager.GetCase().ListAllInsightIn(Files.Load());
            for (int i = 0; i < insight.Count; i++)
            {
                var go = Instantiate(objectPrefab, root);
                go.GetComponent <ListedObject>().SetInfo(insight[i]);
                if (i == 0)
                {
                    go.GetComponent <Selectable>().Select();
                }
            }
            break;
        }
    }