IEnumerator WaitToLoad() { //animation.CrossFade("Death"); // smoothly start the Death animation yield return(new WaitForSeconds(time)); // wait time enough FUNCTIONS.LOAD_SCENE(Escena); }
/// <summary> /// Attempts to either look up the symbol or convert it to one /// </summary> /// <param name="symbol"></param> /// <returns></returns> private Symbol ToSymbol(string symbol) { if (SYMBOLS.ContainsKey(symbol)) { return(SYMBOLS[symbol]); } else if (OPERATORS.ContainsKey(symbol)) { return(OPERATORS[symbol]); } else if (FUNCTIONS.ContainsKey(symbol)) { return(FUNCTIONS[symbol]); } else if (IsNumeric(symbol)) { return(new Symbol(double.Parse(symbol))); } else if (IsVariable(symbol)) { return(new Symbol(symbol)); } throw new Exception("ToSymbol : " + symbol + " cannot be converted to a Symbol"); }
/// <summary> /// Muestra el mensaje cuando se completa el juego /// </summary> public void LevelComplete() { //Si el jugador está jugando el nivel máximo en el que va, progresa un nivel. int PlayerLevel = PlayerPrefs.GetInt(VARIABLES.PLAYERLEVEL); int CurrLevel = PlayerPrefs.GetInt(VARIABLES.CURRENT_LEVEL); Debug.Log("PlayerLevel:" + PlayerLevel + "-CurrLevel: " + CurrLevel); if (PlayerLevel == 5) { PlayerPrefs.SetInt(VARIABLES.GAME_COMPLETE_PREF, 1); FUNCTIONS.LOAD_SCENE(VARIABLES.Creditos); } if (PlayerLevel == CurrLevel && PlayerLevel != 5) { PlayerPrefs.SetInt(VARIABLES.PLAYERLEVEL, PlayerLevel + 1); } if (CurrLevel == 5) { PlayerPrefs.SetInt(VARIABLES.GAME_COMPLETE_PREF, 1); FUNCTIONS.LOAD_SCENE(VARIABLES.Creditos); } else { //CargarEscena escena decimal seleccion decimal nivel FUNCTIONS.LOAD_SCENE(VARIABLES.Niveles); } }
/// <summary> /// Verifica que la caja no esté vacia, vguarda la varible y carga la escena de /// </summary> /// <param name="name">Name.</param> public void Next(Text name) { if (FUNCTIONS.VALIDATE_TEXT(name.text)) { PlayerPrefs.SetString(VARIABLES.PLAYERNAME_PREF, name.text); FUNCTIONS.LOAD_SCENE(VARIABLES.Nombre_Tienda); } }
public static List <Role> GetRolesForFunction(FUNCTIONS function) { List <Role> listRoles = FunctionAuthenticationList[function].ToList(); //Role roleAdmin = RoleCollection.GetRoleCollection().Where(r => r.Name == System.Configuration.ConfigurationManager.AppSettings["GroupAdmin"]).Single(); //listRoles.Add(roleAdmin); return(listRoles); }
/// <summary> /// Verifica que la caja no esté vacia, vguarda la varible y carga la escena de /// </summary> /// <param name="name">Name.</param> public void Next(Text name) { if (FUNCTIONS.VALIDATE_TEXT(name.text)) { PlayerPrefs.SetString(VARIABLES.STORENAME_PREF, name.text); FUNCTIONS.LOAD_SCENE(VARIABLES.Video); } }
public void click() { switch (buttonType) { case ButtonType.StartGame: GameControl.functionList.Add(delegate { return(FUNCTIONS.ConnectionScene()); }); break; case ButtonType.Login: GameControl.functionList.Add(delegate { return(FUNCTIONS.SubmitLogin(FindObjectOfType <LoginUI>().Get)); }); break; } }
private Token ReadNext() { if (!EOF()) { var next = PeekChar(); if (char.IsDigit(next)) { return(ReadNumber()); } next = ReadChar(); if (next == '.') { return(HandleDot()); } if (next == STRING_DELIMITER) { return(ReadString()); } int i = 0; if (next == SINGLE_CHAR_STRING) { return(new Token(ReadWhile(_ => i++ < 1), TokenType.String)); } if (next == DOUBLE_CHAR_STRING) { return(new Token(ReadWhile(_ => i++ < 2), TokenType.String)); } if (next == TRIPLE_CHAR_STRING) { return(new Token(ReadWhile(_ => i++ < 3), TokenType.String)); } if (next == COMPRESSED_STRING_DELIMITER) { return(ReadCompressedString()); } if (VARIABLES.Contains(next)) { return(new Token(next.ToString(), TokenType.Variable)); } if (PUNCTUATION.Contains(next)) { return(new Token(next.ToString(), TokenType.Punctuation)); } if (FUNCTIONS.Contains(next)) { return(new Token(next.ToString(), TokenType.Function)); } } throw new InvalidOperationException("This shouldn't happen."); }
public static HttpResponseMessage Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, ILogger log) { string requestBody = new StreamReader(req.Body).ReadToEnd(); Request <ISet <String> > request = JsonConvert.DeserializeObject <Request <ISet <String> > >(requestBody); try { using (SqlConnection con = new SqlConnection(Environment.GetEnvironmentVariable("DB_CONNECTION_STRING"))) { con.Open(); // TOKEN überprüfen HttpResponseMessage message = FUNCTIONS <ISet <String> > .checkToken(request, con); if (message != null) { return(message); } foreach (String file in request.obj) { // Anfrage bearbeiten string sql = "insert imageNutzer values(@ID, @FNAME)"; using (SqlCommand com1 = new SqlCommand(sql, con)) { com1.Parameters.Add("@ID", System.Data.SqlDbType.Int); com1.Parameters.Add("@FNAME", System.Data.SqlDbType.NVarChar); com1.Parameters["@FNAME"].Value = file; com1.Parameters["@ID"].Value = request.Id; com1.ExecuteNonQuery(); } } } request.Success = true; } catch (SqlException e) { request.Success = false; request.Error = e.Message; request.Errorcode = e.ErrorCode; } return(new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(request)) }); }
void OnLevelWasLoaded(int lev) { switch (SceneManager.GetActiveScene().name) { case "Connection": UILabel infolable = GameObject.Find("infolable").GetComponent <UILabel>(); StartCoroutine(FUNCTIONS.ConnectToServer(infolable)); break; case "Login": break; } }
public static HttpResponseMessage Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, ILogger log) { string requestBody = new StreamReader(req.Body).ReadToEnd(); Request <ISet <String> > request = JsonConvert.DeserializeObject <Request <ISet <String> > >(requestBody); try { using (SqlConnection con = new SqlConnection(Environment.GetEnvironmentVariable("DB_CONNECTION_STRING"))) { con.Open(); // TOKEN überprüfen HttpResponseMessage message = FUNCTIONS <ISet <String> > .checkToken(request, con); if (message != null) { return(message); } // Anfrage bearbeiten request.obj = new HashSet <String>(); string sql = "Select * from imageNutzer where id_nutzer=" + request.Id; using (SqlCommand com1 = new SqlCommand(sql, con)) { using (SqlDataReader reader = com1.ExecuteReader()) { while (reader.Read()) { request.obj.Add(reader.GetString(1)); } } } } request.Success = true; } catch (SqlException e) { request.Success = false; request.Error = e.Message; request.Errorcode = e.ErrorCode; } return(new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(request)) }); }
public static void RemoveRoleForFunctionDB(FUNCTIONS function, Role role) { Database database = new Database(ConnectionStringName); using (DbConnection connection = database.GetConnection()) { DbCommand command = database.GetCommand(); command.Connection = connection; #region RoleId DbParameter prId = database.GetParameter(System.Data.DbType.Guid, "@RoleId", role.Id); command.Parameters.Add(prId); #endregion #region FunctionId DbParameter prFunctionId = database.GetParameter(System.Data.DbType.Int32, "@FunctionId", (int)function); command.Parameters.Add(prFunctionId); #endregion command.CommandText = "delete SystemAuthentication where RoleId=@RoleId and FunctionId=@FunctionId"; connection.Open(); command.ExecuteNonQuery(); } }
public static bool CheckAllowFunction(FUNCTIONS function) { if (System.Web.HttpContext.Current.User.IsInRole(System.Configuration.ConfigurationManager.AppSettings["GroupAdmin"])) { return(true); } string subId = SessionHelper.GetSession(SessionKey.SubDomain); List <Role> listRoles = GetRolesForFunction(function); foreach (Role role in listRoles) { if (System.Web.HttpContext.Current.User.IsInRole(role.Name)) { SubDomainCollection sub = SubDomainCollection.GetSubDomainCollection(role); if (sub.Count(a => a.Id == new Guid(subId)) > 0) { return(true); } } } return(false); }
public FUNCTIONS ModificationQuery(Int16?SN) { FUNCTIONS row = null; using (DbCommand cmd = Db.CreateConnection().CreateCommand()) { string sql = @" SELECT SN, NAME, MODE, CATEGORY, URL, PARENT_SN, SORT, CDATE, CUSER, MDATE, MUSER FROM FUNCTIONS WHERE SN=@SN; "; Db.AddInParameter(cmd, "SN", DbType.Int32, SN); cmd.CommandType = CommandType.Text; cmd.CommandText = sql; using (IDataReader reader = Db.ExecuteReader(cmd)) { while (reader.Read()) { row = new FUNCTIONS { SN = reader["SN"] as Int16? ?? null, NAME = reader["NAME"] as string, MODE = reader["MODE"] as string, CATEGORY = reader["CATEGORY"] as string, URL = reader["URL"] as string, PARENT_SN = reader["PARENT_SN"] as Int16? ?? null, SORT = reader["SORT"] as Int16? ?? null, CDATE = reader["CDATE"] as DateTime? ?? null, CUSER = reader["CUSER"] as Int16? ?? null, MDATE = reader["MDATE"] as DateTime? ?? null, MUSER = reader["MUSER"] as Int16? ?? null }; } } } return(row); }
public FunctionRetrieveRes PaginationRetrieve(FunctionRetrieveReq req) { FunctionRetrieveRes res = new FunctionRetrieveRes() { FUNCTIONS = new List <FUNCTIONS>(), Pagination = new Pagination { PageCount = 0, RowCount = 0, PageNumber = 0, MinNumber = 0, MaxNumber = 0, StartTime = DateTime.Now } }; using (DbCommand cmd = Db.CreateConnection().CreateCommand()) { string sql = @"SELECT COUNT(1) FROM (SELECT TOP(@TOP) SN FROM [FUNCTIONS]{0}) A; SELECT TOP(@TOP) SN, NAME, MODE, CATEGORY, URL, PARENT_SN, SORT, CDATE, CUSER, MDATE, MUSER FROM [FUNCTIONS]{0};"; string where = ""; Db.AddInParameter(cmd, "TOP", DbType.Int32, 1000000); if (req.FUNCTIONS.SN != null) { where += " AND SN=@SN"; Db.AddInParameter(cmd, "SN", DbType.Int32, req.FUNCTIONS.SN); } if (req.FUNCTIONS.NAME != null) { where += " AND NAME LIKE '%' + @NAME + '%'"; Db.AddInParameter(cmd, "NAME", DbType.String, req.FUNCTIONS.NAME); } if (req.FUNCTIONS.MODE != null) { where += " AND MODE=@MODE"; Db.AddInParameter(cmd, "MODE", DbType.String, req.FUNCTIONS.MODE); } if (req.FUNCTIONS.CATEGORY != null) { where += " AND CATEGORY=@CATEGORY"; Db.AddInParameter(cmd, "CATEGORY", DbType.String, req.FUNCTIONS.CATEGORY); } if (req.FUNCTIONS.PARENT_SN != null) { where += " AND PARENT_SN=@PARENT_SN"; Db.AddInParameter(cmd, "PARENT_SN", DbType.Int32, req.FUNCTIONS.PARENT_SN); } if (req.FUNCTIONS.URL != null) { where += " AND URL LIKE '%' + @URL + '%'"; Db.AddInParameter(cmd, "URL", DbType.String, req.FUNCTIONS.URL); } if (where.Length > 0) { where = " WHERE" + where.Substring(4); } sql = String.Format(sql, where); cmd.CommandType = CommandType.Text; cmd.CommandText = sql; using (IDataReader reader = Db.ExecuteReader(cmd)) { reader.Read(); int.TryParse(reader[0].ToString(), out res.Pagination.RowCount); if (res.Pagination.RowCount > 0) { reader.NextResult(); res.Pagination.PageCount = Convert.ToInt32(Math.Ceiling(1.0 * res.Pagination.RowCount / req.PageSize)); res.Pagination.PageNumber = req.PageNumber < 1 ? 1 : req.PageNumber; res.Pagination.PageNumber = req.PageNumber > res.Pagination.PageCount ? res.Pagination.PageCount : res.Pagination.PageNumber; res.Pagination.MinNumber = (res.Pagination.PageNumber - 1) * req.PageSize + 1; res.Pagination.MaxNumber = res.Pagination.PageNumber * req.PageSize; res.Pagination.MaxNumber = res.Pagination.MaxNumber > res.Pagination.RowCount ? res.Pagination.RowCount : res.Pagination.MaxNumber; int i = 0; while (reader.Read()) { i++; if (i >= res.Pagination.MinNumber && i <= res.Pagination.MaxNumber) { var row = new FUNCTIONS { SN = reader["SN"] as Int16? ?? null, NAME = reader["NAME"] as string, MODE = reader["MODE"] as string, CATEGORY = reader["CATEGORY"] as string, URL = reader["URL"] as string, PARENT_SN = reader["PARENT_SN"] as Int16? ?? null, SORT = reader["SORT"] as Int16? ?? null, CDATE = reader["CDATE"] as DateTime? ?? null, CUSER = reader["CUSER"] as Int16? ?? null, MDATE = reader["MDATE"] as DateTime? ?? null, MUSER = reader["MUSER"] as Int16? ?? null }; res.FUNCTIONS.Add(row); } else if (i > res.Pagination.MaxNumber) { reader.Close(); break; } } } } } res.Pagination.EndTime = DateTime.Now; return(res); }
public static async System.Threading.Tasks.Task <HttpResponseMessage> runAsync([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, ILogger log) { string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); Request <SpielHighscores> request = JsonConvert.DeserializeObject <Request <SpielHighscores> >(requestBody); try { using (SqlConnection con = new SqlConnection(Environment.GetEnvironmentVariable("DB_CONNECTION_STRING"))) { con.Open(); // TOKEN überprüfen HttpResponseMessage message = FUNCTIONS <SpielHighscores> .checkToken(request, con); if (message != null) { return(message); } // Anfrage bearbeiten request.obj = new SpielHighscores(); string sql = "Select * from Spiel"; using (SqlCommand com1 = new SqlCommand(sql, con)) { using (SqlDataReader reader = com1.ExecuteReader()) { while (reader.Read()) { Spiel spiel = new Spiel(); request.obj.spiele.Add(reader.GetInt32(0), spiel); spiel.id_spiel = reader.GetInt32(0); spiel.spiel = reader.GetString(1); spiel.globaleBestzeit = reader.GetInt32(2); spiel.globalerDurschnitt = reader.GetInt32(3); spiel.rekordhalter = reader.GetString(5); if (spiel.globaleBestzeit == Int32.MaxValue) { spiel.rekordhalter = "Niemand"; spiel.globaleBestzeit = 0; } } } foreach (int key in request.obj.spiele.Keys) { sql = "Select * from Highscore where id_spiel=" + key + " and id_nutzer=" + request.Id; using (SqlCommand com2 = new SqlCommand(sql, con)) { using (SqlDataReader reader2 = com2.ExecuteReader()) { reader2.Read(); Spiel spiel = request.obj.spiele[reader2.GetInt32(1)]; spiel.bestzeit = reader2.GetInt32(2); spiel.schlechtesteZeit = reader2.GetInt32(3); spiel.durchschnitt = reader2.GetInt32(4); spiel.anzahl_gespielt = reader2.GetInt32(5); spiel.akummulierteSpielzeit = reader2.GetInt64(6); if (spiel.bestzeit == Int32.MaxValue) { spiel.bestzeit = 0; } } } } } } request.Success = true; } catch (SqlException e) { request.Success = false; request.Error = e.Message; request.Errorcode = e.ErrorCode; } return(new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(request)) }); }
public void Next() { FUNCTIONS.LOAD_SCENE(VARIABLES.Juego); }
public void LoadTutorial() { FUNCTIONS.LOAD_SCENE(VARIABLES.Tutorial); }
public void cargaCreditos() { FUNCTIONS.LOAD_SCENE(VARIABLES.Creditos); }
public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, ILogger log) { string requestBody = new StreamReader(req.Body).ReadToEnd(); Request <ISet <string> > request = JsonConvert.DeserializeObject <Request <ISet <String> > >(requestBody); try { using (SqlConnection con = new SqlConnection(Environment.GetEnvironmentVariable("DB_CONNECTION_STRING"))) { con.Open(); // TOKEN überprüfen HttpResponseMessage message = FUNCTIONS <ISet <String> > .checkToken(request, con); if (message != null) { return(message); } string blob = null; string sql = "Select blob from Nutzer where id=" + request.Id; using (SqlCommand com1 = new SqlCommand(sql, con)) { using (SqlDataReader reader = com1.ExecuteReader()) { while (reader.Read()) { blob = reader.GetString(0); } } } CloudStorageAccount storageAccount = CloudStorageAccount.Parse(Environment.GetEnvironmentVariable("AZURE_STORAGE_CONNECTION_STRING")); var client = storageAccount.CreateCloudBlobClient(); var container = client.GetContainerReference(blob); CloudBlockBlob cloudBlockBlob; foreach (String file in request.obj) { cloudBlockBlob = container.GetBlockBlobReference(file); await cloudBlockBlob.DeleteIfExistsAsync(); sql = "Delete from imageNutzer where id_nutzer=@ID and nameOfFile=@FNAME"; using (SqlCommand com1 = new SqlCommand(sql, con)) { com1.Parameters.Add("@ID", System.Data.SqlDbType.Int); com1.Parameters.Add("@FNAME", System.Data.SqlDbType.NVarChar); com1.Parameters["@FNAME"].Value = file; com1.Parameters["@ID"].Value = request.Id; com1.ExecuteNonQuery(); } } } request.Success = true; } catch (SqlException e) { request.Success = false; request.Error = e.Message; request.Errorcode = e.ErrorCode; } return(new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(request)) }); }
/// <summary> /// Carga un nuevo juego y reinicia las variables de niveles /// </summary> public void NewGame() { PlayerPrefs.SetInt(VARIABLES.PLAYERLEVEL, 1); FUNCTIONS.LOAD_SCENE(VARIABLES.Nombre_Jugador); }
/// <summary> /// Tests if a given input is contained in any of the Symbol Dictionaries /// </summary> /// <param name="symbol"></param> /// <returns></returns> private bool IsDefined(string symbol) { return(SYMBOLS.ContainsKey(symbol) || OPERATORS.ContainsKey(symbol) || FUNCTIONS.ContainsKey(symbol)); }
public void restarLevel() { FUNCTIONS.LOAD_SCENE(VARIABLES.Dialogo); }
public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, ILogger log) { string requestBody = new StreamReader(req.Body).ReadToEnd(); Request <ISet <String> > request = JsonConvert.DeserializeObject <Request <ISet <String> > >(requestBody); try { using (SqlConnection con = new SqlConnection(Environment.GetEnvironmentVariable("DB_CONNECTION_STRING"))) { con.Open(); // TOKEN überprüfen HttpResponseMessage message = FUNCTIONS <ISet <String> > .checkToken(request, con); if (message != null) { return(message); } ISet <String> blobs = await FUNCTIONS2.GetImages(); string blob = null; string sql = "Select blob from Nutzer where id=" + request.Id; using (SqlCommand com1 = new SqlCommand(sql, con)) { using (SqlDataReader reader = com1.ExecuteReader()) { while (reader.Read()) { blob = reader.GetString(0); } } } sql = "Select * from imageNutzer where id_nutzer=" + request.Id; using (SqlCommand com1 = new SqlCommand(sql, con)) { using (SqlDataReader reader = com1.ExecuteReader()) { while (reader.Read()) { if (blobs.Contains(reader.GetString(1))) { blobs.Remove(reader.GetString(1)); } } } } if (blobs.Count == 0) { request.Errorcode = -11; throw new Exception(""); } CloudStorageAccount storageAccount = CloudStorageAccount.Parse(Environment.GetEnvironmentVariable("AZURE_STORAGE_CONNECTION_STRING")); var client = storageAccount.CreateCloudBlobClient(); var cbContainer = client.GetContainerReference("images"); var container = client.GetContainerReference(blob); //Blobs kopieren await FUNCTIONS2.CopyImages(cbContainer, container, blobs); FUNCTIONS2.writeToDb(blobs, request.Id, con); request.obj = blobs; } request.Success = true; } catch (SqlException e) { request.Success = false; request.Error = e.Message; request.Errorcode = e.ErrorCode; } catch (Exception e1) { request.Success = false; request.Error = "Ein Fehler ist aufgetreten"; } return(new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(request)) }); }
public FunctionRetrieveRes PaginationQuery2(FunctionRetrieveReq req) { FunctionRetrieveRes res = new FunctionRetrieveRes() { FUNCTIONS = new List <FUNCTIONS>(), Pagination = new Pagination { PageCount = 0, RowCount = 0, PageNumber = 0, MinNumber = 0, MaxNumber = 0, //Data = null, StartTime = DateTime.Now } }; using (DbCommand cmd = Db.CreateConnection().CreateCommand()) { string sql = @" SELECT TOP(@TOP) SN, NAME, MODE, CATEGORY, URL, PARENT_SN, SORT, CDATE, CUSER, MDATE, MUSER FROM [FUNCTION]{0};"; string where = ""; Db.AddInParameter(cmd, "TOP", DbType.Int32, 1000000); //參數化 if (req.FUNCTIONS.SN != null) { where += " AND SN=@SN"; Db.AddInParameter(cmd, "SN", DbType.Int32, req.FUNCTIONS.SN); } if (req.FUNCTIONS.NAME != null) { where += " AND NAME LIKE '%' + @NAME + '%'"; Db.AddInParameter(cmd, "NAME", DbType.String, req.FUNCTIONS.NAME); } if (req.FUNCTIONS.MODE != null) { where += " AND MODE=@MODE"; Db.AddInParameter(cmd, "MODE", DbType.String, req.FUNCTIONS.MODE); } if (req.FUNCTIONS.CATEGORY != null) { where += " AND CATEGORY=@CATEGORY"; Db.AddInParameter(cmd, "CATEGORY", DbType.String, req.FUNCTIONS.CATEGORY); } if (req.FUNCTIONS.PARENT_SN != null) { where += " AND PARENT_SN=@PARENT_SN"; Db.AddInParameter(cmd, "PARENT_SN", DbType.Int32, req.FUNCTIONS.PARENT_SN); } if (req.FUNCTIONS.URL != null) { where += " AND URL LIKE '%' + @URL + '%'"; Db.AddInParameter(cmd, "URL", DbType.String, req.FUNCTIONS.URL); } if (where.Length > 0) { where = " WHERE" + where.Substring(4); } sql = String.Format(sql, where); cmd.CommandType = CommandType.Text; cmd.CommandText = sql; using (IDataReader reader = Db.ExecuteReader(cmd)) { List <FUNCTIONS> data = new List <FUNCTIONS>(); res.Pagination.RowCount = 0; while (reader.Read()) { res.Pagination.RowCount++; var row = new FUNCTIONS { ROWNUM = res.Pagination.RowCount, SN = reader["SN"] as Int16? ?? null, NAME = reader["NAME"] as string, MODE = reader["MODE"] as string, CATEGORY = reader["CATEGORY"] as string, URL = reader["URL"] as string, PARENT_SN = reader["PARENT_SN"] as Int16? ?? null, SORT = reader["SORT"] as Int16? ?? null, CDATE = reader["CDATE"] as DateTime? ?? null, CUSER = reader["CUSER"] as Int16? ?? null, MDATE = reader["MDATE"] as DateTime? ?? null, MUSER = reader["MUSER"] as Int16? ?? null }; data.Add(row); } res.Pagination.PageCount = Convert.ToInt32(Math.Ceiling(1.0 * res.Pagination.RowCount / req.PageSize)); res.Pagination.PageNumber = req.PageNumber < 1 ? 1 : req.PageNumber; res.Pagination.PageNumber = req.PageNumber > res.Pagination.PageCount ? res.Pagination.PageCount : res.Pagination.PageNumber; res.Pagination.MinNumber = (res.Pagination.PageNumber - 1) * req.PageSize + 1; res.Pagination.MaxNumber = res.Pagination.PageNumber * req.PageSize; res.Pagination.MaxNumber = res.Pagination.MaxNumber > res.Pagination.RowCount ? res.Pagination.RowCount : res.Pagination.MaxNumber; data = (from d in data where d.ROWNUM >= res.Pagination.MinNumber && d.ROWNUM <= res.Pagination.MaxNumber select d).ToList(); res.FUNCTIONS = data; } } res.Pagination.EndTime = DateTime.Now; return(res); }
/// <summary> /// Carga la escena de niveles para que continúen con el juego /// </summary> public void ContinueGame() { FUNCTIONS.LOAD_SCENE(VARIABLES.Niveles); }
public static HttpResponseMessage run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, ILogger log) { string requestBody = new StreamReader(req.Body).ReadToEnd(); Request <Spiel> request = JsonConvert.DeserializeObject <Request <Spiel> >(requestBody); try { using (SqlConnection con = new SqlConnection(Environment.GetEnvironmentVariable("DB_CONNECTION_STRING"))) { con.Open(); // TOKEN überprüfen HttpResponseMessage message = FUNCTIONS <Spiel> .checkToken(request, con); if (message != null) { return(message); } // Anfrage bearbeiten string sql = "Update Highscore Set bestzeit=@BEST, schlechteste_Zeit=@BAD, durchschnitt=@AVERG, anzahl=@COU, kumulierteSpielzeit=@KUM Where id_Spiel=@SID and id_Nutzer=@NID"; using (SqlCommand com1 = new SqlCommand(sql, con)) { com1.Parameters.Add("@BEST", System.Data.SqlDbType.Int); com1.Parameters.Add("@BAD", System.Data.SqlDbType.Int); com1.Parameters.Add("@AVERG", System.Data.SqlDbType.Int); com1.Parameters.Add("@COU", System.Data.SqlDbType.Int); com1.Parameters.Add("@KUM", System.Data.SqlDbType.BigInt); com1.Parameters.Add("@SID", System.Data.SqlDbType.Int); com1.Parameters.Add("@NID", System.Data.SqlDbType.Int); com1.Parameters["@BEST"].Value = request.obj.bestzeit; com1.Parameters["@BAD"].Value = request.obj.schlechtesteZeit; com1.Parameters["@AVERG"].Value = request.obj.durchschnitt; com1.Parameters["@COU"].Value = request.obj.anzahl_gespielt; com1.Parameters["@KUM"].Value = request.obj.akummulierteSpielzeit; com1.Parameters["@SID"].Value = request.obj.id_spiel; com1.Parameters["@NID"].Value = request.Id; com1.ExecuteNonQuery(); } sql = "Select * from Spiel where id=" + request.obj.id_spiel; using (SqlCommand com1 = new SqlCommand(sql, con)) { using (SqlDataReader reader = com1.ExecuteReader()) { reader.Read(); request.obj.globaleBestzeit = reader.GetInt32(2); request.obj.globalerDurschnitt = reader.GetInt32(3); request.obj.rekordhalter = reader.GetString(5); } } } request.Success = true; } catch (SqlException e) { request.Success = false; request.Error = e.Message; request.Errorcode = e.ErrorCode; } return(new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(request)) }); }
public void LoadLevel(int level) { PlayerPrefs.SetInt(VARIABLES.CURRENT_LEVEL, level); FUNCTIONS.LOAD_SCENE(VARIABLES.Dialogo); }
public void goHome() { FUNCTIONS.LOAD_SCENE(VARIABLES.Menu); }
//Test if is an operator private bool IsOperator(string token) { return(OPERATORS.ContainsKey(token) || FUNCTIONS.ContainsKey(token)); }