Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Api/Api.as
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
namespace Api {

bool UploadingReplay = false;
// Workaround method for checkServer to ensure checkServer is only called when webId and playerLogin are not the equal
void checkServerWaitForValidWebId() {
while (g_dojo.network.PlayerInfo.Login == g_dojo.network.PlayerInfo.WebServicesUserId) {
Expand Down Expand Up @@ -198,11 +198,15 @@ namespace Api {
@req.Headers = Headers;

// Start and wait until request is finished
UploadingReplay = true;

req.Start();
while (!req.Finished()) {
yield();
}

UploadingReplay = false;

// Handle error status codes
int status = req.ResponseCode();
if (status == 401) {
Expand Down
12 changes: 3 additions & 9 deletions Lib/Dojo.as
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,9 @@ class TMDojo
bool hudOff = !UI::IsGameUIVisible();

if (app.CurrentPlayground !is null && app.CurrentPlayground.Interface !is null) {
if (hudOff || @playgroundScript == null) {
if (@app.Network.PlaygroundClientScriptAPI != null) {
auto playgroundClientScriptAPI = cast<CGamePlaygroundClientScriptAPI>(app.Network.PlaygroundClientScriptAPI);
if (@playgroundClientScriptAPI != null) {
g_dojo.currentRaceTime = playgroundClientScriptAPI.GameTime - smScript.StartTime;
}
}
} else {
g_dojo.currentRaceTime = smScript.CurrentRaceTime;
auto playgroundClientScriptAPI = cast<CGamePlaygroundClientScriptAPI>(app.Network.PlaygroundClientScriptAPI);
if (@playgroundClientScriptAPI != null) {
g_dojo.currentRaceTime = playgroundClientScriptAPI.GameTime - smScript.StartTime;
}
}

Expand Down
42 changes: 38 additions & 4 deletions UI/RecordingOverlay.as
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ void drawRecordingOverlay() {

// Define colors
vec4 white = vec4(1, 1, 1, 1);
vec4 orange = vec4(1, 0.5, 0, 1);
vec4 gray = vec4(0.1, 0.1, 0.1, 1);
vec4 red = vec4(0.95, 0.05, 0.05, 1);

Expand All @@ -24,7 +25,15 @@ void drawRecordingOverlay() {
int circleTop = panelTop + 18;
nvg::BeginPath();
nvg::Circle(vec2(circleLeft, circleTop), 10);
nvg::FillColor(g_dojo.recording ? red : gray);

if (g_dojo.recording) {
nvg::FillColor(red);
} else if (Api::UploadingReplay) {
nvg::FillColor(orange);
} else{
nvg::FillColor(gray);
}

nvg::Fill();
nvg::StrokeColor(gray);
nvg::StrokeWidth(3);
Expand All @@ -34,7 +43,32 @@ void drawRecordingOverlay() {
// Recording text
int textLeft = panelLeft + 38;
int textTop = panelTop + 23;
nvg::FillColor(g_dojo.recording ? red : white);
nvg::FillColor(white);
nvg::Text(textLeft, textTop, (g_dojo.recording ? "Recording" : "Not Recording"));

if (g_dojo.recording) {
nvg::FillColor(white);
nvg::Text(textLeft, textTop, "Recording");
} else if (Api::UploadingReplay) {
nvg::FillColor(white);
nvg::Text(textLeft, textTop, "Uploading");

nvg::BeginPath();

float timeOffset = (float(Time::Now) % 2000) / (Math::PI * 100);

// First arc
nvg::Arc(vec2(circleLeft, circleTop), 10.5, 1.2 + timeOffset, timeOffset, nvg::Winding::CCW);
nvg::FillColor(orange);
nvg::Fill();
nvg::ClosePath();

// Second arc on the opposite side
nvg::BeginPath();
nvg::Arc(vec2(circleLeft, circleTop), 10.5, 4.3 + timeOffset, 3.1 + timeOffset, nvg::Winding::CCW);
nvg::FillColor(orange);
nvg::Fill();
nvg::ClosePath();
} else{
nvg::FillColor(white);
nvg::Text(textLeft, textTop, "Not Recording");
}
}
2 changes: 1 addition & 1 deletion info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "TMDojo"
author = "TeamDojo"
category = "Utilities"
version = "0.7.0"
version = "0.7.1"
siteid = 180

[script]
Expand Down