Exemple #1
0
 public Options()
 {
     Video       = getDefaultVideoOptions();
     Audio       = getDefaultAudioOptions();
     GamePlay    = getDefaultGamePlayOptions();
     KeySettings = getDefaultKeyBindings();
 }
Exemple #2
0
 public Options()
 {
     Video = getDefaultVideoOptions();
     Audio = getDefaultAudioOptions();
     GamePlay = getDefaultGamePlayOptions();
     KeySettings = getDefaultKeyBindings();
 }
Exemple #3
0
        public VTankOptions()
        {
            videoOptions    = getDefaultVideoOptions();
            audioOptions    = getDefaultAudioOptions();
            gamePlayOptions = getDefaultGamePlayOptions();
            keyBindings     = getDefaultKeyBindings();

            ServerAddress  = "glacier2a.cis.vtc.edu";
            ServerPort     = "4063";
            DefaultAccount = "";
            MapsFolder     = "maps";
        }
        public VTankOptions()
        {
            videoOptions = getDefaultVideoOptions();
            audioOptions = getDefaultAudioOptions();
            gamePlayOptions = getDefaultGamePlayOptions();
            keyBindings = getDefaultKeyBindings();

            ServerAddress = "glacier2a.cis.vtc.edu";
            ServerPort = "4063";
            DefaultAccount = "";
            MapsFolder = "maps";
        }
Exemple #5
0
        public static VTankOptions ReadOptions()
        {
            bool          doCommit = false;
            VTankOptions  options  = new VTankOptions();
            KeysConverter kc       = new KeysConverter();

            VideoOptions    defaultVideo = getDefaultVideoOptions();
            AudioOptions    defaultAudio = getDefaultAudioOptions();
            GamePlayOptions defaultGame  = getDefaultGamePlayOptions();
            KeyBindings     defaultKeys  = getDefaultKeyBindings();

            string filename = GetConfigFilePath();

            if (!File.Exists(filename))
            {
                doCommit = true;
            }
            Xmlconfig config = new Xmlconfig(filename, true);

            try
            {
                if (config.Settings.Name == "configuration")
                {
                    // Old configuration file. Port to new configuration type.
                    config.NewXml("xml");
                    doCommit = true;
                    ConvertFromLegacyConfig(config, filename);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Warning: Your old configuration settings have been lost due to an unforeseen error.",
                                "Old configuration settings lost!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            // Configure options.
            // Format: options.Key = Get(config, "Key", "DefaultValue");
            options.ServerAddress                       = Get(config, "ServerAddress", "glacier2a.cis.vtc.edu");
            options.ServerPort                          = Get(config, "ServerPort", "4063");
            options.DefaultAccount                      = Get(config, "DefaultAccount");
            options.MapsFolder                          = Get(config, "MapsFolder", "maps");
            options.videoOptions.Resolution             = Get(config, "options/video/Resolution", defaultVideo.Resolution);
            options.videoOptions.Windowed               = Get(config, "options/video/Windowed", defaultVideo.Windowed);
            options.videoOptions.TextureQuality         = Get(config, "options/video/TextureQuality", defaultVideo.TextureQuality);
            options.videoOptions.AntiAliasing           = Get(config, "options/video/AntiAliasing", defaultVideo.AntiAliasing);
            options.videoOptions.ShadingEnabled         = Get(config, "options/video/ShadingEnabled", defaultVideo.ShadingEnabled);
            options.audioOptions.ambientSound.Volume    = Get(config, "options/audio/ambientSound/Volume", defaultAudio.ambientSound.Volume);
            options.audioOptions.ambientSound.Muted     = Get(config, "options/audio/ambientSound/Muted", defaultAudio.ambientSound.Muted);
            options.audioOptions.backgroundSound.Volume = Get(config, "options/audio/backgroundSound/Volume", defaultAudio.backgroundSound.Volume);
            options.audioOptions.backgroundSound.Muted  = Get(config, "options/audio/backgroundSound/Muted", defaultAudio.backgroundSound.Muted);
            options.gamePlayOptions.ShowNames           = Get(config, "options/gameplay/ShowNames", defaultGame.ShowNames);
            options.gamePlayOptions.ProfanityFilter     = Get(config, "options/gameplay/ProfanityFilter", defaultGame.ProfanityFilter);
            options.gamePlayOptions.InterfacePlugin     = Get(config, "options/gameplay/InterfacePlugin", defaultGame.InterfacePlugin);
            options.keyBindings.Forward                 = (Keys)kc.ConvertFromString(Get(config, "options/keybindings/Forward", defaultKeys.Forward.ToString()));
            options.keyBindings.Backward                = (Keys)kc.ConvertFromString(Get(config, "options/keybindings/Backward", defaultKeys.Backward.ToString()));
            options.keyBindings.RotateLeft              = (Keys)kc.ConvertFromString(Get(config, "options/keybindings/RotateLeft", defaultKeys.RotateLeft.ToString()));
            options.keyBindings.RotateRight             = (Keys)kc.ConvertFromString(Get(config, "options/keybindings/RotateRight", defaultKeys.RotateRight.ToString()));
            //options.keyBindings.FirePrimary = (Keys)kc.ConvertFromString(Get(config, "options/keybindings/FirePrimary", ""));
            //options.keyBindings.FireSecondary = (Keys)kc.ConvertFromString(Get(config, "options/keybindings/FireSecondary", ""));
            options.keyBindings.Menu    = (Keys)kc.ConvertFromString(Get(config, "options/keybindings/Menu", defaultKeys.Menu.ToString()));
            options.keyBindings.Minimap = (Keys)kc.ConvertFromString(Get(config, "options/keybindings/Minimap", defaultKeys.Minimap.ToString()));
            options.keyBindings.Score   = (Keys)kc.ConvertFromString(Get(config, "options/keybindings/Score", defaultKeys.Score.ToString()));
            options.keyBindings.Camera  = (Keys)kc.ConvertFromString(Get(config, "options/keybindings/Camera", defaultKeys.Camera.ToString()));
            options.keyBindings.Pointer = Get(config, "options/keybindings/Pointer", defaultKeys.Pointer);

            if (doCommit)
            {
                WriteOptions(options);
            }

            return(options);
        }