Пример #1
0
        public void switchToInspectPage()
        {
            PdaPage inspectPage = pages.Find(x => x.pageType == PdaPageType.Inspect);

            if (currentPage == null)
            {
                currentPage = GameObject.Instantiate(inspectPage.gameObject, transform).GetComponent <PdaPage>();
            }
            else if (currentPage.pageType != PdaPageType.Inspect)
            {
                GameObject.Destroy(currentPage.gameObject);
                currentPage = GameObject.Instantiate(inspectPage.gameObject, transform).GetComponent <PdaPage>();
            }

            TMPro.TMP_Text[] textComponents = currentPage.gameObject.GetComponentsInChildren <TMPro.TMP_Text>();
            TMPro.TMP_Text   textField      = null;
            foreach (TMPro.TMP_Text textComp in textComponents)
            {
                if (textComp.gameObject.name == "Content")
                {
                    textField = textComp;
                }
            }
            if (textField != null)
            {
                textField.SetText(currentInspectContent);
            }
        }
Пример #2
0
 void Awake()
 {
     parentPage = gameObject.GetComponentInParent <PdaPage>();
     if (parentPage == null)
     {
         throw new Exception("Button " + gameObject.name + " must be a child of a PdaPage!");
     }
 }
Пример #3
0
        void Awake()
        {
            if (pages == null)
            {
                throw new Exception("Pda has no Pages defined!");
            }

            currentPage = null;

            observer = GameObject.FindGameObjectWithTag("Observer");
        }
Пример #4
0
        public void switchToSettingsPage()
        {
            //Debug.Log("Switching to inspection page.");
            PdaPage settingsPage = pages.Find(x => x.pageType == PdaPageType.Settings);

            if (currentPage == null)
            {
                currentPage = GameObject.Instantiate(settingsPage.gameObject, transform).GetComponent <PdaPage>();
            }
            else if (currentPage.pageType != PdaPageType.Settings)
            {
                GameObject.Destroy(currentPage.gameObject);
                currentPage = GameObject.Instantiate(settingsPage.gameObject, transform).GetComponent <PdaPage>();
            }
        }