Commit 1873ab73 authored by Yousef Sameh's avatar Yousef Sameh

Challenge

parent 0a10504d
using UnityEngine;
public class Splash : MonoBehaviour
{
}
fileFormatVersion: 2
guid: 78c293a646596184bb35371f972aef61
\ No newline at end of file
...@@ -18,6 +18,56 @@ public class SupabaseAuthentication : MonoBehaviour ...@@ -18,6 +18,56 @@ public class SupabaseAuthentication : MonoBehaviour
supabaseManager = SupabaseManager.Instance; supabaseManager = SupabaseManager.Instance;
} }
public async UniTask<OneOf<Success, string>> EnsureSession()
{
try
{
IsLoading = true;
supabaseManager.Supabase()!.Auth.LoadSession();
if (supabaseManager.Supabase()!.Auth.CurrentUser == null)
{
await supabaseManager.Supabase()!.Auth.SignInAnonymously();
}
return new Success();
}
catch (GotrueException gotrueexception)
{
return gotrueexception.Message;
}
catch (Exception e)
{
return e.Message;
}
finally
{
IsLoading = false;
}
}
public async UniTask<OneOf<Success, string>> SignInAnonymously()
{
try
{
IsLoading = true;
await supabaseManager.Supabase()!.Auth.SignInAnonymously();
return new Success();
}
catch (GotrueException gotrueexception)
{
return gotrueexception.Message;
}
catch (Exception e)
{
return e.Message;
}
finally
{
IsLoading = false;
}
}
public async UniTask<OneOf<Success, string>> LogIn(string username, string password) public async UniTask<OneOf<Success, string>> LogIn(string username, string password)
{ {
try try
......
fileFormatVersion: 2
guid: fd49566d83fe00b48a6f6c1ad1d872e3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System;
using Supabase.Postgrest.Attributes;
using Supabase.Postgrest.Models;
[Table("challenges")]
public class Challenge : BaseModel
{
[PrimaryKey("id")]
public string Id { get; set; }
[Column("user_id")]
public string UserId { get; set; }
[Column("has_won")]
public bool HasWon { get; set; }
[Column("points_earned")]
public int PointsEarned { get; set; } = 0;
[Column("started_at")]
public DateTime StartedAt { get; set; }
[Column("ended_at")]
public DateTime EndedAt { get; set; }
[Column("created_at")]
public DateTime CreatedAt { get; set; }
}
\ No newline at end of file
fileFormatVersion: 2
guid: 90f958872b71bed449582ff3552a4ab5
\ No newline at end of file
using Cysharp.Threading.Tasks;
using OneOf;
using Supabase;
using System;
using System.Collections.Generic;
using UnityEngine;
using static Supabase.Postgrest.Constants;
public class ChallengeService : Singleton<ChallengeService>
{
private Client supabase => SupabaseManager.Instance.Supabase();
// Add a completed challenge
public async UniTask<OneOf<ChallengeResult, ErrorResult>> AddChallenge(
bool hasWon,
int points,
DateTime startTime,
DateTime endTime)
{
try
{
var authUser = supabase.Auth.CurrentUser;
if (authUser == null)
return new ErrorResult("Not authenticated");
var challenge = new Challenge
{
HasWon = hasWon,
PointsEarned = points,
StartedAt = startTime,
EndedAt = endTime,
CreatedAt = DateTime.UtcNow
};
await supabase.From<Challenge>().Insert(challenge);
Debug.Log($"✓ Challenge added: {(hasWon ? "Won" : "Lost")} - {points} pts");
return new ChallengeResult(challenge);
}
catch (Exception ex)
{
Debug.LogError($"Error adding challenge: {ex.Message}");
return new ErrorResult(ex.Message);
}
}
// Get user's challenge history
public async UniTask<OneOf<ChallengeListResult, ErrorResult>> GetUserChallenges(int limit = 50)
{
try
{
var authUser = supabase.Auth.CurrentUser;
if (authUser == null)
return new ErrorResult("Not authenticated");
var userId = authUser.Id.ToString();
var response = await supabase
.From<Challenge>()
.Where(x => x.UserId == userId)
.Order(x => x.StartedAt, Ordering.Descending)
.Limit(limit)
.Get();
return new ChallengeListResult(response.Models ?? new());
}
catch (Exception ex)
{
return new ErrorResult(ex.Message);
}
}
// Get challenge by ID
public async UniTask<OneOf<ChallengeResult, ErrorResult>> GetChallengeById(string challengeId)
{
try
{
var response = await supabase
.From<Challenge>()
.Where(x => x.Id == challengeId)
.Get();
if (response?.Models == null || response.Models.Count == 0)
return new ErrorResult("Challenge not found");
return new ChallengeResult(response.Models[0]);
}
catch (Exception ex)
{
return new ErrorResult(ex.Message);
}
}
// Get win/loss stats
public async UniTask<OneOf<ChallengeStatsResult, ErrorResult>> GetChallengeStats()
{
try
{
var authUser = supabase.Auth.CurrentUser;
if (authUser == null)
return new ErrorResult("Not authenticated");
var userId = authUser.Id.ToString();
var response = await supabase
.From<Challenge>()
.Where(x => x.UserId == userId)
.Get();
var challenges = response.Models ?? new();
int totalGames = challenges.Count;
int wins = 0;
int losses = 0;
int totalPoints = 0;
foreach (var c in challenges)
{
if (c.HasWon) wins++;
else losses++;
totalPoints += c.PointsEarned;
}
float winRate = totalGames > 0 ? (float)wins / totalGames * 100f : 0f;
return new ChallengeStatsResult(
TotalGames: totalGames,
Wins: wins,
Losses: losses,
WinRate: winRate,
TotalPoints: totalPoints
);
}
catch (Exception ex)
{
return new ErrorResult(ex.Message);
}
}
}
// Result types
public record ChallengeResult(Challenge Challenge);
public record ChallengeListResult(List<Challenge> Challenges);
public record ChallengeStatsResult(
int TotalGames,
int Wins,
int Losses,
float WinRate,
int TotalPoints
);
\ No newline at end of file
fileFormatVersion: 2
guid: 02f567249bc7e8949a0ce010a6f7a353
\ No newline at end of file
using System;
using Cysharp.Threading.Tasks;
using Supabase.Gotrue; using Supabase.Gotrue;
using Supabase.Gotrue.Interfaces; using Supabase.Gotrue.Interfaces;
using Unity.VisualScripting;
using UnityEngine; using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
public class SessionListener : Singleton<SessionListener> public class SessionListener : Singleton<SessionListener>
{ {
[SerializeField] private SupabaseManager SupabaseManager; [SerializeField] private SupabaseManager SupabaseManager;
[SerializeField] private Transform splash;
[SerializeField] private UnityEvent LoggedIn; [SerializeField] private UnityEvent LoggedIn;
[SerializeField] private UnityEvent LoggedOut; [SerializeField] private UnityEvent LoggedOut;
[SerializeField] private UnityEvent NewUser;
public void UnityAuthListener(IGotrueClient<Supabase.Gotrue.User, Session> sender, Constants.AuthState newState) public void UnityAuthListener(IGotrueClient<Supabase.Gotrue.User, Session> sender, Constants.AuthState newState)
{ {
switch (newState) switch (newState)
{ {
case Constants.AuthState.SignedIn: case Constants.AuthState.SignedIn:
LoggedIn.Invoke(); CheckUserFile();
break; break;
case Constants.AuthState.SignedOut: case Constants.AuthState.SignedOut:
LoggedOut.Invoke();
break; break;
case Constants.AuthState.UserUpdated: case Constants.AuthState.UserUpdated:
LoggedIn.Invoke();
break; break;
case Constants.AuthState.PasswordRecovery: case Constants.AuthState.PasswordRecovery:
Debug.Log("Password Recovery"); Debug.Log("Password Recovery");
break; break;
case Constants.AuthState.TokenRefreshed: case Constants.AuthState.TokenRefreshed:
Debug.Log("Token Refreshed"); CheckUserFile();
break; break;
case Constants.AuthState.Shutdown: case Constants.AuthState.Shutdown:
Debug.Log("Shutdown"); Debug.Log("Shutdown");
...@@ -37,4 +41,25 @@ public class SessionListener : Singleton<SessionListener> ...@@ -37,4 +41,25 @@ public class SessionListener : Singleton<SessionListener>
break; break;
} }
} }
private void OnUserChanged(User user)
{
LoggedIn.Invoke();
UserService.Instance.OnUserChange -= OnUserChanged;
}
private async UniTask CheckUserFile()
{
var userOrError = await UserService.Instance.LoadCurrentUser();
if (userOrError.IsT0)
{
LoggedIn.Invoke();
}
else
{
UserService.Instance.OnUserChange += OnUserChanged;
splash.gameObject.SetActive(false);
NewUser.Invoke();
}
}
} }
...@@ -43,7 +43,9 @@ public class SupabaseManager : Singleton<SupabaseManager> ...@@ -43,7 +43,9 @@ public class SupabaseManager : Singleton<SupabaseManager>
// Fetch the session from the persistence layer // Fetch the session from the persistence layer
// If there is a valid/unexpired session available this counts as a user log in // If there is a valid/unexpired session available this counts as a user log in
// and will send an event to the UnityAuthListener above. // and will send an event to the UnityAuthListener above.
client.Auth.LoadSession(); // client.Auth.LoadSession();
await SupabaseAuthentication.Instance.EnsureSession();
// Allow unconfirmed user sessions. If you turn this on you will have to complete the // Allow unconfirmed user sessions. If you turn this on you will have to complete the
// email verification flow before you can use the session. // email verification flow before you can use the session.
......
...@@ -14,7 +14,7 @@ public class UserService : Singleton<UserService> ...@@ -14,7 +14,7 @@ public class UserService : Singleton<UserService>
private RealtimeChannel _userChannel; private RealtimeChannel _userChannel;
public async UniTask LoadCurrentUser() public async UniTask<OneOf<UserResult, ErrorResult>> LoadCurrentUser()
{ {
var userOrFail = await GetCurrentUser(); var userOrFail = await GetCurrentUser();
userOrFail.Switch(async (user) => userOrFail.Switch(async (user) =>
...@@ -26,6 +26,7 @@ public class UserService : Singleton<UserService> ...@@ -26,6 +26,7 @@ public class UserService : Singleton<UserService>
{ {
Debug.LogError(error.Message); Debug.LogError(error.Message);
}); });
return userOrFail;
} }
protected async override void Awake() protected async override void Awake()
......
...@@ -150,6 +150,7 @@ MonoBehaviour: ...@@ -150,6 +150,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: Assembly-CSharp::SessionListener m_EditorClassIdentifier: Assembly-CSharp::SessionListener
SupabaseManager: {fileID: 689087718} SupabaseManager: {fileID: 689087718}
splash: {fileID: 1946331747}
LoggedIn: LoggedIn:
m_PersistentCalls: m_PersistentCalls:
m_Calls: m_Calls:
...@@ -180,6 +181,21 @@ MonoBehaviour: ...@@ -180,6 +181,21 @@ MonoBehaviour:
m_StringArgument: m_StringArgument:
m_BoolArgument: 0 m_BoolArgument: 0
m_CallState: 2 m_CallState: 2
NewUser:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1113388152}
m_TargetAssemblyTypeName: LoginPageAnimation, Assembly-CSharp
m_MethodName: RegiserOpen
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!4 &232732870 --- !u!4 &232732870
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -241,6 +257,100 @@ Transform: ...@@ -241,6 +257,100 @@ Transform:
- {fileID: 2025346609} - {fileID: 2025346609}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &639516600
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 639516601}
- component: {fileID: 639516603}
- component: {fileID: 639516602}
m_Layer: 5
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &639516601
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 639516600}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 793411418}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 586.0189, y: 288.1363}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &639516602
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 639516600}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: beaa34cb0e58d624bb3a264b28600785, type: 3}
m_Name:
m_EditorClassIdentifier: LightSide.UniText::LightSide.UniText
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
text: "\u062C\u0627\u0631\u064A \u0627\u0644\u062A\u062D\u0645\u064A\u0644...."
fontStack: {fileID: 11400000, guid: 0029e5efb4c7a12f1ac9136de794e6dc, type: 2}
appearance: {fileID: 11400000, guid: 3a559cf5d653f05ea807e1be5655df92, type: 2}
fontSize: 72
baseDirection: 2
wordWrap: 1
horizontalAlignment: 1
verticalAlignment: 1
overEdge: 0
underEdge: 0
leadingDistribution: 0
autoSize: 1
minFontSize: 10
maxFontSize: 72
modRegisters:
items: []
modRegisterConfigs:
items: []
highlighter:
rid: 8674289297877106688
references:
version: 2
RefIds:
- rid: 8674289297877106688
type: {class: DefaultTextHighlighter, ns: LightSide, asm: LightSide.UniText}
data:
clickColor: {r: 0.2, g: 0.5, b: 1, a: 0.6}
fadeDuration: 0.25
hoverColor: {r: 0.2, g: 0.5, b: 1, a: 0.1}
--- !u!222 &639516603
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 639516600}
m_CullTransparentMesh: 1
--- !u!1 &689087716 --- !u!1 &689087716
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -286,6 +396,82 @@ MonoBehaviour: ...@@ -286,6 +396,82 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: Assembly-CSharp::SupabaseManager m_EditorClassIdentifier: Assembly-CSharp::SupabaseManager
SessionListener: {fileID: 232732869} SessionListener: {fileID: 232732869}
--- !u!1 &793411417
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 793411418}
- component: {fileID: 793411420}
- component: {fileID: 793411419}
m_Layer: 5
m_Name: Panel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &793411418
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 793411417}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 639516601}
m_Father: {fileID: 1946331747}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &793411419
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 793411417}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0.046317577, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &793411420
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 793411417}
m_CullTransparentMesh: 1
--- !u!1 &1113388150 --- !u!1 &1113388150
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -532,6 +718,108 @@ MonoBehaviour: ...@@ -532,6 +718,108 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: Assembly-CSharp::LoginController m_EditorClassIdentifier: Assembly-CSharp::LoginController
uIDocument: {fileID: 2143987065} uIDocument: {fileID: 2143987065}
--- !u!1 &1946331743
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1946331747}
- component: {fileID: 1946331746}
- component: {fileID: 1946331745}
- component: {fileID: 1946331744}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1946331744
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1946331743}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.GraphicRaycaster
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &1946331745
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1946331743}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.CanvasScaler
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &1946331746
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1946331743}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 9
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 30
m_TargetDisplay: 0
--- !u!224 &1946331747
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1946331743}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 793411418}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &2025346608 --- !u!1 &2025346608
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -765,3 +1053,4 @@ SceneRoots: ...@@ -765,3 +1053,4 @@ SceneRoots:
- {fileID: 1486533217} - {fileID: 1486533217}
- {fileID: 689087717} - {fileID: 689087717}
- {fileID: 414692744} - {fileID: 414692744}
- {fileID: 1946331747}
...@@ -9,6 +9,11 @@ public class LoginPageAnimation : MonoBehaviour ...@@ -9,6 +9,11 @@ public class LoginPageAnimation : MonoBehaviour
VisualElement _registerPanel; VisualElement _registerPanel;
public void RegiserOpen()
{
_registerPanel.style.translate = new Translate(0, 0);
}
void Start() void Start()
{ {
ContantPanel = loginPage.rootVisualElement.Q<VisualElement>("ContantPanel"); ContantPanel = loginPage.rootVisualElement.Q<VisualElement>("ContantPanel");
...@@ -26,7 +31,7 @@ public class LoginPageAnimation : MonoBehaviour ...@@ -26,7 +31,7 @@ public class LoginPageAnimation : MonoBehaviour
loginPage.rootVisualElement.Q<Button>("OpenLoginPanel").clicked += () => loginPage.rootVisualElement.Q<Button>("OpenLoginPanel").clicked += () =>
{ {
_registerPanel.style.translate = new Translate(0, new Length(100,LengthUnit.Percent)); _registerPanel.style.translate = new Translate(0, new Length(100, LengthUnit.Percent));
}; };
} }
} }
...@@ -28,9 +28,9 @@ RectTransform: ...@@ -28,9 +28,9 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 7987928246961044090} m_Father: {fileID: 7987928246961044090}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
...@@ -58,7 +58,7 @@ MonoBehaviour: ...@@ -58,7 +58,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1} m_Color: {r: 0.1882353, g: 0.1882353, b: 0.8156863, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1 m_Maskable: 1
...@@ -102,10 +102,10 @@ RectTransform: ...@@ -102,10 +102,10 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 7987928246961044090} - {fileID: 7987928246961044090}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
...@@ -150,10 +150,10 @@ RectTransform: ...@@ -150,10 +150,10 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 939772201543363291} - {fileID: 939772201543363291}
m_Father: {fileID: 2771212925527886026} m_Father: {fileID: 2771212925527886026}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
...@@ -213,7 +213,7 @@ MonoBehaviour: ...@@ -213,7 +213,7 @@ MonoBehaviour:
m_ShowMaskGraphic: 1 m_ShowMaskGraphic: 1
--- !u!95 &6505739098132124525 --- !u!95 &6505739098132124525
Animator: Animator:
serializedVersion: 3 serializedVersion: 7
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
...@@ -226,7 +226,10 @@ Animator: ...@@ -226,7 +226,10 @@ Animator:
m_UpdateMode: 0 m_UpdateMode: 0
m_ApplyRootMotion: 0 m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0 m_LinearVelocityBlending: 0
m_StabilizeFeet: 0
m_AnimatePhysics: 0
m_WarningMessage: m_WarningMessage:
m_HasTransformHierarchy: 1 m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1 m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0 m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0
...@@ -27,10 +27,10 @@ RectTransform: ...@@ -27,10 +27,10 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1389609922629737571} - {fileID: 1389609922629737571}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
...@@ -75,10 +75,10 @@ RectTransform: ...@@ -75,10 +75,10 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 8102041105475503462} - {fileID: 8102041105475503462}
m_Father: {fileID: 2141563140782837367} m_Father: {fileID: 2141563140782837367}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
...@@ -138,7 +138,7 @@ MonoBehaviour: ...@@ -138,7 +138,7 @@ MonoBehaviour:
m_ShowMaskGraphic: 1 m_ShowMaskGraphic: 1
--- !u!95 &5280856268953975849 --- !u!95 &5280856268953975849
Animator: Animator:
serializedVersion: 3 serializedVersion: 7
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
...@@ -151,10 +151,13 @@ Animator: ...@@ -151,10 +151,13 @@ Animator:
m_UpdateMode: 0 m_UpdateMode: 0
m_ApplyRootMotion: 0 m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0 m_LinearVelocityBlending: 0
m_StabilizeFeet: 0
m_AnimatePhysics: 0
m_WarningMessage: m_WarningMessage:
m_HasTransformHierarchy: 1 m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1 m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0 m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0
--- !u!1 &4418937180279055598 --- !u!1 &4418937180279055598
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -183,9 +186,9 @@ RectTransform: ...@@ -183,9 +186,9 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 1389609922629737571} m_Father: {fileID: 1389609922629737571}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
...@@ -213,7 +216,7 @@ MonoBehaviour: ...@@ -213,7 +216,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1} m_Color: {r: 0.1882353, g: 0.1882353, b: 0.8156863, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1 m_Maskable: 1
......
...@@ -14,7 +14,7 @@ MonoBehaviour: ...@@ -14,7 +14,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
multiplyColorMaterial: {fileID: 2100000, guid: 53171468e32441749b007c64337cd3db, type: 2} multiplyColorMaterial: {fileID: 2100000, guid: 53171468e32441749b007c64337cd3db, type: 2}
addColorMaterial: {fileID: 2100000, guid: 65ccb7b6cbefce14eb6f884cfc33ba91, type: 2} addColorMaterial: {fileID: 2100000, guid: 65ccb7b6cbefce14eb6f884cfc33ba91, type: 2}
refrenceResolution: {x: 1920, y: 1080} refrenceResolution: {x: 1080, y: 2400}
blockRaycasts: 1 blockRaycasts: 1
colorTintMode: 0 colorTintMode: 0
colorTint: {r: 1, g: 1, b: 1, a: 1} colorTint: {r: 1, g: 1, b: 1, a: 1}
......
...@@ -1526,10 +1526,10 @@ RectTransform: ...@@ -1526,10 +1526,10 @@ RectTransform:
m_Children: [] m_Children: []
m_Father: {fileID: 1868296225662172060} m_Father: {fileID: 1868296225662172060}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 22.572838, y: -25.96685} m_AnchoredPosition: {x: 22.572838, y: 0}
m_SizeDelta: {x: 0, y: 51.9337} m_SizeDelta: {x: 51.9337, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5599785267463442964 --- !u!222 &5599785267463442964
CanvasRenderer: CanvasRenderer:
...@@ -1874,10 +1874,10 @@ RectTransform: ...@@ -1874,10 +1874,10 @@ RectTransform:
m_Children: [] m_Children: []
m_Father: {fileID: 1868296225662172060} m_Father: {fileID: 1868296225662172060}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 267.15555, y: -25.96685} m_AnchoredPosition: {x: 267.15555, y: 0}
m_SizeDelta: {x: 0, y: 51.9337} m_SizeDelta: {x: 51.9337, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5340325998096306428 --- !u!222 &5340325998096306428
CanvasRenderer: CanvasRenderer:
...@@ -2987,10 +2987,10 @@ RectTransform: ...@@ -2987,10 +2987,10 @@ RectTransform:
m_Children: [] m_Children: []
m_Father: {fileID: 1868296225662172060} m_Father: {fileID: 1868296225662172060}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 206.00986, y: -25.96685} m_AnchoredPosition: {x: 206.00986, y: 0}
m_SizeDelta: {x: 0, y: 51.9337} m_SizeDelta: {x: 51.9337, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4280031676036218401 --- !u!222 &4280031676036218401
CanvasRenderer: CanvasRenderer:
...@@ -3385,10 +3385,10 @@ RectTransform: ...@@ -3385,10 +3385,10 @@ RectTransform:
m_Children: [] m_Children: []
m_Father: {fileID: 1868296225662172060} m_Father: {fileID: 1868296225662172060}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 144.8642, y: -25.96685} m_AnchoredPosition: {x: 144.8642, y: 0}
m_SizeDelta: {x: 0, y: 51.9337} m_SizeDelta: {x: 51.9337, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3352223824432655738 --- !u!222 &3352223824432655738
CanvasRenderer: CanvasRenderer:
...@@ -3662,10 +3662,10 @@ RectTransform: ...@@ -3662,10 +3662,10 @@ RectTransform:
m_Children: [] m_Children: []
m_Father: {fileID: 1868296225662172060} m_Father: {fileID: 1868296225662172060}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 83.71851, y: -25.96685} m_AnchoredPosition: {x: 83.71851, y: 0}
m_SizeDelta: {x: 0, y: 51.9337} m_SizeDelta: {x: 51.9337, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2582842219960060486 --- !u!222 &2582842219960060486
CanvasRenderer: CanvasRenderer:
......
...@@ -168,6 +168,51 @@ Transform: ...@@ -168,6 +168,51 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &601229405
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 601229407}
- component: {fileID: 601229406}
m_Layer: 0
m_Name: TransitionManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &601229406
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 601229405}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 61430b0086307cc4da3ccc8d39ae88da, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::EasyTransition.TransitionManager
transitionTemplate: {fileID: 5276914992623515724, guid: 616d511151a6c554caddf1c754e4f91d, type: 3}
--- !u!4 &601229407
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 601229405}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 562.3606, y: 1200, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &878368482 --- !u!1 &878368482
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -687,3 +732,4 @@ SceneRoots: ...@@ -687,3 +732,4 @@ SceneRoots:
- {fileID: 1049087476} - {fileID: 1049087476}
- {fileID: 1559015525} - {fileID: 1559015525}
- {fileID: 62724370} - {fileID: 62724370}
- {fileID: 601229407}
...@@ -2490,6 +2490,51 @@ CanvasRenderer: ...@@ -2490,6 +2490,51 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1714205092} m_GameObject: {fileID: 1714205092}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1 &1863734989
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1863734991}
- component: {fileID: 1863734990}
m_Layer: 0
m_Name: TransitionManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1863734990
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1863734989}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 61430b0086307cc4da3ccc8d39ae88da, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::EasyTransition.TransitionManager
transitionTemplate: {fileID: 5276914992623515724, guid: 616d511151a6c554caddf1c754e4f91d, type: 3}
--- !u!4 &1863734991
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1863734989}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 284.60147, y: 1513.046, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1951693011 --- !u!1 &1951693011
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -3144,3 +3189,4 @@ SceneRoots: ...@@ -3144,3 +3189,4 @@ SceneRoots:
- {fileID: 712828494} - {fileID: 712828494}
- {fileID: 636897759} - {fileID: 636897759}
- {fileID: 1371168841} - {fileID: 1371168841}
- {fileID: 1863734991}
...@@ -517,6 +517,51 @@ Transform: ...@@ -517,6 +517,51 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1283619807
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1283619809}
- component: {fileID: 1283619808}
m_Layer: 0
m_Name: TransitionManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1283619808
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1283619807}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 61430b0086307cc4da3ccc8d39ae88da, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::EasyTransition.TransitionManager
transitionTemplate: {fileID: 5276914992623515724, guid: 616d511151a6c554caddf1c754e4f91d, type: 3}
--- !u!4 &1283619809
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1283619807}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 562.3606, y: 1200, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1399870136 --- !u!1001 &1399870136
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -1262,3 +1307,4 @@ SceneRoots: ...@@ -1262,3 +1307,4 @@ SceneRoots:
- {fileID: 8716465729602274553} - {fileID: 8716465729602274553}
- {fileID: 6656915196975163273} - {fileID: 6656915196975163273}
- {fileID: 610439457} - {fileID: 610439457}
- {fileID: 1283619809}
...@@ -249,6 +249,51 @@ Transform: ...@@ -249,6 +249,51 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1988099352
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1988099354}
- component: {fileID: 1988099353}
m_Layer: 0
m_Name: TransitionManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1988099353
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1988099352}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 61430b0086307cc4da3ccc8d39ae88da, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::EasyTransition.TransitionManager
transitionTemplate: {fileID: 5276914992623515724, guid: 616d511151a6c554caddf1c754e4f91d, type: 3}
--- !u!4 &1988099354
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1988099352}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 562.3606, y: 1200, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2032328779 --- !u!1 &2032328779
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -393,3 +438,4 @@ SceneRoots: ...@@ -393,3 +438,4 @@ SceneRoots:
- {fileID: 2032328782} - {fileID: 2032328782}
- {fileID: 1185597005} - {fileID: 1185597005}
- {fileID: 1426985715} - {fileID: 1426985715}
- {fileID: 1988099354}
...@@ -521,7 +521,6 @@ namespace com.al_arcade.cs ...@@ -521,7 +521,6 @@ namespace com.al_arcade.cs
SSAudioManager.Instance.StopMusic(); SSAudioManager.Instance.StopMusic();
ClearWordButtons(); ClearWordButtons();
GameHistoryService.Instance.AddGame("cs", _score, gameStartTime, DateTime.Now);
OnGameCompleted?.Invoke(true, _timeLeft); OnGameCompleted?.Invoke(true, _timeLeft);
yield return new WaitForSeconds(5f); yield return new WaitForSeconds(5f);
...@@ -549,6 +548,8 @@ namespace com.al_arcade.cs ...@@ -549,6 +548,8 @@ namespace com.al_arcade.cs
false false
); );
OnGameCompleted?.Invoke(false, _timeLeft);
onGameComplete?.Invoke(_score); onGameComplete?.Invoke(_score);
SSAudioManager.Instance.StopMusic(); SSAudioManager.Instance.StopMusic();
ClearWordButtons(); ClearWordButtons();
......
using DG.Tweening;
using LightSide;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class ChallengeCanvas : MonoBehaviour
{
[SerializeField] private CanvasGroup canvasGroup;
[SerializeField] private RectTransform panel;
[SerializeField] private UniText statusText;
[SerializeField] private UniText timeSavedText;
[SerializeField] private UniText pointsEarnedText;
[SerializeField] private Button restartButton;
[SerializeField] private Button backButton;
[SerializeField] private ChallengeManager challengeManager;
[Header("Animation Settings")]
[SerializeField] private float animDuration = 0.5f;
[SerializeField] private float staggerDelay = 0.15f;
[ContextMenu("Test Animate In")]
public void AnimateIn()
{
gameObject.SetActive(true);
// Reset state
canvasGroup.alpha = 0f;
canvasGroup.interactable = true;
canvasGroup.blocksRaycasts = true;
statusText.transform.localScale = Vector3.zero;
timeSavedText.transform.localScale = Vector3.zero;
pointsEarnedText.transform.localScale = Vector3.zero;
restartButton.transform.localScale = Vector3.zero;
backButton.transform.localScale = Vector3.zero;
var _currentSequence = DOTween.Sequence();
// Fade in + panel scale
_currentSequence.Append(canvasGroup.DOFade(1f, animDuration).SetEase(Ease.OutQuart));
// Stagger each element popping in
_currentSequence.Append(
statusText.transform.DOScale(1f, 0.35f).SetEase(Ease.OutBack, 2f)
);
_currentSequence.Append(
timeSavedText.transform.DOScale(1f, 0.35f).SetEase(Ease.OutBack, 2f)
);
_currentSequence.Append(
pointsEarnedText.transform.DOScale(1f, 0.35f).SetEase(Ease.OutBack, 2f)
);
_currentSequence.Append(
restartButton.transform.DOScale(1f, 0.35f).SetEase(Ease.OutBack, 2f)
);
_currentSequence.Append(
backButton.transform.DOScale(1f, 0.35f).SetEase(Ease.OutBack, 2f)
);
// Punch the button for extra juice
_currentSequence.Append(
restartButton.transform.DOPunchScale(Vector3.one * 0.15f, 0.3f, 6)
);
_currentSequence.SetUpdate(true); // ignores Time.timeScale
}
[ContextMenu("Test Animate Out")]
public void AnimateOut()
{
canvasGroup.interactable = false;
canvasGroup.blocksRaycasts = false;
canvasGroup.DOFade(0f, animDuration).SetEase(Ease.InSine).OnComplete(() =>
{
gameObject.SetActive(false);
});
}
public void Awake()
{
restartButton.onClick.AddListener(OnRestartClicked);
backButton.onClick.AddListener(OnBackClicked);
}
public void ShowChallengeResult(bool hasWon, int timeSaved, int pointsChange)
{
statusText.Text = hasWon ? "كسبت التحدي" : "خسرت التحدي";
timeSavedText.Text = hasWon ? $"الوقت الموفر: {timeSaved} ثانية" : "";
pointsEarnedText.Text = hasWon ? $"النقاط المكتسبة: {pointsChange}" : $"خسرت {pointsChange} نقطة";
restartButton.gameObject.SetActive(true);
AnimateIn();
}
private void OnRestartClicked()
{
challengeManager.StartChallengeButton();
AnimateOut();
}
private void OnBackClicked()
{
SceneManager.LoadScene("MainMenu");
AnimateOut();
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 2c8c7f6aee6fbf24c9f1a1db2d64b603
\ No newline at end of file
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reactive;
using Cysharp.Threading.Tasks; using Cysharp.Threading.Tasks;
using EasyTransition; using EasyTransition;
using UnityEngine; using UnityEngine;
...@@ -7,24 +9,30 @@ using UnityEngine.SceneManagement; ...@@ -7,24 +9,30 @@ using UnityEngine.SceneManagement;
// Spawns three games one after the other. // Spawns three games one after the other.
// Move to next game when the current game is won, if lost end the challenge and show results. // Move to next game when the current game is won, if lost end the challenge and show results.
[RequireComponent(typeof(TransitionManager))]
public class ChallengeManager : MonoBehaviour public class ChallengeManager : MonoBehaviour
{ {
[SerializeField] private List<string> gameSceneNames = new(); [SerializeField] private List<string> gameSceneNames = new();
[SerializeField] private TransitionSettings transitionSettings; [SerializeField] private TransitionSettings transitionSettings;
[SerializeField] private int winningPoints = 100;
[SerializeField] private int timeSavedBonusMultiplier = 2;
[SerializeField] private List<int> penaltiesPerGame = new() { 200, 150, 100 };
// Time saved for bonus if won the challenge // Time saved for bonus if won the challenge
private int timeSaved = 0; private int timeSaved = 0;
private int currentGameIndex = 0; private int currentGameIndex = 0;
private DateTime startTime;
IChallengeGame currentGame = null; IChallengeGame currentGame = null;
private TransitionManager transitionManager;
[SerializeField] private ChallengeCanvas challengeCanvas;
void Awake() void Awake()
{ {
DontDestroyOnLoad(gameObject); DontDestroyOnLoad(gameObject);
transitionManager = GetComponent<TransitionManager>();
} }
[ContextMenu("Start Challenge")] [ContextMenu("Start Challenge")]
...@@ -33,16 +41,33 @@ public class ChallengeManager : MonoBehaviour ...@@ -33,16 +41,33 @@ public class ChallengeManager : MonoBehaviour
StartChallenge().Forget(); StartChallenge().Forget();
} }
private async UniTask StartChallenge() [ContextMenu("Load Next")]
public void LoadNextButton()
{
LoadNextGameAndListen().Forget();
}
[ContextMenu("Fake win")]
public void Fakewin()
{
OnGameCompleted(true, 30);
}
public async UniTask StartChallenge()
{ {
// Load the first game scene and set it up for challenge mode. startTime = DateTime.UtcNow;
// Listen for the OnChallengeComplete event to know when to load the next game or end the challenge. currentGameIndex = 0;
await LoadNextGameAndListen(currentGameIndex); timeSaved = 0;
currentGame = null;
await LoadNextGameAndListen();
} }
private void OnGameCompleted(bool hasWon, float timeLeft) private void OnGameCompleted(bool hasWon, float timeLeft)
{ {
currentGame.OnGameCompleted -= OnGameCompleted; if (currentGame != null)
currentGame.OnGameCompleted -= OnGameCompleted;
if (!hasWon) if (!hasWon)
{ {
...@@ -52,21 +77,20 @@ public class ChallengeManager : MonoBehaviour ...@@ -52,21 +77,20 @@ public class ChallengeManager : MonoBehaviour
// Add time left to the saved time for the next game // Add time left to the saved time for the next game
timeSaved += Mathf.RoundToInt(timeLeft); timeSaved += Mathf.RoundToInt(timeLeft);
currentGameIndex++;
currentGameIndex++;
if (currentGameIndex >= gameSceneNames.Count) if (currentGameIndex >= gameSceneNames.Count)
{ {
WonChallenge(); WonChallenge(timeSaved, timeSaved * timeSavedBonusMultiplier).Forget();
return; return;
} }
LoadNextGameAndListen(currentGameIndex).Forget(); LoadNextGameAndListen().Forget();
} }
private async UniTask LoadNextGameAndListen(int currentGameIndex) private async UniTask LoadNextGameAndListen()
{ {
transitionManager.Transition(gameSceneNames[currentGameIndex], transitionSettings, 0); TransitionManager.Instance().Transition(gameSceneNames[currentGameIndex], transitionSettings, 0);
SceneManager.LoadScene(gameSceneNames[currentGameIndex]);
await UniTask.WaitUntil(() => await UniTask.WaitUntil(() =>
{ {
...@@ -79,16 +103,21 @@ public class ChallengeManager : MonoBehaviour ...@@ -79,16 +103,21 @@ public class ChallengeManager : MonoBehaviour
currentGame.OnGameCompleted += OnGameCompleted; currentGame.OnGameCompleted += OnGameCompleted;
} }
private void LostChallenge() private async UniTask LostChallenge()
{ {
Debug.Log("Challenge failed."); Debug.Log("Challenge failed.");
// Show results, reset challenge, etc. // Show results, reset challenge, etc.
challengeCanvas.ShowChallengeResult(false, timeSaved, -penaltiesPerGame[currentGameIndex]);
await ChallengeService.Instance.AddChallenge(false, 0, startTime, DateTime.UtcNow);
} }
private void WonChallenge() private async UniTask WonChallenge(int timeSaved, int pointsEarned)
{ {
Debug.Log("Challenge completed! Total time saved: " + timeSaved); Debug.Log("Challenge completed! Total time saved: " + timeSaved);
// Show results, rewards, etc.
challengeCanvas.ShowChallengeResult(true, timeSaved, pointsEarned);
await ChallengeService.Instance.AddChallenge(true, timeSaved, startTime, DateTime.UtcNow);
} }
} }
\ No newline at end of file
fileFormatVersion: 2
guid: adacfd07019fd8f4bbd5a9347da9f201
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 2d39cb61bfb87d147a154c8f17099912
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -15,34 +15,34 @@ EditorUserSettings: ...@@ -15,34 +15,34 @@ EditorUserSettings:
value: 2550581500 value: 2550581500
flags: 0 flags: 0
RecentlyUsedSceneGuid-0: RecentlyUsedSceneGuid-0:
value: 545005025c000d0b0f5c087516715944424e4d7b747e2568287e4c64b6e1316e value: 5305515503010a0e0f580977147208444e151a78787b726775711931bbe1613e
flags: 0 flags: 0
RecentlyUsedSceneGuid-1: RecentlyUsedSceneGuid-1:
value: 0003525055055d020e0b0a7216755d444215417e787d27362e2f4866b2e1323e value: 550051035503595d5d0a5975167a0e44144e40797a7924632b7c456bb7b23260
flags: 0 flags: 0
RecentlyUsedSceneGuid-2: RecentlyUsedSceneGuid-2:
value: 5305515503010a0e0f580977147208444e151a78787b726775711931bbe1613e value: 51070402040250035b0d097b42250e44434e19737d7b7f617c7b4c63e3b33068
flags: 0 flags: 0
RecentlyUsedSceneGuid-3: RecentlyUsedSceneGuid-3:
value: 5304575f5c0c51035d5a5e771271594417154e7c2d7b70647b7b4c35bbe1646d value: 5304575f5c0c51035d5a5e771271594417154e7c2d7b70647b7b4c35bbe1646d
flags: 0 flags: 0
RecentlyUsedSceneGuid-4: RecentlyUsedSceneGuid-4:
value: 0752035101010f0c54595b2046760e44134e4e7a7f7d71677c2c4836b7b4633e value: 0003525055055d020e0b0a7216755d444215417e787d27362e2f4866b2e1323e
flags: 0 flags: 0
RecentlyUsedSceneGuid-5: RecentlyUsedSceneGuid-5:
value: 5701055506000a030f5c542744260844404f4d73797975367c2c1e6ab7e2653d value: 5155075f06575f0a0f080e7a47270e444116497f782b7e367c7e4d6abbb9656a
flags: 0 flags: 0
RecentlyUsedSceneGuid-6: RecentlyUsedSceneGuid-6:
value: 060203560401505a595d0a7345200d44404e1b7e2d707e617b7f4d63e7b6606b value: 0752035101010f0c54595b2046760e44134e4e7a7f7d71677c2c4836b7b4633e
flags: 0 flags: 0
RecentlyUsedSceneGuid-7: RecentlyUsedSceneGuid-7:
value: 550051035503595d5d0a5975167a0e44144e40797a7924632b7c456bb7b23260 value: 5701055506000a030f5c542744260844404f4d73797975367c2c1e6ab7e2653d
flags: 0 flags: 0
RecentlyUsedSceneGuid-8: RecentlyUsedSceneGuid-8:
value: 52080c51560d5f03580b5e7242700c4446164f7d2e7f77612c281f32e0b8603d value: 52080c51560d5f03580b5e7242700c4446164f7d2e7f77612c281f32e0b8603d
flags: 0 flags: 0
RecentlyUsedSceneGuid-9: RecentlyUsedSceneGuid-9:
value: 51070402040250035b0d097b42250e44434e19737d7b7f617c7b4c63e3b33068 value: 060203560401505a595d0a7345200d44404e1b7e2d707e617b7f4d63e7b6606b
flags: 0 flags: 0
UnityEditor.ShaderGraph.Blackboard: UnityEditor.ShaderGraph.Blackboard:
value: 18135939215a0a5004000b0e15254b524c030a3f2964643d120d1230e9e93a3fd6e826abbd2e2d293c4ead313b08042de6030a0afa240c0d020be94c4ba75e435d8715fa32c70d15d11612dacc11fee5d3c5d1fe9ab1bf968e93e2ffcbc3e7e2f0b3ffe0e8b0be9af8ffaeffff8e85dd8390e3949c8899daa7 value: 18135939215a0a5004000b0e15254b524c030a3f2964643d120d1230e9e93a3fd6e826abbd2e2d293c4ead313b08042de6030a0afa240c0d020be94c4ba75e435d8715fa32c70d15d11612dacc11fee5d3c5d1fe9ab1bf968e93e2ffcbc3e7e2f0b3ffe0e8b0be9af8ffaeffff8e85dd8390e3949c8899daa7
......
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