Skip to content

Commit

Permalink
Created a more fluid avatar system
Browse files Browse the repository at this point in the history
  • Loading branch information
theberzer committed Oct 1, 2018
1 parent 2947a0f commit ac173e5
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 16 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLeve
{
string sqlMatches = "SELECT COUNT(DISTINCT matchID) FROM matchList WHERE PID1 = '" + PID + "' OR PID2 = '" + PID + "';";
string sqlWins = "SELECT COUNT(DISTINCT matchID) FROM results WHERE win = 1 AND PID = '" + PID + "' GROUP BY PID;";
string sqlName = "SELECT username FROM profile WHERE PID = '" + PID + "';";
string sqlName = "SELECT username, avatar FROM profile WHERE PID = '" + PID + "';";

EntryName pidRow = new EntryName();
pidRow.label = "username";
Expand Down Expand Up @@ -107,7 +107,13 @@ public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLeve
row.label = "username";
row.name = reader.GetString(0);
result.Add(row);
}

EntryName rowA = new EntryName();
rowA.label = "avatar";
rowA.name = reader.GetString(1);
result.Add(rowA);

}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLeve
{
string sqlMatches = "SELECT COUNT(DISTINCT matchID) FROM matchList WHERE PID1 = '" + PID + "' OR PID2 = '" + PID + "';";
string sqlWins = "SELECT COUNT(DISTINCT matchID) FROM results WHERE win = 1 AND PID = '" + PID + " ' GROUP BY PID;";
string sqlName = "SELECT username FROM profile WHERE PID = '" + PID + "';";
string sqlName = "SELECT username, avatar FROM profile WHERE PID = '" + PID + "';";

EntryName pidRow = new EntryName();
pidRow.label = "username";
Expand Down Expand Up @@ -131,6 +131,10 @@ public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLeve
row.label = "username";
row.name = reader.GetString(0);
result.Add(row);
EntryName rowA = new EntryName();
rowA.label = "avatar";
rowA.name = reader.GetString(1);
result.Add(rowA);
}
}
}
Expand Down
15 changes: 8 additions & 7 deletions rocket_league_ai_frontend/assets/js/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,21 @@ function getUpcomingMatchInfo(increment) {


//P1
$("#uindexP1Avatar").attr("src", "https://rlaitimagesandcode.blob.core.windows.net/rlait/avatar_" + data[0].name + ".jpg");
$("#uindexP1Avatar").attr("src", "https://rlaitimagesandcode.blob.core.windows.net/rlait/" + data[4].name);

$("#uindexPlayer1TotalMatches").html(parseInt(data[1].count));
$("#uindexPlayer1TotalWins").html(parseInt(data[2].count));
$("#uindexPlayer1WinningPercentage").html((parseInt(data[1].count) == 0 ? 0 : (parseInt(data[2].count) / parseInt(data[1].count))).toFixed(2));

//P2
$("#uindexP2Avatar").attr("src", "https://rlaitimagesandcode.blob.core.windows.net/rlait/avatar_" + data[4].name + ".jpg");
$("#uindexPlayer2TotalMatches").html(parseInt(data[5].count));
$("#uindexPlayer2TotalWins").html(parseInt(data[6].count));
$("#uindexPlayer2WinningPercentage").html((parseInt(data[5].count) == 0 ? 0 : (parseInt(data[6].count) / parseInt(data[5].count))).toFixed(2));
$("#uindexP2Avatar").attr("src", "https://rlaitimagesandcode.blob.core.windows.net/rlait/" + data[9].name);
$("#uindexPlayer2TotalMatches").html(parseInt(data[6].count));
$("#uindexPlayer2TotalWins").html(parseInt(data[7].count));
$("#uindexPlayer2WinningPercentage").html((parseInt(data[6].count) == 0 ? 0 : (parseInt(data[7].count) / parseInt(data[6].count))).toFixed(2));

//Names
$("#ucurrentMatchNames").html(data[3].name + " VS " + data[7].name);
$("#ucurrentMatchNames").html(data[3].name + " VS " + data[8].name);
$("#gameInfoModal").modal("show")
});
$("#gameInfoModal").modal("show");
;
}
12 changes: 6 additions & 6 deletions rocket_league_ai_frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@
$.getJSON("https://rlaitfunctions.azurewebsites.net/api/getCurrentMatch", function(data) {
data = JSON.parse(data);
//P1
$("#p1Avatar").attr("src", "https://rlaitimagesandcode.blob.core.windows.net/rlait/avatar_" + data[0].name + ".jpg");
$("#p1Avatar").attr("src", "https://rlaitimagesandcode.blob.core.windows.net/rlait/" + data[4].name);

$("#indexPlayer1TotalMatches").html(parseInt(data[1].count));
$("#indexPlayer1TotalWins").html(parseInt(data[2].count));
$("#indexPlayer1WinningPercentage").html((parseInt(data[1].count) == 0 ? 0 : (parseInt(data[2].count) / parseInt(data[1].count))).toFixed(2));

//P2
$("#p2Avatar").attr("src", "https://rlaitimagesandcode.blob.core.windows.net/rlait/avatar_" + data[4].name + ".jpg");
$("#indexPlayer2TotalMatches").html(parseInt(data[5].count));
$("#indexPlayer2TotalWins").html(parseInt(data[6].count));
$("#indexPlayer2WinningPercentage").html((parseInt(data[5].count) == 0 ? 0 : (parseInt(data[6].count) / parseInt(data[5].count))).toFixed(2));
$("#p2Avatar").attr("src", "https://rlaitimagesandcode.blob.core.windows.net/rlait/" + data[9].name);
$("#indexPlayer2TotalMatches").html(parseInt(data[6].count));
$("#indexPlayer2TotalWins").html(parseInt(data[7].count));
$("#indexPlayer2WinningPercentage").html((parseInt(data[6].count) == 0 ? 0 : (parseInt(data[7].count) / parseInt(data[6].count))).toFixed(2));

//Names
$("#currentMatchNames").html(data[3].name + " VS " + data[7].name);
$("#currentMatchNames").html(data[3].name + " VS " + data[8].name);

$("#currentMatch").show();

Expand Down

0 comments on commit ac173e5

Please sign in to comment.