Exemplo n.º 1
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();
            }
        }
    }
Exemplo n.º 2
0
    void selectClue(ClueData clue)
    {
        clueSprite.sprite = clue.sprite;
        clueText.text     = clue.title;

        currentClue = clue;
    }
Exemplo n.º 3
0
    // randomly chooses a clue
    void ClueSetUp(List <ClueData> clues)
    {
        ClueData chosenClue = clues[Random.Range(0, clues.Count)];

        clueText.text = chosenClue.clueText;
        currentClue   = chosenClue;
    }
Exemplo n.º 4
0
 public void SelectClue(ClueData clue)
 {
     transform.GetChild(0).GetComponent <CanvasGroup>().alpha = 1;
     selectedClue = clue;
     title.text   = clue.clueName;
     icon.sprite  = clue.img;
 }
Exemplo n.º 5
0
    // assigns which bottles should be clicked based on clue
    void BottleSetUp(List <Bottle> bottles, ClueData clue)
    {
        foreach (Bottle b in bottles)

        {
            foreach (string m in clue.molecules)
            {
                if (b.chemicalName == m)
                {
                    b.shouldBeClicked = true;
                }
            }
        }
    }
Exemplo n.º 6
0
    private void HighlightSpots()
    {
        ClueData.RowCol pos       = ClueData.Instance.GetPlayerRowCol(turnManager.CurrentTurn - 1);
        List <int[]>    positions = PossibleBoardLocations.GetBoardLocations(pos.row, pos.col, diceRoller.DiceValue, (i => IsValid(i)));

        for (int i = 0; i < positions.Count; i++)
        {
            Vector3    spawn = boardManager.RowColToBoardLocation(positions[i][0], positions[i][1], 5e-4f);
            GameObject tile  = Instantiate(highlight, spawn, Quaternion.identity);
            tile.GetComponent <TileSelector>().cgm       = this;
            tile.GetComponent <TileSelector>().location  = ClueData.GetRowColl(positions[i]);
            tile.GetComponent <TileSelector>().clickable = IsCurrentTurnHuman();
            highlights.Push(tile);
        }
    }
Exemplo n.º 7
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();
        }
    }
Exemplo n.º 9
0
    private void InitClueWidgets(CaseData caseData)
    {
        // First, create enough widgets for the current case
        // there may already be one or more widgets under cluesGrid to visualize better
        // in the editor, so only add what you need.
        // We assume all children of cluesGrid are actually clue widgets, so just count them.
        // If you open the Clues page for the second time in this mission, nothing should be added.
        int currentButtonsCount = cluesGrid.transform.childCount;

        for (int i = currentButtonsCount; i < caseData.clueDataArray.Length; i++)
        {
            Instantiate(clueButtonPrefab, cluesGrid.transform);
        }

        // Second, disable any extra widgets (e.g. created from a previous case that had more clues than the current one)
        for (int i = caseData.clueDataArray.Length; i < currentButtonsCount; i++)
        {
            cluesGrid.transform.GetChild(i).gameObject.SetActive(false);
        }

        // Third, setup the scene widgets for each available scene
        for (int i = 0; i < caseData.clueDataArray.Length; i++)
        {
            // get widget script
            Transform widgetTr = cluesGrid.transform.GetChild(i);
            Debug.AssertFormat(widgetTr != null, cluesGrid,
                               "Scene widget grid {0} has no child of index {1}, yet we should have created up to {2} widgets " +
                               "after the existing {3}.", cluesGrid, i, caseData.clueDataArray.Length, currentButtonsCount);
            var widget = widgetTr.GetComponentOrFail <CaseFileClueWidget>();

            // get clue data
            ClueData clueData = caseData.clueDataArray[i];

            // check if clue has been found
            bool isClueFound = CaseManager.Instance.CurrentCaseProgress.HasFoundClue(clueData.stringID);

            // init clue button widget
            widget.Init(clueData, isClueFound);
        }
    }
Exemplo n.º 10
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;
    }
Exemplo n.º 11
0
 public void AskWitness(ClueData clue)
 {
     collidingWitness[0].Ask(clue);
 }
Exemplo n.º 12
0
 private void OnClueSelected(ClueData clueData)
 {
     clueDescriptionWidget.text = clueData.description;
 }
Exemplo n.º 13
0
 public static void InvokeClueSelected(ClueData clueData)
 {
     clueSelected?.Invoke(clueData);
 }
Exemplo n.º 14
0
 public void SetInfo(ClueData data)
 {
     this.data        = data;
     this.icon.sprite = data.img;
     this.header.text = data.clueName;
 }
Exemplo n.º 15
0
 void Start()
 {
     d    = Dialogtext.GetInstance();
     data = ClueData.getInstance();
 }
Exemplo n.º 16
0
 public void SetInfo(ClueData data)
 {
     title.text = data.clueName;
     obj        = data;
     type       = DataType.CLUE;
 }
Exemplo n.º 17
0
 public int GetClueIndexFromData(ClueData data)
 {
     return(clues.IndexOf(data));
 }
Exemplo n.º 18
0
 public bool IsValid(int[] position)
 {
     return(IsValid(ClueData.GetRowColl(position)));
 }
Exemplo n.º 19
0
 public void Init(ClueData clueData, bool isClueFound)
 {
     m_ClueData          = clueData;
     clueNameWidget.text = clueData.clueName;
     button.interactable = isClueFound;
 }
Exemplo n.º 20
0
 public void Choose(ClueData cd)
 {
     caller.SelectClue(cd);
     Close();
 }
Exemplo n.º 21
0
 public void SetInfo(ClueData cd)
 {
     clueData    = cd;
     name.text   = cd.clueName;
     icon.sprite = cd.img;
 }
Exemplo n.º 22
0
 public void SetInfo(string question, ClueData data)
 {
     this.question.text = question;
     this.answer.text   = data.name;
 }