예제 #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            //graphics.ToggleFullScreen();

            screenState = ScreenState.Title;

            gameScreen     = new GameScreen();
            mainMenuScreen = new MainMenuScreen();
            titleScreen    = new TitleScreen();
            gameOverScreen = new GameOverScreen();
            //playerSelectScreen = new PlayerSelectScreen();
            oneplayerSelectScreen = new OnePlayerSelectScreen();
            twoplayerSelectScreen = new TwoPlayerSelectScreen();
            onlineOptionsScreen   = new OnlineOptionsScreen();
            onlineJoinScreen      = new OnlineJoinScreen();
            optionsScreen         = new OptionsScreen();
            editControls          = new EditControlsScreen();
            pauseScreen           = new PauseScreen();
            errorScreen           = new ErrorScreen();
            gameModeScreen        = new GameModeScreen();
            keyboardScreen        = new KeyboardScreen();
            waitingScreen         = new WaitingScreen();



            graphics.PreferredBackBufferWidth  = 1920;
            graphics.PreferredBackBufferHeight = 1080;
            graphics.ApplyChanges();


            Global.Scale = new Vector2(GraphicsDevice.Viewport.Width / 1920f);

            InputManager.Update();
            Global.UsingKeyboard = !InputManager.PressedKeysPlayer1.IsConnected;
            IsMouseVisible       = true;
            base.Initialize();
        }
예제 #2
0
        /// <summary>
        /// Open add keyboard window
        /// </summary>
        public void OpenAddKeyboardDialog()
        {
            if (_group == null || _group.Length < 1 || _indiv == null | _indiv.Length < 1)
            {
                return;
            }

            bool editingCurrent = false;

            var editDialog = new DialogEditYesNo();

            if (_keys != null && _keys.Length > 0)
            {
                editDialog.QuestionText = "Do you want new keys or to edit: " + _keys;

                if (editDialog.ShowDialog() == true)
                {
                    editingCurrent = editDialog.ReturnedAnswer;
                }
            }

            if (editingCurrent && editDialog.Clicked)
            {
                var mModel = new KeyboardScreenViewModel();
                mModel.PatientName = _indiv;
                mModel.GroupName   = _group;
                mModel.FileName    = _keys;

                var kbWindow = new KeyboardScreen();
                kbWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                kbWindow.DataContext           = mModel;

                mModel.SetupKeysEditing(editingCurrent);

                if (kbWindow.ShowDialog() == true)
                {
                    using (StreamWriter file = new StreamWriter(Path.Combine(Properties.Settings.Default.SaveLocation, _group, _indiv, _keys + ".json"), false))
                    {
                        file.WriteLine(JsonConvert.SerializeObject(mModel.mReturnedKeys));
                    }

                    MessageBox.Show("Successfully Edited Keyboard: " + _keys);

                    FrequencyKeys.Clear();
                    DurationKeys.Clear();

                    keyboardListViewModel.RefreshRepository(_group, _indiv);
                }
            }
            else if (!editingCurrent)
            {
                var dialog = new Dialog.Dialog();
                dialog.Title        = "Add New Key Set";
                dialog.QuestionText = "Please give a name to the new key set.";

                if (dialog.ShowDialog() == true)
                {
                    string mKeySetName = dialog.ResponseText;

                    var mModel = new KeyboardScreenViewModel();
                    mModel.PatientName      = _indiv;
                    mModel.GroupName        = _group;
                    mModel.CurrentlyEditing = editingCurrent;
                    mModel.FileName         = mKeySetName;

                    Window MainWindow2 = Application.Current.MainWindow;
                    var    kbWindow    = new KeyboardScreen();
                    kbWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                    kbWindow.DataContext           = mModel;

                    if (kbWindow.ShowDialog() == true)
                    {
                        using (StreamWriter file = new StreamWriter(Path.Combine(Properties.Settings.Default.SaveLocation, _group, _indiv, mKeySetName + ".json"), false))
                        {
                            file.WriteLine(JsonConvert.SerializeObject(mModel.mReturnedKeys));
                        }

                        MessageBox.Show("Successfully Created Keyboard: " + mKeySetName);

                        FrequencyKeys.Clear();
                        DurationKeys.Clear();

                        keyboardListViewModel.RefreshRepository(_group, _indiv);
                    }
                }
            }
        }