public GameStateManager(GraphicsDeviceManager man,ContentManager cman,MineWorldClient gam) { Audiomanager = new AudioManager(); Config = new ConfigFile("data/settings.ini"); _inputhelper = new InputHelper(); Game = gam; Conmanager = cman; Graphics = man; Device = Graphics.GraphicsDevice; SpriteBatch = new SpriteBatch(Device); _screens = new BaseState[] { new TitleState(this, GameState.TitleState), new MainMenuState(this, GameState.MainMenuState), new LoadingState(this, GameState.LoadingState), new MainGameState(this, GameState.MainGameState), new SettingsState(this, GameState.SettingsState), _serverbrowsingstate = new ServerBrowsingState(this, GameState.ServerBrowsingState), _errorstate = new ErrorState(this, GameState.ErrorState) }; //curScreen = titlestate; Pbag = new PropertyBag(gam,this); //Set initial state in the manager itself SwitchState(GameState.TitleState); }
public StillLife() { InitializeComponent(); ConfigFile config = new ConfigFile(@"config.ini"); speedUpDown = config.SettingGroups["Movement"].Settings["SpeedUpDown"].GetValueAsFloat(); speedLeftRight = config.SettingGroups["Movement"].Settings["SpeedLeftRight"].GetValueAsFloat(); idleTexturePosition.Width = config.SettingGroups["Idle"].Settings["IdleX"].GetValueAsInt(); idleTexturePosition.Height = config.SettingGroups["Idle"].Settings["IdleY"].GetValueAsInt(); timeTillIdle = config.SettingGroups["Idle"].Settings["IdleAfter"].GetValueAsFloat(); idleSpeed = config.SettingGroups["Idle"].Settings["IdleSpeed"].GetValueAsFloat(); leapController = new Controller(); leapListener = new LeapListener(); leapController.AddListener(leapListener); leapListener.LeapSwipe += new LeapListener.SwipeEvent(OnSwipe); leapListener.LeapRegisterFingers += new LeapListener.RegisterFingers(OnRegisterFingers); CalculateColumnsRows(); InitializeIdleValues(); stopWatch.Start(); updateThread = new Thread(UpdateThread); updateThread.Start(); }
static void Main(string[] args) { ConfigFile configFile = new ConfigFile("../../config/Game.ini"); //Console.WriteLine(configFile.SettingGroups["street19"].Settings["name"].GetValueAsString()); foreach (KeyValuePair<string, SettingsGroup> group in configFile.SettingGroups) { Console.WriteLine("****************************"); Console.WriteLine(group.Key + ":"); Console.WriteLine(); foreach (KeyValuePair<string, Setting> value in group.Value.Settings) { Console.WriteLine("{0} = {1} (Is Array? {2})", value.Key, value.Value.GetValueAsString(), value.Value.IsArray); ConfigFile configFile2 = new ConfigFile("../../config/" + value.Value.GetValueAsString()); foreach (KeyValuePair<string, SettingsGroup> group2 in configFile2.SettingGroups) { Console.WriteLine("****************************"); Console.WriteLine(group2.Key + ":"); Console.WriteLine(); foreach (KeyValuePair<string, Setting> value2 in group2.Value.Settings) Console.WriteLine("{0} = {1} (Is Array? {2})", value2.Key, value2.Value.RawValue, value2.Value.IsArray); Console.WriteLine(); } } Console.WriteLine(); } Console.ReadKey(true); }
public Game1() { ConfigFile configFile = new ConfigFile(gameSettingsIni); // engine settings gameSpeed = configFile.SettingGroups[engineSettings].Settings["gameSpeed"].GetValueAsFloat(); defaultResolutionHeight = configFile.SettingGroups[engineSettings].Settings["defaultResolutionHeight"].GetValueAsInt(); enableDebugging = configFile.SettingGroups[engineSettings].Settings["enableDebugging"].GetValueAsBool(); this.ShowDebugView = false; // video settings graphics = new GraphicsDeviceManager(this); graphics.IsFullScreen = configFile.SettingGroups[videoSettings].Settings["Fullscreen"].GetValueAsBool(); if (graphics.IsFullScreen) { graphics.PreferredBackBufferWidth = configFile.SettingGroups[videoSettings].Settings["Width"].GetValueAsInt(); graphics.PreferredBackBufferHeight = configFile.SettingGroups[videoSettings].Settings["Height"].GetValueAsInt(); } else { // default resolution and windowed resolution graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; } SetVsync(configFile.SettingGroups[videoSettings].Settings["Vsync"].GetValueAsBool()); graphics.ApplyChanges(); if (enableDebugging) { Components.Add(new DebugComponent(this, Content, graphics)); } Content.RootDirectory = "Content"; physicsSystem = new PhysicsSystem(); ConvertUnits.SetDisplayUnitToSimUnitRatio(64f); // players get updated twice as much as all other entities playersFixedTimeStep = new FixedTimeStepSystem(fixedTimestep, maxSteps, new SingleStep(PlayersSingleStep), new PostStepping(PlayersPostStepping)); fixedTimeStep = new FixedTimeStepSystem(fixedTimestep * 2f, maxSteps, new SingleStep(SingleStep), new PostStepping(PostStepping)); // general settings GameVariables.NumPlayers = configFile.SettingGroups[generalSettings].Settings["NumPlayers"].GetValueAsInt(); GameVariables.Difficulty = configFile.SettingGroups[generalSettings].Settings["Difficulty"].GetValueAsInt(); GameVariables.Pvp = configFile.SettingGroups[generalSettings].Settings["Pvp"].GetValueAsBool(); }
public MineWorldServer() { NetPeerConfiguration netConfig = new NetPeerConfiguration("MineWorld"); netConfig.Port = Constants.MineworldPort; netConfig.MaximumConnections = 2; netConfig.EnableMessageType(NetIncomingMessageType.ConnectionApproval); netConfig.EnableMessageType(NetIncomingMessageType.DiscoveryRequest); netConfig.DisableMessageType(NetIncomingMessageType.UnconnectedData); Server = new NetServer(netConfig); GameWorld = new GameWorld(this); Console = new MineWorldConsole(this); ServerListener = new ServerListener(Server,this); ServerSender = new ServerSender(Server, this); Listener = new Thread(ServerListener.Start); MapManager = new MapManager(); PlayerManager = new PlayerManager(); Configloader = new ConfigFile("Data/Settings.ini"); }
public static Player CreatePlayer(World world, PlayerIndex playerIndex, PlayerEvent playerEvent, Vector2 playerPosition) { ConfigFile configFile = new ConfigFile(Player.SettingsIni); int health = configFile.SettingGroups[generalSettings].Settings["health"].GetValueAsInt(); bool enableWallJumping = configFile.SettingGroups[generalSettings].Settings["enableWallJumping"].GetValueAsBool(); bool enableWallSliding = configFile.SettingGroups[generalSettings].Settings["enableWallSliding"].GetValueAsBool(); bool enableShooting = configFile.SettingGroups[generalSettings].Settings["enableShooting"].GetValueAsBool(); Player player = new Player(world, (PlayerIndex)playerIndex, playerEvent); player.SetUpPlayer(playerPosition, health); if (enableWallJumping) player.enableWallJumping(); if (enableWallSliding) player.enableWallSliding(); if (enableShooting) player.enableShooting(); return player; }
static void Main(string[] args) { ConfigFile configFile = new ConfigFile("Test.ini"); foreach (KeyValuePair<string, SettingsGroup> group in configFile.SettingGroups) { Console.WriteLine("****************************"); Console.WriteLine(group.Key + ":"); Console.WriteLine(); foreach (KeyValuePair<string, Setting> value in group.Value.Settings) Console.WriteLine("{0} = {1} (Is Array? {2})", value.Key, value.Value.RawValue, value.Value.IsArray); Console.WriteLine(); } Console.ReadKey(true); configFile.Save("TestConfig2.ini"); }
private void LoadConfigFile() { ConfigFile configFile = new ConfigFile("Config.ini"); config = new ConfigurationManager(configFile); }
public Configuration() { configFile = new ConfigFile(@"Content\Config.ini"); }
public ConfigurationManager(ConfigFile configFileParam) { configFile = configFileParam; }
/// <summary> /// Draws the gameplay screen. /// </summary> public override void Draw(GameTime gameTime) { // This game has a blue background. Why? Because! ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, Color.CornflowerBlue, 0, 0); Vector2 tempPlacement; tempPlacement.X = 10; tempPlacement.Y = 10; Vector2 tempPlacement2; tempPlacement2.X = 100; tempPlacement2.Y = 40; DirectoryInfo dir = new DirectoryInfo(content.RootDirectory + "\\Characters"); FileInfo[] filePaths = dir.GetFiles("*.ini"); spriteBatch.Begin(); foreach (FileInfo file in filePaths) { string key = System.IO.Path.GetFileNameWithoutExtension(file.Name) + ".ini"; string key2 = System.IO.Path.GetFileName(file.Name); ConfigFile configFile = new ConfigFile("Content\\Characters\\" + System.IO.Path.GetFileName(file.Name)); foreach (KeyValuePair<string, SettingsGroup> group in configFile.SettingGroups) { spriteBatch.DrawString(gameFont, group.Key + ":", tempPlacement, Color.Black); foreach (KeyValuePair<string, Setting> value in group.Value.Settings) { spriteBatch.DrawString(gameFont, value.Key + " = " + value.Value.RawValue, tempPlacement2, Color.Black); tempPlacement2.Y = tempPlacement2.Y + 40; } tempPlacement.Y = tempPlacement.Y + 40; } tempPlacement.Y = tempPlacement.Y + 60; tempPlacement2.Y = tempPlacement2.Y + 60; //spriteBatch.DrawString(gameFont, key, tempPlacement, Color.Black); } //DrawGameObjects(spriteBatch); spriteBatch.End(); // If the game is transitioning on or off, fade it out to black. if (TransitionPosition > 0 || pauseAlpha > 0) { float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, pauseAlpha / 2); ScreenManager.FadeBackBufferToBlack(alpha); } }
// Constructor public Player(World world, PlayerIndex playerIndex, PlayerEvent playerEvent) : base(world) { // Load resources ConfigFile configFile = new ConfigFile(SettingsIni); screenWidth = configFile.SettingGroups[initSettings].Settings["screenWidth"].GetValueAsFloat(); screenHeight = configFile.SettingGroups[initSettings].Settings["screenHeight"].GetValueAsFloat(); jumpDelay = configFile.SettingGroups[initSettings].Settings["jumpDelay"].GetValueAsFloat(); jumpStateBufferDelay = configFile.SettingGroups[initSettings].Settings["jumpStateBufferDelay"].GetValueAsFloat(); hitDelay = configFile.SettingGroups[initSettings].Settings["hitDelay"].GetValueAsFloat(); recoveryDelay = configFile.SettingGroups[initSettings].Settings["recoveryDelay"].GetValueAsFloat(); respawnDelay = configFile.SettingGroups[initSettings].Settings["respawnDelay"].GetValueAsFloat(); swordDistance = configFile.SettingGroups[initSettings].Settings["swordDistance"].GetValueAsFloat(); addedSwordDistanceWhenRunning = configFile.SettingGroups[initSettings].Settings["addedSwordDistanceWhenRunning"].GetValueAsFloat(); addedSwordDistanceWhenDashing = configFile.SettingGroups[initSettings].Settings["addedSwordDistanceWhenDashing"].GetValueAsFloat(); dashDelay = configFile.SettingGroups[initSettings].Settings["dashDelay"].GetValueAsFloat(); this.PlayerIndex = playerIndex; this.playerEvent = playerEvent; this.PhysicsContainer = new PhysicsContainer<PlayerPhysicsCharacter>(); wallJumpEnabled = false; wallSlideEnabled = false; shootEnabled = false; canJump = false; canWallJump = false; // Accessories: this.Gun = null; this.Gun = new PlayerWeapon(world, this); this.Gun.SetUpWeapon(2, 0.3f, 20, 5, 200f, 1f, true); this.Sword = null; this.Sword = new PlayerWeapon(world, this); this.Sword.SetUpWeapon(1, 0.8f, 10, 36, swordDistance, 3f, false); this.Sword.RotateWhenShooting(40f, 0, 180); }
/// <summary> /// Loads settings from the specified file. /// </summary> /// <param name="filename">The name of the file to load settings from.</param> public static void LoadSettings(string filename) { ConfigFile file = new ConfigFile(filename); SettingsGroup screen = file.SettingGroups["Screen"]; FULLSCREEN = screen.Settings["fullscreen"].GetValueAsBool(); SHOW_MOUSE = screen.Settings["show_mouse"].GetValueAsBool(); RESOLUTION_X = screen.Settings["resolution_x"].GetValueAsInt(); RESOLUTION_Y = screen.Settings["resolution_y"].GetValueAsInt(); ANTIALIASING = screen.Settings["antialiasing"].GetValueAsBool(); SettingsGroup input = file.SettingGroups["Input"]; INPUT_USE_MOUSE = input.Settings["mouse_input"].GetValueAsBool(); INPUT_USE_ORIENTATION = input.Settings["use_orientation"].GetValueAsBool(); INPUT_USE_FIDUCIALS = input.Settings["use_fiducials"].GetValueAsBool(); INPUT_TOUCH_TIME = input.Settings["touch_time"].GetValueAsInt(); INPUT_USE_GLOBAL_CALIBRATION = input.Settings["use_global_calibration"].GetValueAsBool(); INPUT_GLOBAL_X_SHIFT = input.Settings["global_x_shift"].GetValueAsInt(); INPUT_GLOBAL_Y_SHIFT = input.Settings["global_y_shift"].GetValueAsInt(); INPUT_SWIPES_ONLY = input.Settings["swipes_only"].GetValueAsBool(); USE_INDIVIDUAL_CALIBRATION = input.Settings["use_individual_calibration"].GetValueAsBool(); if (!INPUT_USE_FIDUCIALS) { USE_INDIVIDUAL_CALIBRATION = false; INPUT_USE_GLOBAL_CALIBRATION = false; } if (USE_INDIVIDUAL_CALIBRATION) { for (int i = 0; i < 256; i++) { for (int j = 0; j < 3; j++) { if (input.Settings.ContainsKey("marker_" + i)) CALIBRATIONS[i, j] = input.Settings["marker_" + i].GetValueAsIntArray()[j]; } } } SettingsGroup circles = file.SettingGroups["Circles"]; CIRCLE_RADIUS = circles.Settings["radius"].GetValueAsFloat(); CIRCLE_RADIUS_OVERSCAN = circles.Settings["radius_overscan"].GetValueAsFloat(); CIRCLE_BORDER_WIDTH = circles.Settings["border_width"].GetValueAsFloat(); int[] colorValues = circles.Settings["border_color"].GetValueAsIntArray(); CIRCLE_BORDER_COLOR = new Color(colorValues[0], colorValues[1], colorValues[2], colorValues[3]); colorValues = circles.Settings["background_color"].GetValueAsIntArray(); CIRCLE_BACKGROUND_COLOR = new Color(colorValues[0], colorValues[1], colorValues[2], colorValues[3]); colorValues = circles.Settings["on_land_background_color"].GetValueAsIntArray(); CIRCLE_ON_LAND_BACKGROUND_COLOR = new Color(colorValues[0], colorValues[1], colorValues[2], colorValues[3]); CIRCLE_OPEN_TIME = circles.Settings["open_time"].GetValueAsInt(); MAX_CIRCLES = circles.Settings["max_number"].GetValueAsInt(); CIRCLE_VELOCITY = circles.Settings["velocity"].GetValueAsFloat(); CIRCLE_DETECTION_RADIUS = circles.Settings["detection_radius"].GetValueAsInt(); CIRCLE_FADEIN_TIME = circles.Settings["fadein_time"].GetValueAsInt(); CIRCLE_FADEOUT_TIME = circles.Settings["fadeout_time"].GetValueAsInt(); CIRCLE_POSITION_CHANGE_THRESHOLD = circles.Settings["position_change_threshold"].GetValueAsFloat(); SettingsGroup callout = file.SettingGroups["Guide"]; SHOW_CALLOUT = callout.Settings["show_callout"].GetValueAsBool(); CALLOUT_VERTICAL_ADJUST = callout.Settings["vertical_adjust"].GetValueAsInt(); CALLOUT_HORIZONTAL_ADJUST = callout.Settings["horizontal_adjust"].GetValueAsInt(); CALLOUT_HORIZONTAL_HIDE = callout.Settings["horizontal_hide"].GetValueAsInt(); CALLOUT_DETECTION_RADIUS = callout.Settings["detection_radius"].GetValueAsInt(); CALLOUT_OPENING_TIME = callout.Settings["opening_time"].GetValueAsInt(); CALLOUT_CLOSING_TIME = callout.Settings["closing_time"].GetValueAsInt(); int[] closeCoords = callout.Settings["close_coords"].GetValueAsIntArray(); CALLOUT_CLOSE_BUTTON = new Vector2(closeCoords[0], closeCoords[1]); int[] openCoords = callout.Settings["open_coords"].GetValueAsIntArray(); CALLOUT_OPEN_BUTTON = new Vector2(openCoords[0], openCoords[1]); int[] tab1Coords = callout.Settings["tab1_coords"].GetValueAsIntArray(); CALLOUT_TAB1_BUTTON = new Vector2(tab1Coords[0], tab1Coords[1]); int[] tab2Coords = callout.Settings["tab2_coords"].GetValueAsIntArray(); CALLOUT_TAB2_BUTTON = new Vector2(tab2Coords[0], tab2Coords[1]); int[] tab3Coords = callout.Settings["tab3_coords"].GetValueAsIntArray(); CALLOUT_TAB3_BUTTON = new Vector2(tab3Coords[0], tab3Coords[1]); int[] tab4Coords = callout.Settings["tab4_coords"].GetValueAsIntArray(); CALLOUT_TAB4_BUTTON = new Vector2(tab4Coords[0], tab4Coords[1]); int[] closeCoords_reflected = callout.Settings["close_coords_reflected"].GetValueAsIntArray(); CALLOUT_CLOSE_BUTTON_LEFT = new Vector2(closeCoords_reflected[0], closeCoords_reflected[1]); int[] openCoords_reflected = callout.Settings["open_coords_reflected"].GetValueAsIntArray(); CALLOUT_OPEN_BUTTON_LEFT = new Vector2(openCoords_reflected[0], openCoords_reflected[1]); int[] tab1Coords_reflected = callout.Settings["tab1_coords_reflected"].GetValueAsIntArray(); CALLOUT_TAB1_BUTTON_LEFT = new Vector2(tab1Coords_reflected[0], tab1Coords_reflected[1]); int[] tab2Coords_reflected = callout.Settings["tab2_coords_reflected"].GetValueAsIntArray(); CALLOUT_TAB2_BUTTON_LEFT = new Vector2(tab2Coords_reflected[0], tab2Coords_reflected[1]); int[] tab3Coords_reflected = callout.Settings["tab3_coords_reflected"].GetValueAsIntArray(); CALLOUT_TAB3_BUTTON_LEFT = new Vector2(tab3Coords_reflected[0], tab3Coords_reflected[1]); int[] tab4Coords_reflected = callout.Settings["tab4_coords_reflected"].GetValueAsIntArray(); CALLOUT_TAB4_BUTTON_LEFT = new Vector2(tab4Coords_reflected[0], tab4Coords_reflected[1]); CALLOUT_TAB_HEIGHT = callout.Settings["tab_height"].GetValueAsInt(); CALLOUT_TAB_WIDTH = callout.Settings["tab_width"].GetValueAsInt(); SettingsGroup offset = file.SettingGroups["Offset"]; OFFSET_DISTANCE = offset.Settings["offset_distance"].GetValueAsFloat(); OFFSET_RADIUS = offset.Settings["radius"].GetValueAsFloat(); OFFSET_BORDER_WIDTH = offset.Settings["border_width"].GetValueAsFloat(); colorValues = offset.Settings["border_color"].GetValueAsIntArray(); OFFSET_BORDER_COLOR = new Color(colorValues[0], colorValues[1], colorValues[2], colorValues[3]); OFFSET_DETECTION_RADIUS = offset.Settings["detection_radius"].GetValueAsInt(); TANGENT_WIDTH = offset.Settings["tangent_lines_width"].GetValueAsInt(); SettingsGroup timeline = file.SettingGroups["Timeline"]; int[] timelinePosition = timeline.Settings["position"].GetValueAsIntArray(); TIMELINE_X = timelinePosition[0]; TIMELINE_Y = timelinePosition[1]; TIMELINE_MONTH_HASH_HEIGHT = timeline.Settings["month_hash_height"].GetValueAsInt(); TIMELINE_MONTH_NAME_OFFSET = timeline.Settings["month_name_offset"].GetValueAsInt(); TIMELINE_SCRUBBER_HEIGHT = timeline.Settings["scrubber_height"].GetValueAsInt(); TIMELINE_SCRUBBER_WIDTH = timeline.Settings["scrubber_width"].GetValueAsInt(); TIMELINE_ONE_YEAR = timeline.Settings["one_year_only"].GetValueAsBool(); TIMELINE_CIRCULAR = timeline.Settings["circular"].GetValueAsBool(); TIMELINE_MIRROR = timeline.Settings["mirror"].GetValueAsBool(); timelinePosition = timeline.Settings["circular_position"].GetValueAsIntArray(); TIMELINE_CIRCULAR_X = timelinePosition[0]; TIMELINE_CIRCULAR_Y = timelinePosition[1]; TIMELINE_CIRCULAR_RADIUS = timeline.Settings["circular_radius"].GetValueAsInt(); TIMELINE_LINEAR = timeline.Settings["linear"].GetValueAsBool(); TIMELINE_MONTHNAME = timeline.Settings["month_name"].GetValueAsBool(); TIMELINE_MONTHNAME_Y = timeline.Settings["month_name_y"].GetValueAsInt(); TIMELINE_MONTHNAME_CENTER_WIDTH = timeline.Settings["month_name_center_width"].GetValueAsInt(); TIMELINE_MONTHNAME_CENTER_TRANSITION_WIDTH = timeline.Settings["month_name_center_transition_width"].GetValueAsInt(); TIMELINE_MONTHNAME_BLANK_EDGE_WIDTH = timeline.Settings["month_name_blank_edge_width"].GetValueAsInt(); TIMELINE_MONTHNAME_EDGE_TRANSITION_WIDTH = timeline.Settings["month_name_edge_transition_width"].GetValueAsInt(); TIMELINE_MONTHNAME_SPACING = timeline.Settings["month_name_spacing"].GetValueAsInt(); TIMELINE_MONTHNAME_EXPAND_FROM_BASELINE = timeline.Settings["month_name_expand_from_baseline"].GetValueAsBool(); colorValues = timeline.Settings["month_name_current_color"].GetValueAsIntArray(); TIMELINE_MONTHNAME_CURRENT_COLOR = new Color(colorValues[0], colorValues[1], colorValues[2]); colorValues = timeline.Settings["month_name_other_color"].GetValueAsIntArray(); TIMELINE_MONTHNAME_OTHER_COLOR = new Color(colorValues[0], colorValues[1], colorValues[2]); TIMELINE_MONTHNAME_STATIC = timeline.Settings["month_name_static"].GetValueAsBool(); TIMELINE_MONTHNAME_STATIC_SPACING = timeline.Settings["month_name_static_spacing"].GetValueAsInt(); TIMELINE_MONTHNAME_STATIC_MARKER_OFFSET = timeline.Settings["month_name_static_marker_offset"].GetValueAsInt(); SettingsGroup plankton = file.SettingGroups["Plankton"]; PHOSPHORUS_CONVERSIONS = plankton.Settings["phosphorus_conversions"].GetValueAsFloatArray(); PLANKTON_COUNT_CONVERSIONS = plankton.Settings["count_conversions"].GetValueAsFloatArray(); PLANKTON_OPACITY = (byte)plankton.Settings["opacity"].GetValueAsInt(); PLANKTON_SIZES = plankton.Settings["sizes"].GetValueAsFloatArray(); PLANKTON_FADEIN_TIME = plankton.Settings["fadein_time"].GetValueAsInt(); PLANKTON_FADEOUT_TIME = plankton.Settings["fadeout_time"].GetValueAsInt(); PLANKTON_MAX_TOTAL = plankton.Settings["max_total"].GetValueAsInt(); PLANKTON_MAX_PER_CIRCLE = plankton.Settings["max_per_circle"].GetValueAsInt(); SettingsGroup dashboard = file.SettingGroups["Dashboard"]; SHOW_LIGHT = dashboard.Settings["show_light"].GetValueAsBool(); SHOW_TEMP = dashboard.Settings["show_temperature"].GetValueAsBool(); SHOW_SILICA = dashboard.Settings["show_silica"].GetValueAsBool(); SHOW_NITRATE = dashboard.Settings["show_nitrate"].GetValueAsBool(); DASHBOARD_ORIENTATION = dashboard.Settings["orientation"].GetValueAsFloat(); DASHBOARD_SPACING = dashboard.Settings["spacing"].GetValueAsFloat(); DASHBOARD_READOUT_SIZE = dashboard.Settings["size"].GetValueAsInt(); READOUT_DISTANCE = dashboard.Settings["distance"].GetValueAsInt(); READOUT_LABEL_DISTANCE = dashboard.Settings["label_distance"].GetValueAsInt(); colorValues = dashboard.Settings["icon_color"].GetValueAsIntArray(); READOUT_ICON_COLOR = new Color(colorValues[0], colorValues[1], colorValues[2], colorValues[3]); colorValues = dashboard.Settings["label_color"].GetValueAsIntArray(); READOUT_LABEL_COLOR = new Color(colorValues[0], colorValues[1], colorValues[2], colorValues[3]); SettingsGroup tools = file.SettingGroups["Tools"]; NUM_TEMPTOOLS = tools.Settings["num_temptools"].GetValueAsInt(); NUM_NUTRIENTTOOLS = tools.Settings["num_nutrienttools"].GetValueAsInt(); SettingsGroup movie = file.SettingGroups["Movie"]; MOVIE_PAUSE_WHEN_CIRCLES_SHOWN = movie.Settings["pause_when_circles_shown"].GetValueAsBool(); MOVIE_SLOWER = movie.Settings["slower_movie"].GetValueAsBool(); MOVIE_BLUE_WATER = movie.Settings["blue_water"].GetValueAsBool(); MOVIE_BLUE_WATER_SATURATED = movie.Settings["blue_water_saturated"].GetValueAsBool(); SettingsGroup debug = file.SettingGroups["Debug"]; SHOW_RUNNING_SLOWLY = debug.Settings["show_running_slowly_indicator"].GetValueAsBool(); SHOW_TOUCHES = debug.Settings["show_touches"].GetValueAsBool(); SHOW_HITBOXES = debug.Settings["show_hitboxes"].GetValueAsBool(); SettingsGroup crosshairs = file.SettingGroups["Crosshairs"]; CROSSHAIRS_MODE = crosshairs.Settings["crosshairs_mode"].GetValueAsBool(); CROSSHAIRS_WIDTH = crosshairs.Settings["width"].GetValueAsInt(); CROSSHAIRS_LENGTH = crosshairs.Settings["length"].GetValueAsInt(); colorValues = crosshairs.Settings["color"].GetValueAsIntArray(); CROSSHAIRS_COLOR = new Color(colorValues[0], colorValues[1], colorValues[2], colorValues[3]); CROSSHAIRS_MEDIUM_THRESHOLD_VELOCITY = crosshairs.Settings["medium_threshold_velocity"].GetValueAsInt(); CROSSHAIRS_MEDIUM_OPACITY = crosshairs.Settings["medium_opacity"].GetValueAsInt(); CROSSHAIRS_ON_MEDIUM_FADE_TIME = crosshairs.Settings["on_medium_fade_time"].GetValueAsInt(); CROSSHAIRS_SLOW_DELAY_TIME = crosshairs.Settings["slow_delay_time"].GetValueAsInt(); CROSSHAIRS_ON_SLOW_FADE_TIME = crosshairs.Settings["on_slow_fade_time"].GetValueAsInt(); CROSSHAIRS_RING_UP_DELAY_TIME = crosshairs.Settings["ring_up_delay_time"].GetValueAsInt(); CROSSHAIRS_ON_RING_UP_ZOOM_TIME = crosshairs.Settings["on_ring_up_zoom_time"].GetValueAsInt(); CROSSHAIRS_ON_RING_DOWN_ZOOM_TIME = crosshairs.Settings["on_ring_down_zoom_time"].GetValueAsInt(); CROSSHAIRS_ANTI_JITTER_DELAY = crosshairs.Settings["anti_jitter_delay"].GetValueAsInt(); SettingsGroup continent = file.SettingGroups["Continents"]; colorValues = continent.Settings["color"].GetValueAsIntArray(); CONTINENT_COLOR = new Color(colorValues[0], colorValues[1], colorValues[2], colorValues[3]); SettingsGroup touchonly = file.SettingGroups["TouchOnly"]; TOUCHONLY = touchonly.Settings["touch_only"].GetValueAsBool(); TOUCHONLY_NUM_RINGS = touchonly.Settings["num_rings"].GetValueAsInt(); TOUCHONLY_LENS_POWER = touchonly.Settings["lens_power"].GetValueAsFloat(); TOUCHONLY_MEDIUM_THRESHOLD_VELOCITY = touchonly.Settings["medium_threshold_velocity"].GetValueAsInt(); }
/// <summary> /// Loads additional settings from another file, overwriting current settings. /// </summary> /// <param name="filename">The name of the file to load additional settings from.</param> public static void LoadAdditionalSettings(string filename) { ConfigFile file = new ConfigFile(filename); foreach (SettingsGroup group in file.SettingGroups.Values) { // TODO if multiple settings files becomes necessary } }