private void ReadScoreTimeListForLevel(object sender, ScoreCollection scoreCollection) { RemoveAllScores(); if (scoreCollection != null) { if (scoreCollection.scoreList.Count > 0) { foreach (var score in scoreCollection.scoreList) { var text = Instantiate(scoorPreFab); gameObjects.Add(text); TimeSpan result = TimeSpan.FromSeconds(score.time); var textTime = result.ToString("mm':'ss':'ff"); var segments = textTime.Split(':'); segments[0] = (result.TotalMinutes).ToString("00"); var finalText = segments[0] + ":" + segments[1] + ":" + segments[2]; string deathsOrTimeText = showForDeaths ? " ** Deaths: " + score.deathsCount : " ** Time: " + finalText; string scoreText = "Name: " + score.name + deathsOrTimeText; text.GetComponent <TMPro.TextMeshProUGUI>().text = scoreText; text.transform.parent = hightScoors.transform; text.transform.localScale = new Vector3(1, 1, 1); } } } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack == false) { // Choisir le premier Questionnaire a la place de l'utilisateur if (SessionState.Questionnaire == null && SessionState.Questionnaires.Count > 0) { SessionState.Questionnaire = SessionState.Questionnaires[0]; } LabelValidationMessage.Text = ""; NombreScores = 1; TextBoxCombienDeScores.Text = "1"; // BUG1107090002 if (SessionState.Questionnaire == null) { Tools.PageValidation("Pas de questionnaire"); } Scores = ScoreCollection.GetScoreQuestionnaire(SessionState.Questionnaire.QuestionnaireID); } CreateControlPanelScores(); Page.Form.DefaultButton = ButtonCombienDeScoresOk.UniqueID; // Pour donner le focus }
/// <summary> /// returns a new ScorekCollection loaded from the given file /// </summary> public static ScoreCollection Load(Stream stream, string filePath) { XmlSerializer serializer = new XmlSerializer(typeof(ScoreCollection)); ScoreCollection result = serializer.Deserialize(stream) as ScoreCollection; return(result); }
private void LoadHighScore() { using (StreamReader reader = new StreamReader(SCORE_FILE_PATH)){ string json = reader.ReadToEnd(); scoreCollection = JsonUtility.FromJson <ScoreCollection>(json); } }
public string ToConsoleDisplay(PlayerType player) { var str = DebuggerDisplay; str = ScoreCollection.ToConsoleDisplay(str, player); return(str); }
public async Task AddToScoreHistory(List <CardView> cards, ScoreCollection scores, PlayerType player) { List <CardView> fullHand = new List <CardView>(cards); switch (scores.ScoreType) { case ScoreType.Hand: case ScoreType.Crib: case ScoreType.Cut: fullHand.Sort(CardView.CompareCardsByRank); fullHand.Add(GridDeck.Items[0]); break; case ScoreType.Count: break; case ScoreType.Saved: case ScoreType.Unspecified: return; default: break; } string score = GetGameScore(); await HintWindow.AddToHistory(fullHand, scores, player, Deck, score); }
public int Stems; // Number of track's stems (not always the same for all tracks in the same collection) public ScoreTrack(ScoreCollection collection, string name, string title, string musicevent, int stems) { Collection = collection; Name = name; Title = title; Stems = stems; Event = musicevent; }
public ScoreLoader(List <ScoreAtTime> scores, List <Penalty> penalties, int robotCount) { _scores = scores ?? (_scores = new List <ScoreAtTime>()); _penalties = penalties ?? (_penalties = new List <Penalty>()); LoadedScoreCollection = new ScoreCollection(robotCount); _penalties.Sort((x, y) => x.Time.CompareTo(y.Time)); }
public ScoreLoader(List<ScoreAtTime> scores, List<Penalty> penalties, int robotCount) { _scores = scores??(_scores=new List<ScoreAtTime>()); _penalties = penalties?? (_penalties=new List<Penalty>()); LoadedScoreCollection = new ScoreCollection(robotCount); _penalties.Sort((x, y) => x.Time.CompareTo(y.Time)); }
public void ToConsoleDisplay_Hero3_H3Star() { var scores = new ScoreCollection(new GoldScore(1024), new GoldScore(3), new GoldScore(1), new GoldScore(7)); var act = scores.ToConsoleDisplay(PlayerType.Hero3); var exp = "h1: 1,024, h2: 3, h3*: 1, h4: 7"; Assert.AreEqual(exp, act); }
public void DebuggerDisplay_None_DescribingString() { var scores = new ScoreCollection(new GoldScore(1024), new GoldScore(3), new GoldScore(1), new GoldScore(7)); var act = scores.DebuggerDisplay; var exp = "h1: 1,024, h2: 3, h3: 1, h4: 7"; Assert.AreEqual(exp, act); }
public virtual void Initialize(IEngine engine, RobotSettings[] robotSettings) { Engine = engine; Settings = ParseSettings(HelloPackage); Robots = robotSettings.Select(x => x.IsBot ? CreateBot(x.Number) : CreateRobot(x.Number)).OrderBy(x => x.Number).ToList(); Score = new ScoreCollection(RobotCount); Engine.Initialize(Settings); Robots.ForEach(x => x.Init()); }
public void Compare_TwoScoresForPlayer1_Min1() { var scores0 = new ScoreCollection(new GoldScore(1024), new GoldScore(0), new GoldScore(1), new GoldScore(2)); var scores1 = new ScoreCollection(new GoldScore(1000), new GoldScore(3), new GoldScore(5), new GoldScore(7)); var act = scores0.Compare(scores1, PlayerType.Hero1); var exp = -1; Assert.AreEqual(exp, act); }
protected void ImageButtonScoreSupprimer_Click(object sender, EventArgs e) { ImageButton imageButton = ( ImageButton )sender; HiddenField hiddenField = ( HiddenField )imageButton.Parent.FindControl("HiddenFieldScoreID"); Score.Delete(int.Parse(hiddenField.Value)); Scores = ScoreCollection.GetScoreQuestionnaire(SessionState.Questionnaire.QuestionnaireID); CreateControlPanelScores(); }
public ScoreCollection Process(ProcessData data, int turn, ScoreCollection alphas) { var map = data.Map; var resultAlphas = PotentialScore.EmptyCollection; if (this.Turn >= 1199 || turn <= this.Turn) { this.Score = data.Evalutor.Evaluate(this.State); alphas.ContinueProccesingAlphas(this.Score, this.PlayerToMove, out resultAlphas); return(resultAlphas); } if (this.Children == null) { this.Children = new List <Node>(); foreach (var dir in data.MoveGenerator.Generate(map, this.State)) { var state = this.State.Move(map, dir, this.PlayerToMove); var child = data.Lookup.Get(this.Turn + 1, state, dir); this.Children.Add(child); } } var test = PotentialScore.EmptyCollection; for (int i = 0; i < this.Children.Count; i++) { var child = this.Children[i]; switch (i) { case 0: test = child.Process(data, turn - 0, alphas); break; case 1: test = child.Process(data, turn - 1, alphas); break; case 2: test = child.Process(data, turn - 2, alphas); break; case 3: test = child.Process(data, turn - 3, alphas); break; default: case 4: test = child.Process(data, turn - 5, alphas); break; } if (!alphas.ContinueProccesingAlphas(test, this.PlayerToMove, out resultAlphas)) { break; } } var comparer = NodeComparer.Get(this.PlayerToMove); Children.Sort(comparer); this.Score = this.Children[0].Score; return(resultAlphas); }
public async Task OnComputerScoreCrib(int scoreToAdd, ScoreCollection scores) { string message = String.Format("Computer's Crib Score\n{0}\nHit Continue.", scores.Format(false, false, true)); await HintWindow_ShowAndWait(message); await StateMachine.UiState.AddScore(PlayerType.Computer, scoreToAdd); await AddToScoreHistory(GridComputer.Items, scores, PlayerType.Computer); HintWindow.InsertScoreSummary(ScoreType.Crib, 0, scoreToAdd); }
public async Task OnUpdateScoreUi(PlayerType player, int scoreDelta, ScoreCollection scores) { await StateMachine.UiState.AddScore(player, scoreDelta); await AddToScoreHistory(GridPlayer.Items, scores, PlayerType.Player); HintWindow.InsertScoreSummary(scores.ScoreType, scoreDelta, 0); string message = String.Format("Your Score\n{0}\nHit Continue.", scores.Format(false, false, true)); //ShowHintWindowAsync(true, false, message); await HintWindow_ShowAndWait(message); }
public void ContinueProccesingAlphas_BetterAlpha_IsTrue() { var alphas = new ScoreCollection(new GoldScore(1000), new GoldScore(1000), new GoldScore(1000), new GoldScore(1000)); var test = new ScoreCollection(new GoldScore(1900), new GoldScore(2000), new GoldScore(1000), new GoldScore(1800)); ScoreCollection exp = new ScoreCollection(new GoldScore(1000), new GoldScore(2000), new GoldScore(1000), new GoldScore(1000)); ScoreCollection act; var result = alphas.ContinueProccesingAlphas(test, PlayerType.Hero2, out act); Assert.IsTrue(result); Assert.AreEqual(exp.DebuggerDisplay, act.DebuggerDisplay); }
protected void Page_Load(object sender, System.EventArgs e) { if (IsPostBack == false) { if (Request.QueryString["QuestionnaireID"] != null) { Cache["QuestionnaireID"] = int.Parse(Request.QueryString["QuestionnaireID"]); Questionnaire questionnaire = Questionnaire.GetQuestionnaire((int)Cache["QuestionnaireID"]); Reporter.Trace("Questionnaire lecture"); ValidationMessage.Text += "Suppression du Questionnaire : " + questionnaire.Description + ":" + questionnaire.CodeAcces + " questions : "; Cache["Questions"] = PollQuestionCollection.GetByQuestionnaire(( int )Cache["QuestionnaireID"]); ValidationMessage.Text += ((PollQuestionCollection)Cache["Questions"]).Count + "<br />"; foreach (PollQuestion question in ( PollQuestionCollection )Cache["Questions"]) { ValidationMessage.Text += "-- Question : " + question.Question + "<br />"; PollAnswerCollection reponses = PollAnswerCollection.GetByPollQuestionID(question.PollQuestionId); foreach (PollAnswer reponse in reponses) { ValidationMessage.Text += "---- Réponse : " + reponse.Answer + "<br />"; int nbVotes = PollVoteCollection.NumberOfVotesByAnswer(reponse.PollAnswerId); ValidationMessage.Text += "----- Votes : " + nbVotes.ToString() + "<br />"; } } Cache["Personnes"] = PersonneCollection.GetQuestionnaire(( int )Cache["QuestionnaireID"]); ValidationMessage.Text += "</br>"; ValidationMessage.Text += "Suppression des contacts : " + (( PersonneCollection )Cache["Personnes"]).Count + "<br />"; foreach (Personne p in ( PersonneCollection )Cache["Personnes"]) { ValidationMessage.Text += p.Nom + " " + p.Prenom + " " + p.EmailBureau + " " + p.Societe + "<br />"; } MemberInfo membre = MemberInfo.GetMemberInfo(questionnaire.MembreGUID); Cache["WebContents"] = WebContentCollection.GetWebContents(membre.NomUtilisateur, questionnaire.CodeAcces.ToString()); ValidationMessage.Text += "</br>"; ValidationMessage.Text += "Suppression des contenus web : " + (( WebContentCollection )Cache["WebContents"]).Count + "<br />"; foreach (WebContent wc in ( WebContentCollection )Cache["WebContents"]) { ValidationMessage.Text += wc.Section + " " + wc.Utilisateur + " " + wc.Visualisateur + "<br />"; } Cache["Scores"] = ScoreCollection.GetScoreQuestionnaire(( int )Cache["QuestionnaireID"]); ValidationMessage.Text += "</br>"; ValidationMessage.Text += "Suppression des scores : " + (( ScoreCollection )Cache["Scores"]).Count + "<br />"; ValidationMessage.Visible = true; } } }
public void answersArithmeticMeanOfTwoNumbers() { // Arrange var collection = new ScoreCollection(); collection.Add(new SimpleScoreable(5)); collection.Add(new SimpleScoreable(7)); // Act var actualResult = collection.arithmeticMean(); // Assert Assert.That(actualResult, Is.EqualTo(6)); }
public static AverageScoreCollection Create(MoveDirection move, long avg1, long avg2, long avg3, long avg4, int runs) { var scores = new ScoreCollection( new AverageScore(avg1, runs), new AverageScore(avg2, runs), new AverageScore(avg3, runs), new AverageScore(avg4, runs)); return(new AverageScoreCollection() { Move = move, Scores = scores, }); }
public void DisplayLeaderboard(ScoreCollection scoreCollection) { var scoreDataList = new List <SingleScoreData>(scoreCollection.scores).Where(scoreData => scoreData != null); scoreDataList = scoreDataList.OrderByDescending(scoreData => scoreData.score); foreach (SingleScoreData scoreData in scoreDataList) { var rank = rows.Count + 1; AddRow(new LeaderboardRowData(rank, scoreData.userName, scoreData.score)); } loadingHint.gameObject.SetActive(false); }
void showHighscore(string highscoreText) { usernameText.text = ""; scoreText.text = ""; ScoreCollection highscoreList = JsonUtility.FromJson <ScoreCollection>("{\"scores\":" + highscoreText + "}"); for (int i = 0; i < Math.Min(scoreNumber, highscoreList.scores.Length); i++) { Score score = highscoreList.scores[i]; usernameText.text += score.username + "\n"; scoreText.text += score.score + "\n"; } m_ButtonText.text = "REFRESH"; }
public async Task InitializeAsync() { await Task.Run(() => { try { var settingRepository = new SettingRepository(); ColumnVisibleSetting.Value = settingRepository.GetColumnVisibleSetting(); AppSetting.Value = settingRepository.GetAppSetting(); var isAutoImageSave = AppSetting.Value.IsAutoImageSave.Value; var isLatestScoreOutputAsText = AppSetting.Value.IsLatestScoreOutputAsText.Value; _scoreRepository = new ScoreRepository(); _scoreScreenShotRepository = ScoreScreenShotRepository.Create(isAutoImageSave); _scoreFileRepository = ScoreFileRepository.Create(isLatestScoreOutputAsText); _fezScreenShooter = new FEZScreenShooter(); _fezScoreAnalyzer = new FEZScoreAnalyzer(); // DBファイルが無ければ作成、作成済みだが古いバージョンの場合は自動で最新のテーブル構成に更新する _scoreRepository.Database.Migrate(); foreach (var score in _scoreRepository.ScoreDbSet.OrderBy(x => x.記録日時)) { RegisterToDbUpdateWhenPropertyChanged(score); ScoreCollection.Add(score); } LatestScore.Value = ScoreCollection.LastOrDefault() ?? new ScoreEntity(); // 監視状態ONの状態で終了していた場合は、初期化時に監視を開始する if (AppSetting.Value.IsAccumulatingAtLastTime.Value) { StartToAccumulateScore(); } } catch (Exception ex) { ApplicationError.HandleUnexpectedError(ex); } }); // 初回起動時は案内メッセージを表示する(2回目以降は表示しない) if (AppSetting.Value.IsFirstBoot.Value) { MessageBox.Show(Properties.Resources.FirstBootInfoMessage, "Info"); AppSetting.Value.IsFirstBoot.Value = false; } }
protected void ImageButtonScoreSauver_Click(object sender, EventArgs e) { ImageButton imageButton = ( ImageButton )sender; HiddenField hiddenField = ( HiddenField )imageButton.Parent.FindControl("HiddenFieldScoreID"); Score score = new Score(); score.ScoreID = int.Parse(hiddenField.Value); Score scoreOldValues = Scores.FindByScoreID(score.ScoreID); score = scoreOldValues; TextBox textBoxScoreMin = ( TextBox )imageButton.Parent.FindControl("TextBoxScoreMin"); try { score.ScoreMin = int.Parse(textBoxScoreMin.Text); } catch { score.ScoreMin = scoreOldValues.ScoreMin; } TextBox textBoxScoreMax = ( TextBox )imageButton.Parent.FindControl("TextBoxScoreMax"); try { score.ScoreMax = int.Parse(textBoxScoreMax.Text); } catch { score.ScoreMax = scoreOldValues.ScoreMax; } TextBox textBoxScoreTexte = ( TextBox )imageButton.Parent.FindControl("TextBoxScoreTexte"); if (string.IsNullOrEmpty(textBoxScoreTexte.Text.Trim()) == false) { score.ScoreTexte = textBoxScoreTexte.Text; } else { score.ScoreTexte = scoreOldValues.ScoreTexte; } Score.Update(score); Scores = ScoreCollection.GetScoreQuestionnaire(SessionState.Questionnaire.QuestionnaireID); CreateControlPanelScores(); }
private async Task ScoreCutJack(int jackIndex) { // // NOTE: score already added in LocalGame ScoreCollection scores = new ScoreCollection(); scores.ActualScore = 2; scores.Total = 2; scores.ScoreType = ScoreType.Cut; List <int> cards = new List <int>(); cards.Add(jackIndex); scores.Scores.Add(new ScoreInstance(StatName.CutAJack, 1, 2, cards)); await _view.OnUpdateScoreUi(_dealer, 2, scores); }
public void Sort_2234_0023() { int p1, p2, p3, p4; var s1 = 2; var s2 = 2; var s3 = 3; var s4 = 4; ScoreCollection.Sort(s1, s2, s3, s4, out p1, out p2, out p3, out p4); Assert.AreEqual(0, p1, "p1"); Assert.AreEqual(0, p2, "p2"); Assert.AreEqual(2, p3, "p3"); Assert.AreEqual(3, p4, "p4"); }
public void Sort_2845_0312() { int p1, p2, p3, p4; var s1 = 2; var s2 = 8; var s3 = 4; var s4 = 5; ScoreCollection.Sort(s1, s2, s3, s4, out p1, out p2, out p3, out p4); Assert.AreEqual(0, p1, "p1"); Assert.AreEqual(3, p2, "p2"); Assert.AreEqual(1, p3, "p3"); Assert.AreEqual(2, p4, "p4"); }
public void Sort_9773_3110() { int p1, p2, p3, p4; var s1 = 9; var s2 = 7; var s3 = 7; var s4 = 3; ScoreCollection.Sort(s1, s2, s3, s4, out p1, out p2, out p3, out p4); Assert.AreEqual(3, p1, "p1"); Assert.AreEqual(1, p2, "p2"); Assert.AreEqual(1, p3, "p3"); Assert.AreEqual(0, p4, "p4"); }
public GCScore GetScore(int rank, GCBoardTimeSpan scope, GCCollectionType collection) { ScoreCollection col = GlobalCollection; switch (collection) { case GCCollectionType.GLOBAL: col = GlobalCollection; break; case GCCollectionType.FRIENDS: col = SocsialCollection; break; } Dictionary <int, GCScore> scoreDict = col.AllTimeScores; switch (scope) { case GCBoardTimeSpan.ALL_TIME: scoreDict = col.AllTimeScores; break; case GCBoardTimeSpan.TODAY: scoreDict = col.TodayScores; break; case GCBoardTimeSpan.WEEK: scoreDict = col.WeekScores; break; } if (scoreDict.ContainsKey(rank)) { return(scoreDict[rank]); } else { return(null); } }
/// <summary> /// Retrieve an RpcPeerList object to identify all the peers the /// given personID has. If no peers are found then the peers member /// of the returned object will be empty. If the person is not found /// then an empty peers member will be returned. /// </summary> /// <param name="personID">The ID of the person who we are interested in.</param> /// <param name="peerCount">The number of peers to return, if more peers are available only this many will be returned.</param> /// <returns>A new RpcPeerList object which contains the information requested.</returns> public RpcPeerList GetPersonPeers(int personID, int start, int count) { ScoreCollection scores = new ScoreCollection(); RpcPeerList list = new RpcPeerList(); ArrayList peers = new ArrayList(); Score s; int i; // // Load the peers for this person. // scores.LoadBySourcePersonId(personID, 1); // // Make sure we have valid values to work with. // if (start < 0) { start = 0; } if ((start + count) > scores.Count) { count = (scores.Count - start); } // // Walk each peer and add them to our array. // for (i = 0; i < count; i++) { RpcPeer peer = new RpcPeer(); s = scores[i + start]; peer.PersonID = s.TargetPersonId; peer.FullName = new Person(s.TargetPersonId).FullName; peer.Score = s.TotalScore; peer.Trend = s.UpwardTrend; } list.PersonID = personID; list.Peers = (RpcPeer[])peers.ToArray(typeof(RpcPeer)); return(list); }
/// <summary> /// Retrieve an RpcPeerList object to identify all the peers the /// given personID has. If no peers are found then the peers member /// of the returned object will be empty. If the person is not found /// then an empty peers member will be returned. /// </summary> /// <param name="personID">The ID of the person who we are interested in.</param> /// <param name="peerCount">The number of peers to return, if more peers are available only this many will be returned.</param> /// <returns>A new RpcPeerList object which contains the information requested.</returns> public RpcPeerList GetPersonPeers(int personID, int start, int count) { ScoreCollection scores = new ScoreCollection(); RpcPeerList list = new RpcPeerList(); ArrayList peers = new ArrayList(); Score s; int i; // // Load the peers for this person. // scores.LoadBySourcePersonId(personID, 1); // // Make sure we have valid values to work with. // if (start < 0) start = 0; if ((start + count) > scores.Count) count = (scores.Count - start); // // Walk each peer and add them to our array. // for (i = 0; i < count; i++) { RpcPeer peer = new RpcPeer(); s = scores[i + start]; peer.PersonID = s.TargetPersonId; peer.FullName = new Person(s.TargetPersonId).FullName; peer.Score = s.TotalScore; peer.Trend = s.UpwardTrend; } list.PersonID = personID; list.Peers = (RpcPeer[])peers.ToArray(typeof(RpcPeer)); return list; }