protected void Button1_Click(object sender, EventArgs e) { LevelFactory levelFactory = new LevelFactory(); LevelRepository levelRepository = new LevelRepository(); string error; if (!levelFactory.validate(txtName.Text, txtCode.Text, out error)) { lbErrorMsg.Text = error; return; } Level theLevel = levelFactory.Create(txtName.Text, txtCode.Text, txtDescription.Text); if (theLevel != null) { levelRepository.CreatLevel(theLevel); Response.Redirect("View.aspx"); } }
IEnumerator LoadGame() { #if _CALC_LOAD_TIME var watch = System.Diagnostics.Stopwatch.StartNew(); watch.Start(); #endif yield return(StartCoroutine(LoadMaze())); #if _CALC_LOAD_TIME watch.Stop(); Debug.Log("Labyrinth generation time: " + watch.ElapsedMilliseconds / 1000f); #endif Dweller.Map = maze.Map; LevelSettings level = LevelFactory.Create(PlayerPrefs.GetInt("level", 1)); player = DwellerFactory.Create(playerPrefab, maze.Size.GetCenter); coins = DwellerFactory.CreateSet(coinPrefab, level, transform, player); yield return(new WaitForEndOfFrame()); #if _CALC_LOAD_TIME watch = System.Diagnostics.Stopwatch.StartNew(); watch.Start(); #endif enemies = DwellerFactory.CreateSet(enemyPrefab, level, transform, player); #if _CALC_LOAD_TIME watch.Stop(); Debug.Log("Enemies spawn time: " + watch.ElapsedMilliseconds / 1000f); #endif yield return(new WaitForEndOfFrame()); Coin.OnCollect += OnCoinCollect; ControllButtons.PressedButton += player.Move; Enemy.Gotcha += OnCaughtByEnemy; CounterText.Update?.Invoke(TextType.Points, Points = 0); }