This commit is contained in:
2023-02-28 19:02:09 +05:30
parent 152f11b675
commit 258ac130f8
450 changed files with 51328 additions and 44 deletions

View File

@@ -0,0 +1,51 @@
using System;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.SceneManagement;
#if UNITY_WEBGL
public class WebLogin : MonoBehaviour
{
[DllImport("__Internal")]
private static extern void Web3Connect();
[DllImport("__Internal")]
private static extern string ConnectAccount();
[DllImport("__Internal")]
private static extern void SetConnectAccount(string value);
private int expirationTime;
private string account;
public void OnLogin()
{
Web3Connect();
OnConnected();
}
async private void OnConnected()
{
account = ConnectAccount();
while (account == "")
{
await new WaitForSeconds(1f);
account = ConnectAccount();
};
// save account for next scene
PlayerPrefs.SetString("Account", account);
// reset login message
SetConnectAccount("");
// load next scene
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
}
public void OnSkip()
{
// burner account for skipped sign in screen
PlayerPrefs.SetString("Account", "");
// move to next scene
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
}
}
#endif