Пример #1
0
    // Select a site button (i.e. "Luxor", "Mar Saba", etc.)
    public void SelectSiteButton(SiteButton siteButton)
    {
        // Initialize this list.
        siteElementButtons = new List <SiteElementButton>();

        // Get all the data types associated with that site.
        List <SiteElementSet> dataSets = siteButton.associatedSite.dataSets;

        siteButton.associatedSite.associatedPOI.SetSelected(true);

        // Create a button for each data type.
        for (int i = 0; i < dataSets.Count; i++)
        {
            // This specific data set.
            SiteElementSet dataSet = dataSets[i];

            // Create the new button from component. Add the SiteElementButton script and give it a name.
            SiteElementButton newButton = (GameObject.Instantiate(siteElementButtonPrefab) as GameObject).AddComponent <SiteElementButton>();
            newButton.gameObject.name = dataSet.setType;

            // Be sure to set the data.
            newButton.SetData(dataSet);

            // Determine this button's x and y position.
            float newXPos = i * (newButton.buttonSize.x + horizontalBuffer);
            float newYPos = -siteButton.buttonSize.y / 1.5f + verticalBuffer;

            //Determine size of site element button
            newButton.GetComponentInChildren <RectTransform>().sizeDelta = new Vector2(35, 10);

            // Set the parent and position of the button.
            newButton.transform.SetParent(siteButton.transform);
            newButton.transform.localPosition = new Vector3(newXPos, newYPos, 0.0f);

            // Add this button to the list.
            siteElementButtons.Add(newButton);

            // Set the button color to inactive.
            newButton.SetButtonColor(buttonInactiveColor);

            // Set data button font size and color
            newButton.GetComponentInChildren <Text>().fontSize = dataButtonTextSize;
            newButton.GetComponentInChildren <Text>().color    = buttonTextColor;
            newButton.GetComponentInChildren <Text>().font     = latoBold;
        }

        // If there are any data types, highlight the first one.
        if (dataSets.Count > 0)
        {
            selectedElementIndex = 0;
            siteElementButtons[selectedElementIndex].SetButtonColor(buttonActiveColor);
        }
    }
Пример #2
0
    // Loads every single site and it's data.
    // Warning: This can take a LONG time! Best when scheduled when nobody will be using the application.
    public IEnumerator LoadAllSites()
    {
        // Set the status text so the user knows to wait.
        StatusText.SetText("Loading All Sites. Please Wait.");

        // Lock all input.
        GamepadInput.LockInput(true);

        // Check one more time to make sure we're supposed to be doing this.
        if (GameManager.instance.caveSettings.loadAllDataOnStart)
        {
            // Iterate through every single site.
            for (int i = 0; i < sites.Count; i++)
            {
                // Store the site at this array index.
                Site site = sites[i];

                // Iterate through all data sets that are part of this site.
                for (int j = 0; j < site.dataSets.Count; j++)
                {
                    // Store the data set.
                    SiteElementSet dataSet = site.dataSets[j];

                    // Iterate through all data elements that are part of this data set.
                    for (int k = 0; k < dataSet.siteElements.Count; k++)
                    {
                        // Store this data element.
                        SiteElement dataElement = dataSet.siteElements[k];

                        // Set the status text to a helpful message.
                        string statusString = string.Format("Loading element {0} of {1} from set {2} of {3} from site {4} of {5}",
                                                            k, dataSet.siteElements.Count, j, site.dataSets.Count, i, sites.Count);

                        StatusText.SetText(statusString);
                        Debug.Log(statusString);

                        // Wait for this data element to load before proceeding.
                        yield return(dataElement.Load());
                    }
                }
            }
        }

        // Unlock input.
        GamepadInput.LockInput(false);
    }
Пример #3
0
    // Sets the associated data.
    public void SetData(SiteElementSet set)
    {
        associatedElementSet = set;

        GetComponentInChildren <Text>().text = set.setType;
    }