private void Read(string name) { string filename = PRTY_FILES_PATH + name + ".prty"; using (var file = File.Open(filename, FileMode.OpenOrCreate, FileAccess.Read)) { if (file.Length == 0) { Initialize(); } else { NameInput.Text = ReadText(file); EnvironmentInput.SelectedIndex = EnvironmentData.FindIndex(ReadShort(file)); NumberOfPlayers = ReadByte(file); NumberOfPlayersDisplay.Text = NumberOfPlayers.ToString(); for (int i = 0; i < NumberOfPlayers; i++) { Players[i].Read(file); Players[i].Visible = true; } for (int i = NumberOfPlayers; i < MAX_NUMBER_OF_PLAYERS; i++) { Players[i].Initialize(); Players[i].Visible = false; } for (int i = 0; i < 6; i++) { Relations[i].SelectedIndex = ReadByte(file); } BattleInput.SelectedIndex = BattleData.FindIndex(ReadShort(file)); } } }
public MasterEntity GetData() { MasterEntity dataStorage = new MasterEntity(); // Environment: EnvironmentData environment = envHandler.GetEnvironmentData(); // Check for IIS: Version iisVersion = iisHandler.GetIisVersion(); environment.hasIis = iisVersion != null; // Save Environment to MasterEntity dataStorage.environment = environment; dataStorage.Id = environment.machineName; // IIS: if (environment.hasIis) { IISData iis = iisHandler.CreateIisDataObject(iisVersion); IISStringContainer iisContainer = iisHandler.StoreIIS(iis); // Save IIS to MasterEntity dataStorage.iis = iisContainer; } // Services: dataStorage.services = serHandler.ListServices(); return(dataStorage); }
private async void SetConfiguration(bool isSetting, bool isImageResource) { Dp_Image.Stop(); Pg_Loading.Visibility = Visibility.Visible; if (isImageResource) { Pg_Loading.SetMessage("이미지 정보를 가져옵니다."); List <ImageResource> sources = await resourceCore.GetImageSources(); Dp_Image.SetImageResources(sources); } if (isSetting) { Pg_Loading.SetMessage("설정 정보를 가져옵니다."); SettingData settingData = await resourceCore.GetSettingData(); if (settingData != null) { environmentCore.SetEnvironmentOptions(settingData.GetCity(), settingData.GetProvince(), settingData.GetLatitude(), settingData.GetLongitude()); EnvironmentData environmentData = await environmentCore.GetEnvironment(); Dp_Image.SetOutputTime(int.Parse(settingData.GetDisplayTime())); Eb_Air_State.ShowPublicData(environmentData); } } Pg_Loading.Visibility = Visibility.Collapsed; Dp_Image.Start(isImageResource); }
static void Main() { Receiver receiver = new Receiver(); string receivedData; var environmentData = new EnvironmentData(); while ((receivedData = receiver.ReceiveViaConsole()) != null) { var isValid = receiver.ValidateReceivedData(receivedData, ref environmentData); if (!isValid) { continue; } Console.WriteLine(receivedData); var temperatureStatusCode = receiver.CheckTemperatureAndReturnStatusCode(environmentData.Temperature); var humidityStatusCode = receiver.CheckHumidityAndReturnStatusCode(environmentData.Humidity); var prefixMessage = "Temperature: "; receiver.LoggingToConsole(temperatureStatusCode, ref prefixMessage); prefixMessage = "Humidity: "; receiver.LoggingToConsole(humidityStatusCode, ref prefixMessage); Console.WriteLine(); } }
public bool ValidateReceivedData(string receivedData, ref EnvironmentData environmentData) { var isValid = false; var environmentDataString = receivedData.Split(','); if (!receivedData.Equals("File Does not exist")) { try { environmentData.Temperature = double.Parse(environmentDataString[0]); environmentData.Humidity = double.Parse(environmentDataString[1]); Console.WriteLine(environmentData); isValid = true; } catch (Exception e) { Console.WriteLine("Exception: " + e.Message + "\n"); isValid = false; } } else { Console.WriteLine("File Does not exist\n"); } return(isValid); }
/// <summary> /// Replaces the content of this database with the content of some other container. /// </summary> /// <param name="ed">The environment data to copy into this database</param> public void Replace(EnvironmentData ed) { TableFactory tf = new TableFactory(); DataServer ds = new DataServer(m_ConnectionString); try { // Disable all foreign key constraints tf.EnableForeignKeys(ds, false); ds.RunTransaction(delegate { // Get rid of everything in this database. tf.RemoveAll(ds); // Add the entire content of the specified container tf.Import(ds, ed.Data); }); Data.Clear(); Data.Load(m_ConnectionString); } finally { // Restore all foreign key constraints tf.EnableForeignKeys(ds, true); } }
private void SetEnvironment() { _data = new EnvironmentData(); RemoteConfigWebApiClient.CreateEnvironment(Application.cloudProjectId, _model.environmentName, OnException); RemoteConfigWebApiClient.environmentCreated += OnEnvironmentCreated; }
public DustManager( SunOrbit orb, Persistence.Game game, Persistence.Base @base, SurvivalTimer timer, Func <IEnumerator, Coroutine> startCoroutine, Action <Coroutine> stopCoroutine) { survivalTimer = timer; survivalTimer.OnPlayerInHabitatChange += _OnPlayerInHabitatChange; orb.OnSolChange += _OnSolChange; orb.OnHourChange += _OnHourChange; orb.OnDawn += _OnDawn; orb.OnDusk += _OnDusk; DuskAndDawnOnlyParent = orb.DuskAndDawnOnlyParent; environment = game.Environment; this.random = new System.Random(@base.WeatherSeed); this.startCoroutine = startCoroutine; this.stopCoroutine = stopCoroutine; FastForward(environment.CurrentSol); DoAfterSolChange(); if (environment.CurrentHour > 12) { AnnounceForecast(); } else { #if UNITY_EDITOR AnnounceForecast(); #endif } refreshSolarPanels(); }
/// <summary> /// Writes the log item fields to the log file writer. /// </summary> /// <param name="writer">The log file writer to write to.</param> internal override void Write(FieldLogFileWriter writer) { writer.SetItemType(IsRepeated ? FieldLogItemType.RepeatedScope : FieldLogItemType.Scope); base.Write(writer); writer.AddBuffer((byte)Type); writer.AddBuffer(Level); writer.AddBuffer(Name); if (Type == FieldLogScopeType.ThreadStart) { byte flags = 0; if (IsBackgroundThread) { flags |= 1; } if (IsPoolThread) { flags |= 2; } writer.AddBuffer(flags); } if (Type == FieldLogScopeType.LogStart) { EnvironmentData.Write(writer); } if (Type == FieldLogScopeType.WebRequestStart) { WebRequestData.Write(writer); } writer.WriteBuffer(); }
public LoginTests(string configfile) { this.configfile = configfile; var config = this.InitConfiguration(); environmentData = config.GetSection("EnvironmentData").Get <EnvironmentData>(); }
void Awake() { if (data == null) { data = new EnvironmentData(); } }
public static void Main(string[] args) { var envData = new EnvironmentData(); var routeFinder = new RouteFinder(envData); var startPopulation = routeFinder.GenerateStartPopulation(); // var result = routeFinder.GeneticAlgorithm(...); }
public IActionResult UpdateEnvironment(long id, [FromBody] EnvironmentData eData) { if (ModelState.IsValid) { Models.Environment environment = eData.Environment; environment.EnvironmentId = id; if (environment.ApiDependency.Count > 0) { foreach (Api i in environment.ApiDependency) { if (i != null && i.ApiId != 0) { _context.Attach(i); } } } if (environment.Company != null && environment.Company.CompanyId != 0) { _context.Attach(environment.Company); } if (environment.DatabaseDependency.Count > 0) { foreach (Database i in environment.DatabaseDependency) { if (i != null && i.DatabaseId != 0) { _context.Attach(i); } } } if (environment.EnvironmentType != null && environment.EnvironmentType.EnvironmentTypeId != 0) { _context.Attach(environment.EnvironmentType); } if (environment.LastHealthCheck != null && environment.LastHealthCheck.HealthCheckId != 0) { _context.Attach(environment.LastHealthCheck); } if (environment.Product != null && environment.Product.ProductId != 0) { _context.Attach(environment.Product); } if (environment.Server != null && environment.Server.ServerId != 0) { _context.Attach(environment.Server); } if (environment.WebServer != null && environment.WebServer.WebServerId != 0) { _context.Attach(environment.WebServer); } _context.Update(environment); _context.SaveChanges(); return(Ok(environment.EnvironmentId)); } else { return(BadRequest(ModelState)); } }
private async void WeatherResetTimer_Tick(object sender, EventArgs e) { EnvironmentData environmentData = await environmentCore.GetEnvironment(); Dispatcher.Invoke(new Action(delegate { Eb_Air_State.ShowPublicData(environmentData); }), DispatcherPriority.Normal); }
public override SettingsMessageData GetData() { var payload = new EnvironmentData(); payload.Index = envList.value; payload.Name = envNames[envList.value]; payload.Duration = int.Parse(duration.text); return(payload); }
public EnvironmentData GetEnvironmentData() { string machineName = Environment.MachineName; string domainName = Environment.UserDomainName.ToString(); string userName = Environment.UserName; string osVersion = Environment.OSVersion.ToString(); DateTime logTime = DateTime.Now; EnvironmentData temp = new EnvironmentData(machineName, domainName, userName, osVersion, logTime); return(temp); }
void TrainingCost() { ListDataInfo playerDataInfo = MasterManager.ManagerGlobalData.GetPlayerDataInfo(); playerDataInfo.statsList[0].Stamina -= (short)(CostStamina); //NewStam.text = playerDataInfo.statsList[0].Stamina.ToString(); EnvironmentData envData = MasterManager.ManagerGlobalData.GetEnvData(); envData.gold -= CostGold; //NewGold.text = envData.gold.ToString("N0"); }
private DataExtract Setup() { envData = new EnvironmentData(null, null, null, null, DateTime.Now); eHandlerMoq = new Mock <IEnvironmentHandler>(); eHandlerMoq.Setup(m => m.GetEnvironmentData()).Returns(envData); iisHandlerMoq = new Mock <IIisHandler>(); servHandlerMoq = new Mock <IServiceHandler>(); var sut = new DataExtract(eHandlerMoq.Object, iisHandlerMoq.Object, servHandlerMoq.Object); return(sut); }
public void LoadallData() { playerDataInfo = Utility.ReadDataFromJSON <ListDataInfo>(Constants.JSONIndex.DATA_PLAYER); enemiesDataInfo = Utility.ReadDataFromJSON <ListEnemiesInfo>(Constants.JSONIndex.DATA_ENEMY); itemDataInfo = Utility.ReadDataFromJSON <ListItemsInfo>(Constants.JSONIndex.DATA_ITEM); envData = Utility.ReadDataFromJSON <EnvironmentData>(Constants.JSONIndex.DATA_ENVIRONMENT); workData = Utility.ReadDataFromJSON <ListWorkInfo>(Constants.JSONIndex.DATA_WORK); config = Utility.ReadDataFromJSON <Configuration>(Constants.JSONIndex.DATA_CONFIG); creditData = Utility.ReadDataFromJSON <ListCreditInfo>(Constants.JSONIndex.DATA_CREDIT); Debug.Log("All Data Loaded"); //Debug.Log(enemiesStatus[0].statsList[0].Agility); }
//Save environment data public static void SaveEnvironment(EnvironmentController controller, string worldName) { BinaryFormatter formatter = new BinaryFormatter(); Directory.CreateDirectory(Application.persistentDataPath + "/Saves/" + worldName); string path = Application.persistentDataPath + "/Saves/" + worldName + "/Environment.SGSAVE"; FileStream stream = new FileStream(path, FileMode.Create); EnvironmentData data = new EnvironmentData(controller); formatter.Serialize(stream, data); stream.Close(); }
// Use this for initialization protected override void Start() { higherColor = new Color(0, .5f, 0); lowerColor = new Color(1, 0, 0); activeColor = new Color(1, 1, 1); desactiveColor = new Color(.8f, .8f, .8f); equalsColor = new Color(0, 0, 0); hiddenColor = new Color(0, 0, 0, 0); Armors = MasterManager.ManagerSprite.ArmorList; Helmets = MasterManager.ManagerSprite.HelmetList; LeftHands = MasterManager.ManagerSprite.LeftHandList; RightHands = MasterManager.ManagerSprite.RightHandList; Pants = MasterManager.ManagerSprite.PantsList; Shoes = MasterManager.ManagerSprite.ShoesList; playerData = MasterManager.ManagerGlobalData.GetPlayerDataInfo(); playerItens = playerData.itemList; List <ItemDataInfo> allItens = MasterManager.ManagerGlobalData.GetItemDataInfo().itemData; itemList = new List <ItemDataInfo>(); ItemBlocks = new List <GameObject>(); for (int p = 0; p < allItens.Count; p++) { if (allItens[p].Tier == playerData.playerTier) { itemList.Add(allItens[p]); } } equipedItems = new List <ItemDataInfo>(); for (int i = 0; i < playerData.equipedItensId.Count; i++) { for (int p = 0; p < itemList.Count; p++) { if (itemList[p].id == playerData.equipedItensId[i]) { equipedItems.Add(itemList[p]); } } } envData = MasterManager.ManagerGlobalData.GetEnvData(); coins.text = envData.gold.ToString(); filteredItemList = itemList; hasUsedShop = false; UpdateItemArea(); }
void Start() { //get time data from json //money, current time //set current data to UI envData = MasterManager.ManagerGlobalData.GetEnvData(); if (MasterManager.ManagerLoadScene.AfterBattle == true) { MasterManager.ManagerLoadScene.AfterBattle = false; StartNextWeek(); //After Battle goes to Monday 8 am envData.times = Constants.TIME_GAMESTART; } }
// Start is called before the first frame update /// <summary> /// Called on initialization /// </summary> private void Awake() { // Use this class instance as singleton Instance = this; // Add the ImageCapture class to this Gameobject gameObject.AddComponent <ImageCapture>(); // Add the CustomVisionAnalyser class to this Gameobject gameObject.AddComponent <CustomVisionAnalyser>(); // Add the CustomVisionObjects class to this Gameobject gameObject.AddComponent <CustomVisionObjects>(); envData = new EnvironmentData(); }
private void initSupplyDrop() { EnvironmentData data = Data.Instance.getEnvByTheme(Theme.FOREST); Timer supply = gameObject.AddComponent <Timer>(); supply.time = data.supplyDropTime; supply.OnEnd += delegate() { int supplyId = Data.Instance.getRandomSupplyId(); GameObject dropInstance = Instantiate(data.dropPrefab) as GameObject; Drop drop = dropInstance.GetComponent <Drop>(); drop.createDropLimitedTime(Entity.SUPPLY, supplyId, 20f); battleField.Drop(drop); initSupplyDrop(); }; supply.Launch(); }
private void initItemDrop() { EnvironmentData data = Data.Instance.getEnvByTheme(Theme.FOREST); Timer item = gameObject.AddComponent <Timer>(); item.time = data.itemDropTime; item.OnEnd += delegate() { int itemId = Data.Instance.getRandomItemId(); GameObject dropInstance = Instantiate(data.dropPrefab) as GameObject; Drop drop = dropInstance.GetComponent <Drop>(); drop.createDropLimitedAmount(Entity.ITEM, itemId, 2); battleField.Drop(drop); initItemDrop(); }; item.Launch(); }
private void initWeaponDrop() { EnvironmentData data = Data.Instance.getEnvByTheme(Theme.FOREST); Timer weapon = gameObject.AddComponent <Timer>(); weapon.time = data.weaponDropTime; weapon.OnEnd += delegate() { int weaponId = Data.Instance.getRandomWeaponId(); GameObject dropInstance = Instantiate(data.dropPrefab) as GameObject; Drop drop = dropInstance.GetComponent <Drop>(); drop.createDropLimitedAmount(Entity.WEAPON, weaponId, 2); battleField.Drop(drop); initWeaponDrop(); }; weapon.Launch(); }
public static IServiceCollection AddGoTDatabase(this IServiceCollection services, IConfiguration config, IHostingEnvironment environment) { EnvironmentData[] environments = config.GetEnvironmentCollection(); EnvironmentData env = null; switch (environment.EnvironmentName) { case Environments.Development: { env = environments.First(e => e.Name == Environments.Development); break; } case Environments.Release: { env = environments.First(e => e.Name == Environments.Release); break; } case Environments.Production: { env = environments.First(e => e.Name == Environments.Production); break; } } services.AddDbContext <GoTGameContextDb>(options => { options.UseSqlServer(env.ConnectionString, sqlServerOptionsAction: sqlOptions => { sqlOptions.EnableRetryOnFailure( maxRetryCount: 10, maxRetryDelay: TimeSpan.FromSeconds(3), errorNumbersToAdd: null); }); }, ServiceLifetime.Transient); //services.AddSingleton<IGoTGameContextDb, GoTGameContextDb>(); services.AddTransient <IGamesRepository, GamesRepository>(); services.AddTransient <IPlayersRepository, PlayersRepository>(); services.AddTransient <IGameRulesRepository, GameRulesRepository>(); services.AddSingleton <IChatRepository, ChatRepository>(); services.AddTransient <IUserRepository, UserRepository>(); services.AddTransient <ISignInService, SignInService>(); return(services); }
public void CallBackEndSleep() { // sleepImage.SetActive(false); ListDataInfo playerDataInfo = MasterManager.ManagerGlobalData.GetPlayerDataInfo(); EnvironmentData envData = MasterManager.ManagerGlobalData.GetEnvData(); Constants.HouseType houseType = (Constants.HouseType)envData.house_level; float multiPlier = 100.0f; //Generates stamina; //to do : depends on house level /* * level 1 - 45%; * level 2 - 65%; * level 3 - 85%; * level 4 - 110%; */ switch (houseType) { case Constants.HouseType.SMALL: multiPlier = 0.45f; break; case Constants.HouseType.MEDIUM: multiPlier = 0.65f; break; case Constants.HouseType.HUGE: multiPlier = 0.85f; break; case Constants.HouseType.MANSION: multiPlier = 1.00f; break; default: break; } short addAmount = (short)(playerDataInfo.GetActualStats().MaxStamina *multiPlier); playerDataInfo.statsList[0].Stamina = (short)Mathf.Min((int)playerDataInfo.statsList[0].MaxStamina, (int)playerDataInfo.statsList[0].Stamina + addAmount); //Refills HP to 100 %; playerDataInfo.statsList[0].HP = (int)(playerDataInfo.GetActualStats().MAXHP *Constants.HP_MULTIPLIER); MasterManager.ManagerGlobalData.SavePlayerData(); TownManager.Instance.UpdatePlayerUI(); }
private static string ProcessEnvironmentData([CanBeNull] EnvironmentData environmentData, PathTable pathTable) { if (environmentData == null) { return(null); } object data = environmentData.GetValue(); Contract.Assert(!(data is UnitValue)); StringBuilder s = new StringBuilder(); DoProcessEnvironmentData(data, pathTable, s); return(s.ToString()); }
public void Describe(Description description) { description.Title = "OWIN Settings"; description.ShortDescription = "Governs the attachment and ordering of OWIN middleware plus OWIN host properties"; Properties.Each(x => description.Properties[x.Key] = x.Value.ToString()); EnvironmentData.Each((key, value) => description.Properties[key] = value.ToString()); var middleware = new BulletList { Name = "Middleware", Label = "Middleware" }; Middleware.Each(x => middleware.Children.Add(x.ToDescription())); description.BulletLists.Add(middleware); }
/// <summary> /// Recursively calculates the nearest sound speed profiles along a given radial using a binary search-like algorithm /// 1. If start and end points are provided, use them, otherwise find the nearest SSP to each of those points /// 2. If the start point was calculated, add the SSP closest to the calculated start point to the enumerable /// 2. If the SSPs closest to the start and end points are within 10m of each other they are considered identical and there are /// assumed to be no more intervening points /// 3. If the SSPs closest to the start and end points are NOT within 10m of each other, calculate the midpoint of the segment /// and find the nearest SSP to that point. /// 4. If the SSP nearest the midpoint is not within 10m of the SSP nearest to the start point, recursively call this function to /// find the new midpoint between the start point and the current midpoint /// 5. Return the /// </summary> /// <param name="segment"></param> /// <param name="startDistance"></param> /// <param name="startProfile"></param> /// <param name="endProfile"></param> /// <param name="bottomProfile"></param> /// <param name="soundSpeedData"></param> /// <param name="deepestProfile"></param> /// <returns></returns> static IEnumerable<Tuple<double, SoundSpeedProfile>> ProfilesAlongRadial(GeoSegment segment, double startDistance, SoundSpeedProfile startProfile, SoundSpeedProfile endProfile, BottomProfile bottomProfile, EnvironmentData<SoundSpeedProfile> soundSpeedData, SoundSpeedProfile deepestProfile) { var returnStartProfile = false; var returnEndProfile = false; if (startProfile == null) { returnStartProfile = true; startProfile = soundSpeedData.IsFast2DLookupAvailable ? soundSpeedData.GetNearestPointAsync(segment[0]).Result.Extend(deepestProfile) : soundSpeedData.GetNearestPoint(segment[0]).Extend(deepestProfile); } if (endProfile == null) { returnEndProfile = true; endProfile = soundSpeedData.IsFast2DLookupAvailable ? soundSpeedData.GetNearestPointAsync(segment[1]).Result.Extend(deepestProfile) : soundSpeedData.GetNearestPoint(segment[1]).Extend(deepestProfile); } if (returnStartProfile) yield return Tuple.Create(NearestBottomProfileDistanceTo(bottomProfile, startDistance), startProfile); // If the start and end profiles are the same, we're done if (startProfile.DistanceKilometers(endProfile) <= 0.01) yield break; // If not, create a middle profile var middleProfile = soundSpeedData.IsFast2DLookupAvailable ? soundSpeedData.GetNearestPointAsync(segment.Center).Result.Extend(deepestProfile) : soundSpeedData.GetNearestPoint(segment.Center).Extend(deepestProfile); // If the center profile is different from BOTH endpoints if (startProfile.DistanceKilometers(middleProfile) > 0.01 && middleProfile.DistanceKilometers(endProfile) > 0.01) { // Recursively create and return any new sound speed profiles between the start and the center var firstHalfSegment = new GeoSegment(segment[0], segment.Center); foreach (var tuple in ProfilesAlongRadial(firstHalfSegment, startDistance, startProfile, middleProfile, bottomProfile, soundSpeedData, deepestProfile)) yield return tuple; var centerDistance = startDistance + Geo.RadiansToKilometers(segment[0].DistanceRadians(segment.Center)); // return the center profile yield return Tuple.Create(NearestBottomProfileDistanceTo(bottomProfile, centerDistance), middleProfile); // Recursively create and return any new sound speed profiles between the center and the end var secondHalfSegment = new GeoSegment(segment.Center, segment[1]); foreach (var tuple in ProfilesAlongRadial(secondHalfSegment, centerDistance, middleProfile, endProfile, bottomProfile, soundSpeedData, deepestProfile)) yield return tuple; } var endDistance = startDistance + Geo.RadiansToKilometers(segment.LengthRadians); // return the end profile if (returnEndProfile) yield return Tuple.Create(NearestBottomProfileDistanceTo(bottomProfile, endDistance), endProfile); }
public void Initialize() { _list = new EnvironmentData<Geo>(); }