Пример #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]);
        }
Пример #2
0
        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;
        }
Пример #3
0
    private static void SavePreferences()
    {
        if (collection == null)
        {
            collection = new PreferenceCollection();
        }

        FileHelper.SaveFile <PreferenceCollection>(collection, PrefPath());
    }
Пример #4
0
        public static PreferenceCollection DeserializePreferencesCollection(string xmlPath)
        {
            PreferenceCollection tempCollection = null;

            XmlSerializer serializer = new XmlSerializer(typeof(PreferenceCollection));

            StreamReader reader = new StreamReader(xmlPath);

            tempCollection = (PreferenceCollection)serializer.Deserialize(reader);
            reader.Close();

            return(tempCollection);
        }
Пример #5
0
    private static PreferenceCollection GetPreferences()
    {
        if (collection == null)
        {
            if (!File.Exists(PrefPath()))
            {
                collection = new PreferenceCollection();
            }
            else
            {
                collection = FileHelper.LoadFile <PreferenceCollection>(PrefPath());
            }
        }

        return(collection);
    }
Пример #6
0
 public User(PreferenceCollection preferences)
 {
     PreferenceTitle = preferences.Title;
     // put info to collection
 }