public static RegistereBg getInstance()
 {
     if (_instance == null)
     {
         _instance = new RegistereBg();
     }
     return(_instance);
 }
Beispiel #2
0
	// 登入按钮的回调

	public void LoginBtn()
	{ 
		
		string isLegal = RegistereBg.getInstance().BeginRegularPlayer (nameField.text,regularPhone,regularEmail) ;
		if (isLegal == "isPhone" || isLegal == "isEmail") {
			Debug.Log ("账号输入合法");

		} else 
		{

			Debug.Log ("不合法 重新输入 ");
			return;
		}

		// 2.
		string UserNameOne = "USER where name="+" '"+nameField.text + "'";
		int count = SqliteMangeToCSharp.GetInstance ().selectTableDataCondition (UserNameOne,path);

		// 账号存在 去验证密码
		if (count > 0) 
		{
			// 查找是否有这个账号 且密码是否一致
			string UserName = "******"+" '"+nameField.text+"'";
			Debug.Log (count);
			SqliteDataReader reader = SqliteMangeToCSharp.GetInstance().selectTaleDataAll (UserName,path);
			Debug.Log (count);
			while (reader.Read ()) {


				string name = nameField.text;
				string psw = pwdField.text;

				if (name == reader.GetString (1) && psw == reader.GetString (2)) {

					Debug.Log ("登入成功");

					gameObject.SetActive (false);
					LoadWaitingView.SetActive (true);
					Invoke ("LoadGamesLobby",2.0f);



				} else {

					Debug.Log ("密码错误");
				}


			}


		}
		else {

			Debug.Log ("账号未注册");

		}
		}