public void AddBonus(ScoreTypes type, string name, float amount) { if (bonuses.Count > 0) { if (bonuses[bonuses.Count - 1].type == type) { bonuses[bonuses.Count - 1].AddPoints(amount); return; } } GameObject go = Instantiate(display, transform); TextMeshProUGUI textElement = go.GetComponentInChildren <TextMeshProUGUI>(); Bonus b = go.GetComponent <Bonus>(); b.title = name; b.type = type; b.amount = amount; b.bd = this; bonuses.Add(b); foreach (Bonus bonus in bonuses) { if (bonus != null) { bonus.transform.Translate(Vector3.up * offset); } } }
public static void ShowBonus(ScoreTypes type, string name, float amount) { if (bonusScript != null) { bonusScript.AddBonus(type, name, amount); } }
private IEnumerator UpdateGateCountUIAnimated(Transform target, ScoreTypes scoreType) { float updateNumberTime = textScaleCurve.keys[1].time; textUpdated = false; elapsedTime = 0; while (elapsedTime <= 1) { //Local scale: target.localScale = (1 - textScaleCurve.Evaluate(elapsedTime)) * Vector3.one; if (!textUpdated && elapsedTime >= updateNumberTime) { UpdateScoreUI(scoreType); textUpdated = true; } elapsedTime += animationSpeed * Time.deltaTime; yield return(null); } if (!textUpdated) { UpdateScoreUI(scoreType); } gateCounterTextTransform.localScale = Vector3.one; gateScoreAnimationCoroutine = null; }
public void ScorePost(int postId, ScoreTypes types) { using (DbContextTransaction transaction = dbContext.Database.BeginTransaction()) { try { Post post = dbContext.Posts.Where(p => p.Id == postId).First(); switch (types) { case ScoreTypes.Positive: post.Rating += 1; break; case ScoreTypes.Negative: post.Rating -= 1; break; } dbContext.SaveChanges(); transaction.Commit(); } catch { transaction.Rollback(); throw; } } }
public ActionResult DeleteConfirmed(int id) { ScoreTypes scoreTypes = db.ScoreTypes.Find(id); db.ScoreTypes.Remove(scoreTypes); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult ScorePost(int postId, int wallId, ScoreTypes type, int userId) { postService.ScorePost(postId, type, userId); UserDto currentUser = (UserDto)Session["session"]; userService.UpdateScoredPostList(currentUser); Session["session"] = currentUser; return(RedirectToAction("Wall", new { wallId = wallId })); }
public ActionResult Edit([Bind(Include = "ID,Type")] ScoreTypes scoreTypes) { if (ModelState.IsValid) { db.Entry(scoreTypes).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(scoreTypes)); }
public ActionResult Create([Bind(Include = "ID,Type")] ScoreTypes scoreTypes) { if (ModelState.IsValid) { db.ScoreTypes.Add(scoreTypes); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(scoreTypes)); }
private void UpdateScoreUI(ScoreTypes type = ScoreTypes.All) { //Binary And operation if ((ScoreTypes.Collectible & type) != 0) { collectibleCounterText.text = gameplayData.currentCollectibleCount.ToString(); } if ((ScoreTypes.Gate & type) != 0) { gateCounterText.text = gameplayData.currentGateCount.ToString(); } }
// GET: ScoreTypes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ScoreTypes scoreTypes = db.ScoreTypes.Find(id); if (scoreTypes == null) { return(HttpNotFound()); } return(View(scoreTypes)); }
private void AddScoredPost(int postId, int userId, ScoreTypes type) { ScoredPost scoredPost = new ScoredPost() { PostId = postId, UserId = userId }; switch (type) { case ScoreTypes.Positive: scoredPost.Score = true; break; case ScoreTypes.Negative: scoredPost.Score = false; break; } postManager.AddScoredPost(scoredPost); }
public void ScorePost(int postId, ScoreTypes type, int userId) { postManager.ScorePost(postId, type); AddScoredPost(postId, userId, type); }
public void ScoreGlobal() { scoreType = ScoreTypes.Global; LoadScores(); }
public void ScoreLocal() { scoreType = ScoreTypes.Local; LoadScores(); }