public void SendLessonScore(string category, int lesson, int score, List <Question> questionList) { ScoreHistory temp = new ScoreHistory(); temp.id = 999; temp.category = category; temp.lesson = lesson; temp.score = score; Setting.historyList.Add(temp); string username = GetUsername(); string uri = string.Format("http://sajjadcv.ir/lingoland/addscore.php?user_id={0}&name={1}&category={2}&lesson={3}&score={4}", SystemInfo.deviceUniqueIdentifier, username, category, lesson, score); List <IMultipartFormSection> formData = new List <IMultipartFormSection>(); if (questionList != null) { for (int i = 0; i < questionList.Count; i++) { var item = questionList[i]; formData.Add(new MultipartFormDataSection(i.ToString(), string.Format("{0} {1} {2} {3} {4} {5}", item.QuestionNum, item.answerType, item.selectedAnswer, item.correctAnswer, item.Mode, item.structure))); } } StartCoroutine(Setting.SendData(uri, formData)); }
private static void Postfix(SongSelect __instance) { FilterPanel.Initialize(); ScoreHistory.LoadHistory(PlatformChooser.I.GetLeaderboardID()); MelonCoroutines.Start(SongBrowser.UpdateLastSongCount()); MelonLogger.Msg("Updating song count"); }
private static void Postfix(SongSelect __instance) { //FilterPanel.filteringFavorites = false; FilterPanel.Initialize(); ScoreHistory.LoadHistory(PlatformChooser.I.GetLeaderboardID()); MelonCoroutines.Start(SongBrowser.UpdateLastSongCount()); }
public void Clear() { ScoreHistory.Clear(); ScoreHistory.Add(new Score()); History.Clear(); History.Add(new List <Cage>()); }
/// <summary> /// 获取用户积分变动记录 /// </summary> public Response Execute(User currentUser, string request) { var req = JsonConvert.DeserializeObject <Request <GetUserScoreHistoryListFilter> >(request); var cmd = CommandHelper.CreateProcedure <ScoreHistory>(text: "sp_GetScoreHistoryList"); cmd.Params.Add(CommandHelper.CreateParam("@userId", req.Filter.UserId)); cmd.Params.Add(CommandHelper.CreateParam("@sportId", req.Filter.SportId)); cmd.CreateParamPager(req.Filter); var result = DbContext.GetInstance().Execute(cmd); result.SetRowCount(); foreach (var item in result.Entities) { ScoreHistory sh = item as ScoreHistory; if (sh.Editor == "0")//默认积分,查询时Editor字段写死 { sh.Description = "您获得了初始积分"; sh.ScoreStr = sh.Score.ToString(); } else if (!string.IsNullOrEmpty(sh.LoopId)) { string des = "您在{0}中的一场比赛{1}了{2},积分{3}了"; if (sh.Score >= 0) { sh.Description = string.Format(des, sh.GameName, "获得", "胜利", "增加"); sh.ScoreStr = "+" + sh.Score.ToString(); } else { sh.Description = string.Format(des, sh.GameName, "遭遇", "失败", "减少"); sh.ScoreStr = sh.Score.ToString(); } } else if (sh.IsEdit) { sh.Description = "管理员根据您的水平,调整了积分"; if (sh.Score - sh.OldScore >= 0) { sh.ScoreStr = "+" + (sh.Score - sh.OldScore).ToString(); } else { sh.ScoreStr = (sh.Score - sh.OldScore).ToString(); } } else { sh.Description = "管理员根据您的水平,调整了您的最终积分值"; sh.ScoreStr = sh.Score.ToString(); } } return(result); }
private long GetScoreToDisplay(double phraseNumber) { if (phraseNumber < 0) { return(0); } var idx = (int)Math.Min(ScoreHistory.Count() - 1, Math.Floor(phraseNumber)); idx = Math.Max(0, idx); return(ScoreHistory[idx]); }
public async Task <bool> AddScore(Member member, int intScore, string strDescription, bool bIsAdd, bool bIsSaveToDb = true) { Attach <Member>(member); ScoreHistory scoreHistory = new ScoreHistory { MemberId = member.Id, Different = (bIsAdd ? intScore : -intScore), Description = (bIsAdd ? "" : "撤消") + strDescription }; _Db.ScoreHistories.Add(scoreHistory); member.Score = member.Score + (bIsAdd ? intScore : -intScore); if (bIsSaveToDb) { return(await SaveChangesAsync()); } return(true); }
private void SetScore(ScoreBoard scoreBoard, int playerId, int newValue, string type, DateTime lastUpdate) { var score = scoreBoard.Scores.FirstOrDefault(s => s.Id == playerId); if (score == null) { //Create new score item if not exists score = new Score() { Id = playerId, UpdateHistory = new List <ScoreHistory>() }; scoreBoard.Scores.Add(score); } //Update score var typeInfo = score.GetType().GetProperty(type.ToString()); var value = (int)typeInfo.GetValue(score); if (value != newValue) { //Add history var updateHistory = new ScoreHistory() { Type = type, OldValue = value, NewValue = newValue, UpdateInterval = lastUpdate - score.LastUpdate, UpdatedAt = lastUpdate }; score.UpdateHistory.Add(updateHistory); //Update score typeInfo.SetValue(score, newValue); } //Update score update time if (score.LastUpdate < lastUpdate) { score.LastUpdate = lastUpdate; } }
public async Task AddAsync(ScoreHistory history) { await this.Connection.InsertAsync(history); }