示例#1
0
        public GameLauncher()
        {
            InitializeComponent();

            backButton.Hide();

            notifyIcon              = new NotifyIcon();
            userControls            = new List <UserControl>();
            previousControlsIndexes = new Stack <int>();

            PreferenceCollection pC = DeSerializer.DeserializePreferencesCollection("Resources\\Preferences\\preferences.xml");

            gameConfiguration = new GameConfiguration();
            gameConfiguration.ResolutionWidth  = pC.Preferences[0].ResolutionWidth;
            gameConfiguration.ResolutionHeigth = pC.Preferences[0].ResolutionHeight;
            gameConfiguration.IsFullScreen     = pC.Preferences[0].FullScreen;
            gameConfiguration.MasterVolume     = pC.Preferences[0].MasterVolume;

            currentActiveUserControlIndex = 0;
            userControls.Add(new MainScreen(this));           //0
            userControls.Add(new MatchConfiguration(this));   //1
            userControls.Add(new MultiplayerScreen(this));    //2
            userControls.Add(new ServerConfigurations(this)); //3
            userControls.Add(new GeneralConfiguration(this)); //4

            mainPanel.Controls.Add(userControls[currentActiveUserControlIndex]);
        }
        public GeneralConfiguration(GameLauncher parent)
        {
            InitializeComponent();

            this.gameLauncher = parent;

            pC = DeSerializer.DeserializePreferencesCollection("Resources\\Preferences\\preferences.xml");
            this.resolutionComboBox.Items.Add(new Tuple <int, int>(Convert.ToInt32(pC.Preferences[0].ResolutionWidth),
                                                                   Convert.ToInt32(pC.Preferences[0].ResolutionHeight)));

            resolutions = new List <Tuple <int, int> >();
            resolutions.Add(new Tuple <int, int>(1366, 768));
            resolutions.Add(new Tuple <int, int>(1280, 768));
            resolutions.Add(new Tuple <int, int>(1024, 768));

            foreach (var tuple in resolutions)
            {
                if (!resolutionComboBox.Items.Contains(tuple))
                {
                    this.resolutionComboBox.Items.Add(tuple);
                }
            }

            this.resolutionComboBox.SelectedIndex = 0;
            this.fullscreenToggle.Checked         = pC.Preferences[0].FullScreen;
            this.tabControl.SelectedIndex         = 0;
        }