示例#1
0
        public InGameMenu(App root, LevelHandler levelHandler)
        {
            this.root         = root;
            this.levelHandler = levelHandler;

            root.Immersive = true;

#if MULTIPLAYER
            bool isMultiplayerSession = (levelHandler is MultiplayerLevelHandler);
#else
            bool isMultiplayerSession = false;
#endif

            DualityApp.Sound.PauseGameplaySpecificSounds();

            levelHandler.EnableLowpassOnMusic(true);

            rootObject = new GameObject();
            rootObject.AddComponent(new LocalController(this));
            AddObject(rootObject);

            // Setup camera
            GameObject camera = new GameObject();
            camera.AddComponent <Transform>();

            Camera cameraInner = camera.AddComponent <Camera>();
            cameraInner.Projection = ProjectionMode.Orthographic;
            cameraInner.NearZ      = 10;
            cameraInner.FarZ       = 1000;

            cameraInner.RenderingSetup = new MainMenuRenderSetup();
            camera.Parent = rootObject;

            canvas = new Canvas();

            // Load resources
            fontSmall  = new BitmapFont(canvas, "_custom/font_small");
            fontMedium = new BitmapFont(canvas, "_custom/font_medium");

            metadata = ContentResolver.Current.RequestMetadata("UI/MainMenu");

            // Get game screen
            Camera           cameraLevel = levelHandler.FindComponent <Camera>();
            LevelRenderSetup renderSetup = cameraLevel.ActiveRenderSetup as LevelRenderSetup;
            if (renderSetup != null)
            {
                finalMaterial = new Material(DrawTechnique.Solid, renderSetup.RequestBlurredInGame());
            }

            InitPlatformSpecific();

            // Show Begin section
            sectionStack = new Stack <MenuSection>();

            SwitchToSection(new InGameMenuBeginSection(isMultiplayerSession));
        }
示例#2
0
        public InGameMenu(Controller root, LevelHandler levelHandler)
        {
            this.root         = root;
            this.levelHandler = levelHandler;

            root.Immersive = true;

            rootObject = new GameObject("InGameMenu");
            rootObject.AddComponent(new LocalController(this));
            AddObject(rootObject);

            // Setup camera
            GameObject camera = new GameObject("MainCamera");

            camera.AddComponent <Transform>();

            Camera cameraInner = camera.AddComponent <Camera>();

            cameraInner.Perspective = PerspectiveMode.Flat;
            cameraInner.NearZ       = 0;
            cameraInner.FarZ        = 1000;

            cameraInner.RenderingSetup = new MainMenuRenderSetup();
            camera.Parent = rootObject;

            canvas = new Canvas();

            // Load resources
            fontSmall  = new BitmapFont(canvas, "UI/font_small", 17, 18, 15, 32, 256, -2);
            fontMedium = new BitmapFont(canvas, "UI/font_medium", 29, 31, 15, 32, 256, -1);

            metadata = ContentResolver.Current.RequestMetadata("UI/MainMenu");

            // Get game screen
            Camera           cameraLevel = levelHandler.FindComponent <Camera>();
            LevelRenderSetup renderSetup = cameraLevel.ActiveRenderSetup as LevelRenderSetup;

            if (renderSetup != null)
            {
                finalMaterial = new Material(DrawTechnique.Solid, renderSetup.FinalTexture);
            }

            InitTouch();

            // Show Begin section
            sectionStack = new Stack <InGameMenuSection>();

            SwitchToSection(new InGameMenuBeginSection());
        }