public async Task DeleteAsync(string serviceId) { Order order = await _unitOfWork.Orders.GetByAsync(x => x.ServiceId == serviceId); if (order.ServiceTipe == ServiceTipe.Air) { Air air = await _unitOfWork.Airs.GetByIdAsynс(order.ServiceId); air.TravellerId = null; _unitOfWork.Airs.Update(air); _unitOfWork.Orders.Delete(order); } if (order.ServiceTipe == ServiceTipe.Train) { Train train = await _unitOfWork.Trains.GetByIdAsynс(order.ServiceId); train.TravellerId = null; _unitOfWork.Trains.Update(train); _unitOfWork.Orders.Delete(order); } if (order.ServiceTipe == ServiceTipe.Hotel) { Hotel hotel = await _unitOfWork.Hotels.GetByIdAsynс(order.ServiceId); hotel.TravellerId = null; _unitOfWork.Hotels.Update(hotel); _unitOfWork.Orders.Delete(order); } await _unitOfWork.CommitAsync(); }
public async Task AddAirAsync(ServiceDTO services) { await CheckEmp(services.EmployeeId); Cart cart = await _unitOfWork.Carts.GetByAsync(x => x.EmployeeId == services.EmployeeId); foreach (var item in services.serviceIds) { await CheckAir(item); Air air = await _unitOfWork.Airs.GetByIdAsynс(item); air.TravellerId = services.EmployeeId; Order newOrder = new Order() { CartId = cart.Id, ServiceId = item, ServiceTipe = ServiceTipe.Air }; _unitOfWork.Orders.Create(newOrder); } await _unitOfWork.CommitAsync(); }
public Baloon(Air air) { if (air != null) { State = InflationState.Inflated; } }
public static Block GetBlock(this BlockEntity input) { Block Block = new Air(); switch (input.Id) { case "Sign": Block = new StandingSign(); break; case "Chest": Block = new Chest(); break; case "EnchantTable": Block = new EnchantingTable(); break; case "Furnace": Block = new Furnace(); break; case "Skull": Block = new Skull(); break; case "ItemFrame": Block = new ItemFrame(); break; } return(Block); }
private void ShowAirGUI(Air air) { Dictionary <Gas, float> gases = air.gases; GUILayout.Label("Gases", EditorStyles.label); foreach (var gas in air.gases.Keys) { GUILayout.BeginHorizontal(); GUILayout.Label(gas.name, GUILayout.MinWidth(30f)); gases[gas] = EditorGUILayout.Slider(air.gases[gas], 0f, 1f); GUILayout.EndHorizontal(); } air.gases = gases; GUILayout.Space(20f); GUILayout.BeginHorizontal(); GUILayout.Label("Temperature", GUILayout.MinWidth(80f)); air.temperature = EditorGUILayout.FloatField(air.temperature); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Pressure", GUILayout.MinWidth(80f)); air.pressure = EditorGUILayout.FloatField(air.pressure); GUILayout.EndHorizontal(); }
public float GetVolumeRatio(Air air) { float moles = GetMoles(air); float volumePct = moles / air.GetTotalMoles(); return(volumePct); }
public void Update(double delta) { foreach (Cylinder cylinder in cylinders) { //Add air on intake stage if (cylinder.current_stroke == StrokeCycle.Intake) { //cylinder.mass_of_air += mass_of_air_avaliable / intake_cylinders.Count; double air_kpa = 101.325; double vol_of_cylinder = Math.Pow(es.bore / 2.0, 2) * Math.PI * es.stroke; vol_of_cylinder *= throttle_body_position; double air_temp = Constants.CELCIUS_TO_KELVIN * 25; cylinder.mass_of_air = Air.Mass(air_kpa, vol_of_cylinder, air_temp); } cylinder.Update(delta); } crankshaft.Update(delta); mass_of_air_avaliable = 0; //Console.WriteLine(crankshaft.rpm); }
public float GetPartialPressure(Air air) { float moles = GetMoles(air); float totalMoles = air.GetTotalMoles(); return(moles / totalMoles * air.pressure); }
public GasMixture?RemoveAir(float amount) { var gas = Air?.Remove(amount); CheckStatus(); return(gas); }
private void PerformHotspotExposure() { if (Air == null || !Hotspot.Valid) { return; } Hotspot.Bypassing = Hotspot.SkippedFirstProcess && (Hotspot.Volume > Atmospherics.CellVolume * 0.95); if (Hotspot.Bypassing) { Hotspot.Volume = Air.ReactionResultFire * Atmospherics.FireGrowthRate; Hotspot.Temperature = Air.Temperature; } else { var affected = Air.RemoveRatio(Hotspot.Volume / Air.Volume); if (affected != null) { affected.Temperature = Hotspot.Temperature; affected.React(this); Hotspot.Temperature = affected.Temperature; Hotspot.Volume = affected.ReactionResultFire * Atmospherics.FireGrowthRate; AssumeAir(affected); } } // TODO ATMOS Let all entities in this tile know about the fire? }
public void Exhale(float frameTime, GasMixture to) { // TODO: Make the bloodstream separately pump toxins into the lungs, making the lungs' only job to empty. if (Body == null) { return; } if (!Body.Owner.TryGetComponent(out BloodstreamComponent? bloodstream)) { return; } bloodstream.PumpToxins(Air); var lungRemoved = Air.RemoveRatio(0.5f); var toOld = to.Gases.ToArray(); to.Merge(lungRemoved); for (var gas = 0; gas < Atmospherics.TotalNumberOfGases; gas++) { var newAmount = to.GetMoles(gas); var oldAmount = toOld[gas]; var delta = newAmount - oldAmount; lungRemoved.AdjustMoles(gas, -delta); } Air.Merge(lungRemoved); }
private void Start() { air = GetComponent <Air>(); element = Element.EARTH; Cursor.lockState = CursorLockMode.Locked; _camera = Camera.main; }
public void Passing_more_than_one_object() { new Behaviour() .Given(_air = new Air(), _baloon = new Baloon(_air)) .Then(_baloon.State == Baloon.InflationState.Inflated) ; }
// REVIEW: この辺の生ノーツデータを手づかみで触る処理はここじゃなくてNoteBookでやったほうが安全じゃない…? private void ReverseShortNotes(List <Note> noteList, LaneBook laneBook, NoteBook noteBook) { noteList.ForEach(x => { int reverseLane = BottomRightPosition.Lane - (x.Position.Lane - TopLeftPosition.Lane + x.Size) + 1; Position newPosition = new Position(reverseLane, x.Position.Tick); x.RelocateOnlyAndUpdate(newPosition, laneBook); if (x is AirableNote airable && airable.IsAirAttached) { Air newAir = null; if (airable.Air is AirUpL) { newAir = new AirUpR(x); } else if (airable.Air is AirUpR) { newAir = new AirUpL(x); } else if (airable.Air is AirDownL) { newAir = new AirDownR(x); } else if (airable.Air is AirDownR) { newAir = new AirDownL(x); } if (newAir != null) { noteBook.DetachAirFromAirableNote(airable, out _); noteBook.AttachAirToAirableNote(airable, newAir); } } }); }
private void FinalizeEq() { var transferDirections = new float[Atmospherics.Directions]; var hasTransferDirs = false; for (var i = 0; i < Atmospherics.Directions; i++) { var amount = _tileAtmosInfo[i]; if (amount == 0) continue; transferDirections[i] = amount; _tileAtmosInfo[i] = 0; // Set them to 0 to prevent infinite recursion. hasTransferDirs = true; } if (!hasTransferDirs) return; for(var i = 0; i < Atmospherics.Directions; i++) { var direction = (AtmosDirection) (1 << i); if (!_adjacentBits.HasFlag(direction)) continue; var amount = transferDirections[i]; var tile = _adjacentTiles[i]; if (tile?.Air == null) continue; if (amount > 0) { if (Air.TotalMoles < amount) FinalizeEqNeighbors(transferDirections); tile._tileAtmosInfo[direction.GetOpposite()] = 0; tile.Air.Merge(Air.Remove(amount)); UpdateVisuals(); tile.UpdateVisuals(); ConsiderPressureDifference(tile, amount); } } }
public float GetMass(Air air) { float totalAirMass = air.GetMassFromPressure(); float pseudoMass = air.gases[this] * molarMass; float airMolarMass = air.GetMolarMass(); return(pseudoMass / airMolarMass * totalAirMass); }
public void Passing_Arbitrary_objects() { new Behaviour() .Given(1 == 1) .AndGiven(_bool = 1 == 2) .AndGiven(_air = new Air(), _baloon = new Baloon(_air)) .Then(_bool == false); }
public override string CompInspectStringExtra() { StringBuilder lel = new StringBuilder(); lel.Append(base.CompInspectStringExtra()); lel.AppendLine("Oxygen " + Air.ToString() + " / " + airMax.ToString()); return(lel.ToString()); }
public float GetVolume(Air air, float mass) { float moles = mass / molarMass; float totalMoles = air.GetTotalMoles() - GetMoles(air) + GetMoles(mass); float volumePct = moles / totalMoles; return(volumePct * air.volume); }
public void Passing_Arbitrary_objects() { new ExceptionBehaviour() .Given(_air = new Air()) .AndGiven(_baloon = new Baloon(_air)) .When(() => _baloon.Inflate()) .AnExceptionOfType(typeof(AlreadyInflatedException)) .IsThrownWithMessage("The baloon is already inflated"); }
private void Start() { player = PlayerController.instance; playerCollider = player.GetComponent <Collider>(); oldPlayerPos = PlayerController.instance.transform.position; o2Ctrl = player.GetComponent <OxygenController>(); capsAir = CapsuleAirController.instance.air; mesh = GetComponent <MeshFilter>().mesh; }
private void FinishSuperconduction() { // Conduct with air on my tile if I have it if (!BlocksAir) { _temperature = Air.TemperatureShare(ThermalConductivity, _temperature, HeatCapacity); } FinishSuperconduction(BlocksAir ? _temperature : Air.Temperature); }
internal static void Postfix(Player __instance, ref float __result) { if (Guard.IsGamePaused() || __instance.CanBreathe() || __result == 0) { return; } __result = Air.UpdateOxygenPerBreath(__instance, ref __result, lastBreathInterval); return; }
private void EliminarDato() { Air air = new Air(); air.a = Convert.ToInt32(txtId_Eliminar.Text); if (N_Modificar.N_EliminarD(air) == 1) { MessageBox.Show("Eliminado correctamente"); CargarDatos(); } }
public async Task <object> GetAirData() { try { return(new { data = await Air.GetData() }); } catch (Exception e) { return(new { error = e.Message }); } }
public AddAirNoteOperation(Model model, Air air, AirableNote airable) { Invoke += () => { model.NoteBook.AttachAirToAirableNote(airable, air); }; Undo += () => { model.NoteBook.DetachAirFromAirableNote(airable, out air); }; }
public int Guardar(Air air) { int rsp = 0; using (BDAEntities1 bd = new BDAEntities1()) { bd.Air.Add(air); rsp = bd.SaveChanges(); } return(rsp); }
public async Task UpdateAsync(AirDTO airDTO) { if (airDTO == null) { throw new BusinessLogicException("Требуется услуга", ""); } Air air = Mapper.Map <AirDTO, Air>(airDTO); unitOfWork.Airs.Update(air); await unitOfWork.CommitAsync(); }
public bool AssumeAir(GasMixture giver) { if (giver == null || Air == null) { return(false); } Air.Merge(giver); UpdateVisuals(); return(true); }
private void GuardarNuevo() { Air air = new Air(); air.b = txtApellido.Text; air.c = Convert.ToDouble(txtEdad.Text); air.Fecha = DateTime.Now; if (N_GuardarDatos.N_AddDatos(air) == 1) { MessageBox.Show("Guardado Correctamente"); CargarDatos(); } }
public int EliminarDato(Air air) { int rsp = 0; using (BDAEntities1 bd = new BDAEntities1()) { Air _air = bd.Air.Find(air.a); bd.Air.Remove(_air); rsp = bd.SaveChanges(); } return(rsp); }
public void Button_Air() { Sel1.SetActive(false); All.SetActive(false); Sel2.SetActive(false); Solid.SetActive(false); Sel3.SetActive(false); Liquid.SetActive(false); Sel4.SetActive(true); Air.SetActive(true); }
static void Main(string[] args) { Console.WriteLine("beigin cliebtra----------->"); Festival bus = new Bus(); Festival train = new Train(); Festival air = new Air(); bus.Happy(); train.Happy(); air.Happy(); Console.Read(); }
private void ModificarDato() { Air air = new Air(); air.a = Convert.ToInt32(txtId.Text); air.b = txtApellido.Text; air.c = Convert.ToDouble(txtEdad.Text); air.Fecha = DateTime.Now; if (N_Modificar.N_ModificarD(air) == 1) { MessageBox.Show("Modificado correctamente"); CargarDatos(); } }
public MouseButtonControl(Air.Mouse.Buttons button) { string buttonName; switch (button) { case Air.Mouse.Buttons.X1: buttonName = "XButton1"; break; case Air.Mouse.Buttons.X2: buttonName = "XButton2"; break; default: buttonName = button.ToString() + "Button"; break; } this.button = typeof(MouseState).GetProperty(buttonName); }
public void CmdRemoveBlock(int x, int y, int z) { try { if (data[x, y, z].type != BlockType.AIR) { data[x,y,z] = new Air(); RpcRemoveBlock(x, y, z); } else { Debug.LogError("Server could not remove block " + x + " " + y + " " + z + ". The block is air"); } } catch (System.IndexOutOfRangeException e) { Debug.LogError("Server could not remove block " + x + " " + y + " " + z + ". " + e.Message); return; } }
public void breath(Air air) { }
abstract public void breath(Air air);
void airServer_UserPresenceReceivedAsk(out bool isVisible, ref Air.UserInfo userInfo) { if (string.IsNullOrEmpty(UserAccountPicture)) { UserAccountPicture = AirFileExchange.Air.Helper.UserAccountPictureAsBase64(); } isVisible = true; userInfo = new AirFileExchange.Air.UserInfo() { DisplayName = Environment.UserName, ComputerName = Environment.MachineName, Icon = UserAccountPicture }; }
public TriggerControl(PlayerIndex player, Air.GamePad.Triggers trigger) { this.player = player; this.trigger = trigger; }
void airServer_UserWantToSendFiles(Air.SendFiles sendFiles, AirServer.IPEndPointHolder remotePoint, TcpClient client) { if (Dispatcher.Thread != Thread.CurrentThread) { Dispatcher.BeginInvoke(new AirServer.UserSendsFiles(airServer_UserWantToSendFiles), new object[] { sendFiles, remotePoint, client }); return; } foreach (UserIcon userIcon in PanelOfUsers.Children) { if (userIcon.RemotePoint.Equals(remotePoint)) { if (MessageBox.Show(this, string.Format("\"{0}\" wants to share {1} file(s) (~{2:0.00} MB) with you. Would you like to receive them now?", userIcon.TextDisplayName.Text, sendFiles.Count, sendFiles.Size / 1024f), "AirFileExchange - Receiving files", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { userIcon.IsCanceled = false; userIcon.LastStatus = UserIcon.OperationStatus.None; airServer.ReceiveFilesFromAsync(remotePoint, client, sendFiles, true, userIcon, new AirServer.UserReceiveFilesProgress(airServer_UserReceiveFilesProgress), new AirServer.UserReceiveFilesComplete(airServer_UserReceiveFilesComplete)); } else { airServer.ReceiveFilesFromAsync(remotePoint, client, sendFiles, false, userIcon, null, new AirServer.UserReceiveFilesComplete(airServer_UserReceiveFilesComplete)); } return; } } }
void airServer_UserPresenceReceivedRequest(Air.RequestPresence request, AirServer.IPEndPointHolder remotePoint) { if (Dispatcher.Thread != Thread.CurrentThread) { Dispatcher.BeginInvoke(new AirServer.UserPresenceRequest(airServer_UserPresenceReceivedRequest), new object[] { request, remotePoint }); return; } if (!remotePoint.IsMine) { UserIcon userIcon = new UserIcon(); userIcon.RemotePoint = remotePoint; userIcon.TextDisplayName.Text = request.UserInfo.DisplayName; userIcon.TextComputerName.Text = request.UserInfo.ComputerName; userIcon.ImageIcon.Source = AirFileExchange.Air.Helper.ImageFromBase64(request.UserInfo.Icon); userIcon.Click += new EventHandler(userIcon_Click); userIcon.DropFileList += new UserIcon.EventDropFileList(userIcon_DropFileList); PanelOfUsers.Children.Add(userIcon); userIcon.Popup(); } }
public GamePadButtonControl(PlayerIndex player, Air.GamePad.Buttons button) { this.player = player; this.button = typeof(GamePadButtons).GetProperty(button.ToString()); this.isDPadButton = false; }
public GamePadButtonControl(PlayerIndex player, Air.GamePad.DPad dPadButton) { this.player = player; this.button = typeof(GamePadDPad).GetProperty(dPadButton.ToString()); this.isDPadButton = true; }
public ThumbstickControl(PlayerIndex player, Air.GamePad.Thumbsticks t) { this.player = player; this.t = t; }
// Use this for initialization void Start() { Application.targetFrameRate = 60; data = new Block[worldX, worldY, worldZ]; for (int x = 0; x < worldX; x++) { for (int z = 0; z < worldZ; z++) { int stone = PerlinNoise (x, 0, z, 10, 3, 1.2f); stone += PerlinNoise (x, 300, z, 20, 4, 0) + 10; int dirt = PerlinNoise (x, 100, z, 50, 6, 0) + 2; for (int y = 0; y < worldY; y++) { if (y <= stone) data[x,y,z] = new Rock(); else if (y < dirt+stone) data[x,y,z] = new Dirt(); else if (y == dirt+stone) data[x,y,z] = new Grass(); else data[x, y, z] = new Air(); } } } if (isClient) { Cursor.lockState = CursorLockMode.Locked; chunks = new Chunk[Mathf.FloorToInt(worldX/chunkSize), Mathf.FloorToInt(worldY/chunkSize), Mathf.FloorToInt(worldZ/chunkSize)]; GenerateChunks(); } }
public void RpcRemoveBlock(int x, int y, int z) { data[x,y,z] = new Air(); // Sync for client UpdateChunksForBlock(x, y, z); }
/* //引入DLL函数 [DllImport("AccessWDM.dll", EntryPoint = "GetAircCount", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] private static extern int GetAircCount(string mystr); [DllImport("AccessWDM.dll", EntryPoint = "GetAirc", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] private static extern int GetAirc(IntPtr p, string mystr); [DllImport("AccessWDM.dll", EntryPoint = "GetStmcCount", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] private static extern int GetStmcCount(string mystr, string str); [DllImport("AccessWDM.dll", EntryPoint = "GetStmc", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] private static extern int GetStmc(IntPtr p, string mystr, string str); [DllImport("AccessWDM.dll", EntryPoint = "GetOperCount", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] private static extern int GetOperCount(string mystr, string str); [DllImport("AccessWDM.dll", EntryPoint = "GetOper", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] private static extern int GetOper(IntPtr p, string mystr, string str); */ /// <summary> /// WDM:飞机型号特征数据表结构描述 /// </summary> /// <param name="fileName">WDM文件路径</param> /// <returns></returns> public static Air[] getAircs() { /* if (!File.Exists(fileName)) { return null; } int c = GetAircCount(fileName); Air[] airs = new Air[c]; IntPtr[] ptArray = new IntPtr[1]; ptArray[0] = Marshal.AllocHGlobal((Marshal.SizeOf(typeof(Air))) * 100); IntPtr pt = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Air))); Marshal.Copy(ptArray, 0, pt, 1); GetAirc(pt, fileName); for (int i = 0; i < c; i++) { Air a = (Air)Marshal.PtrToStructure((IntPtr)((UInt32)ptArray[0] + i * 232), typeof(Air)); airs[i] = a; } Marshal.FreeHGlobal(ptArray[0]); Marshal.FreeHGlobal(pt); */ string connectString = getWDMDBConnectionStrings(); if (connectString == "") { return null; } using (SqlConnection sqlCnt = new SqlConnection(connectString)) { using (SqlCommand command = sqlCnt.CreateCommand()) { try { sqlCnt.Open(); string tableName = getWDMDBQueryName("WDM_AIRC"); if (tableName == "") { return null; } command.CommandText = "select count(1) from " + tableName; int c = Convert.ToInt32(command.ExecuteScalar()); Air[] airs = new Air[c]; command.CommandText = "Select * from " + tableName; SqlDataReader reader = command.ExecuteReader(); //执行SQL,返回一个“流” int i = 0; while (reader.Read()) { Air a = new Air(); a.ID = reader["id"].ToString(); a.MC = reader["MC"].ToString(); //a.XMAC = Convert.ToSingle(reader["XMAC"]); ; //a.WTNOL = Convert.ToSingle(reader["stdRIT"]); //a.WTMAX = Convert.ToSingle(reader["stdRIT"]); //a.WTMIN = Convert.ToSingle(reader["stdRIT"]); //a.stdFWD = Convert.ToSingle(reader["stdRIT"]); //a.stdAFT = Convert.ToSingle(reader["stdRIT"]); //a.stdLFT = Convert.ToSingle(reader["stdRIT"]); //a.stdRIT = Convert.ToSingle(reader["stdRIT"]); airs[i++] = a; } return airs; } catch { return null; } } } }
//Water>Fire>Dark>Earth>Air>Arcana>Water // Use this for initialization void Start() { Fire FireSpell1 = new Fire("Fireball", 1); Air AirSpell1 = new Air("Gust", 1); }