Esempio n. 1
0
        //!
        //! Handle submited config widget
        //! This triggers the server adapter to request a scene
        //! @param widget     source widget
        //!
        public void configWidgetSubmit(ConfigWidget widget)
        {
            ui.hideConfigWidget();

            ui.switchLayoutMainMenu(layouts.DEFAULT);

            ui.resetMainMenu();

            TouchInput input = inputAdapter.GetComponent <TouchInput>();

            if (input)
            {
                input.enabled = true;
            }

            hideARWidgets();

            // request progress bar from UI and connect listener to server adapter
            RoundProgressBar progressWidget = ui.drawProgressWidget();

            // Connect set value to progress event
            serverAdapter.OnProgressEvent.AddListener(progressWidget.SetValue);
            // Connect scene load complete to progress finish event
            progressWidget.OnFinishEvent.AddListener(this.sceneLoadCompleted);

            // init server adapter
            serverAdapter.initServerAdapterTransfer();
        }
Esempio n. 2
0
        // TODO: create generic widget class

        /*
         * public void hideConfigWidget( ConfigWidget widget)
         * {
         *  widget.Hide();
         * }
         */


        public RoundProgressBar drawProgressWidget()
        {
            // draw and return progress widget
            if (progressWidget == null)
            {
                // get ProgressWidget
                GameObject refObject = GameObject.Find("GUI/Canvas/ProgressWidget");
                if (refObject == null)
                {
                    Debug.LogWarning(string.Format("{0}: No GUI/Canvas/ProgressWidget Object found. Load From Resource.", this.GetType()));
                    GameObject refObjectPrefab = Resources.Load <GameObject>("VPET/Prefabs/ProgressWidget");
                    refObject      = Instantiate(refObjectPrefab);
                    refObject.name = refObjectPrefab.name;
                    GameObject refParent = GameObject.Find("GUI/Canvas");
                    refObject.transform.SetParent(refParent.transform, false);
                }
                progressWidget = refObject.GetComponent <RoundProgressBar>();
                if (progressWidget == null)
                {
                    Debug.LogWarning(string.Format("{0}: No ProgressWidget Component found. Create", this.GetType()));
                    progressWidget = refObject.AddComponent <RoundProgressBar>();
                }
            }

            progressWidget.Show();
            return(progressWidget);
        }