Ejemplo n.º 1
0
    /// <summary>
    /// Displays the outcome of the case.
    /// </summary>
    /// <param name="hasWon"></param>
    public void DisplayOutcome(bool hasWon, bool load)
    {
        _load = load;
        if (TutorialManager.Instance._doTutorial &&
            TutorialManager.Instance.currentState == TutorialManager.TutorialState.SolveCaseTwo)
        {
            if (hasWon)
            {
                TutorialManager.Instance.ScoreTutorial(true);
            }
            else
            {
                TutorialManager.Instance.ScoreTutorial(false);
                return;
            }
        }
        if (hasWon)
        {
            winLossPopUps[0].SetActive(true);
            winLossPopUps[1].SetActive(false);
        }
        else
        {
            winLossPopUps[1].SetActive(true);
            winLossPopUps[0].SetActive(false);
        }

        MissionManager misMan = FindObjectOfType <MissionManager>();

        misMan.FindAndAddMission();

        EmailInbox inBox = FindObjectOfType <EmailInbox>();

        foreach (var email in inBox.GetEmails())
        {
            if (email.caseNumber == caseNumber)
            {
                email.currentStatus = EmailListing.CaseStatus.Conclusion;
                email.SetVisuals();
                break;
            }
        }

        for (var index = 0; index < BrowserManager.Instance.tabList.Count; index++) // this is a for loop because we consecutively delete from the list, foreach loops do NOT like that
        {
            var tab = BrowserManager.Instance.tabList[index];
            if (tab.caseNumber == caseNumber)
            {
                BrowserManager.Instance.CloseTab(tab);
            }
        }


        _solvedOutcome = hasWon;
        _solved        = true;
    }
Ejemplo n.º 2
0
        /// <summary>
        /// Find the inbox and put all the listing we have back into it using the ids we saved and a list of all the listing prefabs
        /// </summary>
        /// <param name="playerSaveData"></param>
        private void LoadMail(PlayerSaveData playerSaveData)
        {
            EmailInbox inbox = FindObjectOfType <EmailInbox>();

            for (int i = 0; i < playerSaveData.mailListings.Count; i++)
            {
                if (playerSaveData.mailListings[i] <= _mailDictionary.Count)
                {
                    inbox.LoadEmail(_mailDictionary[playerSaveData.mailListings[i] - 1].listing, playerSaveData.emailPosition[i],
                                    playerSaveData.mailStatus[i]);
                }
            }
        }
    //Load messages from data into EmailInboxes
    void InitializeMessages()
    {
        //Inbox
        XmlSerializer serialize = new XmlSerializer(typeof(EmailInbox));
        FileStream    file      = new FileStream(Application.streamingAssetsPath + "/Data/inbox.xml", FileMode.Open);

        inboxData = (EmailInbox)serialize.Deserialize(file);

        //Sent
        file = new FileStream(Application.streamingAssetsPath + "/Data/sent.xml", FileMode.Open);

        //If there is new sent data, then use that instead
        if (File.Exists(Application.streamingAssetsPath + "/Data/newsent.xml"))
        {
            file = new FileStream(Application.streamingAssetsPath + "/Data/newsent.xml", FileMode.Open);
        }
        sentData = (EmailInbox)serialize.Deserialize(file);

        //Spam
        file     = new FileStream(Application.streamingAssetsPath + "/Data/spam.xml", FileMode.Open);
        spamData = (EmailInbox)serialize.Deserialize(file);

        //Trash
        file      = new FileStream(Application.streamingAssetsPath + "/Data/trash.xml", FileMode.Open);
        trashData = (EmailInbox)serialize.Deserialize(file);

        //More sanity checking
        if (gameController != null)
        {
            if (gameController.GetComponent <GameController>().PhishingResponse&& gameController.GetComponent <GameController>().PhishingPuzzle)
            {
                //Load phishing response
                XmlSerializer ser = new XmlSerializer(typeof(EmailInbox.Message));
                file = new FileStream(Application.streamingAssetsPath + "/Data/phishingresponse.xml", FileMode.Open);
                EmailInbox.Message phishingResponse = (EmailInbox.Message)ser.Deserialize(file);

                //Get time for the response
                phishingResponse.time = GetTime();

                //Add to inbox
                inboxData.messageList.Insert(0, phishingResponse);
            }
        }

        //Default to inbox
        InstantiateMessages(inboxData);
    }
    //Event handler for opening an email
    public void EmailItemEvent(EmailInbox sourceList, int index)
    {
        emailMessageText.SetActive(true);

        //Special case email was from sent
        if (sourceList.type == "Sent")
        {
            emailMessageText.transform.GetChild(0).GetChild(0).GetComponent <TMP_Text>().text = "*****@*****.**";
            emailMessageText.transform.GetChild(1).GetChild(0).GetComponent <TMP_Text>().text = sourceList.messageList[index].senderOrRecipient;
        }
        else
        {
            emailMessageText.transform.GetChild(0).GetChild(0).GetComponent <TMP_Text>().text = sourceList.messageList[index].senderOrRecipient;
            emailMessageText.transform.GetChild(1).GetChild(0).GetComponent <TMP_Text>().text = "*****@*****.**";
        }

        emailMessageText.transform.GetChild(2).GetChild(0).GetComponent <TMP_Text>().text = sourceList.messageList[index].subject;
        emailMessageText.transform.GetChild(3).GetChild(0).GetComponent <TMP_Text>().text = sourceList.messageList[index].text.Replace("~", Environment.NewLine);
    }
    //Event handler for opening inboxes
    public void OnClickEmailCategory(string type)
    {
        EmailInbox currentData = inboxData;

        switch (type)
        {
        case "Sent":
            currentData = sentData;
            break;

        case "Spam":
            currentData = spamData;
            break;

        case "Trash":
            currentData = trashData;
            break;
        }

        InstantiateMessages(currentData);
    }
    //Populate message list with messages
    void InstantiateMessages(EmailInbox messageList)
    {
        //Clear list
        for (int i = 0; i < emailMessageList.transform.childCount; i++)
        {
            Destroy(emailMessageList.transform.GetChild(i).gameObject);
        }

        //Add messages
        for (int i = 0; i < messageList.messageList.Count; i++)
        {
            GameObject messageObj = Instantiate(message, emailMessageList.transform);
            messageObj.GetComponent <RectTransform>().anchoredPosition = new Vector3(0, -47 - 20 * i, 0);
            messageObj.transform.GetChild(0).GetComponent <TMP_Text>().SetText(messageList.messageList[i].senderOrRecipient);
            messageObj.transform.GetChild(1).GetComponent <TMP_Text>().SetText(messageList.messageList[i].subject);
            messageObj.transform.GetChild(2).GetComponent <TMP_Text>().SetText(messageList.messageList[i].time);

            //Must make a copy of i, else the EmailItemEvent will break
            int index = i;
            messageObj.transform.GetChild(3).GetComponent <Button>().onClick.AddListener(() => EmailItemEvent(messageList, index));
        }
    }
Ejemplo n.º 7
0
        /** Sets up the missionManager after boot  */
        private IEnumerator WaitForBoot()
        {
            yield return(new WaitForEndOfFrame());

            GameObject monitorObject = GameObject.FindWithTag("VSCMonitor");

            _hoverMonitor = monitorObject.GetComponent <HoverOverObject>();

            _virtualScreenSpaceCanvaser =
                monitorObject.GetComponent <VirtualScreenSpaceCanvaser>();

            _missionCases = FindObjectOfType <SaveManager>().GetComponent <SaveManager>().mailDictList;
            _emailInbox   = FindObjectOfType <EmailInbox>();

            Debug.Log("While loading inbox has " + -_emailInbox.GetEmails().Count);

            _createdMissions = new List <EmailListing>();

            _virtualScreenSpaceCanvaser.ToggleCanvas();

            _virtualScreenSpaceCanvaser.ToggleCanvas();
        }