public GameConfiguration ReadConfig() { GameConfigurationSection config = (GameConfigurationSection)ConfigurationManager.GetSection("gameConfig"); GameConfiguration gameConfig = config.Map();; return(gameConfig); }
public PreferencesWindowViewModel(GameConfigurationSection configurationSection) { _configurationSection = configurationSection; WhiteListedFiles = new ObservableCollection <WhitelistedFileEditableObject>(configurationSection.WhiteListedFiles.Select(v => new WhitelistedFileEditableObject(v))); BasePath = configurationSection.BasePath; SelectBasePath = ReactiveCommand.Create(DoSelectBasePath); Ok = ReactiveCommand.Create(DoSave, _canSave); Cancel = ReactiveCommand.Create(() => ShouldClose?.Invoke(this, false)); ValidatePreferences(); }
public override void Parse(GameConfigurationSection sect) { base.Parse(sect); Radius = sect.GetSingle("Radius"); float radLng = MathEx.Degree2Radian(Longitude); float radLat = MathEx.Degree2Radian(Latitude); stdPosition = PlanetEarth.GetPosition(radLng, radLat, PlanetEarth.PlanetRadius); }
public override void Parse(GameConfigurationSection sect) { base.Parse(sect); modelName = sect["Model"]; scale = sect.GetSingle("Radius", 1); rot = sect.GetSingle("Amount", 0); float radLng = MathEx.Degree2Radian(Longitude); float radLat = MathEx.Degree2Radian(Latitude); float alt = TerrainData.Instance.QueryHeight(radLng, radLat); Position = PlanetEarth.GetPosition(radLng, radLat, PlanetEarth.PlanetRadius + alt * TerrainMeshManager.PostHeightScale); Orientation = PlanetEarth.GetOrientation(radLng, radLat); }
private void LoadConfiguration(string game) { var section = _configuration.Sections[game] as GameConfigurationSection; if (section == null) { section = new GameConfigurationSection(new StellarisConfiguration()); _configuration.Sections.Add(game, section); _configuration.Save(ConfigurationSaveMode.Full); } _gameConfiguration = section; if (string.IsNullOrEmpty(_gameConfiguration.BasePath) || !Directory.Exists(_gameConfiguration.BasePath) || !File.Exists(_gameConfiguration.SettingsPath)) { MessageBox.Show( $"There is an error configuration, please sellect a valid documents directory for {game}"); DoShowPreferences(); } }
public void Init() { _config = new GameConfigurationSection(); _config.Battle = new BattleElement(); _config.Battle.IncreasePowerProbability = 1; _config.Battle.MaxWinProbability = 2; _config.Battle.MinWinProbability = 3; _config.Battle.LooseResult = new BattleResultElement(); _config.Battle.WinResult = new BattleResultElement(); _config.Battle.LooseResult.CoinsChange = 4; _config.Battle.LooseResult.HealthChange = 5; _config.Battle.LooseResult.HealthChangeType = ChangeValueTypes.Percent; _config.Battle.WinResult.CoinsChange = 6; _config.Battle.WinResult.HealthChange = 7; _config.Battle.WinResult.HealthChangeType = ChangeValueTypes.Value; _config.InitialPlayer = new InitialPlayerElement(); _config.InitialPlayer.InitialPlayerCoins = 8; _config.InitialPlayer.InitialPlayerHealth = 9; _config.InitialPlayer.InitialPlayerMaxHealth = 10; _config.InitialPlayer.InitialPlayerPower = 11; _config.Shops = new ShopsElement(); _config.Shops.Armor = new ShopElement(); _config.Shops.Heal = new ShopElement(); _config.Shops.Weapon = new ShopElement(); _config.Shops.Armor.EffectFrom = 12; _config.Shops.Armor.EffectTo = 15; _config.Shops.Armor.Price = 17; _config.Shops.Weapon.EffectFrom = 18; _config.Shops.Weapon.EffectTo = 18; _config.Shops.Weapon.Price = 19; _mappedConfig = _config.Map(); }
public override void Parse(GameConfigurationSection sect) { base.Parse(sect); string type = sect.GetString("Type", string.Empty).ToLowerInvariant(); if (type == "wood") { this.Type = NaturalResourceType.Wood; } else if (type == "petro") { this.Type = NaturalResourceType.Oil; } CurrentAmount = sect.GetSingle("Amount", 0); //MaxAmount = CurrentAmount * FTimesMaxAmount; UpdateLocation(); Reset(CurrentAmount); }
public override void Parse(GameConfigurationSection sect) { base.Parse(sect); }
public override void Parse(GameConfigurationSection sect) { base.Parse(sect); harvester.SetPosition(MathEx.Degree2Radian(Longitude), MathEx.Degree2Radian(Latitude)); }
/// <summary> /// 配置文件解析 /// </summary> /// <param name="sect"></param> public virtual void Parse(GameConfigurationSection sect) { Longitude = sect.GetSingle("Longitude"); Latitude = sect.GetSingle("Latitude"); }
public static GameConfiguration Map(this GameConfigurationSection section) { return(Mapper.Map <GameConfigurationSection, GameConfiguration>(section)); }