Example #1
0
#pragma warning restore 0649
        void Awake()
        {
            Instance = this;

            //get my components
            audioSource = GetComponent <AudioSource>();

            //clear static lists
            StaticViews.Clear();
            BackStack.Clear();
            FullScreenFadeStack.Clear();

            //init other objects
            dragger       = new Dragger();
            soundsManager = new SoundsManager(BackgroundSoundPrefab, FadeVolume, VolumeChangeSpeed);

            //find all views
            var views = SceneInfoGrabber <BaseView> .GetUIComponentsOnScene(scene : gameObject.scene);

            //grab components for views
            foreach (var view in views)
            {
                view.GrabComponents();
                StaticViews[view.GetType().Name] = view;
            }

            //grab views for views
            foreach (var view in views)
            {
                view.GrabViews(StaticViews);
            }

            //init views
            foreach (var view in views)
            {
                view.Init();
            }

            //subscribe views
            foreach (var view in views)
            {
                view.AutoSubscribe();
            }

            //show views
            foreach (var view in views.Where(v => v.ShowAtStart))
            {
                Show(view, null, noAnimation: true);
            }

            //init gestures
            InitGestures();
        }
Example #2
0
        private static void OnViewHidden(BaseView view)
        {
            var prevState = view.VisibleState;

            (view as IBaseViewInternal).SetVisibleState(VisibleState.Hidden);

            if (view.FullscreenFade)
            {
                FullScreenFadeStack.Remove(view);
            }

            ViewHidden?.Invoke(view);
            ViewVisibleStateChanged?.Invoke(view, prevState, view.VisibleState);
        }