protected override void Initialize()
        {
            /*
             * //TODO: Loading screen, run this on a separate thread
             #if !CONSOLE && CLIENT
             * DiscordManager.InitialiseDiscord();
             #endif
             *
             #if CLIENT
             * OnTargetFPSChanged();
             * Snooper.Initialise();
             *
             * InputManager.Initialise();
             *
             * //TODO: Rework for UI system
             * font = Content.Load<SpriteFont>("MainFont");
             #endif
             * //TODO: Connect textures by string, and models are reloaded after textures are reloaded.
             * TextureManager.Reload();
             *
             * //Initialise the Block & Item Managers
             * blockRegistry = new BlockManager();
             * itemRegistry = new ItemManager();
             *
             * //Register the blocks and items
             * BlockManager.RegisterBlocks();
             * ItemManager.RegisterItems();
             *
             * GameSettings.Load(Path.Combine(gameDirectory, "options.txt"));
             #if DEBUG
             * GameSettings.LoadDebug(Path.Combine(gameDirectory, "options.debug"));
             #endif
             *
             #if CLIENT
             * //Register the UI Menus
             * UiRegisterer.RegisterUiMenus();
             *
             * Window.TextInput += OnTextInput;
             #endif
             */
            World = new MenuWorld();

            base.Initialize();
        }
Пример #2
0
        public ControllerSelect(MenuWorld parent, int playerSlot, int joyId)
        {
            var font = Library.GetFont("fonts/Laffayette_Comic_Pro.ttf");

            changing = false;

            this.parent = parent;
            Height      = FP.Height - 20;
            Width       = 250;

            this.JoyId      = joyId;
            this.PlayerSlot = playerSlot;

            Image            = new Image(Library.GetTexture("menu.png"));
            Image.Color      = new Color(Color = colors[PlayerSlot]);
            pressStart       = new Text("PRESS START");
            pressStart.Font  = font;
            pressStart.X    -= 80;
            pressStart.Y     = Height - 100;
            pressStart.Size  = 20;
            pressStart.Color = new Color(0);

            check = new Image(Library.GetTexture("ready.png"));
            check.CenterOO();
            check.Y      = Height * 0.75f;
            check.ScaleY = 0;

            OriginX       = Width / 2;
            Image.OriginX = Image.Width / 2;

            var slot = GamepadManager.GetSlot(joyId);

            if (SnesController.IsMatch(slot))
            {
                var snes = new SnesController(slot);
                confirm = new Image(Library.GetTexture("Snes_1.png"));
                Cursor  = snes.Dpad;
                Start   = snes.Start;
                Back    = snes.A;
                Confirm = snes.B;
            }
            else if (Xbox360Controller.IsMatch(slot))
            {
                var xbox = new Xbox360Controller(slot);
                confirm = new Image(Library.GetTexture("Xbox_1.png"));
                Cursor  = xbox.LeftStick;
                Start   = xbox.Start;
                Confirm = xbox.A;
                Back    = xbox.B;
            }
            else
            {
                throw new Exception("Invalid gamepad type, sorry D:");
            }

            AddComponent(Image);
            AddComponent(pressStart);
            if (wins.ContainsKey(JoyId))
            {
                var score = new Text(wins[joyId].ToString("Wins: 0"));
                score.Font  = font;
                score.Color = new Color(0);
                score.Size  = 20;
                score.X     = pressStart.X + 32;
                score.Y     = pressStart.Y + score.Size;
                AddComponent(score);
            }
        }