//--------------------------------------
        // PUBLIC METHODS
        //--------------------------------------

        /// <summary>Initializes the scene.</summary>
        public override void Init()
        {
            base.Init();

            // Ugly, but useful during development.
            foreach (var type in Assembly.GetExecutingAssembly().GetTypes())
            {
                if (!type.IsSubclassOf(typeof(Scene)) || type == GetType())
                {
                    continue;
                }

                CreateLabel(type.Name, () => {
                    Game1.Inst.EnterScene((Scene)Activator.CreateInstance(type));
                });
            }

            CreateLabel("Quit", () => {
                Game1.Inst.Exit();
            });

            SfxUtil.PlayMusic("Sounds/Music/MainMenu");

            OnEvent("selchanged", data => SfxUtil.PlaySound("Sounds/Effects/Click"));
        }
Exemple #2
0
        public override void Init()
        {
            base.Init();

            var    screenCenter = new Vector2(Game1.Inst.GraphicsDevice.Viewport.Width * 0.5f, Game1.Inst.GraphicsDevice.Viewport.Height * 0.5f);
            string text         = "GAME";
            var    largeFont    = Game1.Inst.Content.Load <SpriteFont>("Fonts/FFFForward_Large");
            var    textSize     = largeFont.MeasureString(text);
            int    id           = AddEntity();

            AddComponent <C2DRenderable>(id, new CText {
                color    = Color.Black,
                font     = largeFont,
                format   = text,
                origin   = Vector2.Zero,
                position = new Vector2(
                    screenCenter.X - textSize.X * 0.5f,
                    screenCenter.Y - textSize.Y - 20
                    )
            });
            text     = "the game";
            textSize = mFont.MeasureString(text);
            id       = AddEntity();
            AddComponent <C2DRenderable>(id, new CText {
                color    = Color.Black,
                font     = mFont,
                format   = text,
                origin   = Vector2.Zero,
                position = new Vector2(
                    screenCenter.X - textSize.X * 0.5f,
                    screenCenter.Y
                    )
            });

            if (mIsMultiplayer)
            {
                addWatingForPlayers();
                OnEvent("update_peers", updatePeers);
            }
            else
            {
                SfxUtil.PlayMusic("Sounds/Music/MainMenu");
                CreateLabels();
            }

            OnEvent("selchanged", data => SfxUtil.PlaySound("Sounds/Effects/Click"));
        }
Exemple #3
0
        /// <summary>Initializes the scene.</summary>
        public override void Init()
        {
            base.Init();
        #if DBG_MENU
            // Ugly, but useful during development.
            foreach (var type in Assembly.GetExecutingAssembly().GetTypes())
            {
                if (!type.IsSubclassOf(typeof(Scene)) || type == GetType())
                {
                    continue;
                }

                CreateLabel(type.Name, () => {
                    Game1.Inst.EnterScene((Scene)Activator.CreateInstance(type));
                });
            }
        #endif
            CreateLabel("Single-Player", () => {
                Game1.Inst.EnterScene(new ConfigSceneMenu(false, _args));
            });

            CreateLabel("Multi-Player", () => {
                Game1.Inst.EnterScene(new ConfigSceneMenu(true, _args));
            });


            CreateLabel("Quit", () => {
                Game1.Inst.Exit();
            });
            addArrow();

            var    screenCenter = new Vector2(Game1.Inst.GraphicsDevice.Viewport.Width * 0.5f, Game1.Inst.GraphicsDevice.Viewport.Height * 0.5f);
            string text         = "GAME";
            var    mFont        = Game1.Inst.Content.Load <SpriteFont>("Fonts/FFFForward_Large");
            var    textSize     = mFont.MeasureString(text);
            int    id           = AddEntity();
            AddComponent <C2DRenderable>(id, new CText {
                color    = Color.Black,
                font     = mFont,
                format   = text,
                origin   = Vector2.Zero,
                position = new Vector2(
                    screenCenter.X - textSize.X * 0.5f,
                    screenCenter.Y - textSize.Y - 20
                    )
            });
            text     = "the game";
            mFont    = Game1.Inst.Content.Load <SpriteFont>("Fonts/FFFForward");
            textSize = mFont.MeasureString(text);
            id       = AddEntity();
            AddComponent <C2DRenderable>(id, new CText {
                color    = Color.Black,
                font     = mFont,
                format   = text,
                origin   = Vector2.Zero,
                position = new Vector2(
                    screenCenter.X - textSize.X * 0.5f,
                    screenCenter.Y
                    )
            });

            SfxUtil.PlayMusic("Sounds/Music/MainMenu");

            OnEvent("selchanged", data => SfxUtil.PlaySound("Sounds/Effects/Click"));
        }