Add segment counter to the checkpoint UI (#7)
This commit is contained in:
parent
f46aabc472
commit
1284924976
@ -282,6 +282,7 @@ UIModules_Chrono::SetTimeOffset(Player, SpecificOffset);
|
|||||||
|
|
||||||
***Match_InitRound***
|
***Match_InitRound***
|
||||||
***
|
***
|
||||||
|
declare netwrite Integer Net_RoyalRounds_CheckpointUI_TotalNbSegments for Teams[0];
|
||||||
declare Integer[Text] CustomTimes for This = [];
|
declare Integer[Text] CustomTimes for This = [];
|
||||||
declare Integer[Text][Integer] CurrentRanking for This = []; // CurrentRanking[Segment][AccountId][Time]
|
declare Integer[Text][Integer] CurrentRanking for This = []; // CurrentRanking[Segment][AccountId][Time]
|
||||||
CurrentRanking[0] = Integer[Text]; // Init white section
|
CurrentRanking[0] = Integer[Text]; // Init white section
|
||||||
@ -338,13 +339,12 @@ foreach (Event in RacePendingEvents) {
|
|||||||
Event.Player.Dossard_Number = TL::FormatInteger(ML::Clamp(Rank, 0, 99), 2);
|
Event.Player.Dossard_Number = TL::FormatInteger(ML::Clamp(Rank, 0, 99), 2);
|
||||||
|
|
||||||
// Send Rank to Checkpoint UI
|
// Send Rank to Checkpoint UI
|
||||||
declare UI <=> UIManager.GetUI(Event.Player);
|
declare netwrite Integer Net_RoyalRounds_CheckpointUI_Rank for Event.Player;
|
||||||
if (UI != Null) {
|
|
||||||
declare netwrite Integer Net_RoyalRounds_CheckpointUI_Rank for UI;
|
|
||||||
Net_RoyalRounds_CheckpointUI_Rank = Rank;
|
Net_RoyalRounds_CheckpointUI_Rank = Rank;
|
||||||
declare netwrite Integer Net_RoyalRounds_CheckpointUI_Update for UI;
|
declare netwrite Integer Net_RoyalRounds_CheckpointUI_Update for Event.Player;
|
||||||
Net_RoyalRounds_CheckpointUI_Update += 1;
|
Net_RoyalRounds_CheckpointUI_Update += 1;
|
||||||
}
|
declare netwrite Integer Net_RoyalRounds_CheckpointUI_CurrentNbSegments for Event.Player;
|
||||||
|
Net_RoyalRounds_CheckpointUI_CurrentNbSegments = CurrentSegment;
|
||||||
|
|
||||||
if (CurrentSegment < S_SegmentsPerRound) { // TODO Try to keep CP diff a the bottom of the screen
|
if (CurrentSegment < S_SegmentsPerRound) { // TODO Try to keep CP diff a the bottom of the screen
|
||||||
declare ModeRounds_CanSpawn for Event.Player.Score = Rounds_Settings_CanSpawnDefault;
|
declare ModeRounds_CanSpawn for Event.Player.Score = Rounds_Settings_CanSpawnDefault;
|
||||||
@ -426,6 +426,10 @@ if (
|
|||||||
|
|
||||||
UpdateScoresTableFooter(S_PointsLimit, S_RoundsPerMap, S_MapsPerMatch, Map_ValidRoundsNb, S_SegmentsPerRound);
|
UpdateScoresTableFooter(S_PointsLimit, S_RoundsPerMap, S_MapsPerMatch, Map_ValidRoundsNb, S_SegmentsPerRound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Net_RoyalRounds_CheckpointUI_TotalNbSegments != S_SegmentsPerRound) {
|
||||||
|
Net_RoyalRounds_CheckpointUI_TotalNbSegments = S_SegmentsPerRound;
|
||||||
|
}
|
||||||
***
|
***
|
||||||
|
|
||||||
***Rounds_CheckStopRound***
|
***Rounds_CheckStopRound***
|
||||||
@ -733,31 +737,46 @@ Boolean MapIsOver(Boolean _UseTieBreak, Integer _PointsLimit, Integer _ValidRoun
|
|||||||
#Include "TextLib" as TL
|
#Include "TextLib" as TL
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
declare netread Integer Net_RoyalRounds_CheckpointUI_Rank for UI;
|
|
||||||
declare netread Integer Net_RoyalRounds_CheckpointUI_Update for UI;
|
|
||||||
|
|
||||||
declare Integer TimeToDisplay = 0;
|
declare Integer TimeToDisplay = 0;
|
||||||
declare Integer LastUpdate = 0;
|
declare Integer LastUpdate = 0;
|
||||||
|
|
||||||
declare Quad_UI <=> (Page.GetFirstChild("quad-ui") as CMlQuad);
|
declare Quad_UI <=> (Page.GetFirstChild("quad-ui") as CMlQuad);
|
||||||
declare Label_Rank <=> (Page.GetFirstChild("label-rank") as CMlLabel);
|
declare Label_Rank <=> (Page.GetFirstChild("label-rank") as CMlLabel);
|
||||||
declare Label_Time <=> (Page.GetFirstChild("label-time") as CMlLabel);
|
declare Label_Time <=> (Page.GetFirstChild("label-time") as CMlLabel);
|
||||||
|
declare Label_Segments <=> (Page.GetFirstChild("label-segments") as CMlLabel);
|
||||||
|
|
||||||
|
declare netread Integer Net_RoyalRounds_CheckpointUI_TotalNbSegments for Teams[0];
|
||||||
|
|
||||||
while(True) {
|
while(True) {
|
||||||
yield;
|
yield;
|
||||||
|
|
||||||
|
if (GUIPlayer != Null) {
|
||||||
|
declare netread Integer Net_RoyalRounds_CheckpointUI_Rank for GUIPlayer;
|
||||||
|
declare netread Integer Net_RoyalRounds_CheckpointUI_CurrentNbSegments for GUIPlayer;
|
||||||
|
declare netread Integer Net_RoyalRounds_CheckpointUI_Update for GUIPlayer;
|
||||||
|
|
||||||
if (LastUpdate != Net_RoyalRounds_CheckpointUI_Update) {
|
if (LastUpdate != Net_RoyalRounds_CheckpointUI_Update) {
|
||||||
|
if (GUIPlayer.RaceWaypointTimes.count <= 0) continue; // skip if there is any latency (useful for spectators)
|
||||||
LastUpdate = Net_RoyalRounds_CheckpointUI_Update;
|
LastUpdate = Net_RoyalRounds_CheckpointUI_Update;
|
||||||
|
if (Net_RoyalRounds_CheckpointUI_Rank > 0) {
|
||||||
|
Label_Time.Value = TL::TimeToText(GUIPlayer.RaceWaypointTimes[0], True, True);
|
||||||
Label_Rank.Value = TL::FormatRank(Net_RoyalRounds_CheckpointUI_Rank, False);
|
Label_Rank.Value = TL::FormatRank(Net_RoyalRounds_CheckpointUI_Rank, False);
|
||||||
Label_Time.Value = TL::TimeToText(GUIPlayer.RaceWaypointTimes[0], True, True);// PrevRace
|
Label_Segments.Value = TL::Compose("Segment %1/%2", TL::ToText(Net_RoyalRounds_CheckpointUI_CurrentNbSegments), TL::ToText(Net_RoyalRounds_CheckpointUI_TotalNbSegments));
|
||||||
Quad_UI.Visible = True;
|
Quad_UI.Visible = True;
|
||||||
TimeToDisplay = Now + 3000;
|
TimeToDisplay = Now + 3000;
|
||||||
|
} else {
|
||||||
|
TimeToDisplay = -1; // Force hide UI
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TimeToDisplay != 0 && TimeToDisplay < Now) {
|
if (TimeToDisplay != 0 && TimeToDisplay < Now) {
|
||||||
Quad_UI.Visible = False;
|
Quad_UI.Visible = False;
|
||||||
TimeToDisplay = 0;
|
TimeToDisplay = 0;
|
||||||
}
|
}
|
||||||
|
} else if (Quad_UI.Visible) {
|
||||||
|
Quad_UI.Visible = False;
|
||||||
|
TimeToDisplay = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--></script>
|
--></script>
|
||||||
@ -776,6 +795,10 @@ Boolean MapIsOver(Boolean _UseTieBreak, Integer _PointsLimit, Integer _ValidRoun
|
|||||||
<quad z-index="0" size="10 8" halign="right" valign="center" bgcolor="000000" opacity="0.6" id="quad-race-rank" />
|
<quad z-index="0" size="10 8" halign="right" valign="center" bgcolor="000000" opacity="0.6" id="quad-race-rank" />
|
||||||
<label pos="-0.5 0" z-index="1" size="8.5 10" halign="right" valign="center2" textsize="3" textemboss="1" class="text-default" id="label-rank" />
|
<label pos="-0.5 0" z-index="1" size="8.5 10" halign="right" valign="center2" textsize="3" textemboss="1" class="text-default" id="label-rank" />
|
||||||
</frame>
|
</frame>
|
||||||
|
<frame pos="0 -2.25" id="frame-race-segment" scale="0.9">
|
||||||
|
<quad z-index="0" size="25 8" valign="center" bgcolor="000000" opacity="0.6" />
|
||||||
|
<label pos="24 0" z-index="1" size="23 10" halign="right" valign="center2" class="text-default" id="label-segments" />
|
||||||
|
</frame>
|
||||||
</frame>
|
</frame>
|
||||||
</frame>
|
</frame>
|
||||||
</frame>
|
</frame>
|
||||||
|
Loading…
Reference in New Issue
Block a user