// This updates the overlay
        private void UpdateOverlay()
        {
            // We must redraw the tiles to the canvas when the stats to view has changed
            if (lastviewstats != BuilderPlug.InterfaceForm.ViewStats)
            {
                RedrawAllTiles();
                lastviewstats = BuilderPlug.InterfaceForm.ViewStats;
            }

            // Render the overlay
            if (renderer.StartOverlay(true))
            {
                // Render the canvas to screen
                RectangleF r = new RectangleF(0, 0, canvas.Width, canvas.Height);
                renderer.RenderRectangleFilled(r, PixelColor.FromColor(Color.White), false, image);

                // Render any selection
                if (selecting)
                {
                    RenderMultiSelection();
                }

                // Finish our rendering to this layer.
                renderer.Finish();
            }
        }
Esempio n. 2
0
        public static void FirstFight()
        {
            System.Console.Clear();
            Design.GameUI();
            ViewStats.PlayerStats();
            System.Console.WriteLine("A Giant Rat is blocking the cell door opening...");
            System.Console.WriteLine("It's time for your first fight!");
            System.Console.WriteLine("Press enter to continue...");
            System.Console.ReadKey();
            System.Console.Clear();
            Design.GameUI();
            ViewStats.PlayerStats();
            System.Console.WriteLine("Would you like to know how fighting works in Toonax?");
            System.Console.WriteLine("Type 'Y' if you want to read them. Type 'N' if you already know what you are doing...");
            Program.yesOrNo = System.Console.ReadLine();
            if (Program.yesOrNo == "y" || Program.yesOrNo == "Y")
            {
                FightInstructions();
            }
            else
            {
                FirstEncounter();

                System.Console.Clear();
                Design.GameUI();
                ViewStats.PlayerStats();
                System.Console.WriteLine("Great job! " + Program.player.characterName + " You have proven you have what it takes to become a true Hero of Toonax!\nNow let us move onto the next chapter in your life!");
                System.Console.WriteLine("Press any key to continue onto CHAPTER 2...");
                System.Console.ReadKey();
                Chapter2.beginChapter2();
            }
        }
Esempio n. 3
0
 public static void FirstEncounter()
 {
     System.Console.Clear();
     Design.GameUI();
     ViewStats.PlayerStats();
     ViewStats.EnemyStats(Program.rat1);
     Fight.FightSequence(Program.rat1);
 }
Esempio n. 4
0
 public static void FightInstructions()
 {
     System.Console.Clear();
     Design.GameUI();
     ViewStats.PlayerStats();
     System.Console.WriteLine("You are rolling two dice against the enemy. The total of the two dice will \nbe added to your current SKILL stat and if it is greater \nthan the enemies SKILL total then you will inflict damage on their STAMINA.\n You will keep rolling until one of you has been killed. Good Luck " + Program.player.characterName);
     System.Console.WriteLine("Press enter to return to the battle...");
     System.Console.ReadKey();
     FirstEncounter();
 }
Esempio n. 5
0
        // Selecting a type of stats to view
        private void stats_Click(object sender, EventArgs e)
        {
            foreach (ToolStripMenuItem i in statsbutton.DropDownItems)
            {
                i.Checked = false;
            }

            ToolStripMenuItem item = (ToolStripMenuItem)sender;

            viewstats         = (ViewStats)int.Parse(item.Tag.ToString(), CultureInfo.InvariantCulture);
            item.Checked      = true;
            statsbutton.Image = item.Image;

            General.Interface.RedrawDisplay();
        }
Esempio n. 6
0
        private void ViewStatsCall(ViewStoredQuizzes VS, StoredQuizzes storedQuizzes, List <StoredQuestions> storedQuestions, List <StoredQuizQuestions> storedQuizQuestions)
        {
            //Launches the viewstats form
            ViewStats vs = new ViewStats(student, storedQuizzes, storedQuestions, storedQuizQuestions);

            vs.Show();

            vs.FormClosed += (source, EventArgs) =>
            {
                this.Show();
            };

            vs.OpenStoredQuizzes += (source, EventArgs) =>
            {
                //The user can specify to return to the storedquizzes, if they wish to do that this event is called
                button3_Click(null, EventArgs.Empty);
            };
        }
        // Get the configured static limit for the given stat.
        private uint StaticLimit(ViewStats stat)
        {
            switch (stat)
            {
            case ViewStats.Visplanes:
                return(General.Map.Config.StaticLimits.Visplanes);

            case ViewStats.Drawsegs:
                return(General.Map.Config.StaticLimits.Drawsegs);

            case ViewStats.Solidsegs:
                return(General.Map.Config.StaticLimits.Solidsegs);

            case ViewStats.Openings:
                return(General.Map.Config.StaticLimits.Openings);

            default:
                return(0);
            }
        }
        // Mode starts
        public override void OnEngage()
        {
            Cursor.Current = Cursors.WaitCursor;
            base.OnEngage();
            General.Interface.DisplayStatus(StatusType.Busy, "Setting up test environment...");

            BuilderPlug.InitVPO();             //mxd

            CleanUp();

            BuilderPlug.InterfaceForm.AddToInterface();
            BuilderPlug.InterfaceForm.OnOpenDoorsChanged += OnOpenDoorsChanged;             //mxd
            lastviewstats = BuilderPlug.InterfaceForm.ViewStats;

            // Export the current map to a temporary WAD file
            tempfile = BuilderPlug.MakeTempFilename(".wad");
            if (!General.Map.ExportToFile(tempfile))
            {
                //mxd. Abort on export fail
                Cursor.Current = Cursors.Default;
                General.Interface.DisplayStatus(StatusType.Warning, "Unable to set test environment...");
                OnCancel();
                return;
            }

            // Load the map in VPO_DLL
            BuilderPlug.VPO.Start(tempfile, General.Map.Options.LevelName);

            // Determine map boundary
            mapbounds = Rectangle.Round(MapSet.CreateArea(General.Map.Map.Vertices));

            // Create tiles for all points inside the map
            CreateTiles();             //mxd

            QueuePoints(0);

            // Make an image to draw on.
            // The BitmapImage for Doom Builder's resources must be Format32bppArgb and NOT using color correction,
            // otherwise DB will make a copy of the bitmap when LoadImage() is called! This is normally not a problem,
            // but we want to keep drawing to the same bitmap.
            int width  = General.NextPowerOf2(General.Interface.Display.ClientSize.Width);
            int height = General.NextPowerOf2(General.Interface.Display.ClientSize.Height);

            canvas = new Bitmap(width, height, PixelFormat.Format32bppArgb);
            image  = new DynamicBitmapImage(canvas, "_CANVAS_");
            image.UseColorCorrection = false;
            image.MipMapLevels       = 1;
            image.LoadImageNow();

            // Make custom presentation
            CustomPresentation p = new CustomPresentation();

            p.AddLayer(new PresentLayer(RendererLayer.Overlay, BlendingMode.Mask, 1f, false));
            p.AddLayer(new PresentLayer(RendererLayer.Grid, BlendingMode.Mask));
            p.AddLayer(new PresentLayer(RendererLayer.Geometry, BlendingMode.Alpha, 1f, true));
            renderer.SetPresentation(p);

            // Setup processing
            nextupdate = Clock.CurrentTime + 100;
            General.Interface.EnableProcessing();
            processingenabled = true;

            RedrawAllTiles();
            Cursor.Current = Cursors.Default;
            General.Interface.SetCursor(Cursors.Cross);
            General.Interface.DisplayReady();
        }
Esempio n. 9
0
        // Mode starts
        public override void OnEngage()
        {
            Cursor.Current = Cursors.WaitCursor;
            base.OnEngage();
            General.Interface.DisplayStatus(StatusType.Busy, "Setting up test environment...");

            CleanUp();

            BuilderPlug.InterfaceForm.AddToInterface();
            lastviewstats = BuilderPlug.InterfaceForm.ViewStats;

            // Export the current map to a temporary WAD file
            tempfile = BuilderPlug.MakeTempFilename(".wad");
            General.Map.ExportToFile(tempfile);

            // Load the map in VPO_DLL
            BuilderPlug.VPO.Start(tempfile, General.Map.Options.LevelName);

            // Determine map boundary
            mapbounds = Rectangle.Round(MapSet.CreateArea(General.Map.Map.Vertices));

            // Create tiles for all points inside the map
            Point               lt        = TileForPoint(mapbounds.Left - Tile.TILE_SIZE, mapbounds.Top - Tile.TILE_SIZE);
            Point               rb        = TileForPoint(mapbounds.Right + Tile.TILE_SIZE, mapbounds.Bottom + Tile.TILE_SIZE);
            Rectangle           tilesrect = new Rectangle(lt.X, lt.Y, rb.X - lt.X, rb.Y - lt.Y);
            NearestLineBlockmap blockmap  = new NearestLineBlockmap(tilesrect);

            for (int x = tilesrect.X; x <= tilesrect.Right; x += Tile.TILE_SIZE)
            {
                for (int y = tilesrect.Y; y <= tilesrect.Bottom; y += Tile.TILE_SIZE)
                {
                    // If the tile is obviously outside the map, don't create it
                    Vector2D pc         = new Vector2D(x + (Tile.TILE_SIZE >> 1), y + (Tile.TILE_SIZE >> 1));
                    Linedef  ld         = MapSet.NearestLinedef(blockmap.GetBlockAt(pc).Lines, pc);
                    float    distancesq = ld.DistanceToSq(pc, true);
                    if (distancesq > (Tile.TILE_SIZE * Tile.TILE_SIZE))
                    {
                        float side = ld.SideOfLine(pc);
                        if ((side > 0.0f) && (ld.Back == null))
                        {
                            continue;
                        }
                    }

                    Point tp = new Point(x, y);
                    tiles.Add(tp, new Tile(tp));
                }
            }

            QueuePoints(0);

            // Make an image to draw on.
            // The BitmapImage for Doom Builder's resources must be Format32bppArgb and NOT using color correction,
            // otherwise DB will make a copy of the bitmap when LoadImage() is called! This is normally not a problem,
            // but we want to keep drawing to the same bitmap.
            int width  = General.NextPowerOf2(General.Interface.Display.ClientSize.Width);
            int height = General.NextPowerOf2(General.Interface.Display.ClientSize.Height);

            canvas = new Bitmap(width, height, PixelFormat.Format32bppArgb);
            image  = new DynamicBitmapImage(canvas, "_CANVAS_");
            image.UseColorCorrection = false;
            image.MipMapLevels       = 1;
            image.LoadImage();
            image.CreateTexture();

            // Make custom presentation
            CustomPresentation p = new CustomPresentation();

            p.AddLayer(new PresentLayer(RendererLayer.Overlay, BlendingMode.Mask, 1f, false));
            p.AddLayer(new PresentLayer(RendererLayer.Grid, BlendingMode.Mask));
            p.AddLayer(new PresentLayer(RendererLayer.Geometry, BlendingMode.Alpha, 1f, true));
            renderer.SetPresentation(p);

            // Setup processing
            nextupdate = DateTime.Now + new TimeSpan(0, 0, 0, 0, 100);
            General.Interface.EnableProcessing();
            processingenabled = true;

            RedrawAllTiles();
            Cursor.Current = Cursors.Default;
            General.Interface.SetCursor(Cursors.Cross);
            General.Interface.DisplayReady();
        }