Example #1
0
        public ConfigManager()
        {
            string ResourceName = API.GetCurrentResourceName();

            ServerConfig    = JsonConvert.DeserializeObject <ServerConfig>(API.LoadResourceFile(ResourceName, "/configs/server.json"));
            CharacterConfig = JsonConvert.DeserializeObject <CharacterConfig>(API.LoadResourceFile(ResourceName, "/configs/characters.json"));
            SpawningConfig  = JsonConvert.DeserializeObject <List <SpawningConfig> >(API.LoadResourceFile(ResourceName, "/configs/playerspawns.json"));
            WeatherConfig   = JsonConvert.DeserializeObject <WeatherConfig>(API.LoadResourceFile(ResourceName, "/configs/weather.json"));
            ControlsConfig  = JsonConvert.DeserializeObject <Dictionary <string, int> >(API.LoadResourceFile(ResourceName, "/configs/controls.json"));

            Utils.WriteLine("ConfigManager Loaded");
        }
        public IComponent CreateComponent(IMessageHub hub, string fileName)
        {
            var file      = WeatherConfig.GetFileSystem();
            var logger    = WeatherConfig.GetLoggerConfiguration();
            var reader    = new WeatherReader(file, logger);
            var mapper    = new WeatherMapper(logger);
            var notify    = new WeatherNotifier(logger);
            var processor = new WeatherProcessor(reader, mapper, notify, hub, logger);

            _weatherComponent = new Types.WeatherComponent(reader, mapper, notify, processor, fileName);

            return(_weatherComponent);
        }
Example #3
0
        public ConfigManager()
        {
            Utils.DebugLine("Config Manager Loading", "SConfigManager");

            string resourceName = MainServer.ResouceName();

            ServerConfig    = JsonConvert.DeserializeObject <ServerConfig>(MainServer.LoadResourceFile(resourceName, "/configs/server_config.json"));
            CharacterConfig = JsonConvert.DeserializeObject <CharacterConfig>(MainServer.LoadResourceFile(resourceName, "/configs/character_config.json"));
            SpawningConfig  = JsonConvert.DeserializeObject <List <SpawningConfig> >(MainServer.LoadResourceFile(resourceName, "/configs/playerspawns.json"));
            WeatherConfig   = JsonConvert.DeserializeObject <WeatherConfig>(MainServer.LoadResourceFile(resourceName, "/configs/weather_config.json"));
            ControlsConfig  = JsonConvert.DeserializeObject <Dictionary <string, int> >(MainServer.LoadResourceFile(resourceName, "/configs/controls_config.json"));
            MarkerConfig    = JsonConvert.DeserializeObject <Dictionary <string, MarkerConfig> >(MainServer.LoadResourceFile(resourceName, "/configs/markers_config.json"));

            Utils.DebugLine("Config Manager Loaded", "SConfigManager");
        }
        public FerngillCustomRain(IMonitor Monitor, MersenneTwister Dice, WeatherConfig config, int numOfDrops, bool BloodRain = true)
        {
            Logger        = Monitor;
            pRNG          = Dice;
            ModOptions    = config;
            rainDrops     = new RainDrop[numOfDrops];
            backRainColor = Color.Blue;
            rainColor     = Color.White;
            IsBloodRain   = BloodRain;

            for (int index = 0; index < this.rainDrops.Length; ++index)
            {
                this.rainDrops[index] = new RainDrop(pRNG.Next(Game1.viewport.Width),
                                                     pRNG.Next(Game1.viewport.Height), pRNG.Next(4), pRNG.Next(70));
            }
        }
Example #5
0
        public static void AddWeatherConfig(this IServiceCollection services, IConfiguration configuration)
        {
            var wconfig = new WeatherConfig();

            configuration.GetSection("WeatherConfig").Bind(wconfig);

            services.TryAddSingleton(wconfig);

            services.TryAddSingleton <WeatherCache>();

            services.TryAddTransient <OWMHandler>();
            services.AddHttpClient("owm", c => {
                c.BaseAddress = new Uri(wconfig.Link);
            }).ConfigurePrimaryHttpMessageHandler <OWMHandler>();

            services.TryAddTransient <IWeatherService, WeatherService>();
        }
 public ClimatesOfFerngillAPI(WeatherConditions cond, WeatherConfig Opt)
 {
     LoadData(cond, Opt);
 }
Example #7
0
 public WeatherHelper(WeatherConfig _configSettigs)
 {
     config = _configSettigs;
 }
 public void LoadData(WeatherConditions Cond, WeatherConfig Opt)
 {
     CurrentConditions = Cond;
     Options           = Opt;
 }
Example #9
0
 public DaoWeather(WeatherConfig config)
 {
     this._config = config;
 }
Example #10
0
 public WeatherController(IOptions <WeatherConfig> config)
 {
     _configSettigs = config.Value;
     WeatherHelper helper = new WeatherHelper(_configSettigs);
 }
Example #11
0
 public void LoadData(WeatherConditions cond, WeatherConfig opt)
 {
     CurrentConditions = cond;
     Options           = opt;
 }
Example #12
0
 //Constructor
 internal ClimatesOfFerngillApi(SDVMoon moon, WeatherConditions cond, StaminaDrain manager, WeatherConfig config)
 {
     Termina           = moon;
     CurrentConditions = cond;
     StaminaManager    = manager;
     ModConfig         = config;
 }
 public WeatherClient(WeatherConfig configuration, IFileProvider fileProvider)
 {
     _filePath     = configuration.Filepath;
     _fileProvider = fileProvider;
 }
Example #14
0
    public void SetMapParam()
    {
        WeatherConfig.SetClimateType(ScenceClimate, vegetationId);
        SetTerrainHeight(terrainHeight, ScenceClimate);
        VFDataRTGen.SetRiverDensity(riverDensity);
        VFDataRTGen.SetRiverWidth(riverWidth);
        System.Random randTool = new System.Random(RandSeed);
        VFDataRTGen.SetPlainThickness(plainHeight);
//		VFDataRTGen.SetPlainMin((float)randTool.NextDouble());
//		VFDataRTGen.SetPlainMax((float)randTool.NextDouble());
        VFDataRTGen.SetFlatness(flatness);
        VFDataRTGen.SetFlatMin((float)randTool.NextDouble());
        VFDataRTGen.SetFlatMax((float)randTool.NextDouble());
        VFDataRTGen.SetBridgeMaxHeight(bridgeMaxHeight);
        //Debug.LogError(Mathf.Atan(1)*4);
        switch (mapSize)
        {
        case 0:
            //boundary
            SetBoundary(-20000, 20000, -20000, 20000, 200);
            //VFDataRTGen mineral
            VFDataRTGen.MetalReduceSwitch = false;
            VFDataRTGen.MetalReduceArea   = 4000;
            //VFDataRTGen.MineFrequency0 = 0.5;
            //VFDataRTGen.MineFrequency1 = 2;

            VFDataRTGen.SetMapTypeFrequency(1f);
            //VArtifactTownManager town level campDistance detectarea
            //SetTownBoundary(-19200, 19200, -19200, 19200);
            //VArtifactTownManager.Instance.LevelRadius = 4000;
            //SetTownDistance(1, 1);
            //VArtifactTownManager.Instance.DetectedChunkNum = 32;
            //allyCount=8;
            break;

        case 1:
            //boundary
            SetBoundary(-10000, 10000, -10000, 10000, 100);
            //VFDataRTGen mineral
            VFDataRTGen.MetalReduceSwitch = false;
            VFDataRTGen.MetalReduceArea   = 2000;
            //VFDataRTGen.MineFrequency0 = 0.5;
            //VFDataRTGen.MineFrequency1 = 2;

            VFDataRTGen.SetMapTypeFrequency(1f);
            //VArtifactTownManager town level
            //SetTownBoundary(-9600, 9600, -9600, 9600);
            //VArtifactTownManager.Instance.LevelRadius = 2000;
            //SetTownDistance(1, 1);
            //VArtifactTownManager.Instance.DetectedChunkNum = 32;
            //allyCount=8;
            break;

        case 2:
            //boundary
            SetBoundary(-4000, 4000, -4000, 4000, 40);
            //VFDataRTGen mineral
            VFDataRTGen.MetalReduceSwitch = false;
            //VFDataRTGen.MineFrequency0 = 0.25;
            //VFDataRTGen.MineFrequency1 = 0.25;
            //maptype
            VFDataRTGen.SetMapTypeFrequency(1.5f);
            //VFDataRTGen.SetTerrainFrequency(1.5f);
            //VArtifactTownManager town level campDistance detectarea
            //SetTownBoundary(-3860, 3860, -3860, 3860);
            //VArtifactTownManager.Instance.LevelRadius = 800;
            //SetTownDistance(0.5f, 0.8f);
            //VArtifactTownManager.Instance.DetectedChunkNum = 16;
            //allyCount=8;
            break;

        case 3:
            //boundary
            SetBoundary(-2000, 2000, -2000, 2000, 20);
            //VFDataRTGen mineral
            VFDataRTGen.MetalReduceSwitch = false;
            //VFDataRTGen.MineFrequency0 = 1;
            //VFDataRTGen.MineFrequency1 = 2;
            VFDataRTGen.SetMapTypeFrequency(3f);
            //VFDataRTGen.SetTerrainFrequency(3f);
            //VArtifactTownManager town level campDistance detectarea
            //SetTownBoundary(-1920, 1920, -1920, 1920);
            //VArtifactTownManager.Instance.LevelRadius = 400;
            //SetTownDistance(0.5f, 0.8f);
            //VArtifactTownManager.Instance.DetectedChunkNum = 12;
            //allyCount=4;
            break;

        case 4:
            //boundary
            SetBoundary(-1000, 1000, -1000, 1000, 10);
            //VFDataRTGen mineral
            VFDataRTGen.MetalReduceSwitch = false;
            //VFDataRTGen.MineFrequency0 = 1;
            //VFDataRTGen.MineFrequency1 = 2;
            VFDataRTGen.SetMapTypeFrequency(3f);
            //VFDataRTGen.SetTerrainFrequency(3f);
            //VArtifactTownManager town level campDistance detectarea
            //SetTownBoundary(-960, 960, -960, 960);
            //VArtifactTownManager.Instance.LevelRadius = 200;
            //SetTownDistance(0.25f, 0.8f);
            //VArtifactTownManager.Instance.DetectedChunkNum = 6;
            //allyCount=4;
            break;
        }
        //VFDataRTGen.TestMapBound();

        Debug.Log("<color=red>SeedString:" + SeedString
                  + "terrainHeight:" + terrainHeight
                  + "mapsize: " + mapSize
                  + ", riverdensity: " + riverDensity
                  + ", riverwidth: " + riverWidth
                  + "plainHeight:" + plainHeight
                  + "flatness:" + flatness
                  + "bridgemaxheight:" + bridgeMaxHeight
                  + "allyCount" + allyCount
                  + "</color>");


        VFVoxelWater.c_fWaterLvl = VFDataRTGen.WaterHeightBase;
        if (ScenceClimate == ClimateType.CT_Wet)
        {
            System.Random waterseed = new System.Random(RandSeed);
            int           waterplus = waterseed.Next(VFDataRTGen.WET_WATER_PLUS_MIN, VFDataRTGen.WET_WATER_PLUS_MAX);
            VFVoxelWater.c_fWaterLvl += waterplus;
        }
        else if (ScenceClimate == ClimateType.CT_Temperate)
        {
            System.Random waterseed = new System.Random(RandSeed);
            int           waterplus = waterseed.Next(VFDataRTGen.TEMP_WATER_PLUS_MIN, VFDataRTGen.TEMP_WATER_PLUS_MAX);
            VFVoxelWater.c_fWaterLvl += waterplus;
        }
        VFDataRTGen.sceneClimate = ScenceClimate;
        VFDataRTGen.waterHeight  = VFVoxelWater.c_fWaterLvl;
        VFDataRTGen.InitStaticParam(RandSeed);
        SetGlobalFogHeight(VFDataRTGen.waterHeight);
    }
Example #15
0
 public WeatherClientWrapper(WeatherConfig config)
 {
     _config = config;
 }
Example #16
0
 public OWMHandler(WeatherConfig config): base(new HttpClientHandler())
 {
     _config = config;
 }
Example #17
0
        public static List <WeatherViewModel> MapToViewModel(this OpenWeatherResponse raw, WeatherConfig config)
        {
            var l = new List <WeatherViewModel>();

            if (raw == null)
            {
                return(l);
            }

            foreach (var r in raw.OpenWeatherList)
            {
                var c  = config.Companies.First(x => x.MapId == r.Id);
                var vm = new WeatherViewModel
                {
                    MapId       = c.MapId,
                    Description = c.Description,
                    City        = c.City,
                    Sunrise     = DateTimeOffset.FromUnixTimeMilliseconds(r.Sys.Sunrise).DateTime,
                    Sunset      = DateTimeOffset.FromUnixTimeMilliseconds(r.Sys.Sunset).DateTime,
                    LocalTime   = DateTime.UtcNow.AddSeconds(r.Sys.Timezone),
                    Temperature = r.Main.Temp,
                    WeatherType = r.Weather.First().Main,
                    WeatherIcon = r.Weather.First().Icon.TranslateIcon()
                };
                l.Add(vm);
            }

            return(l);
        }