示例#1
0
        public void DrawTest()
        {
            var view = new HuntTheWumpus.View(1024, 768);

            view.Clear();
            view.Clear(System.Drawing.Color.Aqua);
            view.Created();
            view.Graphics.FillRectangle(Brushes.Aqua, 0, 0, 10, 10);
            view.DrawMainMenu();
            var map = new HuntTheWumpus.Map();

            view.DrawPickCave(map.graph, map.isActive, 0, 1, "112");
            view.MainForm.DrawAll();
        }
示例#2
0
        public void UpDate(long time)
        {
            if (state == ControlState.Cave)
            {
                List <string> listachiv = new List <string>();
                map.GetAchievement(listachiv);
                if (minigame != null)
                {
                    minigame.GetAchievement(listachiv);
                }
                player.GetAchievement(listachiv);
                score.getAchievement(listachiv);
                view.DrawCave(map.graph, map.isActive, map.GetDangerList(), map.danger, map.Room);
                if (!MiniGameEnd)
                {
                    minigame.TickTime();
                    minigame.DrawMiniGame(view.Graphics);
                    if (!minigame.Is_playing)
                    {
                        if (!minigame.Is_Winner && StoryMiniGame != StoryMG.BuyArrow && StoryMiniGame != StoryMG.BuyHint)
                        {
                            IsWin = false;
                            EndGame();
                        }
                        if (minigame.Is_Winner && StoryMiniGame == StoryMG.BuyHint)
                        {
                            int  rnd      = Utily.Next() % HintMessage.Count;
                            Hint NowHint  = (Hint)rnd;
                            int  HintData = 0;
                            if (NowHint == Hint.Bat)
                            {
                                HintData = map.GetBat() + 1;
                            }
                            if (NowHint == Hint.Pit)
                            {
                                HintData = map.GetPit() + 1;
                            }
                            if (NowHint == Hint.Wumpus)
                            {
                                HintData = map.Wumpus + 1;
                            }
                            if (NowHint != Hint.NoLuck)
                            {
                                view.AddComand(HintMessage[(int)NowHint] + HintData, true);
                            }
                            else
                            {
                                view.AddComand(HintMessage[(int)NowHint], true);
                            }
                        }
                        if (minigame.Is_Winner && StoryMiniGame == StoryMG.BuyArrow)
                        {
                            player.GiveArrows();
                            view.AddComand(Messages.GiveArrowsString, true, false);
                        }
                        if (minigame.Is_Winner && StoryMG.Wumpus == StoryMiniGame)
                        {
                            map.WumpusGoAway();
                            view.AddComand(Messages.WumpusRunString, true);
                        }
                        if (minigame.Is_Winner)
                        {
                            score.AddScores(50);
                        }
                        MiniGameEnd = true;
                    }
                }
                else
                {
                    view.DrawInterface(player.Coins, player.Arrow, map.Room, player.CanBuyArrow(), player.CanBuyHint());
                }
                if (!CheckDanger && !view.MinimizeBat && !view.IsAnimated)
                {
                    CheckDanger = true;
                    if (map.danger == Danger.Pit)
                    {
                        minigame          = new MiniGame(Width, Height);
                        StoryMiniGame     = StoryMG.Pit;
                        minigame.HintText = Messages.PitHintText;
                        minigame.InitializeMiniGame(PitDiff[Difficulty]);
                        UseMiniGame = true;
                        MiniGameEnd = false;
                    }
                    if (map.danger == Danger.Bat)
                    {
                        view.AddComand(Messages.MetBatString, true);
                        map.Respaw();
                    }
                    if (map.danger == Danger.Wumpus)
                    {
                        minigame          = new MiniGame(Width, Height);
                        StoryMiniGame     = StoryMG.Wumpus;
                        minigame.HintText = Messages.WumpusHintText;
                        MiniGameEnd       = false;
                        UseMiniGame       = true;
                        minigame.InitializeMiniGame(WumpusDiff[Difficulty]);
                    }
                    Danger dangerabout = map.GetDangerAbout();
                    if (dangerabout == Danger.Bat)
                    {
                        view.AddComand(String.Format(Messages.BatWarning, map.Room + 1), true);
                    }
                    if (dangerabout == Danger.Pit)
                    {
                        view.AddComand(String.Format(Messages.PitWarning, map.Room + 1), true);
                    }
                    if (dangerabout == Danger.Wumpus)
                    {
                        string strout = String.Format(Messages.WumpusWarning, map.Room + 1);
                        if (!player.IsShotArrow)
                        {
                            strout += Messages.HintRightClick;
                        }
                        view.AddComand(strout, true);
                    }
                }
                if (map.IsWin && view.IsEndAnimation())
                {
                    IsWin = true;
                    EndGame();
                }
                else if (player.Arrow == 0 && view.IsEndAnimation())
                {
                    IsWin = false;
                    EndGame();
                }
            }

            if (state == ControlState.MainMenu)
            {
                view.DrawMainMenu();
            }

            if (state == ControlState.PickCave)
            {
                view.DrawPickCave(MapForPiсk[numPickCave].graph, MapForPiсk[numPickCave].isActive, numPickCave, numDiff, seed);
            }
            if (time > 0)
            {
                view.DrawText((1000 / time).ToString(), 5, 5, 10, "Arial", Color.White);
            }
            if (score != null)
            {
                score.TickTime();
                score.Draw(view.Graphics);
            }
        }