public GameStageUI() { snakeAllSounds.BackgroundSound = gameSound; snakeAllSounds.SnakeSound = snakeSound; game = new GameService(snakeAllSounds); highScores = new HighScoresService(); meniu = new Meniu(highScores); meniuTexture = new MeniuTexture(); stageTexture = new GameStageTexture(); snakeTexture[0] = new SnakeTexture(); snakeTexture[1] = new SnakeTexture(); snakeTexture[2] = new SnakeTexture(); foodTexture = new FoodTexture(); infoWindTexture = new InfoTexture(); radarTexture = new RadarTexture(); barrierTexture = new BarrierTexture(); graphics = new GraphicsDeviceManager(this); stageDraw = new StageDrawingService(stageTexture); snakeDraw = new SnakeDrawingService(0, snakeTexture); foodDraw = new FoodDrawingService(foodTexture); infoDraw = new InfoDrawService(infoWindTexture); radarDraw = new RadarDrawingService(radarTexture); barrierDraw = new BarrierDrawingService(barrierTexture); meniuSound = new MeniuSound(); direction.X = -1; direction.Y = 1; up = true; down = true; keyboard = new KeyboardInput(); }
/// <summary> /// Piešiamas žaidimo stiliaus pasirinkimas. /// </summary> /// <param name="Batch"></param> /// <param name="texture"></param> private void DrawGameType(SpriteBatch batch, MeniuTexture texture) { batch.Begin(); batch.Draw(texture.Background, Vector2.Zero, Color.White); batch.Draw(texture.GameTypeTitle, new Vector2(380, 30), Color.White); batch.Draw(texture.SignPole, new Vector2(620, 180), Color.White); if (Iterator == 1) { batch.Draw(texture.SClassical_marked, new Vector2(555, 190), Color.White); } else { batch.Draw(texture.SClassical, new Vector2(555, 190), Color.White); } if (Iterator == 2) { batch.Draw(texture.SArcade_marked, new Vector2(555, 260), Color.White); } else { batch.Draw(texture.SArcade, new Vector2(555, 260), Color.White); } if (Iterator == 3) { batch.Draw(texture.SBack_marked, new Vector2(555, 320), Color.White); } else { batch.Draw(texture.SBack, new Vector2(555, 320), Color.White); } batch.End(); }
/// <summary> /// Sudėtingumo lange nupiešiama pasirinkta gyvatė. /// </summary> /// <param name="Batch"></param> /// <param name="texture"></param> private void DrawChosenSnake(SpriteBatch batch, MeniuTexture texture) { switch (SnakeType) { case 0: batch.Draw(texture.BTreeSnake1, new Vector2(108, 57), Color.White); break; case 1: batch.Draw(texture.BTreeSnake2, new Vector2(108, 57), Color.White); break; case 2: batch.Draw(texture.BTreeSnake3, new Vector2(108, 57), Color.White); break; } }
/// <summary> /// Piešiamas gyvatės pasirinkimo langas. /// </summary> /// <param name="Batch"></param> /// <param name="texture"></param> private void DrawChooseSnakeMeniu(SpriteBatch batch, MeniuTexture texture) { batch.Begin(); batch.Draw(texture.Background, Vector2.Zero, Color.White); batch.Draw(texture.ChooseSnakeTitle, new Vector2(500, 10), Color.White); batch.Draw(texture.SignPole, new Vector2(620, 180), Color.White); if (Iterator == 1) { batch.Draw(texture.SSnake1_marked, new Vector2(555, 190), Color.White); batch.Draw(texture.BTreeSnake1, new Vector2(108, 57), Color.White); } else { batch.Draw(texture.SSnake1, new Vector2(555, 190), Color.White); } if (Iterator == 2) { batch.Draw(texture.SSnake2_marked, new Vector2(555, 260), Color.White); batch.Draw(texture.BTreeSnake2, new Vector2(108, 57), Color.White); } else { batch.Draw(texture.SSnake2, new Vector2(555, 260), Color.White); } if (Iterator == 3) { batch.Draw(texture.SSnake3_marked, new Vector2(555, 320), Color.White); batch.Draw(texture.BTreeSnake3, new Vector2(108, 57), Color.White); } else { batch.Draw(texture.SSnake3, new Vector2(555, 320), Color.White); } if (Iterator == 4) { batch.Draw(texture.SBack_marked, new Vector2(555, 380), Color.White); } else { batch.Draw(texture.SBack, new Vector2(555, 380), Color.White); } batch.End(); }
/// <summary> /// Piešiamas pagalbos langas. /// </summary> /// <param name="Batch"></param> /// <param name="texture"></param> private void DrawHelpScreen(SpriteBatch batch, MeniuTexture texture) { batch.Begin(); batch.Draw(texture.Background, Vector2.Zero, Color.White); batch.Draw(texture.GameTitle, new Vector2(500, 10), Color.White); batch.Draw(texture.DarkLayer, Vector2.Zero, Color.White); batch.Draw(texture.Help, new Vector2(8, 0), Color.White); batch.Draw(texture.DarkSignPole, new Vector2(680, 380), Color.White); switch (helpPage) { case 1: batch.Draw(texture.LControlHelp, new Vector2(100, 130), Color.White); break; case 2: batch.Draw(texture.LFoodHelp, new Vector2(100, 130), Color.White); break; default: batch.Draw(texture.LBarrierHelp, new Vector2(130, 130), Color.White); break; } if (Iterator == 1) { batch.Draw(texture.BNextMarked, new Vector2(720, 340), Color.White); } else { batch.Draw(texture.BNext, new Vector2(720, 340), Color.White); } if (Iterator == 2) { batch.Draw(texture.SBack2Marked, new Vector2(620, 380), Color.White); } else { batch.Draw(texture.SBack2, new Vector2(620, 380), Color.White); } batch.End(); }
/// <summary> /// Sudėtingumo lango piešimas /// </summary> /// <param name="Batch"></param> /// <param name="texture"></param> private void DrawDifficultScreen(SpriteBatch batch, MeniuTexture texture) { batch.Begin(); batch.Draw(texture.Background, Vector2.Zero, Color.White); batch.Draw(texture.DiffLevelTitle, new Vector2(310, 10), Color.White); batch.Draw(texture.SignPole, new Vector2(620, 180), Color.White); DrawChosenSnake(batch, texture); if (Iterator == 1) { batch.Draw(texture.SEasy_marked, new Vector2(555, 190), Color.White); } else { batch.Draw(texture.SEasy, new Vector2(555, 190), Color.White); } if (Iterator == 2) { batch.Draw(texture.SMedium_marked, new Vector2(555, 260), Color.White); } else { batch.Draw(texture.SMedium, new Vector2(555, 260), Color.White); } if (Iterator == 3) { batch.Draw(texture.SHard_marked, new Vector2(555, 320), Color.White); } else { batch.Draw(texture.SHard, new Vector2(555, 320), Color.White); } if (Iterator == 4) { batch.Draw(texture.SBack_marked, new Vector2(555, 380), Color.White); } else { batch.Draw(texture.SBack, new Vector2(555, 380), Color.White); } batch.End(); }
/// <summary> /// Piešiamas pasiekimų lango lenta bei prierašas, kokio tipo pasieikimai rodomi. /// </summary> /// <param name="batch">Piešimo objektas.</param> /// <param name="texture">Objektas, kuriame saugomos visos tekstūros</param> private void DrawHighScoresBackground(SpriteBatch batch, MeniuTexture texture) { switch (highScore) { case HighScoresType.Ar1: batch.Draw(texture.HighScoresArc, new Vector2(115, 0), Color.White); batch.Draw(texture.L1, new Vector2(580, 142), Color.White); break; case HighScoresType.Ar2: batch.Draw(texture.HighScoresArc, new Vector2(115, 0), Color.White); batch.Draw(texture.L2, new Vector2(580, 142), Color.White); break; case HighScoresType.Ar3: batch.Draw(texture.HighScoresArc, new Vector2(115, 0), Color.White); batch.Draw(texture.L3, new Vector2(580, 142), Color.White); break; case HighScoresType.Ar4: batch.Draw(texture.HighScoresArc, new Vector2(115, 0), Color.White); batch.Draw(texture.L4, new Vector2(580, 142), Color.White); break; case HighScoresType.Ar5: batch.Draw(texture.HighScoresArc, new Vector2(115, 0), Color.White); batch.Draw(texture.L5, new Vector2(580, 142), Color.White); break; case HighScoresType.Ar6: batch.Draw(texture.HighScoresArc, new Vector2(115, 0), Color.White); batch.Draw(texture.L6, new Vector2(580, 142), Color.White); break; case HighScoresType.Cl0: batch.Draw(texture.HighScoresCla, new Vector2(115, 0), Color.White); batch.Draw(texture.LEasy, new Vector2(545, 142), Color.White); break; case HighScoresType.Cl1: batch.Draw(texture.HighScoresCla, new Vector2(115, 0), Color.White); batch.Draw(texture.LMedium, new Vector2(545, 142), Color.White); break; case HighScoresType.Cl2: batch.Draw(texture.HighScoresCla, new Vector2(115, 0), Color.White); batch.Draw(texture.LHard, new Vector2(545, 142), Color.White); break; } }
//pakoreguoti kintamuosius /// <summary> /// Piešia pagrindinį Meniu. /// </summary> /// <param name="Batch"></param> /// <param name="screenWidth"></param> /// <param name="texture"></param> private void DrawMainMenu(SpriteBatch batch, int screenWidth, MeniuTexture texture) { batch.Begin(); batch.Draw(texture.Background, Vector2.Zero, Color.White); batch.Draw(texture.GameTitle, new Vector2(500, 10), Color.White); batch.Draw(texture.SignPole, new Vector2(620, 180), Color.White); if (Iterator == 1) { batch.Draw(texture.SNew_game_marked, new Vector2(555, 190), Color.White); } else { batch.Draw(texture.SNew_game, new Vector2(555, 190), Color.White); } if (Iterator == 2) { batch.Draw(texture.SHighscores_marked, new Vector2(555, 260), Color.White); } else { batch.Draw(texture.SHighscores, new Vector2(555, 260), Color.White); } if (Iterator == 3) { batch.Draw(texture.SHelp_marked, new Vector2(555, 320), Color.White); } else { batch.Draw(texture.SHelp, new Vector2(555, 320), Color.White); } if (Iterator == 4) { batch.Draw(texture.SQuit_marked, new Vector2(555, 380), Color.White); } else { batch.Draw(texture.SQuit, new Vector2(555, 380), Color.White); } batch.End(); }
/// <summary> /// Meniu piešimo parinkimas. /// </summary> /// <param name="Batch"></param> /// <param name="screenWidth"></param> /// <param name="arial"></param> /// <param name="texture"></param> public void DrawMenu(SpriteBatch batch, int screenWidth, SpriteFont arial, MeniuTexture texture) { switch (meniuState) { case MeniuState.Main: DrawMainMenu(batch, 1000, texture); break; case MeniuState.GameType: DrawGameType(batch, texture); break; case MeniuState.Difficulty: DrawDifficultScreen(batch, texture); break; case MeniuState.ChooseSnake: DrawChooseSnakeMeniu(batch, texture); break; case MeniuState.Highscores: DrawHighScores(batch, texture); break; case MeniuState.Level: DrawChoseLevelMeniu(batch, texture); break; case MeniuState.Help: DrawHelpScreen(batch, texture); break; case MeniuState.Pause: MenuItems = 2; DrawPauseScreen(batch, texture); break; } }
private void DrawPauseScreen(SpriteBatch batch, MeniuTexture texture) { batch.Begin(); batch.Draw(texture.BigDarkLayer, Vector2.Zero, Color.White); batch.Draw(texture.PauseSign, new Vector2(160, 110), Color.White); if (Iterator == 1) { batch.Draw(texture.TResumeMarked, new Vector2(350, 215), Color.White); } else { batch.Draw(texture.TResume, new Vector2(350, 220), Color.White); } if (Iterator == 2) { batch.Draw(texture.TMeniuMarked, new Vector2(280, 255), Color.White); } else { batch.Draw(texture.TMeniu, new Vector2(280, 255), Color.White); } batch.End(); }
/// <summary> /// Piešiama pasiekimų lentelė. /// </summary> /// <param name="Batch"></param> /// <param name="texture"></param> private void DrawHighScores(SpriteBatch batch, MeniuTexture texture) { batch.Begin(); batch.Draw(texture.Background, Vector2.Zero, Color.White); batch.Draw(texture.GameTitle, new Vector2(500, 10), Color.White); batch.Draw(texture.DarkLayer, Vector2.Zero, Color.White); DrawHighScoresBackground(batch, texture); batch.Draw(texture.DarkSignPole, new Vector2(680, 380), Color.White); if (Iterator == 1) { batch.Draw(texture.BPreviousMarked, new Vector2(155, 285), Color.White); } else { batch.Draw(texture.BPrevious, new Vector2(155, 285), Color.White); } if (Iterator == 2) { batch.Draw(texture.BNextMarked, new Vector2(620, 285), Color.White); } else { batch.Draw(texture.BNext, new Vector2(620, 285), Color.White); } if (Iterator == 3) { batch.Draw(texture.SBack2Marked, new Vector2(620, 380), Color.White); } else { batch.Draw(texture.SBack2, new Vector2(620, 380), Color.White); } PlayerHighScores(batch); batch.End(); }
/// <summary> /// Piešiamas nuotykių rėžimo lygio pasirinkimų Meniu. /// </summary> /// <param name="Batch"></param> /// <param name="texture"></param> private void DrawChoseLevelMeniu(SpriteBatch batch, MeniuTexture texture) { batch.Begin(); batch.Draw(texture.Background, Vector2.Zero, Color.White); batch.Draw(texture.DarkLayer, Vector2.Zero, Color.White); batch.Draw(texture.ChooseLevelTitle, new Vector2(270, 50), Color.White); batch.Draw(texture.DarkSignPole, new Vector2(620, 180), Color.White); if (Iterator == 6) { batch.Draw(texture.SLevel6Marked, new Vector2(600, 0), Color.White); } else { batch.Draw(texture.SLevel6, new Vector2(600, 0), Color.White); } if (Iterator == 5) { batch.Draw(texture.SLevel5Marked, new Vector2(550, 150), Color.White); } else { batch.Draw(texture.SLevel5, new Vector2(550, 150), Color.White); } if (Iterator == 4) { batch.Draw(texture.SLevel4Marked, new Vector2(400, 275), Color.White); } else { batch.Draw(texture.SLevel4, new Vector2(400, 275), Color.White); } if (Iterator == 3) { batch.Draw(texture.SLevel3Marked, new Vector2(250, 160), Color.White); } else { batch.Draw(texture.SLevel3, new Vector2(250, 160), Color.White); } if (Iterator == 2) { batch.Draw(texture.SLevel2Marked, new Vector2(90, 20), Color.White); } else { batch.Draw(texture.SLevel2, new Vector2(90, 20), Color.White); } if (Iterator == 1) { batch.Draw(texture.SLevel1Marked, new Vector2(25, 240), Color.White); } else { batch.Draw(texture.SLevel1, new Vector2(25, 240), Color.White); } if (Iterator == 7) { batch.Draw(texture.SBackSMarked, new Vector2(660, 380), Color.White); } else { batch.Draw(texture.SBackS, new Vector2(660, 380), Color.White); } batch.Draw(texture.ASurvival, new Vector2(36, 290), Color.White); batch.Draw(texture.ANight, new Vector2(105, 52), Color.White); batch.Draw(texture.ABugs, new Vector2(295, 205), Color.White); batch.Draw(texture.AFastSnake, new Vector2(468, 324), Color.White); batch.Draw(texture.ABarrier, new Vector2(619, 207), Color.White); batch.Draw(texture.ABarrier, new Vector2(669, 51), Color.White); batch.End(); }