public override void Paint(Level Level) { base.Paint(Level); Entity prop; var r = Rnd.Int(3); if (r == 0) { prop = new VendingMachine(); } else if (r == 1) { prop = new Charger(); } else { prop = new Safe(); } Level.Area.Add(prop); prop.Center = GetCenter() * 16 + new Vector2(Rnd.Float(-8, 8), Rnd.Float(-8, 8)); for (var i = 0; i < Rnd.Int(1, Run.Depth); i++) { var item = Items.CreateAndAdd("bk:emerald", Level.Area); item.Center = GetRandomFreeCell() * 16 + new Vector2(Rnd.Float(-4, 4), Rnd.Float(-4, 4)); } }
// Forgive me father for I have sinned // someone replace this horrid code.... maybe loop through types and reflect them all OR circumvent the need for this public static Optional <Equipment> GetBasedOnOwnersType(GameObject owner) { Charger charger = owner.GetComponent <Charger>(); if (charger != null) { return(Optional <Equipment> .Of((Equipment)charger.ReflectionGet("equipment"))); } BaseNuclearReactor baseNuclearReactor = owner.GetComponent <BaseNuclearReactor>(); if (baseNuclearReactor != null) { return(Optional <Equipment> .Of((Equipment)baseNuclearReactor.ReflectionGet("_equipment"))); } CyclopsDecoyLoadingTube cyclopsDecoyLoadingTube = owner.GetComponent <CyclopsDecoyLoadingTube>(); if (cyclopsDecoyLoadingTube != null) { return(Optional <Equipment> .Of(cyclopsDecoyLoadingTube.decoySlots)); } Exosuit exosuit = owner.GetComponent <Exosuit>(); if (exosuit != null) { return(Optional <Equipment> .Of(exosuit.modules)); } SeaMoth seamoth = owner.GetComponent <SeaMoth>(); if (seamoth != null) { return(Optional <Equipment> .Of(seamoth.modules)); } UpgradeConsole upgradeConsole = owner.GetComponent <UpgradeConsole>(); if (upgradeConsole != null) { return(Optional <Equipment> .Of(upgradeConsole.modules)); } Vehicle vehicle = owner.GetComponent <Vehicle>(); if (vehicle != null) { return(Optional <Equipment> .Of(vehicle.modules)); } VehicleUpgradeConsoleInput vehicleUpgradeConsoleInput = owner.GetComponent <VehicleUpgradeConsoleInput>(); if (vehicleUpgradeConsoleInput != null) { return(Optional <Equipment> .Of(vehicleUpgradeConsoleInput.equipment)); } return(Optional <Equipment> .Empty()); }
void Start() { RemainingGameTime = 300f; lastSpawnInvoked = RemainingGameTime; lastHeartSpawned = RemainingGameTime; lasSeedSpawned = RemainingGameTime; pollutionLevel = MaxPollutionLevel / 4f; IsGameEnded = false; IsPaused = false; playerHealth = Player.GetComponent <Health>(); playerCharge = Player.GetComponent <Charger>(); isEnemySpawned = false; pollutionFixed = false; IsLowCharge = false; IsLowHealth = false; IsLowCharge = false; HeartCount = 0; SeedCount = 0; LowHealth.SetActive(false); LowCharge.SetActive(false); Suffocating.SetActive(false); PollutionZero.text = "[ ]"; KilledEnemy.text = "[ ]"; }
public async Task <IActionResult> Edit(int id, [Bind("chargerId,chargerName,chargerPort,chargerPrice")] Charger charger) { if (id != charger.chargerId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(charger); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ChargerExists(charger.chargerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(charger)); }
/* * 访问者模式:表示一个作用于某对象结构中的各个元素的操作。它可以在不改变各元素的类的前提下定义作用于这些元素的新的操作。——《设计模式》GoF * * 使用频率:★☆☆☆☆ * * 模式的组成: * * (1)抽象访问者角色(Vistor): 声明一个包括多个访问操作,多个操作针对多个具体节点角色(可以说有多少个具体节点角色就有多少访问操作),使得所有具体访问者必须实现的接口。 * 如:[Visitor] * * (2)具体访问者角色(ConcreteVistor):实现抽象访问者角色中所有声明的接口,也可以说是实现对每个具体节点角色的新的操作。 * 如:[Charger,Fetcher] * * (3)抽象节点角色(Element):声明一个接受操作,接受一个访问者对象作为参数,如果有其他参数,可以在这个“接受操作”里在定义相关的参数。 * 如:[Medicine] * * (4)具体节点角色(ConcreteElement):实现抽象元素所规定的接受操作。 * 如:[XiaoYanMedicine,ZhiTengMedicine] * * (5)结构对象角色(ObjectStructure):节点的容器,可以包含多个不同类或接口的容器。 * 如:[Prescription] * */ static void Main(string[] args) { //医生开药单 Prescription prescription = new Prescription(); prescription.AddMedicine(new ZhiTengMedicine("止疼药1", 25)); prescription.AddMedicine(new XiaoYanMedicine("消炎药1", 26)); prescription.AddMedicine(new XiaoYanMedicine("消炎药2", 35)); //两个访问者 var visitor1 = new Charger(); var visitor2 = new Fetcher(); Console.WriteLine("===============划价员访问==============="); prescription.AcceptVisitor(visitor1); Console.WriteLine("===============取药员访问==============="); prescription.AcceptVisitor(visitor2); Console.ReadKey(); /* * 总结: * 1.访问者模式中的元素的数据结构相对稳定,但是访问者可能是多个,而且访问者的操作可能不尽相同。 * 2.访问者模式的核心是在于把不同的操作变成了不同的访问者,这样就可以扩展更多的操作和算法。 * * 中心思想:当一些对象的数据或特性相对稳定时,对该对象的操作可能五花八门各不一样,这时我们就可以用访问者模式。 */ }
private void OnTriggerStay2D(Collider2D collision) { tempbullet = collision.GetComponent <colorBullet>(); templayzer = collision.GetComponent <Layzercolor>(); if (tempbullet != null) { if (tempbullet.bulletcol == m_color) { tempcharge = collision.GetComponent <Charger>(); hp -= tempbullet.bulletdamage; if (tempcharge != null) { tempcharge.spread(); } Destroy(collision.gameObject); } } else if (templayzer != null) { if (templayzer.bulletcol == m_color && !invi) { invi = true; StartCoroutine("invitime"); hp -= templayzer.bulletdamage;; } } }
public void SaveUnitsConfiguration() { Needle.SaveConfiguration("NeedleConfiguration"); Conveyor.SaveConfiguration("ConveyorConfiguration"); Charger.SaveConfiguration("ChargerConfiguration"); Rotor.SaveConfiguration("RotorConfiguration"); Pomp.SaveConfiguration("PompConfiguration"); }
public void LoadUnitsConfiguration() { Needle.LoadConfiguration("NeedleConfiguration"); Conveyor.LoadConfiguration("ConveyorConfiguration"); Charger.LoadConfiguration("ChargerConfiguration"); Rotor.LoadConfiguration("RotorConfiguration"); Pomp.LoadConfiguration("PompConfiguration"); }
public AbstractAdult CreateInstance() { AbstractAdult _adult = new Charger() { Name = "李四主管" }; return(_adult); }
private Dictionary <string, IBattery> GetChargerBatteries(Charger charger) { if (Charger_batteries == null) { Charger_batteries = typeof(Charger).GetField("batteries", BindingFlags.NonPublic | BindingFlags.Instance); } return((Dictionary <string, IBattery>)Charger_batteries.GetValue(charger)); }
public override void Paint(Level level) { base.Paint(level); var charger = new Charger(); level.Area.Add(charger); charger.BottomCenter = GetCenterVector(); }
public virtual void StopCharging() { if (ChargerInstance == null) { return; } ChargerInstance.Detach(); ChargerInstance = null; }
public async Task <IActionResult> ConfirmDeleteFromChargers_list(int?id) { if (id != null) { Charger find_part = await PartsContext.Chargers.FirstOrDefaultAsync(p => p.Id == id); return(DeleteView(find_part, "Chargers_list")); } return(NotFound()); }
public async Task <IActionResult> Create([Bind("id,Start_,End_,Hours_,OnTheRanch")] Charger charger) { if (ModelState.IsValid) { _context.Add(charger); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(charger)); }
public async Task <IEnumerable <Charger> > PostCharger([FromBody] Charger value) { if (User.Identity.IsAuthenticated) { return(await _componentService.AddCharger(new AddChargerRequest(value))); } else { throw new UnauthorizedAccessException("Only admin can make changes. Have a nice day and f**k off ;)"); } }
public void PowerSupply() { FakeInOut fakeInOut = new FakeInOut(); Charger headsetIPhone = new Charger(fakeInOut); fakeInOut.FakeWrite = ""; headsetIPhone.PowerSupply(new object()); var expectedString = $"{nameof(Charger)} connected to USB, charging mobile device"; Assert.AreEqual(expectedString, fakeInOut.FakeWrite); }
public ActionResult Edit([Bind(Include = "Id,LocationID,Availability,InsertDate,UpdateDate,DeleteDate,IsDeleted,ChargerName")] Charger charger) { if (ModelState.IsValid) { charger.UpdateDate = DateTime.UtcNow; db.Entry(charger).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.LocationID = new SelectList(db.Locations, "ID", "LocationName", charger.LocationID); return(View(charger)); }
/// <summary> /// /// </summary> /// <param name="element">Element to be added</param> public AddChargerRequest(Charger element) { _element = element; _parameters = new List <SqlParameter> { new SqlParameter("@series", _element.Series), new SqlParameter("@sertificate", _element.Sertificate80Plus), new SqlParameter("@connector", _element.ConnectorType) }; if (Validate <string>(_element.Title, "element.Title")) { _parameters.Add(new SqlParameter("@title", _element.Title)); } if (Validate <string>(_element.Company, "element.Company")) { _parameters.Add(new SqlParameter("@company", _element.Company)); } if (Validate <int>(_element.Power, "element.Power")) { _parameters.Add(new SqlParameter("@power", _element.Power)); } if (Validate <int>(_element.VideoConnectorsAmount, "element.VideoConnectorsAmount")) { _parameters.Add(new SqlParameter("@videoConnAmount", _element.VideoConnectorsAmount)); } if (Validate <string>(_element.VideocardConnector, "element.VideocardConnector")) { _parameters.Add(new SqlParameter("@videocardPin", _element.VideocardConnector)); } if (Validate <int>(_element.SATAAmount, "element.SATAAmount")) { _parameters.Add(new SqlParameter("@sata", _element.SATAAmount)); } if (Validate <int>(_element.IDEAmount, "element.IDEAmount")) { _parameters.Add(new SqlParameter("@ide", _element.IDEAmount)); } if (Validate <string>(_element.MotherboardConnector, "element.MotherboardConnector")) { _parameters.Add(new SqlParameter("@motherboardPin", _element.MotherboardConnector)); } }
public string InsertFeesListremarks(long projectID, string projectName, string submitPerson, double buildingArea, string recipient, string depart, int chargetype, double total, DateTime chargetime, string txtremarx, string chargeDetail, string chargeExtra, string whereTransfer, double centiCnt, double feeNumbers2) { string seqNo = ""; var ch = from a in db.Charger orderby a.ID descending select a; string seqNostr = string.Empty; try { Charger charge = new Charger(); charge.charger1 = ""; charge.ID = Convert.ToInt32(ch.First().ID) + 1; charge.searchNo = projectID; charge.itemName = projectName; charge.unitName = projectName; charge.buildingArea = buildingArea; charge.fromDepartment = depart; charge.chargeExtra = chargeExtra;//1:档案馆整理费2:报送单位整理费 charge.chargeDetail = chargeDetail; charge.chargeClassify = chargetype; charge.totalExpense = Convert.ToDecimal(total); charge.theoryExpense = Convert.ToDecimal(feeNumbers2); charge.isCharge = false; charge.chargeTime = chargetime; charge.remarks = txtremarx; charge.whereTransfer = Int32.Parse(whereTransfer.Trim()); charge.centiCnt = centiCnt; charge.isBack = false; charge.backNote = string.Empty; charge.@operator = recipient; //增加一条数据,自动添加财务编号 int id = GetMaxId(); charge.ID = id; seqNostr = getCurDayMaxSeqNo(); seqNo = seqNostr; charge.seqNo = seqNostr; charge.backNote = ""; //增加一条记录并返回最大收费编号 if (ModelState.IsValid) { db.Charger.Add(charge); db.SaveChanges(); } } catch (Exception e) { seqNo = "error" + e.Message; } return(seqNo); }
private void RfidDetected() { int id; id = Rfid; switch (State) { case PhoneLockerState.Available: //DoorLocked = false; if (Charger.Connected) { Door.LockDoor(); Logging.Write(DateTime.Now.ToString("HH:mm:ss") + ": Skab laast med RFID: " + id); Charger.StartCharge(); oldId = id; Display.DisplayText("Brug RFID til at låse skab op."); Display.DisplayCharge("Skabet er nu optaget og opladning påbegyndes."); State = PhoneLockerState.Locked; } else { Display.DisplayText("Din telefon er ikke ordentlig tilsluttet. Prøv igen."); } break; case PhoneLockerState.DoorOpen: // Ignore break; case PhoneLockerState.Locked: // Check for correct ID if (id == oldId) { Charger.StopCharge(); Door.UnlockDoor(); Console.Clear(); Logging.Write(DateTime.Now.ToString("HH:mm:ss") + ": Skab laast op med RFID: " + id); Display.DisplayText("Tag din telefon ud af skabet og luk døren"); Display.DisplayText("Skabet er nu ledigt"); State = PhoneLockerState.Available; } else { Display.DisplayText("Forkert RFID tag"); } break; } }
public async Task <IActionResult> DeleteChargers_list(int?id) { if (id != null) { Charger find_part = new Charger { Id = id.Value }; await DeletePart(find_part); return(RedirectToAction("Index")); } return(NotFound()); }
public override void Run() { string phone = "Мобила"; var charger = new Charger(); IPowerbank powerbank = new Powerbank(); //charger.ChargePhone(phone, powerbank); // Мы не можем зарядить телефон через powerbank (слишком медленно). Давайте трансформируем его IFastCharge charge = new PowerbankAdapter(powerbank); // Трансформируем powerbank через адаптер charger.ChargePhone(phone, charge); // Ого, заряжает! }
private void Awake() { charger = GetComponent <Charger>(); //audioData = GetComponent<AudioSource>(); health = GetComponent <Health>(); if (health != null) { health.SetDeathDelegate(this.Die); } rb = GetComponent <Rigidbody>(); //audioData.loop = true; }
public ActionResult Delete(Charger charger) { using (EVModelEntities entities = new EVModelEntities()) { Charger updatedCharger = (from c in entities.Chargers where c.Id == charger.Id select c).FirstOrDefault(); updatedCharger.DeleteDate = DateTime.UtcNow; updatedCharger.IsDeleted = true; entities.SaveChanges(); } return(RedirectToAction("Index")); }
// GET: Chargers/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Charger charger = db.Chargers.Find(id); if (charger == null) { return(HttpNotFound()); } return(View(charger)); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Charger = await _context.Chargers.FirstOrDefaultAsync(m => m.ID == id); if (Charger == null) { return(NotFound()); } return(Page()); }
// GET: Chargers/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Charger charger = db.Chargers.Find(id); if (charger == null) { return(HttpNotFound()); } ViewBag.LocationID = new SelectList(db.Locations, "ID", "LocationName", charger.LocationID); return(View(charger)); }
public static void NewClass() { Charger.Clear(); Charger.level = 0; CurrentGame.game.memoryGeneral.humanClassProgress.charger.level = 0; CurrentGame.game.memoryGeneral.humanClassProgress.charger.name = "Charger"; CurrentGame.game.memoryGeneral.humanClassProgress.charger.movement = 5; CurrentGame.game.memoryGeneral.humanClassProgress.charger.classWeapons.classWeapon1.type = "Heavy Blades"; CurrentGame.game.memoryGeneral.humanClassProgress.charger.classWeapons.classWeapon1.rank = 3; CurrentGame.game.memoryGeneral.humanClassProgress.charger.classWeapons.classWeapon2.type = "Spears"; CurrentGame.game.memoryGeneral.humanClassProgress.charger.classWeapons.classWeapon2.rank = 3; CurrentGame.game.memoryGeneral.humanClassProgress.charger.caps = Charger.Caplist(); LevelUpClass(); }
private static void Postfix(Charger __instance, string slot, InventoryItem item, Dictionary <string, SlotDefinition> ___slots) { if (___slots.TryGetValue(slot, out SlotDefinition slotDefinition)) { GameObject battery = slotDefinition.battery; Pickupable pickupable = item?.item; if (battery != null && pickupable != null && Main.abyssBatteries.Contains(pickupable.GetTechType())) { battery.EnsureComponent <PulsatingBehaviour>(); // Ensure the Pulsating Behaviour when the battery is in a charger } else if (battery != null && battery.TryGetComponent(out PulsatingBehaviour pulsatingBehaviour)) { GameObject.Destroy(pulsatingBehaviour); } } }
private static void Postfix(Charger __instance, string slot, InventoryItem item, Dictionary <string, SlotDefinition> ___slots) { if (___slots.TryGetValue(slot, out SlotDefinition slotDefinition)) { GameObject battery = slotDefinition.battery; Pickupable pickupable = item?.item; if (battery != null && pickupable != null && Main.unobtaniumBatteries.Contains(pickupable.GetTechType())) { battery.EnsureComponent <UnobtaniumBehaviour>(); } else if (battery != null && battery.TryGetComponent(out UnobtaniumBehaviour unobtaniumBehaviour)) { GameObject.Destroy(unobtaniumBehaviour); } } }