Esempio n. 1
0
        public void SetCanvasScreenActive(CanvasUIScreen screen)
        {
            if (Application.isPlaying)
            {
                switch (screen)
                {
                case CanvasUIScreen.Main: mainScreen.CanvasWillAppear(); break;

                case CanvasUIScreen.AddSounds: placeSoundsOverlay.CanvasWillAppear(); break;

                case CanvasUIScreen.EditSound: editSoundOverlay.CanvasWillAppear(); break;

                case CanvasUIScreen.LayoutList: layoutList.CanvasWillAppear(); break;

                case CanvasUIScreen.SoundFileList: soundFileList.CanvasWillAppear(); break;

                case CanvasUIScreen.SoundMarkerList: soundMarkerList.CanvasWillAppear(); break;

                default: break;
                }
            }

            mainScreen.gameObject.SetActive(screen == CanvasUIScreen.Main);
            placeSoundsOverlay.gameObject.SetActive(screen == CanvasUIScreen.AddSounds);
            editSoundOverlay.gameObject.SetActive(screen == CanvasUIScreen.EditSound);
            layoutList.gameObject.SetActive(screen == CanvasUIScreen.LayoutList);
            soundFileList.gameObject.SetActive(screen == CanvasUIScreen.SoundFileList);
            soundMarkerList.gameObject.SetActive(screen == CanvasUIScreen.SoundMarkerList);
            canvasDelegate?.CanvasBecameActive(screen, _activeScreen);

            _activeScreen = screen;
        }
        public void SetCanvasScreenActive(CanvasUIScreen screen)
        {
            if (Application.isPlaying)
            {
                switch (screen)
                {
                case CanvasUIScreen.Main: mainScreen.CanvasWillAppear(); break;

                case CanvasUIScreen.AddSounds: placeSoundsOverlay.CanvasWillAppear(); break;

                case CanvasUIScreen.EditSound: editSoundOverlay.CanvasWillAppear(); break;

                case CanvasUIScreen.LayoutList: layoutList.CanvasWillAppear(); break;

                case CanvasUIScreen.SoundFileList: soundFileList.CanvasWillAppear(); break;

                case CanvasUIScreen.SoundMarkerList: soundMarkerList.CanvasWillAppear(); break;

                case CanvasUIScreen.Settings: settings.CanvasWillAppear(); break;

                case CanvasUIScreen.Kiosk: kiosk.CanvasWillAppear(); break;

                case CanvasUIScreen.MarkerAppearance: markerAppearance.CanvasWillAppear(); break;

                default: break;
                }
            }

            // Don't allow SoundMarker selection from certain modes
            if (objectSelection != null)
            {
                objectSelection.selectionEnabled =
                    (screen == CanvasUIScreen.Main ||
                     screen == CanvasUIScreen.AddSounds ||
                     screen == CanvasUIScreen.EditSound);
            }

            mainScreen.gameObject.SetActive(screen == CanvasUIScreen.Main);
            placeSoundsOverlay.gameObject.SetActive(screen == CanvasUIScreen.AddSounds);
            editSoundOverlay.gameObject.SetActive(screen == CanvasUIScreen.EditSound || screen == CanvasUIScreen.MarkerAppearance);
            layoutList.gameObject.SetActive(screen == CanvasUIScreen.LayoutList);
            soundFileList.gameObject.SetActive(screen == CanvasUIScreen.SoundFileList);
            soundMarkerList.gameObject.SetActive(screen == CanvasUIScreen.SoundMarkerList);
            settings.gameObject.SetActive(screen == CanvasUIScreen.Settings);
            kiosk.gameObject.SetActive(screen == CanvasUIScreen.Kiosk);
            markerAppearance.gameObject.SetActive(screen == CanvasUIScreen.MarkerAppearance);
            canvasDelegate?.CanvasBecameActive(screen, _activeScreen);

            if (_activeScreen == CanvasUIScreen.Settings)
            {
                Layout curLayout = GetCurrentLayout();
                if (curLayout != null)
                {
                    MainController.OnDemandColliders.DistanceFromUser = curLayout.onDemandRadius;
                    canvasDelegate?.OnDemandActiveWasChanged(curLayout.onDemandActive);
                }
            }

            _activeScreen = screen;
        }