game: supabase sign in and database get
This commit is contained in:
parent
d69056c9c1
commit
f6b025c825
4 changed files with 8 additions and 21 deletions
|
@ -12,7 +12,7 @@ public class Backend : MonoBehaviour
|
||||||
public string email;
|
public string email;
|
||||||
public string password;
|
public string password;
|
||||||
public Session Session;
|
public Session Session;
|
||||||
|
public Users user;
|
||||||
|
|
||||||
private async void Start()
|
private async void Start()
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ public class Backend : MonoBehaviour
|
||||||
Debug.Log("Supabase Initialized");
|
Debug.Log("Supabase Initialized");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
SignUp(email, password, "Test");
|
SignIn(email, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void SendData(string uid, int score, string displayName, int daysPlayed, int customersHelped, int customersHelpedWrongly)
|
public async void SendData(string uid, int score, string displayName, int daysPlayed, int customersHelped, int customersHelpedWrongly)
|
||||||
|
@ -72,12 +72,15 @@ public class Backend : MonoBehaviour
|
||||||
{
|
{
|
||||||
Session = await Client.Auth.SignIn(email, password);
|
Session = await Client.Auth.SignIn(email, password);
|
||||||
Debug.Log(Session.User.Id);
|
Debug.Log(Session.User.Id);
|
||||||
|
GetData(Session.User.Id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void GetData()
|
public async void GetData(string uid)
|
||||||
{
|
{
|
||||||
|
var result = await Client.From<Users>().Where(x => x.uid == uid).Get();
|
||||||
|
user = result.Model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -11,8 +11,6 @@ public class Test : BaseModel
|
||||||
[Table("users")]
|
[Table("users")]
|
||||||
public class Users : BaseModel
|
public class Users : BaseModel
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
[Column()] public string uid { get; set; }
|
[Column()] public string uid { get; set; }
|
||||||
[Column()] public int score { get; set; }
|
[Column()] public int score { get; set; }
|
||||||
[Column()] public string displayName { get; set; }
|
[Column()] public string displayName { get; set; }
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 58f7e79a87c79824597746e8c1bfe400
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1,7 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: f58d25b9e504a4f41ab4a71cf87c1845
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Loading…
Add table
Reference in a new issue