Пример #1
0
        public MainWindow()
        {
            InitializeComponent();

            Menu menu = new Menu(startButton, loadButton, settingsButton,
                                 collectionButton, exitButton, backgroundImage);

            GameplayUI gameplayUI = new GameplayUI(dialogueBox, dialogueText, characterNameBox, characterNameText);

            gameplayUI.DispDialogueBox(false);
            QuickMenu quickMenu = new QuickMenu(quickMenuBG, returnBtnQ, saveBtnQ, loadBtnQ, settingsBtnQ, returnBtnQ, exitBtnQ);

            quickMenu.DisplayMenu(false);
            SettingsMenu settingsMenu = new SettingsMenu(settingsBG, musicVolText, soundVolText,
                                                         dialogueSpeedText, fullscreenText, musicVolSlider,
                                                         soundVolSlider, dialogueSpeedSlider, fullscreenOnBtn,
                                                         fullscreenOffBtn, applyBtn, backBtn);

            GameController gameController = new GameController(menu, gameplayUI, settingsMenu, quickMenu, musicMedia, soundEffectMedia);

            // Modification of events
            startButton.Click += (sender, EventArgs) => { Start_Button_Click(sender, EventArgs, gameController); };

            backgroundImage.MouseLeftButtonDown  += (sender, EventArgs) => { BackgroundImage_LeftMouseDown(sender, EventArgs, gameController); };
            backgroundImage.MouseWheel           += (sender, MouseWheelEventArgs) => { BackgroundImage_Scroll(sender, MouseWheelEventArgs, gameController); };
            backgroundImage.MouseRightButtonDown += (sender, EventArgs) => { BackgroundImage_RightMouseDown(sender, EventArgs, gameController); };

            settingsButton.Click += (sender, EventArgs) => { SettingsButton_Click(sender, EventArgs, gameController); };
            loadButton.Click     += (sender, EventArgs) => { LoadButton_Click(sender, EventArgs, gameController); };

            resumeBtnQ.Click   += (sender, EventArgs) => { BackgroundImage_RightMouseDown(sender, EventArgs, gameController); };
            settingsBtnQ.Click += (sender, EventArgs) => { QuickSettingsButton_Click(sender, EventArgs, gameController); };
            returnBtnQ.Click   += (sender, EventArgs) => { ReturnBtnQ_Click(sender, EventArgs, gameController); };

            backBtn.Click          += (sender, EventArgs) => { backBtn_Click(sender, EventArgs, gameController); };
            applyBtn.Click         += (sender, EventArgs) => { applyBtn_Click(sender, EventArgs, gameController); };
            fullscreenOnBtn.Click  += (sender, EventArgs) => { fullscreenOnBtn_Click(sender, EventArgs, gameController); };
            fullscreenOffBtn.Click += (sender, EventArgs) => { fullscreenOffBtn_Click(sender, EventArgs, gameController); };



            if (gameController.settings.Fullscreen)
            {
                WindowState = WindowState.Maximized;
                WindowStyle = WindowStyle.None;
            }
            else
            {
                WindowState = WindowState.Normal;
                WindowStyle = WindowStyle.ThreeDBorderWindow;
            }
        }
Пример #2
0
        public GameController(Menu menu, GameplayUI gameplayUI, SettingsMenu settingsMenu, QuickMenu quickMenu, MediaElement musicMedia, MediaElement soundEffectMedia)
        {
            this.menu         = menu;
            this.gameplayUI   = gameplayUI;
            this.settingsMenu = settingsMenu;
            this.quickMenu    = quickMenu;
            settings          = Settings.LoadSettings();

            music       = new SoundController(musicMedia);
            soundEffect = new SoundController(soundEffectMedia);

            music.LoadSound("bensound-relaxing.mp3");
            music.ChangeVolume(settings.MusicVolume);
            music.Play();
        }