Ejemplo n.º 1
0
        public Node(Vector2 position, float width, float height, GUIStyle nodeStyle, GUIStyle selectedStyle,
                    GUIStyle inPointStyle, GUIStyle outPointStyle, Action <ConnectionPoint> OnClickInPoint,
                    Action <ConnectionPoint> OnClickOutPoint, Action <Node> OnClickRemoveNode, string inPointID,
                    string outPointID, EmailListing emailListing, NodeBasedEditor nodeBasedEditor)
        {
            float rowHeight = height / 7;

            rectID            = new Rect(position.x, position.y + rowHeight, width, rowHeight);
            styleID           = new GUIStyle();
            styleID.alignment = TextAnchor.UpperCenter;

            rect  = new Rect(position.x, position.y, width, height);
            style = nodeStyle;

            inPoint           = new ConnectionPoint(this, ConnectionPointType.In, inPointStyle, OnClickInPoint, inPointID);
            outPoint          = new ConnectionPoint(this, ConnectionPointType.Out, outPointStyle, OnClickOutPoint, outPointID);
            defaultNodeStyle  = nodeStyle;
            selectedNodeStyle = selectedStyle;
            OnRemoveNode      = OnClickRemoveNode;

            this._emailListing = emailListing;
            title = _emailListing.caseName;

            this.nodeBasedEditor = nodeBasedEditor;
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  Adds the given gameobject's emaillisting to the emailinbox
        /// </summary>
        /// <param name="currentGameObject"></param>
        private void AddMissionToInbox(GameObject currentGameObject)
        {
            GameObject   newEmail   = Instantiate(currentGameObject, _emailInbox.GetInboxTrans());
            EmailListing newListing = newEmail.GetComponent <EmailListing>();

            _createdMissions.Add(newListing);
            _emailInbox.AddEmail(newListing);
            Debug.Log(newListing.caseName + " added");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// It will check the mailDictionary for the position that was saved in the emailListing. The emailListing list
        /// stores the actual caseId for a case and because the list starts at 0 we need to do -1 because the first case is 1
        /// </summary>
        /// <param name="playerSaveData"></param>
        private void LoadHelpFolders(PlayerSaveData playerSaveData)
        {
            Printer printer = FindObjectOfType <Printer>();
            Dictionary <int, int> tempDict = new Dictionary <int, int>();

            foreach (var id in playerSaveData.GetPrinted())
            {
                string first = id.ToString().Split(',')[0];
                int    temp  = (int)float.Parse(first);
                if (temp != 0)
                {
                    EmailListing newListing = _mailDictionary[playerSaveData.mailListings[temp - 1] - 1].listing
                                              .GetComponent <EmailListing>();
                    foreach (var tabItem in _tabDictionary)
                    {
                        foreach (var mails in FindObjectOfType <EmailInbox>().GetEmails())
                        {
                            if (tabItem.GetId().Equals(id))
                            {
                                if (mails.caseName == newListing.caseName)
                                {
                                    bool tempBool = false;
                                    foreach (var item in tempDict)
                                    {
                                        if (item.Key == temp)
                                        {
                                            foreach (var folder in FilingCabinet.Instance.caseFolders)
                                            {
                                                if (folder.caseNumber == item.Value)
                                                {
                                                    printer.Print(tabItem.prefab.GetComponent <Tab>(), mails.caseNumber, true);
                                                    tempBool = true;
                                                    break;
                                                }
                                            }

                                            break;
                                        }
                                    }

                                    if (!tempBool)
                                    {
                                        var newFolder = FilingCabinet.Instance.CreateFolderLoad();
                                        newFolder.LabelFolder(newListing.caseName,
                                                              "Case " + mails.caseNumber, mails.caseNumber, mails.listingPosition);
                                        tempDict.Add(temp, mails.caseNumber);
                                        foreach (var currentSolved in playerSaveData.GetSolved())
                                        {
                                            if (currentSolved.GetHasWon())
                                            {
                                                string solvedString = currentSolved.GetId().ToString().Split(',')[0];
                                                int    solvedId     = (int)float.Parse(solvedString);
                                                if (solvedId == temp)
                                                {
                                                    newFolder.DisplayOutcome(currentSolved.GetOutcome(), true);
                                                }
                                            }
                                        }
                                        // initiate game printing
                                        printer.Print(tabItem.prefab.GetComponent <Tab>(), mails.caseNumber, true);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }