// September 2015 // Levee Patroller / Dijk Patrouille // This source file is (c) by Deltares. This source file is open source but only available to select users. Do not redistribute without written permission of Stichting Deltares, Delft, The Netherlands. // This header has been automatically generated. //============================================================================= // Object that displays the scoring for the player // ------------------------------------------------------------ // Created by Rui Guimaraes // © 2006, Geodelft // // Date Id Modification // 2006-08-11 The Implemented IsEqual // 2006-08-15 The Taken into account if allowed diagnoses and measures // 2006-08-16 The Made layout for new, more elaborate, report // 2006-08-16 The Finished detailed scoring // 2006-08-16 The Fixed dual-language option // 2006-08-18 The Changed title // 2006-08-30 The Started implementation of new scoring system // 2006-08-31 The Finished new scoring system // 2006-09-04 The Added English text // 2006-09-27 The Moved calculation of score from GeoScoreboard to GeoPlayerController // 2006-10-02 The Removed SCORE_INDEX_SIGNALCHANGES and SCORE_INDEX_NOBREACHBONUS // 2006-10-03 The Moved percentage and evaluation determination from GeoScoreboard to GeoPlayerController // 2006-10-03 The Implemented multi point scores per item //============================================================================= class GeoScoreboard extends ScoreBoard DependsOn(SignalReport); // Begin of constants also defined in GeoPlayerController const SCORE_INDEX_FAILURES = 0; const SCORE_INDEX_LOCATIONS = 1; const SCORE_INDEX_SIGNALS = 2; const SCORE_INDEX_REPORTS = 3; const SCORE_INDEX_ASSESSMENTS = 4; const SCORE_INDEX_DIAGNOSES = 5; const SCORE_INDEX_MEASURES = 6; const SCORE_INDEX_COUNT = 7; // End of constants also defined in GeoPlayerController var() localized String MapName; var bool Dutch; var() Material BoxMaterial; var() Material TitleMaterial; const LX1CHARCOUNT = 1; const LX2CHARCOUNT = 2; const LX3CHARCOUNT = 10; const LX4CHARCOUNT = 30; var GeoPlayerController PlayerOwner; var string ScoreForText, NL_ScoreForText, EN_ScoreForText; var string UnknownLocationText, NL_UnknownLocationText, EN_UnknownLocationText; var string ScoreText1, NL_ScoreText1, EN_ScoreText1; var string ScoreText2, NL_ScoreText2, EN_ScoreText2; var string ScoreOutOf, NL_ScoreOutOf, EN_ScoreOutOf; var string ScoreLocation, NL_ScoreLocation, EN_ScoreLocation; var string ScoreDiagnosis, NL_ScoreDiagnosis, EN_ScoreDiagnosis; var string ScoreMeasure, NL_ScoreMeasure, EN_ScoreMeasure; var string ScoreReport, NL_ScoreReport, EN_ScoreReport; var string ScoreDetails, NL_ScoreDetails, EN_ScoreDetails; var string ScoreFailuresText, NL_ScoreFailuresText, EN_ScoreFailuresText; var string ScoreLocationsText, NL_ScoreLocationsText, EN_ScoreLocationsText; var string ScoreSignalsText, NL_ScoreSignalsText, EN_ScoreSignalsText; var string ScoreSignalChangesText, NL_ScoreSignalChangesText, EN_ScoreSignalChangesText; var string ScoreReportsText, NL_ScoreReportsText, EN_ScoreReportsText; var string ScoreAssessmentsText, NL_ScoreAssessmentsText, EN_ScoreAssessmentsText; var string ScoreDiagnosesText, NL_ScoreDiagnosesText, EN_ScoreDiagnosesText; var string ScoreMeasuresText, NL_ScoreMeasuresText, EN_ScoreMeasuresText; var string ScoreNoBreachBonusText, NL_ScoreNoBreachBonusText, EN_ScoreNoBreachBonusText; var string ScoreTotalText, NL_ScoreTotalText, EN_ScoreTotalText; var string ScoreEndScoreText, NL_ScoreEndScoreText, EN_ScoreEndScoreText; var string ScoreEvaluationText, NL_ScoreEvaluationText, EN_ScoreEvaluationText; var string ScoreUserText, NL_ScoreUserText, EN_ScoreUserText; var string ScoreCorrectText, NL_ScoreCorrectText, EN_ScoreCorrectText; //var string ScoreText, NL_, EN_; //============================================================================= // Date Id Modification // 2006-09-29 The Created //============================================================================= function GeoPlayerController GeoPC() { local GeoPlayerController LGeoPC; local Actor A; if (PlayerOwner.IsA('GeoPlayerController')) { LGeoPC = GeoPlayerController(Owner); } else { ForEach PlayerOwner.DynamicActors( class 'Actor', A, 'GeoPlayerController' ) { LGeoPC = GeoPlayerController(A); } } return LGeoPC; } //============================================================================= // Date Id Modification // 2006-08-30 The Created // 2006-08-31 The Finished new scoring system //============================================================================= function DisplayScoreItem(Canvas Canvas, string AItemText, int AUserScore, int ACorrectScore, int AMaxScore, out float ACurrentYPosition) { local float LXTmp; local float LX1; local float LX2; local float LX3; local float LX4; local float LYCurrent; local float LLineHeight; // Determine line height Canvas.StrLen("W", LXTmp, LLineHeight); // Determine tab positions LX1 = LX1CHARCOUNT * LXTmp; LX2 = LX2CHARCOUNT * LXTmp; LX3 = LX3CHARCOUNT * LXTmp; LX4 = LX4CHARCOUNT * LXTmp; // Display score LYCurrent = ACurrentYPosition; Canvas.SetPos(LX1, LYCurrent); Canvas.DrawText(AItemText, True); LYCurrent = LYCurrent + LLineHeight; Canvas.SetPos(LX2, LYCurrent); Canvas.DrawText(ScoreUserText$" "$AUserScore, True); Canvas.SetPos(LX3, LYCurrent); Canvas.DrawText(ScoreCorrectText, True); Canvas.SetPos(LX4, LYCurrent); Canvas.DrawText(ACorrectScore$"/"$AMaxScore, True); LYCurrent = LYCurrent + LLineHeight; ACurrentYPosition = LYCurrent; } //============================================================================= // Date Id Modification // 2006-08-15 The Created //============================================================================= function Init() { Super.Init(); // InitFailureData(); PlayerOwner = GeoPlayerController(Owner); } //============================================================================= // Date Id Modification // 2006-08-30 The Created this header // 2006-08-30 The Started implementation of new scoring system // 2006-08-31 The Finished new scoring system //============================================================================= simulated event UpdateScoreBoard(Canvas Canvas) { local color WhiteColor; local float LX1; local float LX4; local float LXTmp; local float LTitleXL; local float LYL; local float LLineHeight; local float LCurrentYPosition; local string LTitlestring; local GeoPlayerController LGeoPC; LGeoPC = GeoPC(); Dutch = SetLanguage(); UpdateLanguage(); LGeoPC.InitFailureData(); LGeoPC.FillFailureData(); LGeoPC.CalculateScore(); // draw title WhiteColor = class'Canvas'.static.MakeColor(255,255,225); Canvas.DrawColor = WhiteColor; Canvas.Style = ERenderStyle.STY_Normal; Canvas.Font = HUDClass.static.GetMediumFontFor(Canvas); LTitlestring = ScoreForText$MapName$Level.Title; Canvas.StrLen(LTitleString, LTitleXL, LYL); Canvas.Style = ERenderStyle.STY_Alpha; Canvas.DrawColor = WhiteColor; Canvas.SetPos(0, 0.25 * LYL); Canvas.DrawTileStretched( TitleMaterial, Canvas.ClipX, LYL*1.5); Canvas.SetPos(0.5*(Canvas.ClipX - LTitleXL), 0.5 * LYL); Canvas.DrawText(LTitleString, True); // Determine line height Canvas.StrLen("W", LXTmp, LLineHeight); // Determine tab positions and vertical position LX1 = LXTmp; Canvas.Style = ERenderStyle.STY_Normal; LCurrentYPosition = LLineHeight * 2.5; /* // draw score Canvas.SetPos(LX1, LCurrentYPosition); Canvas.DrawText(ScoreText1$ScorePlayer$ScoreText2$ScorePossible$ScoreDetails, False); LCurrentYPosition = LCurrentYPosition + LLineHeight * 1.5; */ Canvas.Font = HUDClass.static.GetConsoleFont(Canvas); // Determine new line height Canvas.StrLen("W", LXTmp, LLineHeight); // Determine tab positions and vertical position LX1 = LX1CHARCOUNT * LXTmp; LX4 = LX4CHARCOUNT * LXTmp; // Draw score details DisplayScoreItem(Canvas, ScoreFailuresText, LGeoPC.ScoreArray[SCORE_INDEX_FAILURES].UserCount, LGeoPC.ScoreArray[SCORE_INDEX_FAILURES].CorrectCount, LGeoPC.ScoreArray[SCORE_INDEX_FAILURES].MaxCount, LCurrentYPosition); DisplayScoreItem(Canvas, ScoreLocationsText, LGeoPC.ScoreArray[SCORE_INDEX_LOCATIONS].UserCount, LGeoPC.ScoreArray[SCORE_INDEX_LOCATIONS].CorrectCount, LGeoPC.ScoreArray[SCORE_INDEX_LOCATIONS].MaxCount, LCurrentYPosition); DisplayScoreItem(Canvas, ScoreSignalsText, LGeoPC.ScoreArray[SCORE_INDEX_SIGNALS].UserCount, LGeoPC.ScoreArray[SCORE_INDEX_SIGNALS].CorrectCount, LGeoPC.ScoreArray[SCORE_INDEX_SIGNALS].MaxCount, LCurrentYPosition); DisplayScoreItem(Canvas, ScoreReportsText, LGeoPC.ScoreArray[SCORE_INDEX_REPORTS].UserCount, LGeoPC.ScoreArray[SCORE_INDEX_REPORTS].CorrectCount, LGeoPC.ScoreArray[SCORE_INDEX_REPORTS].MaxCount, LCurrentYPosition); DisplayScoreItem(Canvas, ScoreAssessmentsText, LGeoPC.ScoreArray[SCORE_INDEX_ASSESSMENTS].UserCount, LGeoPC.ScoreArray[SCORE_INDEX_ASSESSMENTS].CorrectCount, LGeoPC.ScoreArray[SCORE_INDEX_ASSESSMENTS].MaxCount, LCurrentYPosition); if (LGeoPC.IsAllowedMakeDiagnoses) { DisplayScoreItem(Canvas, ScoreDiagnosesText, LGeoPC.ScoreArray[SCORE_INDEX_DIAGNOSES].UserCount, LGeoPC.ScoreArray[SCORE_INDEX_DIAGNOSES].CorrectCount, LGeoPC.ScoreArray[SCORE_INDEX_DIAGNOSES].MaxCount, LCurrentYPosition); }; if (LGeoPC.IsAllowedTakeMeasures) { DisplayScoreItem(Canvas, ScoreMeasuresText, LGeoPC.ScoreArray[SCORE_INDEX_MEASURES].UserCount, LGeoPC.ScoreArray[SCORE_INDEX_MEASURES].CorrectCount, LGeoPC.ScoreArray[SCORE_INDEX_MEASURES].MaxCount, LCurrentYPosition); }; if (LGeoPC.IsBreachPossible) { /* // Bonus for no dike breach Canvas.SetPos(LX1, LCurrentYPosition); Canvas.DrawText(ScoreNoBreachBonusText, False); Canvas.SetPos(LX4, LCurrentYPosition); Canvas.DrawText(LGeoPC.ScoreArray[SCORE_INDEX_NOBREACHBONUS].CorrectCount$"/"$LGeoPC.ScoreArray[SCORE_INDEX_NOBREACHBONUS].MaxCount, False); LCurrentYPosition = LCurrentYPosition + LLineHeight; */ } // End score points LCurrentYPosition = LCurrentYPosition + LLineHeight; Canvas.SetPos(LX1, LCurrentYPosition); Canvas.DrawText(ScoreTotalText, False); Canvas.SetPos(LX4, LCurrentYPosition); Canvas.DrawText(LGeoPC.ScorePlayer$"/"$LGeoPC.ScorePossible, False); LCurrentYPosition = LCurrentYPosition + LLineHeight; // End score percentage Canvas.SetPos(LX1, LCurrentYPosition); Canvas.DrawText(ScoreEndScoreText, False); Canvas.SetPos(LX4, LCurrentYPosition); Canvas.DrawText(LGeoPC.ScorePercentage$" %", False); LCurrentYPosition = LCurrentYPosition + LLineHeight; // End score evaluation Canvas.SetPos(LX1, LCurrentYPosition); Canvas.DrawText(ScoreEvaluationText, False); Canvas.SetPos(LX4, LCurrentYPosition); Canvas.DrawText(LGeoPC.EvaluationText, False); } //============================================================================= // Date Id Modification // 2006-08-15 The Created //============================================================================= function bool SetLanguage() { local GeoPlayerController GeoPC; local Actor A; if (PlayerOwner.IsA('GeoPlayerController')) { return GeoPlayerController(Owner).Dutch; } else { ForEach PlayerOwner.DynamicActors( class 'Actor', A, 'GeoPlayerController' ) { GeoPC = GeoPlayerController(A); } return GeoPC.Dutch; } } //============================================================================= // Date Id Modification // 2006-08-15 The Created // 2006-08-30 The Started implementation of new scoring system //============================================================================= function UpdateLanguage() { if (Dutch) { ScoreForText = NL_ScoreForText; UnknownLocationText = NL_UnknownLocationText; ScoreText1 = NL_ScoreText1; ScoreText2 = NL_ScoreText2; ScoreOutOf = NL_ScoreOutOf; ScoreLocation = NL_ScoreLocation; ScoreDiagnosis = NL_ScoreDiagnosis; ScoreMeasure = NL_ScoreMeasure; ScoreReport = NL_ScoreReport; ScoreDetails = NL_ScoreDetails; ScoreFailuresText = NL_ScoreFailuresText; ScoreLocationsText = NL_ScoreLocationsText; ScoreSignalsText = NL_ScoreSignalsText; ScoreSignalChangesText = NL_ScoreSignalChangesText; ScoreReportsText = NL_ScoreReportsText; ScoreAssessmentsText = NL_ScoreAssessmentsText; ScoreDiagnosesText = NL_ScoreDiagnosesText; ScoreMeasuresText = NL_ScoreMeasuresText; ScoreNoBreachBonusText = NL_ScoreNoBreachBonusText; ScoreTotalText = NL_ScoreTotalText; ScoreEndScoreText = NL_ScoreEndScoreText; ScoreEvaluationText = NL_ScoreEvaluationText; ScoreUserText = NL_ScoreUserText; ScoreCorrectText = NL_ScoreCorrectText; } else { ScoreForText = EN_ScoreForText; UnknownLocationText = EN_UnknownLocationText; ScoreText1 = EN_ScoreText1; ScoreText2 = EN_ScoreText2; ScoreOutOf = EN_ScoreOutOf; ScoreLocation = EN_ScoreLocation; ScoreDiagnosis = EN_ScoreDiagnosis; ScoreMeasure = EN_ScoreMeasure; ScoreReport = EN_ScoreReport; ScoreDetails = EN_ScoreDetails; ScoreFailuresText = EN_ScoreFailuresText; ScoreLocationsText = EN_ScoreLocationsText; ScoreSignalsText = EN_ScoreSignalsText; ScoreSignalChangesText = EN_ScoreSignalChangesText; ScoreReportsText = EN_ScoreReportsText; ScoreAssessmentsText = EN_ScoreAssessmentsText; ScoreDiagnosesText = EN_ScoreDiagnosesText; ScoreMeasuresText = EN_ScoreMeasuresText; ScoreNoBreachBonusText = EN_ScoreNoBreachBonusText; ScoreTotalText = EN_ScoreTotalText; ScoreEndScoreText = EN_ScoreEndScoreText; ScoreEvaluationText = EN_ScoreEvaluationText; ScoreUserText = EN_ScoreUserText; ScoreCorrectText = EN_ScoreCorrectText; } } //============================================================================= // Date Id Modification // 2006-08-15 The Created this header // 2006-08-30 The Started implementation of new scoring system //============================================================================= defaultproperties { BoxMaterial=Material'GUIContent.BorderBoxD' TitleMaterial=Material'GUIContent.SquareBoxA' HUDClass = class'GeoHUD' // English strings EN_ScoreForText = "Score for "; EN_UnknownLocationText = "Unknown location"; EN_ScoreText1 = "You scored " EN_ScoreText2 = " out of " EN_ScoreOutOf = " out of " EN_ScoreLocation = "Location"; EN_ScoreDiagnosis = "Diagnosis"; EN_ScoreMeasure = "Measure"; EN_ScoreReport = "Report"; EN_ScoreDetails = " (See below for details)"; EN_ScoreFailuresText = "Observed failures"; EN_ScoreLocationsText = "Location accuracy"; EN_ScoreSignalsText = "Observed signals"; EN_ScoreSignalChangesText = "Observed changes"; EN_ScoreReportsText = "Reporting accuracy"; EN_ScoreAssessmentsText = "Situation assessment accuracy"; EN_ScoreDiagnosesText = "Diagnose accuracy"; EN_ScoreMeasuresText = "Measure effectiveness"; EN_ScoreNoBreachBonusText = "Levee breach prevention bonus"; EN_ScoreTotalText = "Total points out of maximum"; EN_ScoreEndScoreText = "Final score"; EN_ScoreEvaluationText = "Performance"; EN_ScoreUserText = "Number:"; EN_ScoreCorrectText = "Correct out of maximum:"; // Dutch strings NL_ScoreForText = "Score voor "; NL_UnknownLocationText = "Onbekende locatie"; NL_ScoreText1 = "Je hebt een score van " NL_ScoreText2 = " uit " NL_ScoreOutOf = " uit " NL_ScoreLocation = "Locatie"; NL_ScoreDiagnosis = "Diagnose"; NL_ScoreMeasure = "Maatregel"; NL_ScoreReport = "Rapport"; NL_ScoreDetails = " (hieronder zijn de details)"; NL_ScoreFailuresText = "Geobserveerde schadebeelden"; NL_ScoreLocationsText = "Locatie nauwkeurigheid"; NL_ScoreSignalsText = "Geobserveerde signalen"; NL_ScoreSignalChangesText = "Geobserveerde veranderingen"; NL_ScoreReportsText = "Rapportage nauwkeurigheid"; NL_ScoreAssessmentsText = "Inschatting van de situatie nauwkeurigheid"; NL_ScoreDiagnosesText = "Diagnose nauwkeurigheid"; NL_ScoreMeasuresText = "Maatregel effectiviteit"; NL_ScoreNoBreachBonusText = "Dijkdoorbraak preventie bonus"; NL_ScoreTotalText = "Totale punten t.o.v. maximum"; NL_ScoreEndScoreText = "Eindscore"; NL_ScoreEvaluationText = "Beoordeling"; NL_ScoreUserText = "Aantal:"; NL_ScoreCorrectText = "Correct t.o.v. maximum:"; }