Commit 222eb0b9 authored by thcrack's avatar thcrack
Browse files

Fixed more bugs on duo mode (again)

parent 0bdbdb51
......@@ -70,7 +70,11 @@ public class DatabaseManager : Singleton<DatabaseManager> {
MySqlCommand cmd = new MySqlCommand(sql, conn);
cmd.Parameters.AddWithValue("?trackid", track.trackID);
cmd.Parameters.AddWithValue("?date", System.DateTime.Now.ToString("yyyy-MM-dd"));
cmd.Parameters.AddWithValue("?playerid", CrossSceneInfo.Instance.loggedID);
if(CrossSceneInfo.Instance.selectedGameMode == GameMode.Single){
cmd.Parameters.AddWithValue("?playerid", CrossSceneInfo.Instance.loggedID);
}else{
cmd.Parameters.AddWithValue("?playerid", CrossSceneInfo.Instance.loggedIDDuoA);
}
MySqlDataReader data = cmd.ExecuteReader();
while(data.Read()){
GameRecordEntry newEntry = new GameRecordEntry(data["playerid"].ToString(), System.Convert.ToInt32(data["score"]), System.Convert.ToInt32(data["recordid"]));
......
......@@ -52,21 +52,42 @@ public class LeaderboardBehavior : MonoBehaviour {
int selfIndex = entries.FindIndex(e => e.recordid == lastRecord.recordid);
totalEntryText.text = "Total Entries: " + entries.Count;
bool selfInTopRank = selfIndex < recordEntryCount;
for(int i = 0; i < recordEntryCount; i++){
if(selfInTopRank || i < recordEntryCount - 1){
if(i < entries.Count){
items[i].UpdateText(i+1, entries[i].playerid, entries[i].score);
if(i == selfIndex){
items[i].SetSelfColor();
if(CrossSceneInfo.Instance.selectedGameMode == GameMode.Single){
for(int i = 0; i < recordEntryCount; i++){
if(selfInTopRank || i < recordEntryCount - 1){
if(i < entries.Count){
items[i].UpdateText(i+1, entries[i].playerid, entries[i].score);
if(i == selfIndex){
items[i].SetSelfColor();
}else{
items[i].SetNormalColor();
}
}else{
items[i].ClearText();
}
}else{
items[i].UpdateText(selfIndex+1, lastRecord.playerid, lastRecord.score);
items[i].SetSelfColor();
}
}
}else{
for(int i = 0; i < recordEntryCount; i++){
if(selfInTopRank || i < recordEntryCount - 1){
if(i < entries.Count){
items[i].UpdateText(i+1, entries[i].playerid, entries[i].score);
if(i == selfIndex){
items[i].SetSelfColor();
}else{
items[i].SetNormalColor();
}
}else{
items[i].SetNormalColor();
items[i].ClearText();
}
}else{
items[i].ClearText();
items[i].UpdateText(selfIndex+1, lastRecord.playerid, lastRecord.score);
items[i].SetSelfColor();
}
}else{
items[i].UpdateText(selfIndex+1, lastRecord.playerid, lastRecord.score);
items[i].SetSelfColor();
}
}
}
......
......@@ -26,4 +26,8 @@ public class LeaderboardItemBehavior : MonoBehaviour {
public void SetSelfColor(){
rankText.color = idText.color = scoreText.color = Color.cyan;
}
public void Set2PColor(){
rankText.color = idText.color = scoreText.color = Color.magenta;
}
}
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment