private void Drums_KeyPress(object sender, KeyPressEventArgs e) { switch (e.KeyChar.ToString()) { case "1": Bass.PerformClick(); break; case "2": Snare.PerformClick(); break; case "3": FloorTom.PerformClick(); break; case "4": Tom1.PerformClick(); break; case "5": Tom2.PerformClick(); break; case "6": Crash.PerformClick(); break; case "0": Hats.PerformClick(); break; } }
public void GetEquip(List <string> buffer, int section, bool clear = false) { if (buffer.Count > 0) { buffer.Clear(); } switch (section) { case 5: Weapons.ForEach(x => buffer.Add(x.ToString())); break; case 6: Skins.ForEach(x => buffer.Add(x.ToString())); break; case 7: Hats.ForEach(x => buffer.Add(x.ToString())); break; case 8: Perks.ForEach(x => buffer.Add(x.ToString())); break; case 9: Items.ForEach(x => buffer.Add(x.ToString())); break; } int min; int max; Type enm; GetEqInfo(section, out min, out max, out enm); int sz = max - min; if (sz < 0 || enm == null) { return; } if (buffer == m_ReusableBuffer || clear) { buffer.Clear(); } for (int i = 0; i <= sz; i++) { int eidx = Equip[min + i]; string str = eidx != EQP_NONE?Enum.GetName(enm, Equip[min + i]) : "None"; if (str != null && !buffer.Contains(str)) { buffer.Add(str); } } }
public ActionResult DeleteConfirmed(int id) { Hats hats = db.Hats.Find(id); db.Hats.Remove(hats); db.SaveChanges(); return(RedirectToAction("Index")); }
private static void DelegateSample() { Hats myHat = new Hats("Cowboy", 7); TryOn theHat = myHat.TryOnHat; theHat("I tried on a " + myHat.HatType + "hat that was size" + myHat.HatSize); Hats mySecondHat = new Hats(); //calling second delegate }
private static void DelegateSample() { Hats myHat = new Hats("cowboy", 7); Tryon theHat = myHat.TryOnHat; theHat("I tryon a " + myHat.HatType + "hat that was size" + myHat.HatSize); Hats mySecondHat = new Hats(); }
public ActionResult Edit([Bind(Include = "id,name,imageUrl,price")] Hats hats) { if (ModelState.IsValid) { db.Entry(hats).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(hats)); }
static void DelegateSample() { Hats myHat = new Hats("Cowboy", 7); TryOn theHat = myHat.TryOnHat; theHat("I can not fit this size of " + myHat.HatType + "; It must be a size " + myHat.HatSize); Hats mySecondHat = new Hats(); }
//Delegate example (Advanced) private static void DelegateSample() { Hats myHat = new Hats("Cowboy", 7); TryOn theHat = myHat.TryOnHat; theHat("I tried on a " + myHat.HatType + "hat that was size " + myHat.HatSize); //Another version of the delegate, independent of the above example Hats mySecond = new Hats(); }
public ActionResult Edit([Bind(Include = "HatsID,HatsName,HatsType,HatsColor,HatsSeason,HatsOccasion,HatsPhoto")] Hats hats) { if (ModelState.IsValid) { db.Entry(hats).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(hats)); }
public ActionResult Create([Bind(Include = "id,name,imageUrl,price")] Hats hats) { if (ModelState.IsValid) { db.HatsSet.Add(hats); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(hats)); }
public ActionResult Create([Bind(Include = "HatsID,HatsName,HatsType,HatsColor,HatsSeason,HatsOccasion,HatsPhoto")] Hats hats) { if (ModelState.IsValid) { db.Hats.Add(hats); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(hats)); }
public delegate void TryOn(string Type); //won't work in main public static void RunWeek5Classwork() { CollectionSample(); MultiDelegateSample(); ThreadingSample(); ExceptionSample(); void CollectionSample() { CollectionExamples mySample = new CollectionExamples(); //mySample.MyArrayListExample(); mySample.MyListExample(); } void MultiDelegateSample() { Hats moreHats = new Hats(7); TryOn someHats, niceHat, sadHat; niceHat = moreHats.FindLuckHat; niceHat("Top"); sadHat = moreHats.FindUglyHat; sadHat("Dunce"); someHats = niceHat + sadHat; someHats("Cowboy"); } void ThreadingSample() { Thread thread = new Thread(CollectionSample); thread.Start(); MultiDelegateSample(); } void ExceptionSample() { ExceptionExamples examples = new ExceptionExamples(); examples.MyException(); examples.MyThirdExample(); } }
private static void MultiDelegateSample() { Hats moreHats = new Hats(7); TryOn someHats, niceHat, sadHat; niceHat = moreHats.FindLuckyHat; niceHat("Top"); sadHat = moreHats.FindUglyHat; sadHat("Dunce"); someHats = niceHat + sadHat; someHats("Cowboy"); }
// GET: Hats/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Hats hats = db.Hats.Find(id); if (hats == null) { return(HttpNotFound()); } return(View(hats)); }
public static void MultiDelegateSample() //new method for 3rd sample Slide #10 { Hats moreHats = new Hats(7); TryOn someHats, niceHat, sadHat; //3 objects of this delegate niceHat = moreHats.FindLuckyHat; //taking the meth and assigning to the delegte niceHat("Top"); sadHat = moreHats.FindUglyHat;//another delegate to a diff method then use var of the delegate and put in the word dunce sadHat("Dunce"); someHats = niceHat + sadHat; //niceHat and sadHat are assigned to someHats and are called thru FindLucyHat thus output is Cowboy someHats("Cowboy"); // twice. }
private static void MultiDelegateSample() //slide10 { Hats moreHats = new Hats(7); ////create 3 delegate objects TryOn someHats, niceHat, sadHat; niceHat = moreHats.FindLuckyHat; niceHat("Top"); sadHat = moreHats.FindUglyHat; sadHat("Dunce"); // sad hat and nice hat are assigned to this someHats someHats = niceHat + sadHat; someHats("Cowboy"); }
public void SetState(TimeSpan elapsed, List <int> axes, List <bool> buttons, List <Hat> hats) { Time = elapsed; Axes.EnsureSize(axes.Count); Buttons.EnsureSize(buttons.Count); Hats.EnsureSize(hats.Count); for (int i = 0; i < axes.Count; i++) { Axes[i] = axes[i]; } for (int i = 0; i < buttons.Count; i++) { Buttons[i] = buttons[i]; } for (int i = 0; i < hats.Count; i++) { Hats[i] = hats[i]; } Used = false; }
public delegate void TryOn(string Type); //won't work in main public static void RunWeek4Classwork() { DelegateSample(); EventSample(); LambdaSample(); void LambdaSample() { LambdaExamples myLamb = new LambdaExamples(); //myLamb.MyLambdaOne(5); Console.WriteLine(myLamb.MyLambdaOne(5)); LambdaExamples mySecond = new LambdaExamples(23); Console.WriteLine(mySecond.MyLambdaOne(mySecond.MyValue)); } void DelegateSample() { Hats myHat = new Hats("Cowboy", 7); //old stuff TryOn theHat = myHat.TryOnHat; theHat("I tried on a " + myHat.HatType + " hat was size " + myHat.HatSize); Hats mySecond = new Hats(); } void EventSample() { Coats myCoat = new Coats(); //Instantiate the class string result = myCoat.MyResult; //Get results from the property Console.WriteLine(result); } }
public ControllerState(List <int> axes, List <bool> buttons, List <Hat> hats) { Axes.AddRange(axes); Buttons.AddRange(buttons); Hats.AddRange(hats); }
private static void Add(int idStore) { Product product; WriteLine($"Производиться добавление товара на склад:"); if (stores[idStore] is Store <FoodProduct> ) { Store <FoodProduct> store = (Store <FoodProduct>)stores[idStore]; WriteLine($"Id: {idStore}. Название: {store.Name}"); WriteLine("Выберите тип продукта: \n1 - Молочные. 2 - Хлебобулочные. 3 - Мясные."); int typeProduct = Convert.ToInt32(ReadLine()); WriteLine("Добавление нового товара на склад."); var(name, company, price, count) = GetNameCompanyPriceCount(); Write("Годен до: "); DateTime fitTo = Convert.ToDateTime(ReadLine()); int id = store.GetIdProduct; switch (typeProduct) { case 1: { product = new Milk(id, name, company, price, count, fitTo); break; } case 2: { product = new Bread(id, name, company, price, count, fitTo); break; } case 3: { product = new Meat(id, name, company, price, count, fitTo); break; } default: { throw new Exception("Неверно указан тип товара."); } } store.Add((FoodProduct)product, ReceiptProductHandler, ShipmentProductHandler, AddProductHandler, RemoveProductHandler); } else { Store <NonFoodProduct> store = (Store <NonFoodProduct>)stores[idStore]; WriteLine($"Id: {idStore}. Название: {store.Name}"); WriteLine("Выберите тип продукта: \n1 - Одежда. 2 - Шляпы. 3 - Обувь."); int typeProduct = Convert.ToInt32(ReadLine()); WriteLine("Добавление нового товара на склад."); var(name, company, price, count) = GetNameCompanyPriceCount(); Write("Гарантия: "); int guarantee = Convert.ToInt32(ReadLine()); int id = store.GetIdProduct; switch (typeProduct) { case 1: { product = new Clothes(id, name, company, price, count, guarantee); break; } case 2: { product = new Hats(id, name, company, price, count, guarantee); break; } case 3: { product = new Shoes(id, name, company, price, count, guarantee); break; } default: { throw new Exception("Неверно указан тип товара."); } } store.Add((NonFoodProduct)product, ReceiptProductHandler, ShipmentProductHandler, AddProductHandler, RemoveProductHandler); } }
static void Main(string[] args) { var hat1 = new Hats { Name = "Doggystyle", Type = "Snapback", numberInCollection = 88 }; var hat2 = new Hats { Name = "Death Row Records", Type = "Snapback", numberInCollection = 89 }; var skate1 = new RollerSkating { Boot = "Riedell 220 Boots", Plates = "Sure Grip Avanti Aluminum Plate", Wheels = "Sure-Grip FoMac Premier Mini Mac roller skate wheels 45mm" }; var skate2 = new RollerSkating { Boot = "Riedell OG Rhythm Boots", Plates = "Sure-Grip Competitor Quad Skate Plate Plates", Wheels = "Radar Varsity Plus Skate Wheels Black 57mm 8 set" }; var movie1 = new Movies { Name = "Clifford", Genre = "Comedy", Description = "Not about the big red dog" }; var movie2 = new Movies { Name = "How High", Genre = "Comedy", Description = "A movie about getting high with Redman and Method Man" }; var music1 = new Music { Song = "Hit Em' Up", Artist = "2pac", Genre = "The hardest diss song in history" }; var music2 = new Music { Song = "What's Yo Name", Artist = "T.I.", Genre = "The song that introduced me to T.I." }; Console.WriteLine($"This is a {hat1.Name}, after Snoop Dogg's first album."); Console.WriteLine($"This is a {hat2.Name} hat."); Console.WriteLine($"The {skate1.Boot} were my first pair of good skates."); Console.WriteLine($"The {skate2.Boot} are my current skates, and I love them."); Console.WriteLine($"Have you seen {movie1.Name}? Not the big red dog."); Console.WriteLine($"{movie2.Name} is my movie. Don't know how good part 2 is though."); Console.WriteLine($"{music1.Artist} is the meanest diss record in history."); Console.WriteLine($"I was introduced to {music2.Artist} back in 2001 when I heard {music2.Song}. Still my favorite song by him to this day."); }
public static void Parse_Figure() { // We set the Decrypted Flag here blnEncrypted = false; // We set the Unique Trio Booleans to False. BlnVehicle = false; blnTrap = false; blnCrystal = false; // We Reset WebCode here and early. frmMain.lblWebCode.Text = ""; // We can get the Figure// s ID and Variant ID without Needing Encryption/Decryption // Get Figure ID and Alter Ego/Variant Figures.GetFigureID_AlterEgo_Variant(); // Because Traps, Vehciles and Crystals are writing bytes to where the Nickname would normally show up, we Do NOT attempt to Decrypt here. // Though, Crystals may write here? if (!blnTrap && !blnCrystal && !BlnVehicle) { blnEncrypted = Enc_Fig(); } else if (blnTrap) { blnEncrypted = Enc_Trap(); } else if (BlnVehicle) { blnEncrypted = Enc_Veh(); } else if (blnCrystal) { // Not Implimented Yet. } if (blnEncrypted) { Decrypt(); } // Calculate the Checksums // Does NOT handle Traps or Crystals, yet. CRC16CCITT.Checksums(); // Determine if we are going to use Area 0 or Area 1 Figures.Area0orArea1(); frmArea.Area0_1(); // We break here if Vehicle, Crystal, Item or Trap if (BlnVehicle) { Application.DoEvents(); var frmVehicles = new frmVehicles(); frmVehicles.Show(); frmMain.Hide(); return; } else if (blnTrap) { Application.DoEvents(); var frmTraps = new frmTraps(); frmTraps.Show(); frmMain.Hide(); return; } else if (blnCrystal) { #if DEBUG Application.DoEvents(); var FrmCrystals = new frmCrystals(); FrmCrystals.Show(); frmMain.Hide(); return; #else frmMain.SaldeStatus.Text = "Crystals are not supported, yet."; return; #endif } // Get the Current Skill Path. Skills.GetSkillPath(); // Get the Current Hero Points value for Areas A and B. Show the Larger Value. Hero.GetHero(); // Get the Current Gold values for Areas A and B. Show the Larger Value. Gold.GetGold(); // Get EXP Exp.GetEXP(); // Get the Current Heroic Challenges value for Areas A and B. Show the Larger Value. Challenges.GetChallenges(); // Show us what Figure we got. // Show us the Figures ID and Variant ID // Figures.ShowID() // Mostly complete Detection Figures.FigureItOut(); // Select the Hat Hats.ReadHats(); // btnSaveAs.Enabled = True // btnWrite.Enabled = True Web_Code.Load(); // btnSaveAs.Enabled = True // btnWrite.Enabled = True System_ID.ReadSystem_ID(); }
// Write_Data write// s Data to the Figures. // Note that Traps, Vehicles and Crystals do NOT use this because they have their own Editor that is used. public static void Write_Data() { if (!BlnVehicle && !blnTrap && !blnCrystal) { // Set Data that changed. Challenges.WriteChallenges(); Exp.WriteEXP(); Gold.WriteGold(); Hero.WriteHero(); Nickname.SetNickname(); Hats.WriteHats(); if (frmMain.numLevel.Value >= 10) { Skills.WriteSkillPath(); } } if (blnTrap) { // Special Byte Data Writes var ZeroTrap = 0; // Add 13 to reach End of Block // 194 = 0C2 // 258 = 102 // 322 = 142 // 386 = 182 // 450 = 1C2 // 515 = 202 // Then we do Area 2 // +1C0 // 642 = 282 // 706 = 2C2 // 770 = 302 // 834 = 342 // 898 = 382 // 962 = 3C2 var trap_Name = new int[] { 194, 258, 322, 386, 450, 515, 642, 706, 770, 834, 898, 962 }; var trapCounter = 0; do { WholeFile[trap_Name[trapCounter] + ZeroTrap] = 0x0; if (ZeroTrap = 13) { ZeroTrap = 0; trapCounter += 1; } else { ZeroTrap += 1; } } while (trapCounter != 12); } else if (BlnVehicle) { // Special Byte Data Writes var ZeroVehicle = 0; // 192 = 0C0 // +1C0 // 640 = 280 do { WholeFile[192 + ZeroVehicle] = 0x0; ZeroVehicle += 1; } while (ZeroVehicle != 14); ZeroVehicle = 0; do { WholeFile[640 + ZeroVehicle] = 0x0; ZeroVehicle += 1; } while (ZeroVehicle != 14); } else if (blnCrystal) { // Special Byte Data Writes // Not Implimented, Yet. } // All Figures need these Functions still. // Write the System ID System_ID.WriteSystem(); // Fix Read/Write Blocks Figures.Fixing_Bytes(); // In theory, this will fix any issues with the Edited Dumps. Figures.SetArea0AndArea1(); // Fix the Checksums. CRC16CCITT.WriteCheckSums(); }
// Update is called once per frame void Update() { gameObject.transform.localScale = new Vector3(-facing, 1, 1); if (gameObject.GetComponent<Rigidbody2D>().velocity.x > 0) { facing = 1; } if (gameObject.GetComponent<Rigidbody2D>().velocity.x < 0) { facing = -1; } //|| (Input.GetButtonDown("Throw_Y_Player2") && player == 2) if (((Input.GetButtonDown("Throw_Y_Player1") && player == 1) || (Input.GetButtonDown("Throw_Y_Player2") && player == 2)) && hat != Hats.none) { GameObject thrownHat = Instantiate(pickup, hatSprite.transform.position + new Vector3 (0, 1, 0), Quaternion.identity) as GameObject; thrownHat.GetComponent<Pickups>().itemSprite = hatSprite.GetComponent<SpriteRenderer>().sprite; thrownHat.GetComponent<Pickups>().itemType = "Hat"; thrownHat.GetComponent<Pickups>().points = hatPoints; thrownHat.GetComponent<Rigidbody2D>().velocity = new Vector2(10 * facing, 3); thrownHat.GetComponent<SpriteRenderer>().sprite = hatSprite.GetComponent<SpriteRenderer>().sprite; hatSprite.GetComponent<SpriteRenderer>().sprite = new Sprite(); if (player == 1) { female.GetComponent<GameManager>().player1Points -= hatPoints; } else { female.GetComponent<GameManager>().player2Points -= hatPoints; } hat = Hats.none; hatPoints = 0; } if (((Input.GetButtonDown("Throw_X_Player1") && player == 1) || (Input.GetButtonDown("Throw_X_Player2") && player == 2)) && glasses != Glasses.none) { GameObject thrownGlasses = Instantiate(pickup, hatSprite.transform.position + new Vector3(0, 1, 0), Quaternion.identity) as GameObject; thrownGlasses.GetComponent<Pickups>().itemSprite = glassesSprite.GetComponent<SpriteRenderer>().sprite; thrownGlasses.GetComponent<Pickups>().itemType = "Glasses"; thrownGlasses.GetComponent<Pickups>().points = glassesPoints; thrownGlasses.GetComponent<Rigidbody2D>().velocity = new Vector2(10 * facing, 3); thrownGlasses.GetComponent<SpriteRenderer>().sprite = glassesSprite.GetComponent<SpriteRenderer>().sprite; glassesSprite.GetComponent<SpriteRenderer>().sprite = new Sprite(); if (player == 1) { female.GetComponent<GameManager>().player1Points -= glassesPoints; } else { female.GetComponent<GameManager>().player2Points -= glassesPoints; } glasses = Glasses.none; glassesPoints = 0; } if (((Input.GetButtonDown("Throw_B_Player1") && player == 1) || (Input.GetButtonDown("Throw_B_Player2") && player == 2)) && scarf != Scarves.none) { GameObject thrownScarf = Instantiate(pickup, hatSprite.transform.position + new Vector3(0, 1, 0), Quaternion.identity) as GameObject; thrownScarf.GetComponent<Pickups>().itemSprite = scarfSprite.GetComponent<SpriteRenderer>().sprite; thrownScarf.GetComponent<Pickups>().itemType = "Scarf"; thrownScarf.GetComponent<Pickups>().points = scarfPoints; thrownScarf.GetComponent<Rigidbody2D>().velocity = new Vector2(10 * facing, 3); thrownScarf.GetComponent<SpriteRenderer>().sprite = scarfSprite.GetComponent<SpriteRenderer>().sprite; scarfSprite.GetComponent<SpriteRenderer>().sprite = new Sprite(); if (player == 1) { female.GetComponent<GameManager>().player1Points -= scarfPoints; } else { female.GetComponent<GameManager>().player2Points -= scarfPoints; } scarf = Scarves.none; scarfPoints = 0; } }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Pickup") { if (other.GetComponent<Pickups>().itemType == "Hat") { hat = Hats.hat; hatSprite.GetComponent<SpriteRenderer>().sprite = other.GetComponent<Pickups>().itemSprite; Destroy(other.gameObject); if (player == 1) { female.GetComponent<GameManager>().player1Points += other.GetComponent<Pickups>().points; female.GetComponent<GameManager>().player1Points -= hatPoints; hatPoints = other.GetComponent<Pickups>().points; } if (player == 2) { female.GetComponent<GameManager>().player2Points += other.GetComponent<Pickups>().points; female.GetComponent<GameManager>().player2Points -= hatPoints; hatPoints = other.GetComponent<Pickups>().points; } } if (other.GetComponent<Pickups>().itemType == "Scarf") { scarf = Scarves.scarf; scarfSprite.GetComponent<SpriteRenderer>().sprite = other.GetComponent<Pickups>().itemSprite; Destroy(other.gameObject); if (player == 1) { female.GetComponent<GameManager>().player1Points += other.GetComponent<Pickups>().points; female.GetComponent<GameManager>().player1Points -= scarfPoints; scarfPoints = other.GetComponent<Pickups>().points; } if (player == 2) { female.GetComponent<GameManager>().player2Points += other.GetComponent<Pickups>().points; female.GetComponent<GameManager>().player2Points -= scarfPoints; scarfPoints = other.GetComponent<Pickups>().points; } } if (other.GetComponent<Pickups>().itemType == "Glasses") { glasses = Glasses.glasses; glassesSprite.GetComponent<SpriteRenderer>().sprite = other.GetComponent<Pickups>().itemSprite; Destroy(other.gameObject); if (player == 1) { female.GetComponent<GameManager>().player1Points += other.GetComponent<Pickups>().points; female.GetComponent<GameManager>().player1Points -= glassesPoints; glassesPoints = other.GetComponent<Pickups>().points; } if (player == 2) { female.GetComponent<GameManager>().player2Points += other.GetComponent<Pickups>().points; female.GetComponent<GameManager>().player2Points -= glassesPoints; glassesPoints = other.GetComponent<Pickups>().points; } } } }