mirror of
https://github.com/smyalygames/monopoly.git
synced 2025-05-18 06:14:10 +02:00
Merge branch 'master' of https://github.com/smyalygames/monopoly
This commit is contained in:
commit
1e0fb19fe0
@ -28,3 +28,9 @@ CREATE TABLE pwdreset (
|
|||||||
pwd_token LONGTEXT NOT NULL, #Where the hashed token is stored
|
pwd_token LONGTEXT NOT NULL, #Where the hashed token is stored
|
||||||
pwd_expires TEXT NOT NULL #When the token expires
|
pwd_expires TEXT NOT NULL #When the token expires
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE TABLE money_spent(
|
||||||
|
user_id int(11) PRIMARY KEY NOT NULL,
|
||||||
|
user_spent int(11) NOT NULL,
|
||||||
|
FOREIGN KEY (user_id) REFERENCES users(user_id)
|
||||||
|
);
|
@ -9,6 +9,7 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
class LoginInformation
|
class LoginInformation
|
||||||
{
|
{
|
||||||
|
public int id;
|
||||||
public string user;
|
public string user;
|
||||||
public bool success;
|
public bool success;
|
||||||
public string errors;
|
public string errors;
|
||||||
@ -24,12 +25,13 @@ public class Login : MonoBehaviour
|
|||||||
private bool CheckIsEmpty() //This checks if the strings are empty.
|
private bool CheckIsEmpty() //This checks if the strings are empty.
|
||||||
{
|
{
|
||||||
var strings = new List<string> {username.text, password.text}; //This puts all of the text boxes into an array.
|
var strings = new List<string> {username.text, password.text}; //This puts all of the text boxes into an array.
|
||||||
string check = ""; //This is used for the check, the ZWSP is TMP's way of identifying nothing as null.
|
string check = ""; //This is used for the check, the ZWSP is TMP's way of identifying nothing as null.
|
||||||
if (strings.Contains(check)) //If any of the inputs are null.
|
if (strings.Contains(check)) //If any of the inputs are null.
|
||||||
{
|
{
|
||||||
|
//Debug.Log("yes");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
//Debug.Log("false");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,16 +86,15 @@ public class Login : MonoBehaviour
|
|||||||
{
|
{
|
||||||
string status = www.downloadHandler.text; //This downloads the data from the server.
|
string status = www.downloadHandler.text; //This downloads the data from the server.
|
||||||
LoginInformation information = JsonConvert.DeserializeObject<LoginInformation>(status); //This deserializes the JSON string to a class.
|
LoginInformation information = JsonConvert.DeserializeObject<LoginInformation>(status); //This deserializes the JSON string to a class.
|
||||||
|
Debug.Log(status);
|
||||||
|
|
||||||
if (information.success) //If the user has successfully logged in.
|
if (information.success) //If the user has successfully logged in.
|
||||||
{
|
{
|
||||||
|
UserManager.userID = information.id;
|
||||||
UserManager.username = information.user; //This sets the logged in username.
|
UserManager.username = information.user; //This sets the logged in username.
|
||||||
UnityEngine.SceneManagement.SceneManager.LoadScene(1); //Loads the menu scene.
|
UnityEngine.SceneManagement.SceneManager.LoadScene(1); //Loads the menu scene.
|
||||||
}
|
}
|
||||||
|
}
|
||||||
InteractableForm(true); // This enables the form again.
|
InteractableForm(true); // This enables the form again.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
public static class UserManager
|
public static class UserManager
|
||||||
{
|
{
|
||||||
|
public static int userID;
|
||||||
public static string username;
|
public static string username;
|
||||||
|
|
||||||
public static bool LoggedIn => username != null;
|
public static bool LoggedIn => username != null;
|
||||||
|
@ -14,6 +14,7 @@ public class MainMenu : MonoBehaviour
|
|||||||
private string existingCards;
|
private string existingCards;
|
||||||
|
|
||||||
void Start() {
|
void Start() {
|
||||||
|
Debug.Log("User ID: " + UserManager.userID);
|
||||||
Debug.Log("Username: " + UserManager.username);
|
Debug.Log("Username: " + UserManager.username);
|
||||||
if (!PropertiesHandler.CheckPropertyExists()) //Checks if the properties file doesn't exist.
|
if (!PropertiesHandler.CheckPropertyExists()) //Checks if the properties file doesn't exist.
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user