- Home /
Login Scrips
i am making a app for me and my group where we share our files and we need some help with our login scrip there is one MAIN account and it disappears when you put it in the right code but if someone could help me and sort of edit the script so it could have multiple accounts without a server and so it would load a different lvl Thx!
-Looped Gaming Team
C# scrip
var btnColorOn : Color = Color(1.0f, 1.0f, 1.0f, 1.0f); var btnColorOff : Color = Color(0.4f, 0.4f, 0.4f, 1.0f);
private var btnColor = btnColorOff;
private var username : String = String.Empty;
private var password : String = String.Empty;
private var correctLogin : boolean;
function Update()
{
correctLogin = (username == "LG" && password == "1234");
var speed = Time.deltaTime * 4;
var targetColor = correctLogin ? btnColorOn : btnColorOff;
btnColor.r = Mathf.MoveTowards(btnColor.r, targetColor.r, speed);
btnColor.g = Mathf.MoveTowards(btnColor.g, targetColor.g, speed);
btnColor.b = Mathf.MoveTowards(btnColor.b, targetColor.b, speed);
btnColor.a = Mathf.MoveTowards(btnColor.a, targetColor.a, speed);
}
function OnGUI()
{
var windowRect : Rect;
windowRect.x = Screen.width / 2 - 100;
windowRect.y = Screen.height / 2 - 50;
windowRect.width = 200;
windowRect.height = 100;
GUI.Window(0, windowRect, OnWindowGUI, "Authentication");
}
function OnWindowGUI()
{
username = GUILayout.TextField(username);
password = GUILayout.PasswordField(password, '*'[0]);
GUI.color = btnColor;
if (GUILayout.Button("Login") && correctLogin)
{
// Add your login code here...
enabled = false;
}
GUI.color = Color.white;
}
Answer by DontShooot · Jul 26, 2014 at 03:43 AM
I don't think there some way to make secured authentication without server. The simple way can be use a xml with logins and password's hashes.
Answer by thelime · Jul 26, 2014 at 09:49 PM
Hi maybe this can work?
correctLogin = ((username == "LG" && password == "1234") || (username == "LG2" && password == "456"))
;
Your answer
Follow this Question
Related Questions
Player creates personal profile 0 Answers
PHP Login not returning anything 1 Answer
Necessary Data Rewind Wasn't Possible WWWForm Error 0 Answers
Detect Game Center login prompt? 1 Answer