Exemple #1
0
        public void AchivTest()
        {
            var           view     = new HuntTheWumpus.View(1024, 768);
            var           score    = new HuntTheWumpus.Scores(1024, 768);
            var           minigame = new HuntTheWumpus.MiniGame(1024, 768);
            List <string> ls       = new List <string>();

            ls.Add("step.png/STEP#IDONT know#opisanie##podlyanka#");
            minigame.InitializeMiniGame(2);
            minigame.GetAchievement(ls);
            score.getAchievement(ls);
            score.Draw(view.Graphics);
        }
 public void MouseUp(object sender, MouseEventArgs e)
 {
     if (state == ControlState.Cave && !MiniGameEnd)
     {
         minigame.Up(e);
     }
     if (state == ControlState.LastWindow && score != null)
     {
         score.MouseUp(e);
     }
     if (e.Button == MouseButtons.Left && score != null && (state == ControlState.LastWindow || state == ControlState.ScoreList))
     {
         ScoreRegion rg = score.GetRegion(e.X, e.Y);
         if (rg == ScoreRegion.Back)
         {
             score    = null;
             player   = null;
             map      = null;
             minigame = null;
             state    = ControlState.MainMenu;
         }
     }
 }
 void NewGame()
 {
     for (int i = 0; i < 5; ++i)
     {
         seeds[i] = Utily.Next();
         Utily.ChangeSeed(seeds[i]);
         MapForPiсk[i] = new Map();
     }
     numPickCave   = 0;
     numDiff       = 1;
     MiniGameEnd   = true;
     minigame      = new MiniGame(Width, Height);
     player        = new Player();
     score         = new Scores(Width, Height);
     score.active  = ScoreState.Achievements;
     CheckDanger   = false;
     IsWin         = false;
     StoryMiniGame = StoryMG.Empty;
     view.UpdateImage();
     view.ClearConsole();
     seed        = "";
     state       = ControlState.PickCave;
     UseMiniGame = false;
 }
 public void MouseDown(object sender, MouseEventArgs e)
 {
     if (state == ControlState.Cave && !MiniGameEnd)
     {
         minigame.Down(e);
     }
     if (state == ControlState.Cave && MiniGameEnd && view.IsEndAnimation())
     {
         view.StopAnimation();
         RegionCave rg = view.GetRegionCave(e.X, e.Y);
         if (rg >= 0 && (int)rg < 6 && map.isActive[map.Room][(int)rg])
         {
             if (e.Button == MouseButtons.Left)
             {
                 int WumpusRun = Utily.Next() % 8;
                 if (WumpusRun < Difficulty)
                 {
                     map.WumpusGoAway(1);
                 }
                 int add = map.Move((int)rg);
                 player.AddCoins(add);
                 score.AddScores(5 * add);
                 view.StartAddCoinAnimation(add);
                 if (map.danger == Danger.Bat)
                 {
                     view.StartBatAnimation();
                 }
                 view.StartMoveAnimation((int)rg);
                 CheckDanger = false;
             }
             else
             {
                 player.PushArrow();
                 map.PushArrow((int)rg);
                 view.StartArrowAnimation((int)rg);
                 List <string> achiv = new List <string>();
                 player.GetAchievement(achiv);
                 score.getAchievement(achiv);
             }
         }
         if (rg == RegionCave.BuyArrow)
         {
             if (player.CanBuyArrow())
             {
                 StoryMiniGame     = StoryMG.BuyArrow;
                 MiniGameEnd       = false;
                 minigame          = new MiniGame(Width, Height);
                 minigame.HintText = Messages.ArrowHintText;
                 minigame.InitializeMiniGame(ArroDiff[Difficulty]);
                 UseMiniGame = true;
                 player.BuyArrows();
             }
             else
             {
                 view.AddComand(string.Format(Messages.NotEnoughCoins, player.NeedForBuyArrows()), true, false);
             }
         }
         if (rg == RegionCave.BuyHint)
         {
             if (player.CanBuyHint())
             {
                 StoryMiniGame     = StoryMG.BuyHint;
                 MiniGameEnd       = false;
                 minigame          = new MiniGame(Width, Height);
                 minigame.HintText = Messages.HintHintText;
                 minigame.InitializeMiniGame(HintDiff[Difficulty]);
                 UseMiniGame = true;
                 player.BuyHint();
             }
             else
             {
                 view.AddComand(string.Format(Messages.NotEnoughCoins, player.NeedForBuyHint()), true, false);
             }
         }
         if (rg == RegionCave.UpConsole)
         {
             view.ChangeIndex(1);
         }
         if (rg == RegionCave.DownConsole)
         {
             view.ChangeIndex(-1);
         }
     }
     if (state == ControlState.MainMenu)
     {
         RegionMenu rg = view.GetRegionMainMenu(e.X, e.Y);
         if (rg == RegionMenu.NewGame)
         {
             NewGame();
         }
         if (rg == RegionMenu.Continue)
         {
             ContinueMenu();
         }
         if (rg == RegionMenu.ScoreList)
         {
             score = new Scores(Width, Height);
             score.LoadLeaders(false);
             state = ControlState.ScoreList;
         }
         if (rg == RegionMenu.Exit)
         {
             Application.Exit();
         }
     }
     if (state == ControlState.PickCave)
     {
         RegionPickCave rg    = view.GetRegionPickCave(e.X, e.Y);
         int            Intrg = (int)rg;
         if (Intrg < 5)
         {
             numPickCave = Intrg;
         }
         if (Intrg >= (int)RegionPickCave.Diff1 && Intrg <= (int)RegionPickCave.Diff3)
         {
             numDiff = Intrg - (int)RegionPickCave.Diff1;
         }
         if (rg == RegionPickCave.Play)
         {
             StartAfterPick();
         }
     }
 }