private void SetToiletMap(Object clickedItem) { Toilet selectedLoo = clickedItem as Toilet; if (AdaptiveStates.CurrentState == NarrowState) { Frame.Navigate(typeof(DetailView), selectedLoo.ObjectId); } if (lastMapPin != null) { detailMap.MapElements.Remove(lastMapPin); } lastMapPin = selectedLoo.GetMapIcon(); detailMap.MapElements.Add(lastMapPin); detailMap.Center = selectedLoo.Location; //lastMapPin = selectedLoo.UpdateToiletMap(detailMap); //detailMap.Center = selectedLoo.Location; // MapControl.SetLocation(lastMapPin, selectedLoo.Location); //detailMap.Children.Add(lastMapPin); }
void CreateToilet(string nombre) { toilet = new GameObject("Toilet"); Toilet toiletToilet = toilet.AddComponent <Toilet>(); toiletToilet.nombre = nombre; }
public static void GoToToilet(GameObject generalGameObject, NeedStatus bladderNeed) { Character2D character = generalGameObject.GetComponent <Character2D>(); List <Toilet> toilets = new List <Toilet>(Object.FindObjectsOfType <Toilet>()).Where(x => x.Occupied == false).ToList(); if (toilets.Count <= 0) { return; } Toilet chosenToilet = toilets[_randomGenerator.Next(0, toilets.Count - 1)]; chosenToilet.Occupied = true; Vector2 toiletPosition = chosenToilet.transform.position; Stack <ITask> taskChain = new Stack <ITask>(); taskChain.Push(new UseToiletTask(new ToiletData { General = character, Toilet = chosenToilet, BladderNeed = bladderNeed })); taskChain.Push(new PathfindToLocationTask(new PathfindData { Character = character, Location = toiletPosition })); character.Tasks.AddToStack(new AITaskChain(taskChain)); }
private void Start() { if (toilet == null) { toilet = FindObjectOfType <Toilet>(); } }
public IHttpActionResult PostToilet(Toilet toilet) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Toilets.Add(toilet); try { db.SaveChanges(); } catch (DbUpdateException) { if (ToiletExists(toilet.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = toilet.Id }, toilet)); }
public async Task <ActionResult <Toilet> > PostToilet(Toilet toilet) { _context.Toilet.Add(toilet); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(toilet), new { id = toilet.Id }, toilet)); }
static void Main(string[] args) { Toilet t1 = new Toilet(true); Toilet t2 = new Toilet(true); Toilet.SetUnitPrice(7); t1.Flush(); Console.WriteLine($"Total flush will use water {t1.Unit} unit"); Console.WriteLine($"Unit of water is now {Toilet.GetUnitPrice()}"); Console.WriteLine( Toilet.UnitPrice ); Toilet.UnitPrice = 8; Console.WriteLine(Toilet.GetUnitPrice()); Console.WriteLine(Toilet.UnitPrice); Console.ReadLine(); Toilet. Toilet.SetUnitPrice(15); t1.Flush(); Console.WriteLine($"Total flush will use water {t1.Unit} unit"); Console.WriteLine($"Unit of water is now {Toilet.GetUnitPrice()}"); Console.ReadLine(); t2.Flush(); Console.WriteLine($"Every flush will use water {t2.Unit} unit"); Console.WriteLine($"Unit of water is now {Toilet.GetUnitPrice()}"); Console.ReadLine(); }
public IHttpActionResult PutToilet(int id, [FromBody] Toilet toilet) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != toilet.Id) { return(BadRequest()); } db.Entry(toilet).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ToiletExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> PutToilet(long id, Toilet toilet) { if (id != toilet.Id) { return(BadRequest()); } _context.Entry(toilet).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ToiletExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
static void Main_IDispose() { System.Console.WriteLine("[1] 열기"); using (var r = new Toilet()) { System.Console.WriteLine("[2] 사용"); } }
public override bool Test(Sim a, Toilet target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (target.Repairable == null) { return(false); } return(target.Repairable.Broken); }
/// <summary> /// Use this to load a FestivalElement from a SaveFE /// </summary> /// <param name="savedFE">SaveFE to be loaded</param> /// <returns>The FestivalElement which was saved</returns> FestivalElement LoadFE(SaveableFE savedFE) { FestivalElement lfe; switch (savedFE.FEType) { case "Square": lfe = new Square(Brushes.Black, 1, 1); break; case "Triangle": lfe = new Triangle(Brushes.Black, 1, 1); break; case "Bush": lfe = new Bush(Brushes.Black, 1, 1); break; case "Stage": lfe = new Stage(Brushes.Black, 1, 1); break; case "BeerTent": lfe = new BeerTent(Brushes.Black, 1, 1); break; case "Bin": lfe = new Bin(Brushes.Black, 1, 1); break; case "CampingZone": lfe = new CampingZone(Brushes.Black, 1, 1); break; case "FairGround": lfe = new FairGround(Brushes.Black, 1, 1); break; case "FoodTent": lfe = new FoodTent(Brushes.Black, 1, 1); break; case "Shop": lfe = new Shop(Brushes.Black, 1, 1); break; case "Toilet": lfe = new Toilet(Brushes.Black, 1, 1); break; default: lfe = new Bush(Brushes.Black, 1, 1); break; } lfe.LoadData(savedFE); lfe.RenderTransform = lfe.GetTransform(); return(lfe); }
public void Init(ToiletDetailNavParams navParam) { var serialisedToilet = navParam?.SerialisedToilet; if (!string.IsNullOrEmpty(serialisedToilet)) { SelectedToilet = JsonConvert.DeserializeObject <Toilet>(serialisedToilet); } }
static void Main() { Console.WriteLine("[1] 열기"); using (var t = new Toilet()) { // 특정 프로세스 종료시 자동으로 닫기 수행 Console.WriteLine("[2] 사용"); } }
public IHttpActionResult GetToilet(int id) { Toilet toilet = db.Toilets.Find(id); if (toilet == null) { return(NotFound()); } return(Ok(toilet)); }
public void NavigateToToiletDetailPage(Toilet selectedToilet) { if (selectedToilet == null) { return; } ShowViewModel <ToiletDetailViewModel>(new ToiletDetailNavParams() { SerialisedToilet = JsonConvert.SerializeObject(selectedToilet) }); }
protected override void OnNavigatedTo(NavigationEventArgs e) { ParseHelper parseHelper = ParseHelper.Instance; var looQuery = from Toilet in parseHelper.parseToilets where Toilet.ObjectId == (String)e.Parameter select Toilet; SelectedLoo = looQuery.First(); ToiletName.Text = SelectedLoo.ToiletName; }
public IHttpActionResult PostToilet(Toilet toilet) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Toilets.Add(toilet); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = toilet.Toilets_id }, toilet)); }
void LateUpdate() { mToilet = GetComponentInParent <Toilet>(); //Cogemos la lista de materiales mMaterials = GetComponent <MeshRenderer>().materials; //La editamos SetRandom(); //La devolvemos GetComponent <MeshRenderer>().materials = mMaterials; Destroy(this); }
public ActionResult CRTPRD(string category, Product p, bool Tank = false, instalation Instalation = instalation.Напольный, drain Drain = drain.Вертикальный, form Form = form.Ассиметричная, material Material = material.Акрил, int Length = 0, int Width = 0, int Pallet_height = 0) { MyContext db = new MyContext(); if (category == "Ванны") { Bath prod = new Bath(); prod.Form = Form; prod.Material = Material; prod.Length = Length; prod.Width = Width; prod.Name = p.Name; prod.Description = p.Description; prod.Price = p.Price; prod.PathPicture = p.PathPicture; prod.ManufacturerId = p.ManufacturerId; db.Bathes.Add(prod); db.SaveChanges(); } else if (category == "Душевые кабинки") { ShowerCubicle prod = new ShowerCubicle(); prod.Form = Form; prod.Material = Material; prod.Length = Length; prod.Width = Width; prod.Pallet_height = Pallet_height; prod.Name = p.Name; prod.Description = p.Description; prod.Price = p.Price; prod.PathPicture = p.PathPicture; prod.ManufacturerId = p.ManufacturerId; db.ShowerCubicles.Add(prod); db.SaveChanges(); } else if (category == "Унитазы") { Toilet prod = new Toilet(); prod.Instalation = Instalation; prod.Drain = Drain; prod.Tank = Tank; prod.Name = p.Name; prod.Description = p.Description; prod.Price = p.Price; prod.PathPicture = p.PathPicture; prod.ManufacturerId = p.ManufacturerId; db.Toilets.Add(prod); db.SaveChanges(); } return(Redirect("/Home/ASDFGHJKL")); }
public IHttpActionResult DeleteToilet(int id) { Toilet toilet = db.Toilets.Find(id); if (toilet == null) { return(NotFound()); } db.Toilets.Remove(toilet); db.SaveChanges(); return(Ok(toilet)); }
public async Task <IActionResult> GetToiletSettings([FromQuery] string sensorId, [FromQuery] string name) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var settings = _context.ToiletsSettings .Where(s => s.Toilet.SensorId == HttpUtility.UrlDecode(sensorId)) .Select(s => new { s.ToiletId, s.UpdateFrequency, s.FanMode, s.FanThreshold }).FirstOrDefault(); if (settings != null) { return(Ok(settings)); } { var toilet = new Toilet { ToiletOwner = "[REDACTED]", ToiletName = name, SensorId = sensorId }; _context.Toilets.Add(toilet); _context.SaveChanges(); var toiletSettings = new ToiletSettings { ToiletId = toilet.ToiletId }; _context.ToiletsSettings.Add(toiletSettings); await _context.SaveChangesAsync(); var result = new List <ToiletSettings> { toiletSettings }; return(Ok(result.Select(s => new { s.ToiletId, s.UpdateFrequency, s.FanMode, s.FanThreshold }).ToList())); } }
void Awake() { toilet = GetComponent <Toilet>(); if (nombre == "") { toilet.nombre = (Random.insideUnitCircle).ToString(); } else { toilet.nombre = nombre; } Destroy(this); }
static void Main(string[] args) { // Will fail without locking!!! IToiletQueue queue = new NoLockingQueue(); // IToiletQueue queue = new SimpleLockQueue(); // IToiletQueue queue = new SemaphoreQueue(); // IToiletQueue queue = new ConcurrentToiletQueue(); int randomSeed = new Random().Next(); Random random = new Random(randomSeed); PeopleGenerator[] producers = new PeopleGenerator[Parameters.Producers]; for (int i = 0; i < producers.Length; i++) { producers[i] = new PeopleGenerator("People Generator " + i, queue, random); } Toilet[] consumers = new Toilet[Parameters.Consumers]; for (int i = 0; i < consumers.Length; i++) { consumers[i] = new Toilet("Toilet " + i, queue); } Statistics.Reset(); for (int i = 0; i < producers.Length; i++) { producers[i].Produce(); } for (int i = 0; i < consumers.Length; i++) { consumers[i].Consume(); } for (int i = 0; i < consumers.Length; i++) { consumers[i].Join(); } Statistics.Display(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); Console.ReadLine(); }
public static void RegisterFunStuffForRegisterTest(IUnityContainer container) { var aToilet = new Toilet(); aToilet.ToiletLocation = "Hiding where you least suspect it..."; container.RegisterInstance(aToilet); container.RegisterType <IElephant, Elephant>(); container.RegisterType <IClown, Clown>(); var anElephant = typeof(IElephant); var aClown = typeof(IClown); container.RegisterType <ICircus, Circus>(new InjectionConstructor(aClown, anElephant, typeof(string))); }
public static bool TestAccessible(Toilet obj, Sim sim) { int roomId = obj.RoomId; if (sim.RoomId == roomId) { return(true); } foreach (CommonDoor door in obj.LotCurrent.GetObjectsInRoom <CommonDoor>(roomId)) { if (door.IsAllowedThrough(sim)) { return(true); } } return(false); }
/// <summary> /// Iterate over root node and initialize data /// </summary> /// <param name="osm"></param> static void IterateNode(XmlNode osm) { foreach (XmlNode item in osm.ChildNodes) { INode node = CreateNode(item); if (node != null) { IterateInformation(node, item); } if (node is Node nd) { foreach (Information info in node.Informations) { if (!info.Contains("amenity")) { continue; } switch (info["amenity"]) { case Atm.Amenity: Atm.Create(nd); break; case Fuel.Amenity: Fuel.Create(nd); break; case Toilet.Amenity: Toilet.Create(nd); break; case Maintenance.Amenity: Maintenance.Create(nd); break; default: break; } } } } }
void SetRandom() { int nombre = Toilet.CalculateNumber(mToilet.nombre); int i = 0; int number = 0; //renderer.materials gives just a copy of the materials array, not a reference.Changing the materials in it doesn't have any effect on the actual materials of the renderer. //What works is to substitute the whole array at once with a new preconfigured materials array: foreach (Material mat in mMaterials) { if (allMaterials || specificMaterials[i]) { if (homogeneous) { number = nombre + 1; } else { number = (int)Mathf.Floor(nombre * (i + 1) / 3.0f); } if (material.Length > 0) { mMaterials[i] = material[Mathf.Abs((nombre + number) % material.Length)]; } if (texture.Length > 0) { mat.mainTexture = texture[Mathf.Abs((nombre - (int)(Mathf.Floor(nombre / 3.0f))) % texture.Length)]; } if (color.Length > 0) { mat.color = color[Mathf.Abs((number) % color.Length)]; } } i++; } }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { go.AddOrGet <LoopingSounds>(); go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.Toilet, false); Toilet toilet = go.AddOrGet <Toilet>(); toilet.maxFlushes = 15; toilet.solidWastePerUse = new Toilet.SpawnInfo(SimHashes.ToxicSand, 6.7f, 0f); toilet.solidWasteTemperature = 310.15f; toilet.gasWasteWhenFull = new Toilet.SpawnInfo(SimHashes.ContaminatedOxygen, 0.1f, 15f); toilet.diseaseId = "FoodPoisoning"; toilet.diseasePerFlush = 100000; toilet.diseaseOnDupePerFlush = 100000; KAnimFile[] overrideAnims = new KAnimFile[1] { Assets.GetAnim("anim_interacts_outhouse_kanim") }; ToiletWorkableUse toiletWorkableUse = go.AddOrGet <ToiletWorkableUse>(); toiletWorkableUse.overrideAnims = overrideAnims; toiletWorkableUse.workLayer = Grid.SceneLayer.BuildingFront; ToiletWorkableClean toiletWorkableClean = go.AddOrGet <ToiletWorkableClean>(); toiletWorkableClean.workTime = 90f; toiletWorkableClean.overrideAnims = overrideAnims; toiletWorkableClean.workLayer = Grid.SceneLayer.BuildingFront; Prioritizable.AddRef(go); Storage storage = go.AddOrGet <Storage>(); storage.SetDefaultStoredItemModifiers(Storage.StandardSealedStorage); storage.showInUI = true; ManualDeliveryKG manualDeliveryKG = go.AddOrGet <ManualDeliveryKG>(); manualDeliveryKG.SetStorage(storage); manualDeliveryKG.requestedItemTag = new Tag("Dirt"); manualDeliveryKG.capacity = 200f; manualDeliveryKG.refillMass = 0.01f; manualDeliveryKG.choreTypeIDHash = Db.Get().ChoreTypes.FetchCritical.IdHash; Ownable ownable = go.AddOrGet <Ownable>(); ownable.slotID = Db.Get().AssignableSlots.Toilet.Id; ownable.canBePublic = true; }
public static void Postfix(Toilet __instance, ref Worker worker) { Element element = ElementLoader.FindElementByHash(__instance.solidWastePerUse.elementID); byte index = Db.Get().Diseases.GetIndex(__instance.diseaseId); Storage massConsumptionTracker = worker.GetComponents <Storage>()[1]; GameObject go = element.substance.SpawnResource(__instance.transform.GetPosition(), massConsumptionTracker.MassStored(), __instance.solidWasteTemperature, index, __instance.diseasePerFlush, true, false, false); Traverse.Create(__instance).Field("storage").Method("Store", go, false, false, true, false).GetValue <GameObject>(); PrimaryElement component = worker.GetComponent <PrimaryElement>(); component.AddDisease(index, __instance.diseaseOnDupePerFlush, "Toilet.Flush"); PopFXManager.Instance.SpawnFX(PopFXManager.Instance.sprite_Resource, string.Format(DUPLICANTS.DISEASES.ADDED_POPFX, Db.Get().Diseases[(int)index].Name, __instance.diseasePerFlush + __instance.diseaseOnDupePerFlush), __instance.transform, Vector3.up, 1.5f, false, false); __instance.FlushesUsed++; Traverse.Create(__instance).Field("meter").Method("SetPositionPercent", (float)__instance.FlushesUsed / (float)__instance.maxFlushes).GetValue(); Tutorial.Instance.TutorialMessage(Tutorial.TutorialMessages.TM_LotsOfGerms, true); }
public override string GetInteractionName(Sim actor, Toilet target, InteractionObjectPair iop) { return base.GetInteractionName(actor, target, new InteractionObjectPair(sOldSingleton, target)); }