Ejemplo n.º 1
0
    public void OpenSpecificEntry(string entryName)
    {
        #region Reset Entire Overlay
        selectedTextID    = 0;
        selectedArticleID = 0;
        ActiveLeftSideElements[selectedTextID].color = selectedColor;
        resetLeftPanelData();
        clearRightPanelData();
        #endregion

        //Deselect primary active element
        ActiveLeftSideElements[selectedTextID].color = deselectedColor;

        //Search through each log entry for specified entry
        foreach (KeyValuePair <string, DataEntry> entry in LoadDataBaseEntries.Logs)
        {
            DataEntry de = entry.Value;

            //If the category matches, set active ID to the header's ID
            if (de.LogName.Equals(entryName))
            {
                selectedTextID = findItem(de.LogCategory);
                break;
            }
        }

        //Select the left panel item at the ID we want
        SelectLeftPanelItem();
        selectedTextID = findItem(entryName);

        //Reload right hand panel
        NavigateLeftPanel(0);

        //Select new lore entry
        ActiveLeftSideElements[selectedTextID].color = selectedColor;
    }
Ejemplo n.º 2
0
    /// <summary>
    /// function that handles input for user scrolling through panels
    /// </summary>
    /// <param name="horiz"></param>
    public void NavigateLeftPanel(float vert)
    {
        //If player is actually moving stick, repopulate right panel
        if (vert != 0)
        {
            //Reset the right panel
            clearRightPanelData();

            ActiveLeftSideElements[selectedTextID].color = deselectedColor;

            //If user scrolls to the up
            if (vert > 0)
            {
                selectedTextID--;
                if (selectedTextID < 0)
                {
                    selectedTextID = ActiveLeftSideElements.Count - 1;
                }
            }
            //If user scrolls to the down
            else if (vert < 0)
            {
                selectedTextID++;
                if (selectedTextID == ActiveLeftSideElements.Count)
                {
                    selectedTextID = 0;
                }
            }
            ActiveLeftSideElements[selectedTextID].color = selectedColor;
        }

        //If selected item is not a content header, populate the right side panel with its unlocked info
        if (!isHeader(selectedTextID))
        {
            foreach (ButtonElementSetup button in ArticleButtons)
            {
                button.gameObject.SetActive(false);
            }

            //Retrieve currently selected item's name
            string selectedItemName = ActiveLeftSideElements[selectedTextID].text.Substring(2);

            //Load the entry from Logs with the name we just retrieved
            DataEntry entry = LoadDataBaseEntries.Logs[selectedItemName];

            //Populate the entry image, header, and category
            EntryImage.sprite = Resources.Load <Sprite>(entry.LogImagePath);
            EntryImage.gameObject.SetActive(true);
            EntryHeader.text   = entry.LogName;
            EntryCategory.text = entry.LogCategory;

            int index = -1;

            //Dictionary<string, Tuple<string, bool>>
            foreach (KeyValuePair <string, Tuple <string, bool> > article in entry.LogEntries)
            {
                index++;

                //Check that the entry article is visible
                if (article.Value.Item2)
                {
                    loadedArticleInfo.Add(article.Value.Item1);
                    ArticleButtons[index].gameObject.SetActive(true);
                    ArticleButtonText[index].text = article.Key;
                    ArticleButtons[index].GetComponent <Button>().image.color = Color.black;
                    ArticleButtonText[index].color = Color.yellow;
                }
            }
            EntryInfo.text = loadedArticleInfo[0];
            ArticleButtons[selectedArticleID].GetComponent <Button>().image.color = Color.yellow;
            ArticleButtonText[selectedArticleID].color = Color.black;
        }
    }