Commit e81089ff authored by Yousef Sameh's avatar Yousef Sameh

supabase challenge timesaved

parent c32eb974
...@@ -17,6 +17,9 @@ public class Challenge : BaseModel ...@@ -17,6 +17,9 @@ public class Challenge : BaseModel
[Column("points_earned")] [Column("points_earned")]
public int PointsEarned { get; set; } = 0; public int PointsEarned { get; set; } = 0;
[Column("time_saved")]
public int TimeSaved { get; set; } = 0;
[Column("started_at")] [Column("started_at")]
public DateTime StartedAt { get; set; } public DateTime StartedAt { get; set; }
......
...@@ -13,6 +13,7 @@ public class ChallengeService : Singleton<ChallengeService> ...@@ -13,6 +13,7 @@ public class ChallengeService : Singleton<ChallengeService>
// Add a completed challenge // Add a completed challenge
public async UniTask<OneOf<ChallengeResult, ErrorResult>> AddChallenge( public async UniTask<OneOf<ChallengeResult, ErrorResult>> AddChallenge(
bool hasWon, bool hasWon,
int timeSaved,
int points, int points,
DateTime startTime, DateTime startTime,
DateTime endTime) DateTime endTime)
...@@ -26,6 +27,7 @@ public class ChallengeService : Singleton<ChallengeService> ...@@ -26,6 +27,7 @@ public class ChallengeService : Singleton<ChallengeService>
var challenge = new Challenge var challenge = new Challenge
{ {
HasWon = hasWon, HasWon = hasWon,
TimeSaved = timeSaved,
PointsEarned = points, PointsEarned = points,
StartedAt = startTime, StartedAt = startTime,
EndedAt = endTime, EndedAt = endTime,
......
...@@ -47,6 +47,10 @@ public class SessionListener : Singleton<SessionListener> ...@@ -47,6 +47,10 @@ public class SessionListener : Singleton<SessionListener>
case Constants.AuthState.SignedIn: case Constants.AuthState.SignedIn:
break; break;
case Constants.AuthState.SignedOut: case Constants.AuthState.SignedOut:
if (SceneManager.GetActiveScene().name != "Login")
{
LoggedOut.Invoke();
}
break; break;
case Constants.AuthState.UserUpdated: case Constants.AuthState.UserUpdated:
break; break;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<ui:VisualElement name="Padding" class="padding" style="flex-grow: 1; flex-direction: row-reverse; align-items: center; background-color: rgb(255, 255, 255); padding-top: 25px; padding-bottom: 25px; border-top-left-radius: 30px; border-top-right-radius: 30px; border-bottom-right-radius: 30px; border-bottom-left-radius: 30px; border-top-width: 0; border-right-width: 0; border-bottom-width: 10px; border-left-width: 0; border-left-color: rgba(0, 0, 0, 0.25); border-right-color: rgba(0, 0, 0, 0.25); border-top-color: rgba(0, 0, 0, 0.25); border-bottom-color: rgba(0, 0, 0, 0.25);"> <ui:VisualElement name="Padding" class="padding" style="flex-grow: 1; flex-direction: row-reverse; align-items: center; background-color: rgb(255, 255, 255); padding-top: 25px; padding-bottom: 25px; border-top-left-radius: 30px; border-top-right-radius: 30px; border-bottom-right-radius: 30px; border-bottom-left-radius: 30px; border-top-width: 0; border-right-width: 0; border-bottom-width: 10px; border-left-width: 0; border-left-color: rgba(0, 0, 0, 0.25); border-right-color: rgba(0, 0, 0, 0.25); border-top-color: rgba(0, 0, 0, 0.25); border-bottom-color: rgba(0, 0, 0, 0.25);">
<ui:Label text="1" name="IndexLabel" class="base-text-bold" style="color: rgb(158, 158, 158); font-size: 34px; margin-left: 5px; width: 60px;"/> <ui:Label text="1" name="IndexLabel" class="base-text-bold" style="color: rgb(158, 158, 158); font-size: 34px; margin-left: 5px; width: 60px;"/>
<ui:VisualElement name="PlayerImage" style="flex-grow: 0; height: 125px; width: 125px; background-image: url(&quot;project://database/Assets/GUI%20PRO%20Kit%20-%20Simple%20Casual/Sprite/Demo/Demo_Character/UserPicture_01_Sample.png?fileID=2800000&amp;guid=358c17b4dd4c0461f8bcaf75f245f54e&amp;type=3#UserPicture_01_Sample&quot;); -unity-background-scale-mode: scale-to-fit; margin-left: 35px; background-color: rgb(209, 209, 209); border-top-left-radius: 50%; border-top-right-radius: 50%; border-bottom-right-radius: 50%; border-bottom-left-radius: 50%;"/> <ui:VisualElement name="PlayerImage" style="flex-grow: 0; height: 125px; width: 125px; background-image: url(&quot;project://database/Assets/GUI%20PRO%20Kit%20-%20Simple%20Casual/Sprite/Demo/Demo_Character/UserPicture_01_Sample.png?fileID=2800000&amp;guid=358c17b4dd4c0461f8bcaf75f245f54e&amp;type=3#UserPicture_01_Sample&quot;); -unity-background-scale-mode: scale-to-fit; margin-left: 35px; background-color: rgb(209, 209, 209); border-top-left-radius: 50%; border-top-right-radius: 50%; border-bottom-right-radius: 50%; border-bottom-left-radius: 50%;"/>
<ui:VisualElement name="GameDetailsPanel" style="height: 117px; width: auto; justify-content: space-between;"> <ui:VisualElement name="GameDetailsPanel" style="height: 117px; width: 404px; justify-content: space-between;">
<ui:Label text="عبد الرحمن" name="PlayerNameLabel" class="base-text-bold" style="font-size: 40px; height: auto; flex-shrink: 0; -unity-font-definition: url(&quot;project://database/Assets/ALArcade/Hakwaty%20Font/TSHakwaty-DemiBold.otf?fileID=12800000&amp;guid=566b773a07b3d064aa1f4c6ef7b6f6fa&amp;type=3#TSHakwaty-DemiBold&quot;);"/> <ui:Label text="عبد الرحمن" name="PlayerNameLabel" class="base-text-bold" style="font-size: 40px; height: auto; flex-shrink: 0; -unity-font-definition: url(&quot;project://database/Assets/ALArcade/Hakwaty%20Font/TSHakwaty-DemiBold.otf?fileID=12800000&amp;guid=566b773a07b3d064aa1f4c6ef7b6f6fa&amp;type=3#TSHakwaty-DemiBold&quot;);"/>
<ui:Label text="ماستر" name="RankLabel" language-direction="RTL" class="base-text-bold" style="font-size: 26px; white-space: pre-wrap; flex-shrink: 0; translate: 0% -13px; color: rgb(158, 158, 158); -unity-font-definition: url(&quot;project://database/Assets/ALArcade/Hakwaty%20Font/TS%20Hakwaty%20Light.otf?fileID=12800000&amp;guid=aeb653dff1f4d2f4fad340e3cf210c77&amp;type=3#TS Hakwaty Light&quot;); -unity-font-style: bold;"/> <ui:Label text="ماستر" name="RankLabel" language-direction="RTL" class="base-text-bold" style="font-size: 26px; white-space: pre-wrap; flex-shrink: 0; translate: 0% -13px; color: rgb(158, 158, 158); -unity-font-definition: url(&quot;project://database/Assets/ALArcade/Hakwaty%20Font/TS%20Hakwaty%20Light.otf?fileID=12800000&amp;guid=aeb653dff1f4d2f4fad340e3cf210c77&amp;type=3#TS Hakwaty Light&quot;); -unity-font-style: bold;"/>
</ui:VisualElement> </ui:VisualElement>
......
...@@ -83,7 +83,9 @@ public class ChallengeManager : MonoBehaviour ...@@ -83,7 +83,9 @@ public class ChallengeManager : MonoBehaviour
currentGameIndex++; currentGameIndex++;
if (currentGameIndex >= gameSceneNames.Count) if (currentGameIndex >= gameSceneNames.Count)
{ {
WonChallenge(timeSaved, timeSaved * timeSavedBonusMultiplier).Forget(); var pointsEarnedTotal = winningPoints + (timeSaved * timeSavedBonusMultiplier);
WonChallenge(timeSaved, pointsEarnedTotal).Forget();
return; return;
} }
...@@ -121,7 +123,7 @@ public class ChallengeManager : MonoBehaviour ...@@ -121,7 +123,7 @@ public class ChallengeManager : MonoBehaviour
// Show results, reset challenge, etc. // Show results, reset challenge, etc.
challengeCanvas.ShowChallengeResult(false, 0, penaltiesPerGame[currentGameIndex]); challengeCanvas.ShowChallengeResult(false, 0, penaltiesPerGame[currentGameIndex]);
await ChallengeService.Instance.AddChallenge(false, -penaltiesPerGame[currentGameIndex], startTime, DateTime.UtcNow); await ChallengeService.Instance.AddChallenge(false, -penaltiesPerGame[currentGameIndex], 0, startTime, DateTime.UtcNow);
} }
private async UniTask WonChallenge(int timeSaved, int pointsEarned) private async UniTask WonChallenge(int timeSaved, int pointsEarned)
...@@ -129,7 +131,7 @@ public class ChallengeManager : MonoBehaviour ...@@ -129,7 +131,7 @@ public class ChallengeManager : MonoBehaviour
Debug.Log("Challenge completed! Total time saved: " + timeSaved); Debug.Log("Challenge completed! Total time saved: " + timeSaved);
challengeCanvas.ShowChallengeResult(true, timeSaved, pointsEarned); challengeCanvas.ShowChallengeResult(true, timeSaved, pointsEarned);
await ChallengeService.Instance.AddChallenge(true, timeSaved, startTime, DateTime.UtcNow); await ChallengeService.Instance.AddChallenge(true, timeSaved, pointsEarned, startTime, DateTime.UtcNow);
} }
public void EndChallenge() public void EndChallenge()
......
...@@ -24,7 +24,7 @@ MonoBehaviour: ...@@ -24,7 +24,7 @@ MonoBehaviour:
m_Scale: 1 m_Scale: 1
m_ReferenceDpi: 96 m_ReferenceDpi: 96
m_FallbackDpi: 96 m_FallbackDpi: 96
m_ReferenceResolution: {x: 1080, y: 1920} m_ReferenceResolution: {x: 1080, y: 2400}
m_ScreenMatchMode: 0 m_ScreenMatchMode: 0
m_Match: 0 m_Match: 0
m_SortingOrder: 0 m_SortingOrder: 0
......
...@@ -26,7 +26,7 @@ MonoBehaviour: ...@@ -26,7 +26,7 @@ MonoBehaviour:
m_MinSize: {x: 400, y: 112} m_MinSize: {x: 400, y: 112}
m_MaxSize: {x: 32384, y: 16192} m_MaxSize: {x: 32384, y: 16192}
vertical: 0 vertical: 0
controlID: 8795 controlID: 12788
draggingID: 0 draggingID: 0
--- !u!114 &2 --- !u!114 &2
MonoBehaviour: MonoBehaviour:
...@@ -99,7 +99,7 @@ MonoBehaviour: ...@@ -99,7 +99,7 @@ MonoBehaviour:
m_HSlider: 0 m_HSlider: 0
m_VSlider: 0 m_VSlider: 0
m_IgnoreScrollWheelUntilClicked: 0 m_IgnoreScrollWheelUntilClicked: 0
m_EnableMouseInput: 0 m_EnableMouseInput: 1
m_EnableSliderZoomHorizontal: 0 m_EnableSliderZoomHorizontal: 0
m_EnableSliderZoomVertical: 0 m_EnableSliderZoomVertical: 0
m_UniformScale: 1 m_UniformScale: 1
...@@ -155,7 +155,7 @@ MonoBehaviour: ...@@ -155,7 +155,7 @@ MonoBehaviour:
m_MinSize: {x: 100, y: 112} m_MinSize: {x: 100, y: 112}
m_MaxSize: {x: 8096, y: 16192} m_MaxSize: {x: 8096, y: 16192}
vertical: 1 vertical: 1
controlID: 8796 controlID: 12789
draggingID: 0 draggingID: 0
--- !u!114 &4 --- !u!114 &4
MonoBehaviour: MonoBehaviour:
...@@ -890,9 +890,9 @@ MonoBehaviour: ...@@ -890,9 +890,9 @@ MonoBehaviour:
m_AudioPlay: 0 m_AudioPlay: 0
m_DebugDrawModesUseInteractiveLightBakingData: 0 m_DebugDrawModesUseInteractiveLightBakingData: 0
m_Position: m_Position:
m_Target: {x: 558.48663, y: 808.17773, z: 5.863441} m_Target: {x: 338.53738, y: 1304.445, z: -10.085905}
speed: 2 speed: 2
m_Value: {x: 558.48663, y: 808.17773, z: 5.863441} m_Value: {x: 338.53738, y: 1304.445, z: -10.085905}
m_RenderMode: 0 m_RenderMode: 0
m_CameraMode: m_CameraMode:
drawMode: 0 drawMode: 0
...@@ -942,9 +942,9 @@ MonoBehaviour: ...@@ -942,9 +942,9 @@ MonoBehaviour:
speed: 2 speed: 2
m_Value: {x: 0, y: 0, z: 0, w: 1} m_Value: {x: 0, y: 0, z: 0, w: 1}
m_Size: m_Size:
m_Target: 440.55576 m_Target: 2035.4912
speed: 2 speed: 2
m_Value: 440.55576 m_Value: 2035.4912
m_Ortho: m_Ortho:
m_Target: 1 m_Target: 1
speed: 2 speed: 2
...@@ -1023,12 +1023,12 @@ MonoBehaviour: ...@@ -1023,12 +1023,12 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 914 x: 914
y: 0 y: 0
width: 351 width: 384
height: 933 height: 933
m_MinSize: {x: 100, y: 112} m_MinSize: {x: 100, y: 112}
m_MaxSize: {x: 8096, y: 16192} m_MaxSize: {x: 8096, y: 16192}
vertical: 1 vertical: 1
controlID: 8860 controlID: 12878
draggingID: 0 draggingID: 0
--- !u!114 &8 --- !u!114 &8
MonoBehaviour: MonoBehaviour:
...@@ -1047,7 +1047,7 @@ MonoBehaviour: ...@@ -1047,7 +1047,7 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 0 y: 0
width: 351 width: 384
height: 500 height: 500
m_MinSize: {x: 201, y: 226} m_MinSize: {x: 201, y: 226}
m_MaxSize: {x: 4001, y: 4026} m_MaxSize: {x: 4001, y: 4026}
...@@ -1079,7 +1079,7 @@ MonoBehaviour: ...@@ -1079,7 +1079,7 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 914 x: 914
y: 79 y: 79
width: 349 width: 382
height: 474 height: 474
m_SerializedDataModeController: m_SerializedDataModeController:
m_DataMode: 0 m_DataMode: 0
...@@ -1098,15 +1098,16 @@ MonoBehaviour: ...@@ -1098,15 +1098,16 @@ MonoBehaviour:
m_TreeViewState: m_TreeViewState:
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 0}
m_SelectedIDs: m_SelectedIDs:
- m_Data: 182598 - m_Data: 188016
m_LastClickedID: m_LastClickedID:
m_Data: 0 m_Data: 188016
m_ExpandedIDs: m_ExpandedIDs:
- m_Data: -194492 - m_Data: -194492
- m_Data: -192202 - m_Data: -192202
- m_Data: -171102 - m_Data: -171102
- m_Data: -170836 - m_Data: -170836
- m_Data: -81142 - m_Data: -81142
- m_Data: -12
- m_Data: 187514 - m_Data: 187514
- m_Data: 187570 - m_Data: 187570
- m_Data: 187930 - m_Data: 187930
...@@ -1153,7 +1154,7 @@ MonoBehaviour: ...@@ -1153,7 +1154,7 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 500 y: 500
width: 351 width: 384
height: 433 height: 433
m_MinSize: {x: 51, y: 76} m_MinSize: {x: 51, y: 76}
m_MaxSize: {x: 4001, y: 4026} m_MaxSize: {x: 4001, y: 4026}
...@@ -1185,7 +1186,7 @@ MonoBehaviour: ...@@ -1185,7 +1186,7 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 914 x: 914
y: 579 y: 579
width: 349 width: 382
height: 407 height: 407
m_SerializedDataModeController: m_SerializedDataModeController:
m_DataMode: 0 m_DataMode: 0
...@@ -1215,9 +1216,9 @@ MonoBehaviour: ...@@ -1215,9 +1216,9 @@ MonoBehaviour:
m_Children: [] m_Children: []
m_Position: m_Position:
serializedVersion: 2 serializedVersion: 2
x: 1265 x: 1298
y: 0 y: 0
width: 289 width: 184
height: 933 height: 933
m_MinSize: {x: 232, y: 276} m_MinSize: {x: 232, y: 276}
m_MaxSize: {x: 10002, y: 10026} m_MaxSize: {x: 10002, y: 10026}
...@@ -1247,9 +1248,9 @@ MonoBehaviour: ...@@ -1247,9 +1248,9 @@ MonoBehaviour:
m_TextWithWhitespace: "Project\u200B" m_TextWithWhitespace: "Project\u200B"
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 1265 x: 1298
y: 79 y: 79
width: 287 width: 182
height: 907 height: 907
m_SerializedDataModeController: m_SerializedDataModeController:
m_DataMode: 0 m_DataMode: 0
...@@ -1275,7 +1276,7 @@ MonoBehaviour: ...@@ -1275,7 +1276,7 @@ MonoBehaviour:
m_SkipHidden: 0 m_SkipHidden: 0
m_SearchArea: 1 m_SearchArea: 1
m_Folders: m_Folders:
- Assets/ScienceStreet/Features/Challenge - Assets/AppUI/NewAppUI
m_Globs: [] m_Globs: []
m_ProductIds: m_ProductIds:
m_AnyWithAssetOrigin: 0 m_AnyWithAssetOrigin: 0
...@@ -1300,11 +1301,14 @@ MonoBehaviour: ...@@ -1300,11 +1301,14 @@ MonoBehaviour:
m_ExpandedIDs: m_ExpandedIDs:
- m_Data: 0 - m_Data: 0
- m_Data: 103290 - m_Data: 103290
- m_Data: 103640 - m_Data: 103688
- m_Data: 103702
- m_Data: 103780 - m_Data: 103780
- m_Data: 103784 - m_Data: 103784
- m_Data: 166894 - m_Data: 166894
- m_Data: 167086 - m_Data: 167086
- m_Data: 196692
- m_Data: 196702
- m_Data: 1000000000 - m_Data: 1000000000
- m_Data: 2147483647 - m_Data: 2147483647
m_RenameOverlay: m_RenameOverlay:
...@@ -1333,16 +1337,16 @@ MonoBehaviour: ...@@ -1333,16 +1337,16 @@ MonoBehaviour:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_ResourceFile: m_ResourceFile:
m_AssetTreeState: m_AssetTreeState:
scrollPos: {x: 0, y: 180} scrollPos: {x: 0, y: 0}
m_SelectedIDs: m_SelectedIDs:
- m_Data: 182598 - m_Data: 188016
m_LastClickedID: m_LastClickedID:
m_Data: 182598 m_Data: 0
m_ExpandedIDs: m_ExpandedIDs:
- m_Data: 0 - m_Data: 0
- m_Data: 103290 - m_Data: 103290
- m_Data: 103640
- m_Data: 103688 - m_Data: 103688
- m_Data: 103702
- m_Data: 103780 - m_Data: 103780
- m_Data: 103784 - m_Data: 103784
- m_Data: 166894 - m_Data: 166894
...@@ -1378,8 +1382,8 @@ MonoBehaviour: ...@@ -1378,8 +1382,8 @@ MonoBehaviour:
m_ResourceFile: m_ResourceFile:
m_ListAreaState: m_ListAreaState:
m_SelectedInstanceIDs: m_SelectedInstanceIDs:
- m_Data: 182598 - m_Data: 188016
m_LastClickedInstanceID: 182598 m_LastClickedInstanceID: 188016
m_HadKeyboardFocusLastEvent: 0 m_HadKeyboardFocusLastEvent: 0
m_ExpandedInstanceIDs: [] m_ExpandedInstanceIDs: []
m_RenameOverlay: m_RenameOverlay:
...@@ -1426,9 +1430,9 @@ MonoBehaviour: ...@@ -1426,9 +1430,9 @@ MonoBehaviour:
m_Children: [] m_Children: []
m_Position: m_Position:
serializedVersion: 2 serializedVersion: 2
x: 1554 x: 1482
y: 0 y: 0
width: 366 width: 438
height: 933 height: 933
m_MinSize: {x: 276, y: 76} m_MinSize: {x: 276, y: 76}
m_MaxSize: {x: 4001, y: 4026} m_MaxSize: {x: 4001, y: 4026}
...@@ -1458,9 +1462,9 @@ MonoBehaviour: ...@@ -1458,9 +1462,9 @@ MonoBehaviour:
m_TextWithWhitespace: "Inspector\u200B" m_TextWithWhitespace: "Inspector\u200B"
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 1554 x: 1482
y: 79 y: 79
width: 365 width: 437
height: 907 height: 907
m_SerializedDataModeController: m_SerializedDataModeController:
m_DataMode: 0 m_DataMode: 0
......
...@@ -13,6 +13,9 @@ scopes = { ...@@ -13,6 +13,9 @@ scopes = {
"picker_visibility_flags.00000000" = "0" "picker_visibility_flags.00000000" = "0"
"picker_item_size.00000000" = "1" "picker_item_size.00000000" = "1"
"picker_inspector.00000000" = "0" "picker_inspector.00000000" = "0"
"last_search.66F56946" = ""
"OpenInspectorPreview.66F56946" = "0"
"currentGroup.66F56946" = "all"
} }
providers = { providers = {
asset = { asset = {
......
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