private bool OnLoginClick(string accountInput, string passwordInput) { int account; int password; if (!int.TryParse(accountInput, out account)) { //Log.Error("Account must be number!"); return(false); } if (!int.TryParse(passwordInput, out password)) { //Log.Error("Password must be number!"); return(false); } if (GameEntry.Database.TryLogin(account, password)) { m_ProcedureOwner.SetData <VarInt>(Constant.ProcedureData.UserId, account); m_LoginSuccess = true; IDBTable <DBUser> dtUser = GameEntry.Database.GetDBTable <DBUser>(); DBUser drUser = dtUser.GetDBRow(account); if (drUser == null || drUser.Player == 0) { m_GetPlayerSuccess = false; } else { m_ProcedureOwner.SetData <VarInt>(Constant.ProcedureData.PlayerId, drUser.Player); m_GetPlayerSuccess = true; } return(true); } else { //Log.Error("账号密码不存在!"); return(false); } }
private void OnLoginClick(string account, string password) { if (GameEntry.Database.TryLogin(account, password)) { m_ProcedureOwner.SetData <VarString>(Constant.ProcedureData.UserId, account); m_LoginSuccess = true; IDBTable <DBUser> dtUser = GameEntry.Database.GetDBTable <DBUser>(); DBUser drUser = dtUser.GetDBRow(int.Parse(account)); if (drUser == null || drUser.Player == 0) { m_GetPlayerSuccess = false; } else { m_ProcedureOwner.SetData <VarInt>(Constant.ProcedureData.PlayerId, drUser.Player); m_GetPlayerSuccess = true; } } else { Log.Error("账号密码不存在!"); } }
/// <summary> /// 获取数据行 /// </summary> /// <typeparam name="T">数据行类型</typeparam> /// <param name="id">编号</param> /// <returns></returns> public T GetDBRow <T>(int id) where T : IDBRow { IDBTable <T> dbTable = GetDBTable <T>(); return(dbTable.GetDBRow(id)); }