public async Task <int> AddEvent(EventAddingBindingModel model) { DanceType dance = DbContext .DanceTypes .FirstOrDefault(dt => dt.Name == model.Dance); if (model.Address == null) { model.Address = model.Place; } Event @event = new Event() { Name = model.Name, Dance = dance, Place = model.Place, Address = model.Address, PosterUrl = model.PosterUrl, StartDate = model.StartDate, EndDate = model.EndDate }; await this.DbContext.Events.AddAsync(@event); await this.DbContext.SaveChangesAsync(); return(@event.Id); }
private void CreateInitialEvents() { DanceType dance = (new DanceType() { Name = "Folklor" }); this.context.Events.Add(new Event() { Name = "Gergiovden", Place = "Stefanovo", Address = "Stefanovo", Dance = dance, PosterUrl = "https://imageshack.com/a/img924/5145/O5s8hO.jpg", StartDate = DateTime.Now, EndDate = DateTime.Now.AddDays(2) }); this.context.Events.Add(new Event() { Name = "Trakia", Place = "Plovdiv", Address = "Plovdiv20", Dance = dance, PosterUrl = "https://imageshack.com/a/img924/5145/O5s8hO.jpg", StartDate = DateTime.Now, EndDate = DateTime.Now.AddDays(2) }); this.context.SaveChanges(); }
public void SetMoveFromIndex(int index, DanceType type) { switch (index) { case 1: move1 = type; break; case 2: move2 = type; break; case 3: move3 = type; break; case 4: move4 = type; break; case 5: move5 = type; break; case 6: move6 = type; break; case 7: move7 = type; break; case 8: move8 = type; break; case 9: move9 = type; break; default: break; } }
public ActionResult DeleteConfirmed(int id) { DanceType danceType = db.DanceTypes.Find(id); db.DanceTypes.Remove(danceType); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,ParentID,Name,IsActive,CreateDate,UpdateDate,CreateUserID,UpdateUserID")] DanceType danceType) { if (ModelState.IsValid) { db.Entry(danceType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(danceType)); }
public ActionResult Edit([Bind(Include = "DanceTypeID,Dance")] DanceType danceType) { if (ModelState.IsValid) { db.Entry(danceType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(danceType)); }
public void PlayerHitNextDanceMoveInSequence() { int index = danceSequenceIndex++; DanceType danceMoveType = danceMoveSequence.GetMoveFromIndex(index); if (danceMoveType == DanceType.NONE) { return; } if (!player.HasHitMove(realMoveDanceSequenceIndex++)) { monster.Growl(); if (++totalMissCount > maxMissCount) { SceneManager.LoadScene("DeathScene"); } return; } switch (danceMoveType) { case DanceType.UP: player.HitUpMove(); monster.HitUpMove(shortSound: false, soundOn: false); break; case DanceType.DOWN: player.HitDownMove(); monster.HitDownMove(shortSound: false, soundOn: false); break; case DanceType.LEFT: player.HitLeftMove(); monster.HitLeftMove(shortSound: false, soundOn: false); break; case DanceType.RIGHT: player.HitRightMove(); monster.HitRightMove(shortSound: false, soundOn: false); break; case DanceType.TWIST: player.HitTwistMove(); monster.HitTwistMove(shortSound: false, soundOn: false); break; case DanceType.POSE: player.HitPoseMove(); monster.HitPoseMove(shortSound: false, soundOn: false); break; case DanceType.NONE: break; } }
public ActionResult Create([Bind(Include = "ID,ParentID,Name,IsActive,CreateDate,UpdateDate,CreateUserID,UpdateUserID")] DanceType danceType) { if (ModelState.IsValid) { db.DanceTypes.Add(danceType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(danceType)); }
public ActionResult Create([Bind(Include = "DanceTypeID,Dance")] DanceType danceType) { if (ModelState.IsValid) { db.DanceTypes.Add(danceType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(danceType)); }
void Update() { if (!isPlayerTurn || danceKeyHitIndex > activeDanceKeyGroup.NumberOfKeys) { return; } DanceType nextDanceKey = ActiveTrimmedDanceSequence.GetMoveFromIndex(danceKeyHitIndex); Sprite redArrow = null; switch (nextDanceKey) { case DanceType.UP: redArrow = redUpArrow; break; case DanceType.DOWN: redArrow = redDownArrow; break; case DanceType.LEFT: redArrow = redLeftArrow; break; case DanceType.RIGHT: redArrow = redRightArrow; break; case DanceType.TWIST: redArrow = redXArrow; break; case DanceType.POSE: redArrow = redCArrow; break; } if (Keyboard.current.upArrowKey.wasPressedThisFrame) { CheckDanceKeyPressed(nextDanceKey, DanceType.UP, greenUpArrow, redArrow); } else if (Keyboard.current.downArrowKey.wasPressedThisFrame) { CheckDanceKeyPressed(nextDanceKey, DanceType.DOWN, greenDownArrow, redArrow); } else if (Keyboard.current.leftArrowKey.wasPressedThisFrame) { CheckDanceKeyPressed(nextDanceKey, DanceType.LEFT, greenLeftArrow, redArrow); } else if (Keyboard.current.rightArrowKey.wasPressedThisFrame) { CheckDanceKeyPressed(nextDanceKey, DanceType.RIGHT, greenRightArrow, redArrow); } else if (Keyboard.current.xKey.wasPressedThisFrame) { CheckDanceKeyPressed(nextDanceKey, DanceType.TWIST, greenXArrow, redArrow); } else if (Keyboard.current.cKey.wasPressedThisFrame) { CheckDanceKeyPressed(nextDanceKey, DanceType.POSE, greenCArrow, redArrow); } }
// GET: Admin/DanceTypes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DanceType danceType = db.DanceTypes.Find(id); if (danceType == null) { return(HttpNotFound()); } return(View(danceType)); }
public void CheckDanceKeyPressed(DanceType nextDanceKey, DanceType wantedDanceKey, Sprite greenSprite, Sprite redSprite) { int index = danceKeyHitIndex++ - 1; if (nextDanceKey == wantedDanceKey) { activeDanceKeyGroup.SetKeySprite(index, greenSprite); hitMoves[index] = true; } else { activeDanceKeyGroup.SetKeySprite(index, redSprite); activeDanceKeyGroup.ShakeKey(index); AudioManager.PlayWrongNoteSound(); } }
private void CreateInitialRewards() { DanceType dance = (new DanceType() { Name = "Folklor" }); this.context.Events.Add(new Event() { Id = 1, Name = "Gergiovden", Place = "Stefanovo", Address = "Stefanovo", Dance = dance, PosterUrl = "https://imageshack.com/a/img924/5145/O5s8hO.jpg", StartDate = DateTime.Now, EndDate = DateTime.Now.AddDays(2) }); this.context.Rewards.Add(new Reward() { Id = 1, Name = "First Place", Description = "Best Performance", EventId = 1, ImageUrl = "https://imageshack.com/a/img924/5145/O5s8hO.jpg" }); this.context.Rewards.Add(new Reward() { Id = 2, Name = "Second Place", Description = "Second Best Performance", EventId = 1, ImageUrl = "https://imageshack.com/a/img924/5145/O5s8hO.jpg" }); this.context.SaveChanges(); }
public static void SeedData(this IApplicationBuilder app) { using (IServiceScope serviceScope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope()) { AbraksContext db = serviceScope.ServiceProvider.GetService <AbraksContext>(); DanceType initialDance = db.DanceTypes.FirstOrDefault(t => t.Name == "Folklor"); if (initialDance == null) { db.DanceTypes.Add(new DanceType() { Name = "Folklor" }); db.DanceTypes.Add(new DanceType() { Name = "Salsa" }); } db.SaveChanges(); Event initialEvent = db.Events.FirstOrDefault(c => c.Name == "Gergiovden"); if (initialEvent == null) { db.Events.Add(new Event() { Name = "Gergiovden", Place = "Stefanovo", Address = "Stefanovo", Dance = initialDance, PosterUrl = "https://imageshack.com/a/img924/5145/O5s8hO.jpg", StartDate = DateTime.Now, EndDate = DateTime.Now.AddDays(2) }); } db.SaveChanges(); } }
public void MonsterHitNextDanceMoveInSequence() { int index = danceSequenceIndex++; DanceType danceMoveType = danceMoveSequence.GetMoveFromIndex(index); if (danceMoveType == DanceType.NONE) { return; } switch (danceMoveType) { case DanceType.UP: if (HasDoubleTime(index)) { monster.HitUpMove(shortSound: false); } else { monster.HitUpMove(shortSound: true); } break; case DanceType.DOWN: if (HasDoubleTime(index)) { monster.HitDownMove(shortSound: false); } else { monster.HitDownMove(shortSound: true); } break; case DanceType.LEFT: if (HasDoubleTime(index)) { monster.HitLeftMove(shortSound: false); } else { monster.HitLeftMove(shortSound: true); } break; case DanceType.RIGHT: if (HasDoubleTime(index)) { monster.HitRightMove(shortSound: false); } else { monster.HitRightMove(shortSound: true); } break; case DanceType.TWIST: if (HasDoubleTime(index)) { monster.HitTwistMove(shortSound: false); } else { monster.HitTwistMove(shortSound: true); } break; case DanceType.POSE: if (HasDoubleTime(index)) { monster.HitPoseMove(shortSound: false); } else { monster.HitPoseMove(shortSound: true); } break; case DanceType.NONE: break; } player.DisplayNextRedCharacterInDanceKeyGroup(); }