Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEngine.UI;
- using System.Text.RegularExpressions;
- using Steamworks;
- public class bl_SignUp : MonoBehaviour
- {
- [Header("Settings")]
- public int MaxNameLenght = 15;
- public bool RegexSymbols = true;
- [Header("References")]
- public InputField UserNameInput = null;
- public InputField NickNameInput = null;
- public InputField EmailInput = null;
- public InputField PasswordInput = null;
- public InputField RePasswordInput = null;
- private bl_LoginPro Login;
- /// <summary>
- ///
- /// </summary>
- void Awake()
- {
- Login = FindObjectOfType<bl_LoginPro>();
- if (UserNameInput != null)
- {
- UserNameInput.characterLimit = MaxNameLenght;
- }
- }
- /// <summary>
- ///
- /// </summary>
- void Update()
- {
- if (UserNameInput != null)
- {
- UserNameInput.text = Regex.Replace(UserNameInput.text, @"[^a-zA-Z0-9 ]", "");//not permit simbols
- }
- }
- /// <summary>
- ///
- /// </summary>
- public void SignUp()
- {
- string user = SteamFriends.GetPersonaName();
- string nick = SteamFriends.GetPersonaName();
- string pass = PasswordInput.text;
- string repass = RePasswordInput.text;
- string email = EmailInput.text;
- CSteamID steamid = SteamUser.GetSteamID();
- Debug.Log(steamid);
- if (!AllFill(user,nick, pass, repass, email))
- return;
- if(pass.Length < bl_LoginProDataBase.Instance.MinPasswordLenght)
- {
- Login.SetLogText(string.Format("your password must be at least <b>{0}</b> characters", bl_LoginProDataBase.Instance.MinPasswordLenght));
- return;
- }
- if(repass != pass)
- {
- Login.SetLogText("Passwords doesn't match.");
- return;
- }
- Login.SinUp(user,nick, pass, email, steamid);
- }
- /// <summary>
- ///
- /// </summary>
- private bool AllFill(string u,string n,string p,string r,string e)
- {
- if (string.IsNullOrEmpty(u))
- {
- Debug.Log("Login name is empty");
- Login.SetLogText("Login name is empty");
- return false;
- }
- if (string.IsNullOrEmpty(n))
- {
- Debug.Log("Nick Name is empty");
- Login.SetLogText("Nick name is empty");
- return false;
- }
- if (string.IsNullOrEmpty(p))
- {
- Debug.Log("Password is empty");
- Login.SetLogText("Password is empty");
- return false;
- }
- if (string.IsNullOrEmpty(r))
- {
- Debug.Log("Re-password is empty");
- Login.SetLogText("Re-password is empty");
- return false;
- }
- if (string.IsNullOrEmpty(e))
- {
- Debug.Log("Email is empty");
- Login.SetLogText("Email is empty");
- return false;
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement