Compare commits
2 commits
e1aee5d946
...
85e3d5827e
Author | SHA1 | Date | |
---|---|---|---|
Mark Joshwel | 85e3d5827e | ||
Mark Joshwel | a5679b4270 |
|
@ -378,13 +378,13 @@ private void OnUsernameUpdateButtonClick()
|
|||
|
||||
GameManager.Instance.Backend.UpdateUserAccountDetail(Backend.UserAccountDetailTargetEnum.Username,
|
||||
_usernameField.value,
|
||||
dtr =>
|
||||
res =>
|
||||
{
|
||||
_accompanyingText.style.display = DisplayStyle.Flex;
|
||||
_accompanyingText.text = dtr switch
|
||||
_accompanyingText.text = res switch
|
||||
{
|
||||
Backend.DatabaseTransactionResult.Ok => "Username updated!",
|
||||
Backend.DatabaseTransactionResult.Unauthenticated =>
|
||||
Backend.TransactionResult.Ok => "Username updated!",
|
||||
Backend.TransactionResult.Unauthenticated =>
|
||||
"You are not signed in. Please sign in to update your username.",
|
||||
_ => "An error occurred updating the username. Please try again."
|
||||
};
|
||||
|
@ -414,9 +414,9 @@ private void OnEmailUpdateButtonClick()
|
|||
_accompanyingText.style.display = DisplayStyle.Flex;
|
||||
_accompanyingText.text = callback switch
|
||||
{
|
||||
Backend.DatabaseTransactionResult.Ok =>
|
||||
Backend.TransactionResult.Ok =>
|
||||
$"Verification email sent to {_emailField.value}! You may want to sign in again to see the changes.",
|
||||
Backend.DatabaseTransactionResult.Unauthenticated =>
|
||||
Backend.TransactionResult.Unauthenticated =>
|
||||
"You are not signed in. Please sign in to update your email.",
|
||||
_ => "An error occurred updating the email. Please try again."
|
||||
};
|
||||
|
@ -446,8 +446,8 @@ private void OnPasswordUpdateButtonClick()
|
|||
_accompanyingText.style.display = DisplayStyle.Flex;
|
||||
_accompanyingText.text = callback switch
|
||||
{
|
||||
Backend.DatabaseTransactionResult.Ok => "Password updated!",
|
||||
Backend.DatabaseTransactionResult.Unauthenticated =>
|
||||
Backend.TransactionResult.Ok => "Password updated!",
|
||||
Backend.TransactionResult.Unauthenticated =>
|
||||
"You are not signed in. Please sign in to update your password.",
|
||||
_ => "An error occurred updating the password. Please try again."
|
||||
};
|
||||
|
@ -635,12 +635,23 @@ private void OnTertiaryActionButtonClick()
|
|||
// delete local data
|
||||
case State.NotSignedIn:
|
||||
PlayerPrefs.DeleteAll();
|
||||
_accompanyingText.style.display = DisplayStyle.Flex;
|
||||
_accompanyingText.text = "Local data deleted.";
|
||||
GameManager.Instance.Data.LoadFromTheWorld(GameManager.Instance.FireLocalPlayerDataChangeCallbacks);
|
||||
break;
|
||||
|
||||
// delete user account
|
||||
case State.SignedIn:
|
||||
GameManager.Instance.Backend.DeleteUser();
|
||||
GameManager.Instance.Backend.DeleteUser(result =>
|
||||
{
|
||||
_accompanyingText.style.display = DisplayStyle.Flex;
|
||||
_accompanyingText.text = result switch
|
||||
{
|
||||
Backend.TransactionResult.Ok => "Account deleted.",
|
||||
Backend.TransactionResult.Unauthenticated => "You are not signed in.",
|
||||
_ => "An error occurred deleting the account. Please try again."
|
||||
};
|
||||
});
|
||||
break;
|
||||
|
||||
case State.AfterContinue:
|
||||
|
@ -661,7 +672,7 @@ private void OnLocalPlayerDataChangeCallback(LocalPlayerData data)
|
|||
$"updating AccountView ui with lkUsername={data.LastKnownUsername} and lkEmail={data.LastKnownEmail}");
|
||||
_usernameField.value = data.LastKnownUsername;
|
||||
_emailField.value = data.LastKnownEmail;
|
||||
_header.text = $"Signed in as {data.LastKnownUsername}";
|
||||
if (state == State.SignedIn) _header.text = $"Signed in as {data.LastKnownUsername}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -28,16 +28,6 @@ public enum AuthenticationResult
|
|||
GenericError
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// generic enum for the result of a database transaction
|
||||
/// </summary>
|
||||
public enum DatabaseTransactionResult
|
||||
{
|
||||
Ok,
|
||||
Unauthenticated,
|
||||
Error
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// enum for the connection status of the firebase backend
|
||||
/// </summary>
|
||||
|
@ -51,6 +41,16 @@ public enum FirebaseConnectionStatus
|
|||
InternalError // "an unknown error occurred"
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// generic enum for the result of a database transaction
|
||||
/// </summary>
|
||||
public enum TransactionResult
|
||||
{
|
||||
Ok,
|
||||
Unauthenticated,
|
||||
Error
|
||||
}
|
||||
|
||||
public enum UserAccountDetailTargetEnum
|
||||
{
|
||||
Username,
|
||||
|
@ -454,14 +454,14 @@ private void RetrieveUsername()
|
|||
/// <summary>
|
||||
/// function to retrieve the user's username from the database
|
||||
/// </summary>
|
||||
private void RetrieveUsernameWithCallback(Action<DatabaseTransactionResult, string> callback)
|
||||
private void RetrieveUsernameWithCallback(Action<TransactionResult, string> callback)
|
||||
{
|
||||
if (!Status.Equals(FirebaseConnectionStatus.Connected)) return;
|
||||
|
||||
if (_user == null)
|
||||
{
|
||||
Debug.LogError("receiving username post-authentication but user is null (should be unreachable)");
|
||||
callback(DatabaseTransactionResult.Unauthenticated, "Unknown");
|
||||
callback(TransactionResult.Unauthenticated, "Unknown");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -471,16 +471,16 @@ private void RetrieveUsernameWithCallback(Action<DatabaseTransactionResult, stri
|
|||
.GetValueAsync()
|
||||
.ContinueWithOnMainThread(task =>
|
||||
{
|
||||
DatabaseTransactionResult result;
|
||||
TransactionResult result;
|
||||
if (task.IsCompletedSuccessfully)
|
||||
{
|
||||
result = DatabaseTransactionResult.Ok;
|
||||
result = TransactionResult.Ok;
|
||||
_username = task.Result.Value.ToString();
|
||||
Debug.Log($"our username is {_username}");
|
||||
}
|
||||
else
|
||||
{
|
||||
result = DatabaseTransactionResult.Error;
|
||||
result = TransactionResult.Error;
|
||||
_username = "Unknown";
|
||||
Debug.LogError("failed to get username");
|
||||
}
|
||||
|
@ -514,18 +514,33 @@ public void SignOutUser()
|
|||
/// <summary>
|
||||
/// abstraction function to delete the user
|
||||
/// </summary>
|
||||
public void DeleteUser()
|
||||
public void DeleteUser(Action<TransactionResult> callback)
|
||||
{
|
||||
if (!Status.Equals(FirebaseConnectionStatus.Connected))
|
||||
{
|
||||
callback(TransactionResult.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_user == null)
|
||||
{
|
||||
callback(TransactionResult.Unauthenticated);
|
||||
return;
|
||||
}
|
||||
|
||||
_user.DeleteAsync().ContinueWithOnMainThread(task =>
|
||||
{
|
||||
if (task.IsCompletedSuccessfully)
|
||||
{
|
||||
Debug.Log("user deleted");
|
||||
SignOutUser();
|
||||
_user = null;
|
||||
FireOnSignOutCallbacks();
|
||||
callback(TransactionResult.Ok);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError(task.Exception);
|
||||
Debug.LogError($"error deleting user: {task.Exception}");
|
||||
callback(TransactionResult.Error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -556,29 +571,29 @@ public void ResetUserPassword(string email, Action<bool> callback)
|
|||
/// abstraction function to get the user's recent scores from the database
|
||||
/// </summary>
|
||||
/// <param name="callback">
|
||||
/// callback function that takes in a <c>DatabaseTransactionResult</c> enum and a
|
||||
/// callback function that takes in a <c>TransactionResult</c> enum and a
|
||||
/// <c>List<LocalPlayerData.Score></c>
|
||||
/// </param>
|
||||
public void GetRecentScores(Action<DatabaseTransactionResult, List<LocalPlayerData.Score>> callback)
|
||||
public void GetRecentScores(Action<TransactionResult, List<LocalPlayerData.Score>> callback)
|
||||
{
|
||||
if (!Status.Equals(FirebaseConnectionStatus.Connected)) return;
|
||||
|
||||
if (_user == null)
|
||||
{
|
||||
callback(DatabaseTransactionResult.Unauthenticated, new List<LocalPlayerData.Score>(0));
|
||||
callback(TransactionResult.Unauthenticated, new List<LocalPlayerData.Score>(0));
|
||||
return;
|
||||
}
|
||||
|
||||
_db.Child("scores")
|
||||
.OrderByChild("timestamp")
|
||||
.LimitToLast(LocalPlayerData.MaxBestOnlineScores)
|
||||
.LimitToLast(LocalPlayerData.MaxBestScores)
|
||||
.GetValueAsync()
|
||||
.ContinueWithOnMainThread(task =>
|
||||
{
|
||||
if (!task.IsCompletedSuccessfully)
|
||||
{
|
||||
Debug.LogError(task.Exception);
|
||||
callback(DatabaseTransactionResult.Error, new List<LocalPlayerData.Score>(0));
|
||||
callback(TransactionResult.Error, new List<LocalPlayerData.Score>(0));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -594,7 +609,7 @@ public void GetRecentScores(Action<DatabaseTransactionResult, List<LocalPlayerDa
|
|||
Debug.LogError($"{e}\n{child.GetRawJsonValue()}");
|
||||
}
|
||||
|
||||
callback(DatabaseTransactionResult.Ok, scores);
|
||||
callback(TransactionResult.Ok, scores);
|
||||
GameManager.Instance.FireLocalPlayerDataChangeCallbacks(GameManager.Instance.Data);
|
||||
});
|
||||
}
|
||||
|
@ -603,29 +618,29 @@ public void GetRecentScores(Action<DatabaseTransactionResult, List<LocalPlayerDa
|
|||
/// abstraction function to get the user's best scores from the database
|
||||
/// </summary>
|
||||
/// <param name="callback">
|
||||
/// callback function that takes in a <c>DatabaseTransactionResult</c> enum and a
|
||||
/// callback function that takes in a <c>TransactionResult</c> enum and a
|
||||
/// <c>List<LocalPlayerData.Score></c>
|
||||
/// </param>
|
||||
private void GetBestScores(Action<DatabaseTransactionResult, List<LocalPlayerData.Score>> callback)
|
||||
private void GetBestScores(Action<TransactionResult, List<LocalPlayerData.Score>> callback)
|
||||
{
|
||||
if (!Status.Equals(FirebaseConnectionStatus.Connected)) return;
|
||||
|
||||
if (_user == null)
|
||||
{
|
||||
callback(DatabaseTransactionResult.Unauthenticated, new List<LocalPlayerData.Score>(0));
|
||||
callback(TransactionResult.Unauthenticated, new List<LocalPlayerData.Score>(0));
|
||||
return;
|
||||
}
|
||||
|
||||
_db.Child("scores")
|
||||
.OrderByChild("avgPerceivedAccuracy")
|
||||
.LimitToLast(LocalPlayerData.MaxBestOnlineScores)
|
||||
.LimitToLast(LocalPlayerData.MaxBestScores)
|
||||
.GetValueAsync()
|
||||
.ContinueWithOnMainThread(task =>
|
||||
{
|
||||
if (!task.IsCompletedSuccessfully)
|
||||
{
|
||||
Debug.LogError(task.Exception);
|
||||
callback(DatabaseTransactionResult.Error, new List<LocalPlayerData.Score>(0));
|
||||
callback(TransactionResult.Error, new List<LocalPlayerData.Score>(0));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -641,7 +656,7 @@ private void GetBestScores(Action<DatabaseTransactionResult, List<LocalPlayerDat
|
|||
Debug.LogError(e);
|
||||
}
|
||||
|
||||
callback(DatabaseTransactionResult.Ok, scores);
|
||||
callback(TransactionResult.Ok, scores);
|
||||
GameManager.Instance.FireLocalPlayerDataChangeCallbacks(GameManager.Instance.Data);
|
||||
});
|
||||
}
|
||||
|
@ -650,16 +665,16 @@ private void GetBestScores(Action<DatabaseTransactionResult, List<LocalPlayerDat
|
|||
/// abstraction function to submit a score to the database
|
||||
/// </summary>
|
||||
/// <param name="score">score</param>
|
||||
/// <param name="callback">callback function that takes in a <c>DatabaseTransactionResult</c> enum </param>
|
||||
/// <param name="callback">callback function that takes in a <c>TransactionResult</c> enum </param>
|
||||
public void SubmitScore(
|
||||
LocalPlayerData.Score score,
|
||||
Action<DatabaseTransactionResult> callback)
|
||||
Action<TransactionResult> callback)
|
||||
{
|
||||
if (!Status.Equals(FirebaseConnectionStatus.Connected)) return;
|
||||
|
||||
if (_user == null)
|
||||
{
|
||||
callback(DatabaseTransactionResult.Unauthenticated);
|
||||
callback(TransactionResult.Unauthenticated);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -670,12 +685,12 @@ private void GetBestScores(Action<DatabaseTransactionResult, List<LocalPlayerDat
|
|||
{
|
||||
if (task.IsCompletedSuccessfully)
|
||||
{
|
||||
callback(DatabaseTransactionResult.Ok);
|
||||
callback(TransactionResult.Ok);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError(task.Exception);
|
||||
callback(DatabaseTransactionResult.Error);
|
||||
callback(TransactionResult.Error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -685,15 +700,15 @@ private void GetBestScores(Action<DatabaseTransactionResult, List<LocalPlayerDat
|
|||
/// calculation is done locally, call UpdateUserRating to update the user's rating in the database
|
||||
/// </summary>
|
||||
/// <param name="callback">
|
||||
/// callback function that takes in a <c>DatabaseTransactionResult</c> enum and a user rating
|
||||
/// callback function that takes in a <c>TransactionResult</c> enum and a user rating
|
||||
/// <c>float</c>
|
||||
/// </param>
|
||||
public void CalculateUserRating(
|
||||
Action<DatabaseTransactionResult, float> callback)
|
||||
Action<TransactionResult, float> callback)
|
||||
{
|
||||
GetRecentScores((recentRes, recentScores) =>
|
||||
{
|
||||
if (recentRes != DatabaseTransactionResult.Ok)
|
||||
if (recentRes != TransactionResult.Ok)
|
||||
{
|
||||
Debug.Log("failed to get recent scores");
|
||||
callback(recentRes, 0f);
|
||||
|
@ -702,22 +717,24 @@ private void GetBestScores(Action<DatabaseTransactionResult, List<LocalPlayerDat
|
|||
|
||||
var recentScoreQueue = GameManager.Instance.Data.RecentOnlineScores;
|
||||
foreach (var score in recentScores) recentScoreQueue.Enqueue(score);
|
||||
while (recentScoreQueue.Count > LocalPlayerData.MaxRecentLocalScores) recentScoreQueue.Dequeue();
|
||||
while (recentScoreQueue.Count > LocalPlayerData.MaxRecentScores) recentScoreQueue.Dequeue();
|
||||
|
||||
GetBestScores((bestRes, bestScores) =>
|
||||
{
|
||||
if (bestRes != DatabaseTransactionResult.Ok)
|
||||
if (bestRes != TransactionResult.Ok)
|
||||
{
|
||||
Debug.Log("failed to get recent scores");
|
||||
GameManager.Instance.FireLocalPlayerDataChangeCallbacks(GameManager.Instance.Data);
|
||||
callback(recentRes, 0f);
|
||||
return;
|
||||
}
|
||||
|
||||
var bestScoreQueue = GameManager.Instance.Data.BestOnlineScores;
|
||||
foreach (var score in bestScores) bestScoreQueue.Enqueue(score);
|
||||
while (bestScoreQueue.Count > LocalPlayerData.MaxBestOnlineScores) bestScoreQueue.Dequeue();
|
||||
while (bestScoreQueue.Count > LocalPlayerData.MaxBestScores) bestScoreQueue.Dequeue();
|
||||
|
||||
callback(DatabaseTransactionResult.Ok, GameManager.Instance.Data.CalculateUserRating());
|
||||
GameManager.Instance.FireLocalPlayerDataChangeCallbacks(GameManager.Instance.Data);
|
||||
callback(TransactionResult.Ok, GameManager.Instance.Data.CalculateUserRating());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -725,32 +742,35 @@ private void GetBestScores(Action<DatabaseTransactionResult, List<LocalPlayerDat
|
|||
/// <summary>
|
||||
/// abstraction function to update the user's rating in the database
|
||||
/// </summary>
|
||||
/// <param name="callback">callback function that takes in a <c>DatabaseTransactionResult</c> enum </param>
|
||||
/// <param name="callback">callback function that takes in a <c>TransactionResult</c> enum </param>
|
||||
public void UpdateUserRating(
|
||||
Action<DatabaseTransactionResult> callback)
|
||||
Action<TransactionResult> callback)
|
||||
{
|
||||
if (!Status.Equals(FirebaseConnectionStatus.Connected)) return;
|
||||
|
||||
|
||||
if (_user == null)
|
||||
{
|
||||
callback(DatabaseTransactionResult.Unauthenticated);
|
||||
callback(TransactionResult.Unauthenticated);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var userRating = GameManager.Instance.Data.CalculateUserRating();
|
||||
|
||||
_db.Child("users")
|
||||
.Child(_user.UserId)
|
||||
.Child("rating")
|
||||
.SetValueAsync(GameManager.Instance.Data.CalculateUserRating())
|
||||
.SetValueAsync(userRating)
|
||||
.ContinueWithOnMainThread(task =>
|
||||
{
|
||||
if (task.IsCompletedSuccessfully)
|
||||
{
|
||||
callback(DatabaseTransactionResult.Ok);
|
||||
Debug.Log($"updated online user rating to {userRating}");
|
||||
callback(TransactionResult.Ok);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError(task.Exception);
|
||||
callback(DatabaseTransactionResult.Error);
|
||||
callback(TransactionResult.Error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -759,10 +779,10 @@ private void GetBestScores(Action<DatabaseTransactionResult, List<LocalPlayerDat
|
|||
/// abstraction function to get the leaderboard from the database
|
||||
/// </summary>
|
||||
/// <param name="callback">
|
||||
/// callback function that takes in a <c>DatabaseTransactionResult</c> enum and a <c>List<LeaderboardEntry></c>
|
||||
/// callback function that takes in a <c>TransactionResult</c> enum and a <c>List<LeaderboardEntry></c>
|
||||
/// </param>
|
||||
public void GetLeaderboard(
|
||||
Action<DatabaseTransactionResult, LeaderboardEntry[]> callback)
|
||||
Action<TransactionResult, LeaderboardEntry[]> callback)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@ -772,18 +792,18 @@ private void GetBestScores(Action<DatabaseTransactionResult, List<LocalPlayerDat
|
|||
/// </summary>
|
||||
/// <param name="target">the target account detail to update</param>
|
||||
/// <param name="newValue">the new value for the target account detail</param>
|
||||
/// <param name="callback">callback function that takes in a <c>DatabaseTransactionResult</c> enum</param>
|
||||
/// <param name="callback">callback function that takes in a <c>TransactionResult</c> enum</param>
|
||||
/// <exception cref="ArgumentOutOfRangeException">thrown when the target is not a valid UserAccountDetailTargetEnum</exception>
|
||||
public void UpdateUserAccountDetail(
|
||||
UserAccountDetailTargetEnum target,
|
||||
string newValue,
|
||||
Action<DatabaseTransactionResult> callback)
|
||||
Action<TransactionResult> callback)
|
||||
{
|
||||
if (!Status.Equals(FirebaseConnectionStatus.Connected)) callback(DatabaseTransactionResult.Unauthenticated);
|
||||
if (!Status.Equals(FirebaseConnectionStatus.Connected)) callback(TransactionResult.Unauthenticated);
|
||||
|
||||
if (_user == null)
|
||||
{
|
||||
callback(DatabaseTransactionResult.Unauthenticated);
|
||||
callback(TransactionResult.Unauthenticated);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -796,12 +816,12 @@ private void GetBestScores(Action<DatabaseTransactionResult, List<LocalPlayerDat
|
|||
{
|
||||
GameManager.Instance.Data.LastKnownEmail = newValue;
|
||||
GameManager.Instance.FireLocalPlayerDataChangeCallbacks(GameManager.Instance.Data);
|
||||
callback(DatabaseTransactionResult.Ok);
|
||||
callback(TransactionResult.Ok);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError(task.Exception);
|
||||
callback(DatabaseTransactionResult.Error);
|
||||
callback(TransactionResult.Error);
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
@ -818,12 +838,12 @@ private void GetBestScores(Action<DatabaseTransactionResult, List<LocalPlayerDat
|
|||
_username = newValue;
|
||||
GameManager.Instance.Data.LastKnownUsername = newValue;
|
||||
GameManager.Instance.FireLocalPlayerDataChangeCallbacks(GameManager.Instance.Data);
|
||||
callback(DatabaseTransactionResult.Ok);
|
||||
callback(TransactionResult.Ok);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError(task.Exception);
|
||||
callback(DatabaseTransactionResult.Error);
|
||||
callback(TransactionResult.Error);
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
@ -833,12 +853,12 @@ private void GetBestScores(Action<DatabaseTransactionResult, List<LocalPlayerDat
|
|||
{
|
||||
if (task.IsCompletedSuccessfully)
|
||||
{
|
||||
callback(DatabaseTransactionResult.Ok);
|
||||
callback(TransactionResult.Ok);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError(task.Exception);
|
||||
callback(DatabaseTransactionResult.Error);
|
||||
callback(TransactionResult.Error);
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
|
|
@ -175,42 +175,47 @@ public void SignalGameEnd(List<Gameplay.RoundInfo> playedRounds)
|
|||
var historicalLightnessAcc = 0f;
|
||||
var historicalChromaAcc = 0f;
|
||||
var historicalHueAcc = 0f;
|
||||
var historicalRounds = 0;
|
||||
var historicalPerceivedAcc = 0f;
|
||||
var historicalGames = 0;
|
||||
|
||||
foreach (var localScore in _data.RecentLocalScores)
|
||||
foreach (var localScore in _data.RecentLocalScores.Take(LocalPlayerData.MaxRecentScores))
|
||||
{
|
||||
historicalLightnessAcc += localScore.AvgLightnessAccuracy;
|
||||
historicalChromaAcc += localScore.AvgChromaAccuracy;
|
||||
historicalHueAcc += localScore.AvgHueAccuracy;
|
||||
historicalRounds += localScore.NoOfRounds;
|
||||
historicalPerceivedAcc += localScore.AvgPerceivedAccuracy;
|
||||
historicalGames++;
|
||||
}
|
||||
|
||||
foreach (var onlineScore in _data.RecentOnlineScores)
|
||||
foreach (var onlineScore in _data.RecentOnlineScores.Take(LocalPlayerData.MaxRecentScores))
|
||||
{
|
||||
historicalLightnessAcc += onlineScore.AvgLightnessAccuracy;
|
||||
historicalChromaAcc += onlineScore.AvgChromaAccuracy;
|
||||
historicalHueAcc += onlineScore.AvgHueAccuracy;
|
||||
historicalRounds += onlineScore.NoOfRounds;
|
||||
historicalPerceivedAcc += onlineScore.AvgPerceivedAccuracy;
|
||||
historicalGames++;
|
||||
}
|
||||
|
||||
foreach (var onlineScore in _data.BestOnlineScores)
|
||||
foreach (var onlineScore in _data.BestOnlineScores.Take(LocalPlayerData.MaxBestScores))
|
||||
{
|
||||
historicalLightnessAcc += onlineScore.AvgLightnessAccuracy;
|
||||
historicalChromaAcc += onlineScore.AvgChromaAccuracy;
|
||||
historicalHueAcc += onlineScore.AvgHueAccuracy;
|
||||
historicalRounds += onlineScore.NoOfRounds;
|
||||
historicalPerceivedAcc += onlineScore.AvgPerceivedAccuracy;
|
||||
historicalGames++;
|
||||
}
|
||||
|
||||
historicalLightnessAcc /= historicalRounds;
|
||||
historicalChromaAcc /= historicalRounds;
|
||||
historicalHueAcc /= historicalRounds;
|
||||
historicalGames = Math.Max(1, historicalGames);
|
||||
historicalLightnessAcc /= historicalGames;
|
||||
historicalChromaAcc /= historicalGames;
|
||||
historicalHueAcc /= historicalGames;
|
||||
historicalPerceivedAcc /= historicalGames;
|
||||
|
||||
// calculate round averages
|
||||
var gameLightnessAcc = 0d;
|
||||
var gameChromaAcc = 0d;
|
||||
var gameHueAcc = 0d;
|
||||
var gamePerceivedAcc = 0d;
|
||||
|
||||
var templateColour = Color.clear;
|
||||
var responseColour = Color.clear;
|
||||
var roundNumber = 1;
|
||||
|
@ -226,7 +231,7 @@ public void SignalGameEnd(List<Gameplay.RoundInfo> playedRounds)
|
|||
var roundLightnessAcc = Math.Clamp(dLCh.L * 100d, 0d, 100d);
|
||||
var roundChromaAcc = Math.Clamp(dLCh.C * 100d, 0d, 100d);
|
||||
var roundHueAcc = Math.Clamp(dLCh.h * 100d, 0d, 100d);
|
||||
var roundPerceivedAcc = Math.Clamp((100d - distance.dE) * 100d, 0d, 100d);
|
||||
var roundPerceivedAcc = Math.Clamp((1d - distance.dE) * 100d, 0d, 100d);
|
||||
|
||||
gameLightnessAcc += roundLightnessAcc;
|
||||
gameChromaAcc += roundChromaAcc;
|
||||
|
@ -242,7 +247,7 @@ public void SignalGameEnd(List<Gameplay.RoundInfo> playedRounds)
|
|||
showcaseTemplate.style.backgroundColor = templateColour;
|
||||
showcaseResponse.style.backgroundColor = responseColour;
|
||||
showcaseInfo.text =
|
||||
$"{roundLightnessAcc:N0}% {roundChromaAcc:N0}% {roundHueAcc:N0}% ({roundPerceivedAcc:N0}%)";
|
||||
$"{roundLightnessAcc * (roundPerceivedAcc / 100d):N0}% {roundChromaAcc * (roundPerceivedAcc / 100d):N0}% {roundHueAcc * (roundPerceivedAcc / 100d):N0}% ({roundPerceivedAcc:N0}%)";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -257,25 +262,30 @@ public void SignalGameEnd(List<Gameplay.RoundInfo> playedRounds)
|
|||
gameHueAcc /= Gameplay.RoundsPerGame;
|
||||
gamePerceivedAcc /= Gameplay.RoundsPerGame;
|
||||
|
||||
// NOTE: this is NOT equiv to user rating, this is just a per-game accuracy score
|
||||
// all that math is done in LocalPlayerData.CalculateUserRating
|
||||
var gameAccuracy = (gameLightnessAcc + gameChromaAcc + gameHueAcc + gamePerceivedAcc) / 4;
|
||||
var adjustedHistoricalLightnessAcc = historicalLightnessAcc * (historicalPerceivedAcc / 100d);
|
||||
var adjustedHistoricalChromaAcc = historicalChromaAcc * (historicalPerceivedAcc / 100d);
|
||||
var adjustedHistoricalHueAcc = historicalHueAcc * (historicalPerceivedAcc / 100d);
|
||||
var adjustedGameLightnessAcc = gameLightnessAcc * (gamePerceivedAcc / 100d);
|
||||
var adjustedGameChromaAcc = gameChromaAcc * (gamePerceivedAcc / 100d);
|
||||
var adjustedGameHueAcc = gameHueAcc * (gamePerceivedAcc / 100d);
|
||||
var gameAccuracy = (gameLightnessAcc + gameChromaAcc + gameHueAcc + gamePerceivedAcc) / 4d;
|
||||
|
||||
// make comparison texts
|
||||
var lAccDeltaText = (gameLightnessAcc > historicalLightnessAcc ? "+" : "-") +
|
||||
Math.Abs(gameLightnessAcc - historicalLightnessAcc).ToString("F2");
|
||||
var cAccDeltaText = (gameChromaAcc > historicalChromaAcc ? "+" : "-") +
|
||||
Math.Abs(gameChromaAcc - historicalChromaAcc).ToString("F2");
|
||||
var hAccDeltaText = (gameHueAcc > historicalHueAcc ? "+" : "-") +
|
||||
Math.Abs(gameHueAcc - historicalHueAcc).ToString("F2");
|
||||
var lAccDeltaText = (adjustedGameLightnessAcc > adjustedHistoricalLightnessAcc ? "+" : "-") +
|
||||
$"{Math.Abs(adjustedGameLightnessAcc - adjustedHistoricalLightnessAcc):F1}%";
|
||||
var cAccDeltaText = (adjustedGameChromaAcc > adjustedHistoricalChromaAcc ? "+" : "-") +
|
||||
$"{Math.Abs(adjustedGameChromaAcc - adjustedHistoricalChromaAcc):F1}%";
|
||||
var hAccDeltaText = (adjustedGameHueAcc > adjustedHistoricalHueAcc ? "+" : "-") +
|
||||
$"{Math.Abs(adjustedGameHueAcc - adjustedHistoricalHueAcc):F1}%";
|
||||
|
||||
var score = new LocalPlayerData.Score(DateTime.Now,
|
||||
playedRounds.Count,
|
||||
(float)gameLightnessAcc,
|
||||
(float)gameChromaAcc,
|
||||
(float)gameHueAcc,
|
||||
(float)adjustedGameLightnessAcc,
|
||||
(float)adjustedGameChromaAcc,
|
||||
(float)adjustedGameHueAcc,
|
||||
(float)gamePerceivedAcc);
|
||||
|
||||
// breakpoint here: why is gamePerceivedAcc always "100"?
|
||||
var oldRating = _data.CalculateUserRating();
|
||||
_data.RegisterLocalScore(score);
|
||||
FireLocalPlayerDataChangeCallbacks(Instance.Data);
|
||||
|
@ -285,7 +295,7 @@ public void SignalGameEnd(List<Gameplay.RoundInfo> playedRounds)
|
|||
Backend.SubmitScore(score,
|
||||
submitRes =>
|
||||
{
|
||||
if (submitRes != Backend.DatabaseTransactionResult.Ok)
|
||||
if (submitRes != Backend.TransactionResult.Ok)
|
||||
{
|
||||
Debug.Log("couldn't submit score");
|
||||
TransitionToResultsView(_data.CalculateUserRating());
|
||||
|
@ -294,17 +304,16 @@ public void SignalGameEnd(List<Gameplay.RoundInfo> playedRounds)
|
|||
|
||||
Backend.CalculateUserRating((urcRes, userRating) =>
|
||||
{
|
||||
if (urcRes != Backend.DatabaseTransactionResult.Ok)
|
||||
if (urcRes != Backend.TransactionResult.Ok)
|
||||
{
|
||||
Debug.Log("couldn't calculate user rating");
|
||||
TransitionToResultsView(_data.CalculateUserRating());
|
||||
FireLocalPlayerDataChangeCallbacks(Instance.Data);
|
||||
return;
|
||||
}
|
||||
|
||||
Backend.UpdateUserRating(updateRes =>
|
||||
{
|
||||
if (updateRes != Backend.DatabaseTransactionResult.Ok)
|
||||
if (updateRes != Backend.TransactionResult.Ok)
|
||||
{
|
||||
Debug.Log("calculated user rating but couldn't update it");
|
||||
TransitionToResultsView(userRating);
|
||||
|
@ -321,18 +330,20 @@ public void SignalGameEnd(List<Gameplay.RoundInfo> playedRounds)
|
|||
void TransitionToResultsView(float rating)
|
||||
{
|
||||
Debug.Log("signal GameManager-UIManager transition to results view");
|
||||
|
||||
var ratingDifferenceDescriptor = oldRating > rating ? "decreased" : "increased";
|
||||
|
||||
var ratingDifferenceDescriptor = rating > oldRating ? "increased" : "decreased";
|
||||
var ratingText = rating >= 0
|
||||
? $"\nYour rating has {ratingDifferenceDescriptor} by {Math.Abs(rating - oldRating):F2}."
|
||||
: "\nYour rating could not be calculated.";
|
||||
|
||||
// build the result text and show the results view
|
||||
ui.UI.Q<Label>("ResultsText").text = string.Join(Environment.NewLine, $"Over {playedRounds.Count} rounds,",
|
||||
$"you were {gameAccuracy} accurate.", "",
|
||||
$"Lightness was {gameLightnessAcc:F2}% accurate. ({lAccDeltaText} from your average)",
|
||||
$"Chroma was {gameChromaAcc:F2}% accurate. ({cAccDeltaText} from your average)",
|
||||
$"Hue was {gameHueAcc:F2}% accurate. ({hAccDeltaText} from your average)") + ratingText;
|
||||
ui.UI.Q<Label>("ResultsText").text = string.Join(Environment.NewLine,
|
||||
$"Over {playedRounds.Count:N0} rounds,",
|
||||
$"you were {LocalPlayerData.UserRatingScalingF(gameAccuracy):F2}% accurate. (raw ΔEok={gameAccuracy:F2}%)",
|
||||
"",
|
||||
$"Lightness was {adjustedGameLightnessAcc:F2}% accurate. ({lAccDeltaText} from your average)",
|
||||
$"Chroma was {adjustedGameChromaAcc:F2}% accurate. ({cAccDeltaText} from your average)",
|
||||
$"Hue was {adjustedGameHueAcc:F2}% accurate. ({hAccDeltaText} from your average)") + ratingText;
|
||||
|
||||
ui.SetDisplayState(UIManager.DisplayState.ResultsView);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public class Gameplay
|
|||
/// seconds per round
|
||||
/// </summary>
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
public const double SecondsPerRound = 15d;
|
||||
public const double SecondsPerRound = 12d;
|
||||
|
||||
/// <summary>
|
||||
/// countdown text label for showing the countdown
|
||||
|
@ -118,7 +118,8 @@ private void StoreRoundInfo()
|
|||
TemplateColour = _templateColour.style.backgroundColor.value,
|
||||
ResponseColour = _responseColour.style.backgroundColor.value
|
||||
});
|
||||
Debug.Log("stored round info");
|
||||
Debug.Log(
|
||||
$"stored round info (Template is {_templateColour.style.backgroundColor.value}, Response is {_responseColour.style.backgroundColor.value})");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -127,13 +128,13 @@ private void StoreRoundInfo()
|
|||
/// </summary>
|
||||
private void GenerateNewTemplateColour()
|
||||
{
|
||||
// - lightness: 40-80
|
||||
// - chroma: 0.05-0.20
|
||||
// - lightness: 30-90
|
||||
// - chroma: 0.03-0.20
|
||||
// - hue: all (0-360)
|
||||
|
||||
var r = new Random();
|
||||
var l = Math.Clamp(r.NextDouble() * 40d + 40d, 40d, 100d);
|
||||
var c = Math.Clamp(r.NextDouble() * 0.15d + 0.05d, 0.05d, 0.20d);
|
||||
var l = Math.Clamp(r.NextDouble() * 60d + 30d, 30d, 90d);
|
||||
var c = Math.Clamp(r.NextDouble() * 0.17d + 0.03d, 0.03d, 0.20d);
|
||||
var h = Math.Clamp(r.NextDouble() * 360d, 0d, 360d);
|
||||
var colour = Colorimetry.RawLchToColor(l, c, h);
|
||||
Debug.Log($"generated new template colour LCh({l:F}, {c:F}, {h:F}) -> {colour}");
|
||||
|
@ -147,7 +148,7 @@ private void Render()
|
|||
{
|
||||
var remaining = (_countdownDatetime - DateTime.Now).TotalSeconds;
|
||||
_roundText.text = $"{Round}/{RoundsPerGame}";
|
||||
_countdownText.text = $"{remaining:F}";
|
||||
_countdownText.text = $"{remaining:F2}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -9,27 +9,23 @@ public class LocalPlayerData
|
|||
/// <summary>
|
||||
/// maximum number of the best online scores to keep track of
|
||||
/// </summary>
|
||||
public const int MaxBestOnlineScores = 10;
|
||||
public const int MaxBestScores = 10;
|
||||
|
||||
/// <summary>
|
||||
/// maximum number of recent local scores to keep track of
|
||||
/// </summary>
|
||||
public const int MaxRecentLocalScores = 10;
|
||||
|
||||
public const int MaxRecentScores = 10;
|
||||
|
||||
/// <summary>
|
||||
/// the gamma value used in the exponential user rating calculation
|
||||
/// </summary>
|
||||
private const float ExponentialUserRatingGamma = 1.75f;
|
||||
private const float ExponentialUserRatingGamma = 2f;
|
||||
|
||||
/// <summary>
|
||||
/// last known email used
|
||||
/// queue of the best online scores,
|
||||
/// used in user rating calculation and accuracy display stats
|
||||
/// </summary>
|
||||
public string LastKnownEmail = "";
|
||||
|
||||
/// <summary>
|
||||
/// last known username used
|
||||
/// </summary>
|
||||
public string LastKnownUsername = "Guest";
|
||||
public readonly Queue<Score> BestOnlineScores = new(20);
|
||||
|
||||
/// <summary>
|
||||
/// queue of the 10 most recent local scores
|
||||
|
@ -43,10 +39,14 @@ public class LocalPlayerData
|
|||
public readonly Queue<Score> RecentOnlineScores = new(10);
|
||||
|
||||
/// <summary>
|
||||
/// queue of the best online scores,
|
||||
/// used in user rating calculation and accuracy display stats
|
||||
/// last known email used
|
||||
/// </summary>
|
||||
public readonly Queue<Score> BestOnlineScores = new(20);
|
||||
public string LastKnownEmail = "";
|
||||
|
||||
/// <summary>
|
||||
/// last known username used
|
||||
/// </summary>
|
||||
public string LastKnownUsername = "Guest";
|
||||
|
||||
/// <summary>
|
||||
/// loads player data from player prefs and database
|
||||
|
@ -149,10 +149,21 @@ public void SaveToTheWorld()
|
|||
/// <param name="score">the score to register</param>
|
||||
public void RegisterLocalScore(Score score)
|
||||
{
|
||||
while (RecentLocalScores.Count >= MaxRecentLocalScores) RecentLocalScores.Dequeue();
|
||||
while (RecentLocalScores.Count >= MaxRecentScores) RecentLocalScores.Dequeue();
|
||||
RecentLocalScores.Enqueue(score);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// scaling function for user ratings
|
||||
/// </summary>
|
||||
/// <returns>the scaled user rating <c>double</c></returns>
|
||||
public static double UserRatingScalingF(double rating)
|
||||
{
|
||||
var rawUserRating = Math.Clamp(rating, 0d, 100d);
|
||||
var exponentialRating = 100d * Math.Pow(rawUserRating / 100d, ExponentialUserRatingGamma);
|
||||
return Math.Clamp(exponentialRating, 0d, 100d);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// calculates the user rating based on whatever local data is available
|
||||
/// </summary>
|
||||
|
@ -164,9 +175,9 @@ public float CalculateUserRating()
|
|||
// in this case 20 best scores, and 10 recent scores are used
|
||||
|
||||
// ensure the scores don't exceed their arbitrary limits
|
||||
while (RecentOnlineScores.Count > MaxRecentLocalScores) RecentOnlineScores.Dequeue();
|
||||
while (RecentLocalScores.Count > MaxRecentLocalScores) RecentLocalScores.Dequeue();
|
||||
while (BestOnlineScores.Count > MaxBestOnlineScores) BestOnlineScores.Dequeue();
|
||||
while (RecentOnlineScores.Count > MaxRecentScores) RecentOnlineScores.Dequeue();
|
||||
while (RecentLocalScores.Count > MaxRecentScores) RecentLocalScores.Dequeue();
|
||||
while (BestOnlineScores.Count > MaxBestScores) BestOnlineScores.Dequeue();
|
||||
|
||||
// if online scores are available, use them
|
||||
var recentScores = RecentOnlineScores.Count > 0 ? RecentOnlineScores : RecentLocalScores;
|
||||
|
@ -177,37 +188,22 @@ public float CalculateUserRating()
|
|||
|
||||
foreach (var score in recentScores.Take(10))
|
||||
{
|
||||
totalRating += (score.AvgLightnessAccuracy + score.AvgChromaAccuracy + score.AvgHueAccuracy +
|
||||
score.AvgPerceivedAccuracy) / 4d;
|
||||
scores++;
|
||||
var dL = score.AvgLightnessAccuracy;
|
||||
var dC = score.AvgChromaAccuracy;
|
||||
var dH = score.AvgHueAccuracy;
|
||||
var dE = Math.Sqrt(score.AvgLightnessAccuracy * score.AvgLightnessAccuracy
|
||||
+ score.AvgChromaAccuracy * score.AvgChromaAccuracy
|
||||
+ score.AvgHueAccuracy * score.AvgHueAccuracy);
|
||||
totalRating += (dL + dC + dH + dE + dE) / 5d;
|
||||
}
|
||||
|
||||
foreach (var score in bestScores.Take(20))
|
||||
{
|
||||
totalRating += (score.AvgLightnessAccuracy + score.AvgChromaAccuracy + score.AvgHueAccuracy +
|
||||
score.AvgPerceivedAccuracy) / 4d;
|
||||
scores++;
|
||||
var dL = score.AvgLightnessAccuracy;
|
||||
var dC = score.AvgChromaAccuracy;
|
||||
var dH = score.AvgHueAccuracy;
|
||||
var dE = Math.Sqrt(score.AvgLightnessAccuracy * score.AvgLightnessAccuracy
|
||||
+ score.AvgChromaAccuracy * score.AvgChromaAccuracy
|
||||
+ score.AvgHueAccuracy * score.AvgHueAccuracy);
|
||||
totalRating += (dL + dC + dH + dE + dE) / 5d;
|
||||
}
|
||||
|
||||
scores = Math.Max(1, scores);
|
||||
totalRating /= scores;
|
||||
|
||||
var rawUserRating = Math.Clamp(totalRating, 0d, 100d);
|
||||
var exponentialRating = 100d * Math.Pow(rawUserRating / 100d, ExponentialUserRatingGamma);
|
||||
|
||||
Debug.Log($"locally calculated user rating: lin: {rawUserRating} -> exp: {exponentialRating}");
|
||||
|
||||
return (float)exponentialRating;
|
||||
|
||||
var rating = UserRatingScalingF(totalRating /= Math.Max(1, scores));
|
||||
Debug.Log($"locally calculated user rating: lin: {totalRating} -> exp: {rating}");
|
||||
|
||||
return (float)rating;
|
||||
}
|
||||
|
||||
public struct Score
|
||||
|
|
|
@ -106,12 +106,12 @@ private static void OnAccountButtonClicked()
|
|||
private void RenderFromPlayerData(LocalPlayerData data)
|
||||
{
|
||||
Debug.Log("updating SideView > AccountSection with new player data");
|
||||
|
||||
|
||||
// calculate averages from both recent local scores and online scores
|
||||
var totalLightnessAcc = 0f;
|
||||
var totalChromaAcc = 0f;
|
||||
var totalHueAcc = 0f;
|
||||
var totalRounds = 0;
|
||||
var totalGames = 0;
|
||||
|
||||
// average out all the scores we have to get a stable-ish average
|
||||
|
||||
|
@ -120,7 +120,7 @@ private void RenderFromPlayerData(LocalPlayerData data)
|
|||
totalLightnessAcc += localScore.AvgLightnessAccuracy;
|
||||
totalChromaAcc += localScore.AvgChromaAccuracy;
|
||||
totalHueAcc += localScore.AvgHueAccuracy;
|
||||
totalRounds += localScore.NoOfRounds;
|
||||
totalGames++;
|
||||
}
|
||||
|
||||
foreach (var onlineScore in data.RecentOnlineScores)
|
||||
|
@ -128,7 +128,7 @@ private void RenderFromPlayerData(LocalPlayerData data)
|
|||
totalLightnessAcc += onlineScore.AvgLightnessAccuracy;
|
||||
totalChromaAcc += onlineScore.AvgChromaAccuracy;
|
||||
totalHueAcc += onlineScore.AvgHueAccuracy;
|
||||
totalRounds += onlineScore.NoOfRounds;
|
||||
totalGames++;
|
||||
}
|
||||
|
||||
foreach (var onlineScore in data.BestOnlineScores)
|
||||
|
@ -136,14 +136,14 @@ private void RenderFromPlayerData(LocalPlayerData data)
|
|||
totalLightnessAcc += onlineScore.AvgLightnessAccuracy;
|
||||
totalChromaAcc += onlineScore.AvgChromaAccuracy;
|
||||
totalHueAcc += onlineScore.AvgHueAccuracy;
|
||||
totalRounds += onlineScore.NoOfRounds;
|
||||
totalGames++;
|
||||
}
|
||||
|
||||
Debug.Log($"tL={totalLightnessAcc} tC={totalChromaAcc} tH={totalHueAcc} tR={totalRounds}");
|
||||
if (totalRounds == 0) totalRounds = 1;
|
||||
var lightnessAcc = totalLightnessAcc / totalRounds;
|
||||
var chromaAcc = totalChromaAcc / totalRounds;
|
||||
var hueAcc = totalHueAcc / totalRounds;
|
||||
Debug.Log($"tL={totalLightnessAcc} tC={totalChromaAcc} tH={totalHueAcc} tG={totalGames}");
|
||||
if (totalGames == 0) totalGames = 1;
|
||||
var lightnessAcc = totalLightnessAcc / totalGames;
|
||||
var chromaAcc = totalChromaAcc / totalGames;
|
||||
var hueAcc = totalHueAcc / totalGames;
|
||||
var playerText = GameManager.Instance.Backend.IsSignedIn
|
||||
? data.LastKnownUsername
|
||||
: $"{data.LastKnownUsername} (Not Signed In)";
|
||||
|
@ -151,9 +151,9 @@ private void RenderFromPlayerData(LocalPlayerData data)
|
|||
|
||||
// finally, set the labels
|
||||
_playerText.text = playerText;
|
||||
_ratingText.text = $"{rating:F}";
|
||||
_lightnessAccuracyText.text = $"{lightnessAcc:F}";
|
||||
_chromaAccuracyText.text = $"{chromaAcc:F}";
|
||||
_hueAccuracyText.text = $"{hueAcc:F}";
|
||||
_ratingText.text = $"{rating:F3}";
|
||||
_lightnessAccuracyText.text = $"{lightnessAcc:F2}%";
|
||||
_chromaAccuracyText.text = $"{chromaAcc:F2}%";
|
||||
_hueAccuracyText.text = $"{hueAcc:F2}%";
|
||||
}
|
||||
}
|
|
@ -66,6 +66,13 @@ private void Start()
|
|||
SetDisplayState(DisplayState.DefaultView);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var gameplay = GameManager.Instance.Gameplay;
|
||||
if (gameplay == null) return;
|
||||
if (gameplay.Round >= 1) gameplay.Update();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// initialise variables and register callbacks
|
||||
/// </summary>
|
||||
|
@ -74,13 +81,6 @@ private void OnEnable()
|
|||
UI = GetComponent<UIDocument>().rootVisualElement;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var gameplay = GameManager.Instance.Gameplay;
|
||||
if (gameplay == null) return;
|
||||
if (gameplay.Round >= 1) gameplay.Update();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// function to show a menu based on the enum passed,
|
||||
/// and any other necessary actions
|
||||
|
@ -141,7 +141,7 @@ public void SetDisplayState(DisplayState newDisplayState)
|
|||
UI.Q<Button>("AccountButton").style.display = DisplayStyle.None;
|
||||
UI.Q<VisualElement>("AccountSection").style.display = DisplayStyle.Flex;
|
||||
UI.Q<VisualElement>("ConnectionStatus").style.display = DisplayStyle.None;
|
||||
|
||||
|
||||
// start the game
|
||||
GameManager.Instance.Gameplay.StartGame();
|
||||
}
|
||||
|
|
|
@ -1,245 +1,136 @@
|
|||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
engine="UnityEngine.UIElements" editor="UnityEditor.UIElements"
|
||||
noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
|
||||
<Style src="project://database/Assets/UI/GameUI.uss?fileID=7433441132597879392&guid=2c7ff79f21a3e8e408e76d75944d575b&type=3#GameUI"/>
|
||||
<ui:VisualElement name="Root"
|
||||
style="flex-grow: 1; background-color: rgb(208, 152, 194); justify-content: space-around; align-items: stretch; align-self: stretch; flex-direction: row;">
|
||||
<ui:VisualElement name="SideView"
|
||||
style="flex-grow: 0; background-color: rgb(15, 13, 27); flex-shrink: 0; width: 25%; justify-content: space-between;">
|
||||
<ui:VisualElement name="Header"
|
||||
style="flex-grow: 0; margin-top: 10%; margin-right: 10%; margin-bottom: 0; margin-left: 10%; justify-content: space-between; align-items: flex-start; flex-direction: column;">
|
||||
<ui:Label tabindex="-1" text="Colour Me OK" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="Name"
|
||||
style="color: rgb(208, 152, 194); -unity-font-style: bold; font-size: 58px; white-space: normal;"/>
|
||||
<ui:Label tabindex="-1"
|
||||
text="Color Me OK is a colour-matching game using the coordinates of the OKLCh colour model on the OKLab perceptually uniform colour space."
|
||||
parse-escape-sequences="true" display-tooltip-when-elided="true" name="Description"
|
||||
style="font-size: 16px; white-space: normal; text-overflow: clip; color: rgb(208, 152, 194);"/>
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
|
||||
<Style src="project://database/Assets/UI/GameUI.uss?fileID=7433441132597879392&guid=2c7ff79f21a3e8e408e76d75944d575b&type=3#GameUI" />
|
||||
<ui:VisualElement name="Root" style="flex-grow: 1; background-color: rgb(208, 152, 194); justify-content: space-around; align-items: stretch; align-self: stretch; flex-direction: row;">
|
||||
<ui:VisualElement name="SideView" style="flex-grow: 0; background-color: rgb(15, 13, 27); flex-shrink: 0; width: 25%; justify-content: space-between;">
|
||||
<ui:VisualElement name="Header" style="flex-grow: 0; margin-top: 10%; margin-right: 10%; margin-bottom: 0; margin-left: 10%; justify-content: space-between; align-items: flex-start; flex-direction: column;">
|
||||
<ui:Label tabindex="-1" text="Colour Me OK" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Name" style="color: rgb(208, 152, 194); -unity-font-style: bold; font-size: 58px; white-space: normal;" />
|
||||
<ui:Label tabindex="-1" text="Color Me OK is a colour-matching game using the coordinates of the OKLCh colour model on the OKLab perceptually uniform colour space." parse-escape-sequences="true" display-tooltip-when-elided="true" name="Description" style="font-size: 16px; white-space: normal; text-overflow: clip; color: rgb(208, 152, 194);" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="Content"
|
||||
style="flex-grow: 0; padding-right: 10%; padding-bottom: 10%; padding-left: 10%;">
|
||||
<ui:Button text="Play ↗" parse-escape-sequences="true" display-tooltip-when-elided="true"
|
||||
name="PlayButton" style="display: none;"/>
|
||||
<ui:Button text="Leaderboard ↗" parse-escape-sequences="true" display-tooltip-when-elided="true"
|
||||
name="LeaderboardButton" style="display: none;"/>
|
||||
<ui:Button text="Account ↗" parse-escape-sequences="true" display-tooltip-when-elided="true"
|
||||
name="AccountButton" style="display: none;"/>
|
||||
<ui:VisualElement name="AccountSection"
|
||||
style="flex-grow: 0; border-top-color: rgb(208, 152, 194); margin-top: 0; border-top-width: 1px; margin-right: 0; margin-bottom: 0; margin-left: 0; border-bottom-color: rgb(208, 152, 194); padding-bottom: 12px; border-bottom-width: 1px; display: flex;">
|
||||
<ui:VisualElement name="PlayerDetails"
|
||||
style="flex-grow: 1; flex-direction: row; align-items: stretch; justify-content: space-between; font-size: 10px; align-self: stretch;">
|
||||
<ui:VisualElement name="Content" style="flex-grow: 0; padding-right: 10%; padding-bottom: 10%; padding-left: 10%;">
|
||||
<ui:Button text="Play ↗" parse-escape-sequences="true" display-tooltip-when-elided="true" name="PlayButton" style="display: none;" />
|
||||
<ui:Button text="Leaderboard ↗" parse-escape-sequences="true" display-tooltip-when-elided="true" name="LeaderboardButton" style="display: none;" />
|
||||
<ui:Button text="Account ↗" parse-escape-sequences="true" display-tooltip-when-elided="true" name="AccountButton" style="display: none;" />
|
||||
<ui:VisualElement name="AccountSection" style="flex-grow: 0; border-top-color: rgb(208, 152, 194); margin-top: 0; border-top-width: 1px; margin-right: 0; margin-bottom: 0; margin-left: 0; border-bottom-color: rgb(208, 152, 194); padding-bottom: 12px; border-bottom-width: 1px; display: flex;">
|
||||
<ui:VisualElement name="PlayerDetails" style="flex-grow: 1; flex-direction: row; align-items: stretch; justify-content: space-between; font-size: 10px; align-self: stretch;">
|
||||
<ui:VisualElement name="PlayerNameDetail" style="flex-grow: 1;">
|
||||
<ui:Label tabindex="-1" text="Player" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="PlayerHeader"
|
||||
style="-unity-font-style: normal; font-size: 14px; padding-bottom: 0; -unity-text-align: lower-left;"/>
|
||||
<ui:Label tabindex="-1" text="Not Signed In" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="PlayerText"
|
||||
style="-unity-font-style: normal; font-size: 18px; padding-top: 6px;"/>
|
||||
<ui:Label tabindex="-1" text="Player" parse-escape-sequences="true" display-tooltip-when-elided="true" name="PlayerHeader" style="-unity-font-style: normal; font-size: 14px; padding-bottom: 0; -unity-text-align: lower-left;" />
|
||||
<ui:Label tabindex="-1" text="Not Signed In" parse-escape-sequences="true" display-tooltip-when-elided="true" name="PlayerText" style="-unity-font-style: normal; font-size: 18px; padding-top: 6px; text-overflow: clip;" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="PlayerRatingDetail" style="flex-grow: 0;">
|
||||
<ui:Label tabindex="-1" text="Rating" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="RatingHeader"
|
||||
style="-unity-font-style: normal; font-size: 14px; padding-bottom: 0; -unity-text-align: lower-right;"/>
|
||||
<ui:Label tabindex="-1" text="00.00%" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="RatingText"
|
||||
style="-unity-font-style: normal; font-size: 18px; padding-top: 6px; -unity-text-align: upper-right;"/>
|
||||
<ui:Label tabindex="-1" text="Rating" parse-escape-sequences="true" display-tooltip-when-elided="true" name="RatingHeader" style="-unity-font-style: normal; font-size: 14px; padding-bottom: 0; -unity-text-align: lower-right;" />
|
||||
<ui:Label tabindex="-1" text="00.00%" parse-escape-sequences="true" display-tooltip-when-elided="true" name="RatingText" style="-unity-font-style: normal; font-size: 18px; padding-top: 6px; -unity-text-align: upper-right; text-overflow: ellipsis;" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="AccuracyDetails"
|
||||
style="flex-grow: 1; flex-direction: row; align-items: stretch; justify-content: space-between; font-size: 10px; align-self: stretch; padding-top: 4px;">
|
||||
<ui:VisualElement name="AccuracyDetails" style="flex-grow: 1; flex-direction: row; align-items: stretch; justify-content: space-between; font-size: 10px; align-self: stretch; padding-top: 4px;">
|
||||
<ui:VisualElement name="LightnessAccuracyDetail" style="flex-grow: 0;">
|
||||
<ui:Label tabindex="-1" text="Lightness Accuracy" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="LightnessAccuracyHeader"
|
||||
style="-unity-font-style: normal; font-size: 14px; padding-bottom: 0; -unity-text-align: lower-left; padding-top: 0;"/>
|
||||
<ui:Label tabindex="-1" text="00.0%" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="LightnessAccuracyText"
|
||||
style="-unity-font-style: normal; font-size: 18px; padding-top: 6px; padding-bottom: 0;"/>
|
||||
<ui:Label tabindex="-1" text="Lightness Accuracy" parse-escape-sequences="true" display-tooltip-when-elided="true" name="LightnessAccuracyHeader" style="-unity-font-style: normal; font-size: 14px; padding-bottom: 0; -unity-text-align: lower-left; padding-top: 0;" />
|
||||
<ui:Label tabindex="-1" text="00.0%" parse-escape-sequences="true" display-tooltip-when-elided="true" name="LightnessAccuracyText" style="-unity-font-style: normal; font-size: 18px; padding-top: 6px; padding-bottom: 0;" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="ChromaAccuracyDetail" style="flex-grow: 0;">
|
||||
<ui:Label tabindex="-1" text="Chroma Accuracy" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="ChromaAccuracyHeader"
|
||||
style="-unity-font-style: normal; font-size: 14px; padding-bottom: 0; -unity-text-align: lower-center; padding-top: 0;"/>
|
||||
<ui:Label tabindex="-1" text="00.0%" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="ChromaAccuracyText"
|
||||
style="-unity-font-style: normal; font-size: 18px; padding-top: 6px; -unity-text-align: upper-center; padding-bottom: 0;"/>
|
||||
<ui:Label tabindex="-1" text="Chroma Accuracy" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ChromaAccuracyHeader" style="-unity-font-style: normal; font-size: 14px; padding-bottom: 0; -unity-text-align: lower-center; padding-top: 0;" />
|
||||
<ui:Label tabindex="-1" text="00.0%" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ChromaAccuracyText" style="-unity-font-style: normal; font-size: 18px; padding-top: 6px; -unity-text-align: upper-center; padding-bottom: 0;" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="HueAccuracyDetail" style="flex-grow: 0;">
|
||||
<ui:Label tabindex="-1" text="Hue Accuracy" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="HueAccuracyHeader"
|
||||
style="-unity-font-style: normal; font-size: 14px; padding-bottom: 0; -unity-text-align: lower-right; padding-top: 0;"/>
|
||||
<ui:Label tabindex="-1" text="00.0%" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="HueAccuracyText"
|
||||
style="-unity-font-style: normal; font-size: 18px; padding-top: 6px; -unity-text-align: upper-right; padding-bottom: 0;"/>
|
||||
<ui:Label tabindex="-1" text="Hue Accuracy" parse-escape-sequences="true" display-tooltip-when-elided="true" name="HueAccuracyHeader" style="-unity-font-style: normal; font-size: 14px; padding-bottom: 0; -unity-text-align: lower-right; padding-top: 0;" />
|
||||
<ui:Label tabindex="-1" text="00.0%" parse-escape-sequences="true" display-tooltip-when-elided="true" name="HueAccuracyText" style="-unity-font-style: normal; font-size: 18px; padding-top: 6px; -unity-text-align: upper-right; padding-bottom: 0;" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="ConnectionStatus"
|
||||
style="flex-grow: 0; border-top-color: rgb(208, 152, 194); margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; border-bottom-color: rgb(208, 152, 194); padding-bottom: 12px; display: flex; border-bottom-width: 1px;">
|
||||
<ui:Label tabindex="-1" text="Status: Unknown" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="ConnectionStatusText"
|
||||
style="-unity-font-style: normal; font-size: 14px; padding-bottom: 0; -unity-text-align: lower-left; display: flex;"/>
|
||||
<ui:VisualElement name="ConnectionStatus" style="flex-grow: 0; border-top-color: rgb(208, 152, 194); margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; border-bottom-color: rgb(208, 152, 194); padding-bottom: 12px; display: flex; border-bottom-width: 1px;">
|
||||
<ui:Label tabindex="-1" text="Status: Unknown" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ConnectionStatusText" style="-unity-font-style: normal; font-size: 14px; padding-bottom: 0; -unity-text-align: lower-left; display: flex;" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="MainView"
|
||||
style="flex-grow: 0; flex-shrink: 0; width: 75%; justify-content: space-between;">
|
||||
<ui:VisualElement name="DefaultView"
|
||||
style="flex-grow: 0; justify-content: space-around; height: 100%; align-self: stretch; display: none;">
|
||||
<ui:VisualElement name="DemoResponseColour"
|
||||
style="flex-grow: 1; background-color: rgb(0, 0, 0); align-self: stretch; justify-content: center;">
|
||||
<ui:VisualElement name="DemoResponseSliderContainer"
|
||||
style="flex-grow: 0; margin-top: 3.25%; margin-right: 3.25%; margin-bottom: 3.25%; margin-left: 3.25%; padding-top: 2%; padding-right: 2%; padding-bottom: 2%; padding-left: 2%; border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 8px; background-color: rgb(208, 152, 194);">
|
||||
<ui:Slider label="Lightness" high-value="100" name="DemoResponseLightnessSlider"
|
||||
class="lch-slider"/>
|
||||
<ui:Slider label="Chroma" high-value="0.5" name="DemoResponseChromaSlider" class="lch-slider"/>
|
||||
<ui:Slider label="Hue" high-value="360" name="DemoResponseHueSlider" class="lch-slider"/>
|
||||
<ui:VisualElement name="MainView" style="flex-grow: 0; flex-shrink: 0; width: 75%; justify-content: space-between;">
|
||||
<ui:VisualElement name="DefaultView" style="flex-grow: 0; justify-content: space-around; height: 100%; align-self: stretch; display: none;">
|
||||
<ui:VisualElement name="DemoResponseColour" style="flex-grow: 1; background-color: rgb(0, 0, 0); align-self: stretch; justify-content: center;">
|
||||
<ui:VisualElement name="DemoResponseSliderContainer" style="flex-grow: 0; margin-top: 3.25%; margin-right: 3.25%; margin-bottom: 3.25%; margin-left: 3.25%; padding-top: 2%; padding-right: 2%; padding-bottom: 2%; padding-left: 2%; border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 8px; background-color: rgb(208, 152, 194);">
|
||||
<ui:Slider label="Lightness" high-value="100" name="DemoResponseLightnessSlider" class="lch-slider" />
|
||||
<ui:Slider label="Chroma" high-value="0.5" name="DemoResponseChromaSlider" class="lch-slider" />
|
||||
<ui:Slider label="Hue" high-value="360" name="DemoResponseHueSlider" class="lch-slider" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="GameView"
|
||||
style="flex-grow: 0; margin-top: 3.25%; margin-right: 3.25%; margin-bottom: 3.25%; margin-left: 3.25%; justify-content: space-between; height: 100%; align-self: stretch; display: none;">
|
||||
<ui:VisualElement name="GameHeader"
|
||||
style="flex-grow: 0; flex-direction: row; justify-content: space-between; align-self: stretch;">
|
||||
<ui:Label tabindex="-1" text="1/5" parse-escape-sequences="true" display-tooltip-when-elided="true"
|
||||
name="RoundText" style="font-size: 58px; -unity-font-style: normal;"/>
|
||||
<ui:Label tabindex="-1" text="0.00s" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="TimeText"
|
||||
style="-unity-text-align: lower-right; font-size: 58px;"/>
|
||||
<ui:VisualElement name="GameView" style="flex-grow: 0; margin-top: 3.25%; margin-right: 3.25%; margin-bottom: 3.25%; margin-left: 3.25%; justify-content: space-between; height: 100%; align-self: stretch; display: none;">
|
||||
<ui:VisualElement name="GameHeader" style="flex-grow: 0; flex-direction: row; justify-content: space-between; align-self: stretch;">
|
||||
<ui:Label tabindex="-1" text="1/5" parse-escape-sequences="true" display-tooltip-when-elided="true" name="RoundText" style="font-size: 58px; -unity-font-style: normal;" />
|
||||
<ui:Label tabindex="-1" text="0.00s" parse-escape-sequences="true" display-tooltip-when-elided="true" name="TimeText" style="-unity-text-align: lower-right; font-size: 58px;" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="ColourPreview"
|
||||
style="flex-grow: 0; height: 50%; background-color: rgb(255, 255, 255); border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 8px; flex-direction: row; padding-top: 2%; padding-right: 2%; padding-bottom: 2%; padding-left: 2%; justify-content: space-between;">
|
||||
<ui:VisualElement name="TemplatePreview"
|
||||
style="flex-grow: 0; flex-shrink: 0; height: 100%; width: 49%;">
|
||||
<ui:Label tabindex="-1" text="Template" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="TemplateText"
|
||||
style="margin-bottom: 12px; margin-top: 0; -unity-font-style: normal;"/>
|
||||
<ui:VisualElement name="TemplateColour"
|
||||
style="flex-grow: 1; border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 8px; background-color: rgb(0, 0, 0);"/>
|
||||
<ui:VisualElement name="ColourPreview" style="flex-grow: 0; height: 50%; background-color: rgb(255, 255, 255); border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 8px; flex-direction: row; padding-top: 2%; padding-right: 2%; padding-bottom: 2%; padding-left: 2%; justify-content: space-between;">
|
||||
<ui:VisualElement name="TemplatePreview" style="flex-grow: 0; flex-shrink: 0; height: 100%; width: 49%;">
|
||||
<ui:Label tabindex="-1" text="Template" parse-escape-sequences="true" display-tooltip-when-elided="true" name="TemplateText" style="margin-bottom: 12px; margin-top: 0; -unity-font-style: normal;" />
|
||||
<ui:VisualElement name="TemplateColour" style="flex-grow: 1; border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 8px; background-color: rgb(0, 0, 0);" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="ResponsePreview"
|
||||
style="flex-grow: 0; flex-shrink: 0; height: 100%; width: 49%;">
|
||||
<ui:Label tabindex="-1" text="Response" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="ResponseText"
|
||||
style="margin-bottom: 12px; margin-top: 0; -unity-font-style: normal; -unity-text-align: upper-right;"/>
|
||||
<ui:VisualElement name="ResponseColour"
|
||||
style="flex-grow: 1; border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 8px; background-color: rgb(0, 0, 0);"/>
|
||||
<ui:VisualElement name="ResponsePreview" style="flex-grow: 0; flex-shrink: 0; height: 100%; width: 49%;">
|
||||
<ui:Label tabindex="-1" text="Response" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ResponseText" style="margin-bottom: 12px; margin-top: 0; -unity-font-style: normal; -unity-text-align: upper-right;" />
|
||||
<ui:VisualElement name="ResponseColour" style="flex-grow: 1; border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 8px; background-color: rgb(0, 0, 0);" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="ResponseSliders" style="flex-grow: 0; display: flex;">
|
||||
<ui:Slider label="Lightness" high-value="100" name="ResponseLightnessSlider" class="lch-slider"/>
|
||||
<ui:Slider label="Chroma" high-value="0.5" name="ResponseChromaSlider" class="lch-slider"/>
|
||||
<ui:Slider label="Hue" high-value="360" name="ResponseHueSlider" class="lch-slider"/>
|
||||
<ui:Slider label="Lightness" high-value="100" name="ResponseLightnessSlider" class="lch-slider" />
|
||||
<ui:Slider label="Chroma" high-value="0.5" name="ResponseChromaSlider" class="lch-slider" />
|
||||
<ui:Slider label="Hue" high-value="360" name="ResponseHueSlider" class="lch-slider" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="ResultsView"
|
||||
style="flex-grow: 1; display: none; margin-top: 3.25%; margin-right: 3.25%; margin-bottom: 3.25%; margin-left: 3.25%; justify-content: space-between;">
|
||||
<ui:VisualElement name="ColourShowcase"
|
||||
style="flex-grow: 1; background-color: rgb(255, 255, 255); border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 8px; padding-top: 2%; padding-right: 2%; padding-bottom: 2%; padding-left: 2%; margin-bottom: 2%; margin-top: 0; margin-right: 0; margin-left: 0;">
|
||||
<ui:Label tabindex="-1" text="Templates" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="ShowcaseTemplatesText"
|
||||
style="-unity-text-align: upper-center; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 2%; padding-left: 0;"/>
|
||||
<ui:VisualElement name="ResultsView" style="flex-grow: 1; display: none; margin-top: 3.25%; margin-right: 3.25%; margin-bottom: 3.25%; margin-left: 3.25%; justify-content: space-between;">
|
||||
<ui:VisualElement name="ColourShowcase" style="flex-grow: 1; background-color: rgb(255, 255, 255); border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 8px; padding-top: 2%; padding-right: 2%; padding-bottom: 2%; padding-left: 2%; margin-bottom: 2%; margin-top: 0; margin-right: 0; margin-left: 0;">
|
||||
<ui:Label tabindex="-1" text="Templates" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ShowcaseTemplatesText" style="-unity-text-align: upper-center; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 2%; padding-left: 0;" />
|
||||
<ui:VisualElement name="Gallery" style="flex-grow: 1; flex-direction: row;">
|
||||
<ui:VisualElement name="ShowcasePair1" style="flex-grow: 1;">
|
||||
<ui:VisualElement name="ShowcasePair1TemplateColour"
|
||||
style="flex-grow: 1; background-color: rgb(15, 13, 27); border-top-left-radius: 8px; border-bottom-left-radius: 8px;"/>
|
||||
<ui:Label tabindex="-1" text="100% 100% 100% (100%)" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="ShowcasePair1Info"
|
||||
style="-unity-text-align: upper-center; font-size: 18px;"/>
|
||||
<ui:VisualElement name="ShowcasePair1ResponseColour"
|
||||
style="flex-grow: 1; border-bottom-left-radius: 8px; border-left-color: rgb(26, 22, 40); border-right-color: rgb(26, 22, 40); border-top-color: rgb(26, 22, 40); border-bottom-color: rgb(26, 22, 40); background-color: rgb(26, 22, 40); border-top-left-radius: 8px;"/>
|
||||
<ui:VisualElement name="ShowcasePair1TemplateColour" style="flex-grow: 1; background-color: rgb(15, 13, 27); border-top-left-radius: 8px; border-bottom-left-radius: 8px;" />
|
||||
<ui:Label tabindex="-1" text="100% 100% 100% (100%)" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ShowcasePair1Info" style="-unity-text-align: upper-center; font-size: 18px;" />
|
||||
<ui:VisualElement name="ShowcasePair1ResponseColour" style="flex-grow: 1; border-bottom-left-radius: 8px; border-left-color: rgb(26, 22, 40); border-right-color: rgb(26, 22, 40); border-top-color: rgb(26, 22, 40); border-bottom-color: rgb(26, 22, 40); background-color: rgb(26, 22, 40); border-top-left-radius: 8px;" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="ShowcasePair2" style="flex-grow: 1;">
|
||||
<ui:VisualElement name="ShowcasePair2TemplateColour"
|
||||
style="flex-grow: 1; background-color: rgb(42, 33, 56);"/>
|
||||
<ui:Label tabindex="-1" text="100% 100% 100% (100%)" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="ShowcasePair2Info"
|
||||
style="-unity-text-align: upper-center; font-size: 18px;"/>
|
||||
<ui:VisualElement name="ShowcasePair2ResponseColour"
|
||||
style="flex-grow: 1; background-color: rgb(63, 48, 76);"/>
|
||||
<ui:VisualElement name="ShowcasePair2TemplateColour" style="flex-grow: 1; background-color: rgb(42, 33, 56);" />
|
||||
<ui:Label tabindex="-1" text="100% 100% 100% (100%)" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ShowcasePair2Info" style="-unity-text-align: upper-center; font-size: 18px;" />
|
||||
<ui:VisualElement name="ShowcasePair2ResponseColour" style="flex-grow: 1; background-color: rgb(63, 48, 76);" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="ShowcasePair3" style="flex-grow: 1;">
|
||||
<ui:VisualElement name="ShowcasePair3TemplateColour"
|
||||
style="flex-grow: 1; background-color: rgb(63, 48, 76);"/>
|
||||
<ui:Label tabindex="-1" text="100% 100% 100% (100%)" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="ShowcasePair3Info"
|
||||
style="-unity-text-align: upper-center; font-size: 18px;"/>
|
||||
<ui:VisualElement name="ShowcasePair3ResponseColour"
|
||||
style="flex-grow: 1; background-color: rgb(89, 67, 100);"/>
|
||||
<ui:VisualElement name="ShowcasePair3TemplateColour" style="flex-grow: 1; background-color: rgb(63, 48, 76);" />
|
||||
<ui:Label tabindex="-1" text="100% 100% 100% (100%)" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ShowcasePair3Info" style="-unity-text-align: upper-center; font-size: 18px;" />
|
||||
<ui:VisualElement name="ShowcasePair3ResponseColour" style="flex-grow: 1; background-color: rgb(89, 67, 100);" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="ShowcasePair4" style="flex-grow: 1;">
|
||||
<ui:VisualElement name="ShowcasePair4TemplateColour"
|
||||
style="flex-grow: 1; background-color: rgb(89, 67, 100);"/>
|
||||
<ui:Label tabindex="-1" text="100% 100% 100% (100%)" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="ShowcasePair4Info"
|
||||
style="-unity-text-align: upper-center; font-size: 18px;"/>
|
||||
<ui:VisualElement name="ShowcasePair4ResponseColour"
|
||||
style="flex-grow: 1; background-color: rgb(122, 90, 126);"/>
|
||||
<ui:VisualElement name="ShowcasePair4TemplateColour" style="flex-grow: 1; background-color: rgb(89, 67, 100);" />
|
||||
<ui:Label tabindex="-1" text="100% 100% 100% (100%)" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ShowcasePair4Info" style="-unity-text-align: upper-center; font-size: 18px;" />
|
||||
<ui:VisualElement name="ShowcasePair4ResponseColour" style="flex-grow: 1; background-color: rgb(122, 90, 126);" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="ShowcasePair5" style="flex-grow: 1;">
|
||||
<ui:VisualElement name="ShowcasePair5TemplateColour"
|
||||
style="flex-grow: 1; background-color: rgb(162, 118, 158); border-top-right-radius: 8px; border-bottom-right-radius: 8px;"/>
|
||||
<ui:Label tabindex="-1" text="100% 100% 100% (100%)" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="ShowcasePair5Info"
|
||||
style="-unity-text-align: upper-center; font-size: 18px;"/>
|
||||
<ui:VisualElement name="ShowcasePair5ResponseColour"
|
||||
style="flex-grow: 1; background-color: rgb(208, 152, 194); border-top-right-radius: 8px; border-bottom-right-radius: 8px;"/>
|
||||
<ui:VisualElement name="ShowcasePair5TemplateColour" style="flex-grow: 1; background-color: rgb(162, 118, 158); border-top-right-radius: 8px; border-bottom-right-radius: 8px;" />
|
||||
<ui:Label tabindex="-1" text="100% 100% 100% (100%)" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ShowcasePair5Info" style="-unity-text-align: upper-center; font-size: 18px;" />
|
||||
<ui:VisualElement name="ShowcasePair5ResponseColour" style="flex-grow: 1; background-color: rgb(208, 152, 194); border-top-right-radius: 8px; border-bottom-right-radius: 8px;" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:Label tabindex="-1" text="Responses" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="ShowcaseResponsesText"
|
||||
style="-unity-text-align: upper-center; padding-top: 1.5%; padding-right: 0; padding-bottom: 0; padding-left: 0; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;"/>
|
||||
<ui:Label tabindex="-1" text="Responses" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ShowcaseResponsesText" style="-unity-text-align: upper-center; padding-top: 1.5%; padding-right: 0; padding-bottom: 0; padding-left: 0; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;" />
|
||||
</ui:VisualElement>
|
||||
<ui:Label tabindex="-1"
|
||||
text="Over n rounds, you were 100.00% accurate. Lightness was 100.00% accurate. (+100.00% from your average) Chroma was 100.00% accurate. (+100.00% from your average) Hue was 100.00% accurate. (+100.00% from your average) Your RATING has increased by 100.00%."
|
||||
parse-escape-sequences="true" display-tooltip-when-elided="true" name="ResultsText"
|
||||
style="flex-grow: 0; margin-top: 2%; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0;"/>
|
||||
<ui:Label tabindex="-1" text="Over n rounds, you were 100.00% accurate. Lightness was 100.00% accurate. (+100.00% from your average) Chroma was 100.00% accurate. (+100.00% from your average) Hue was 100.00% accurate. (+100.00% from your average) Your RATING has increased by 100.00%." parse-escape-sequences="true" display-tooltip-when-elided="true" name="ResultsText" style="flex-grow: 0; margin-top: 2%; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0;" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="LeaderboardView"
|
||||
style="flex-grow: 1; display: none; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; margin-top: 3.25%; margin-right: 3.25%; margin-bottom: 3.25%; margin-left: 3.25%; flex-direction: column; justify-content: space-between;">
|
||||
<ui:Label tabindex="-1" text="Leaderboard" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="LeaderboardHeader"
|
||||
style="font-size: 58px; -unity-font-style: normal;"/>
|
||||
<ui:ListView name="LeaderboardListView"/>
|
||||
<ui:VisualElement name="LeaderboardView" style="flex-grow: 1; display: none; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; margin-top: 3.25%; margin-right: 3.25%; margin-bottom: 3.25%; margin-left: 3.25%; flex-direction: column; justify-content: space-between;">
|
||||
<ui:Label tabindex="-1" text="Leaderboard" parse-escape-sequences="true" display-tooltip-when-elided="true" name="LeaderboardHeader" style="font-size: 58px; -unity-font-style: normal;" />
|
||||
<ui:ListView name="LeaderboardListView" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="AccountView"
|
||||
style="flex-grow: 1; display: flex; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; margin-top: 3.25%; margin-right: 3.25%; margin-bottom: 3.25%; margin-left: 3.25%; flex-direction: column; justify-content: space-between;">
|
||||
<ui:Label tabindex="-1" text="You are not signed in." parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="AccountHeader"
|
||||
style="font-size: 58px; -unity-font-style: normal;"/>
|
||||
<ui:VisualElement name="AccountView" style="flex-grow: 1; display: flex; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; margin-top: 3.25%; margin-right: 3.25%; margin-bottom: 3.25%; margin-left: 3.25%; flex-direction: column; justify-content: space-between;">
|
||||
<ui:Label tabindex="-1" text="You are not signed in." parse-escape-sequences="true" display-tooltip-when-elided="true" name="AccountHeader" style="font-size: 58px; -unity-font-style: normal;" />
|
||||
<ui:VisualElement name="AccountFields" style="flex-grow: 0;">
|
||||
<ui:VisualElement name="UsernameContainer"
|
||||
style="flex-grow: 1; flex-direction: row; justify-content: space-between;">
|
||||
<ui:TextField picking-mode="Ignore" label="Username" name="UsernameField"/>
|
||||
<ui:Button text="Update" parse-escape-sequences="true" display-tooltip-when-elided="true"
|
||||
name="UsernameUpdateButton"/>
|
||||
<ui:VisualElement name="UsernameContainer" style="flex-grow: 1; flex-direction: row; justify-content: space-between;">
|
||||
<ui:TextField picking-mode="Ignore" label="Username" name="UsernameField" />
|
||||
<ui:Button text="Update" parse-escape-sequences="true" display-tooltip-when-elided="true" name="UsernameUpdateButton" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="EmailContainer"
|
||||
style="flex-grow: 1; flex-direction: row; justify-content: space-between;">
|
||||
<ui:TextField picking-mode="Ignore" label="Email" name="EmailField"
|
||||
keyboard-type="EmailAddress"/>
|
||||
<ui:Button text="Update" parse-escape-sequences="true" display-tooltip-when-elided="true"
|
||||
name="EmailUpdateButton"/>
|
||||
<ui:VisualElement name="EmailContainer" style="flex-grow: 1; flex-direction: row; justify-content: space-between;">
|
||||
<ui:TextField picking-mode="Ignore" label="Email" name="EmailField" keyboard-type="EmailAddress" />
|
||||
<ui:Button text="Update" parse-escape-sequences="true" display-tooltip-when-elided="true" name="EmailUpdateButton" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="PasswordContainer"
|
||||
style="flex-grow: 1; flex-direction: row; justify-content: space-between;">
|
||||
<ui:TextField picking-mode="Ignore" label="Password" name="PasswordField" password="true"/>
|
||||
<ui:Button text="Update" parse-escape-sequences="true" display-tooltip-when-elided="true"
|
||||
name="PasswordUpdateButton"/>
|
||||
<ui:VisualElement name="PasswordContainer" style="flex-grow: 1; flex-direction: row; justify-content: space-between;">
|
||||
<ui:TextField picking-mode="Ignore" label="Password" name="PasswordField" password="true" />
|
||||
<ui:Button text="Update" parse-escape-sequences="true" display-tooltip-when-elided="true" name="PasswordUpdateButton" />
|
||||
</ui:VisualElement>
|
||||
<ui:Label tabindex="-1" text="A verification email has been sent. Check your inbox."
|
||||
parse-escape-sequences="true" display-tooltip-when-elided="true" name="AccompanyingText"
|
||||
style="padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; margin-top: 1.5%; margin-right: 0; margin-bottom: 0.75%; margin-left: 0; -unity-text-align: upper-left; display: none;"/>
|
||||
<ui:Label tabindex="-1" text="A verification email has been sent. Check your inbox." parse-escape-sequences="true" display-tooltip-when-elided="true" name="AccompanyingText" style="padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; margin-top: 1.5%; margin-right: 0; margin-bottom: 0.75%; margin-left: 0; -unity-text-align: upper-left; display: none;" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="AccountButtons" style="flex-grow: 0; align-items: flex-start;">
|
||||
<ui:Button text="Primary Action Button →" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="PrimaryActionButton"
|
||||
style="-unity-text-align: middle-center; margin-bottom: 1%; margin-right: 1%; margin-top: 1%; -unity-font-style: bold;"/>
|
||||
<ui:Button text="Secondary Action Button →" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="SecondaryActionButton"
|
||||
style="-unity-text-align: middle-center; margin-bottom: 1%; margin-right: 1%; margin-top: 1%; -unity-font-style: bold;"/>
|
||||
<ui:Button text="Tertiary Action Button →" parse-escape-sequences="true"
|
||||
display-tooltip-when-elided="true" name="TertiaryActionButton"
|
||||
style="margin-top: 1%; margin-right: 1%; -unity-font-style: bold;"/>
|
||||
<ui:Button text="Primary Action Button →" parse-escape-sequences="true" display-tooltip-when-elided="true" name="PrimaryActionButton" style="-unity-text-align: middle-center; margin-bottom: 1%; margin-right: 1%; margin-top: 1%; -unity-font-style: bold;" />
|
||||
<ui:Button text="Secondary Action Button →" parse-escape-sequences="true" display-tooltip-when-elided="true" name="SecondaryActionButton" style="-unity-text-align: middle-center; margin-bottom: 1%; margin-right: 1%; margin-top: 1%; -unity-font-style: bold;" />
|
||||
<ui:Button text="Tertiary Action Button →" parse-escape-sequences="true" display-tooltip-when-elided="true" name="TertiaryActionButton" style="margin-top: 1%; margin-right: 1%; -unity-font-style: bold;" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
|
|
|
@ -4,5 +4,8 @@
|
|||
EditorBuildSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Scenes: []
|
||||
m_Scenes:
|
||||
- enabled: 1
|
||||
path: Assets/Scenes/GameScene.unity
|
||||
guid: 9fc0d4010bbf28b4594072e72b8655ab
|
||||
m_configObjects: {}
|
||||
|
|
|
@ -12,8 +12,8 @@ PlayerSettings:
|
|||
targetDevice: 2
|
||||
useOnDemandResources: 0
|
||||
accelerometerFrequency: 60
|
||||
companyName: DefaultCompany
|
||||
productName: ColourMeOKLABGame
|
||||
companyName: Mark Joshwel
|
||||
productName: Colour Me OK
|
||||
defaultCursor: {fileID: 0}
|
||||
cursorHotspot: {x: 0, y: 0}
|
||||
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
|
||||
|
@ -42,8 +42,8 @@ PlayerSettings:
|
|||
m_SplashScreenLogos: []
|
||||
m_VirtualRealitySplashScreen: {fileID: 0}
|
||||
m_HolographicTrackingLossScreen: {fileID: 0}
|
||||
defaultScreenWidth: 1920
|
||||
defaultScreenHeight: 1080
|
||||
defaultScreenWidth: 1280
|
||||
defaultScreenHeight: 720
|
||||
defaultScreenWidthWeb: 960
|
||||
defaultScreenHeightWeb: 600
|
||||
m_StereoRenderingPath: 0
|
||||
|
@ -93,7 +93,7 @@ PlayerSettings:
|
|||
bakeCollisionMeshes: 0
|
||||
forceSingleInstance: 0
|
||||
useFlipModelSwapchain: 1
|
||||
resizableWindow: 0
|
||||
resizableWindow: 1
|
||||
useMacAppStoreValidation: 0
|
||||
macAppStoreCategory: public.app-category.games
|
||||
gpuSkinning: 1
|
||||
|
@ -104,7 +104,7 @@ PlayerSettings:
|
|||
xboxEnableFitness: 0
|
||||
visibleInBackground: 1
|
||||
allowFullscreenSwitch: 1
|
||||
fullscreenMode: 1
|
||||
fullscreenMode: 3
|
||||
xboxSpeechDB: 0
|
||||
xboxEnableHeadOrientation: 0
|
||||
xboxEnableGuest: 0
|
||||
|
@ -140,7 +140,7 @@ PlayerSettings:
|
|||
loadStoreDebugModeEnabled: 0
|
||||
visionOSBundleVersion: 1.0
|
||||
tvOSBundleVersion: 1.0
|
||||
bundleVersion: 0.1
|
||||
bundleVersion: 1.0.0
|
||||
preloadedAssets: []
|
||||
metroInputSource: 0
|
||||
wsaTransparentSwapchain: 0
|
||||
|
@ -161,13 +161,14 @@ PlayerSettings:
|
|||
resetResolutionOnWindowResize: 0
|
||||
androidSupportedAspectRatio: 1
|
||||
androidMaxAspectRatio: 2.1
|
||||
applicationIdentifier: {}
|
||||
applicationIdentifier:
|
||||
Standalone: co.joshwel.colourmeok
|
||||
buildNumber:
|
||||
Standalone: 0
|
||||
VisionOS: 0
|
||||
iPhone: 0
|
||||
tvOS: 0
|
||||
overrideDefaultApplicationIdentifier: 0
|
||||
overrideDefaultApplicationIdentifier: 1
|
||||
AndroidBundleVersionCode: 1
|
||||
AndroidMinSdkVersion: 22
|
||||
AndroidTargetSdkVersion: 0
|
||||
|
@ -838,7 +839,8 @@ PlayerSettings:
|
|||
scriptingDefineSymbols: {}
|
||||
additionalCompilerArguments: {}
|
||||
platformArchitecture: {}
|
||||
scriptingBackend: {}
|
||||
scriptingBackend:
|
||||
Standalone: 0
|
||||
il2cppCompilerConfiguration: {}
|
||||
il2cppCodeGeneration: {}
|
||||
managedStrippingLevel:
|
||||
|
|
Reference in a new issue