コード例 #1
0
ファイル: Pda.cs プロジェクト: coletotheworld/island-viz
        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
ファイル: Pda.cs プロジェクト: coletotheworld/island-viz
        void Awake()
        {
            if (pages == null)
            {
                throw new Exception("Pda has no Pages defined!");
            }

            currentPage = null;

            observer = GameObject.FindGameObjectWithTag("Observer");
        }
コード例 #4
0
ファイル: Pda.cs プロジェクト: coletotheworld/island-viz
        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>();
            }
        }