Exemple #1
0
        public Editor()
        {
            InitializeComponent();
            SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint |
            ControlStyles.OptimizedDoubleBuffer, true);

            // extern inits
            drawHandler = GetDraw.DrawHandler(level, this.Update);
            AnimateImage.Refresh = false;
            EditorUI.drawHandler = drawHandler;
            EditorUI.level = level;
            EditorUI.properties = properties;
            TmpFileHandler.BackupFilename = Environment.CurrentDirectory + "\\backup.lrl";

            World defaultWorld = new World();
            tmpHandler = new TmpFileHandler(openFile, saveFile, defaultWorld.Serialize, 5);
            defaultWorld = null;

            defaultContextMenuItems = objectContext.Items.Count;
            curRectangle = Rectangle.Empty;

            focus = null;
            moving = false;
            mouseX = 0;
            mouseY = 0;
            pressedKeys = new List<Keys>();

            #region Images loading
            floorToolStripMenuItem.Image = Image.FromFile(Files.floor_middle);
            floorToolStripButton.Image = Image.FromFile(Files.floor_middle);

            designElementToolStripMenuItem.Image = Image.FromFile(Files.tree);
            treeToolStripMenuItem.Image = Image.FromFile(Files.tree);
            treeToolStripButton.Image = Image.FromFile(Files.tree);

            brickToolStripMenuItem.Image = Image.FromFile(Files.brick_blue);
            brickToolStripButton.Image = Image.FromFile(Files.brick_blue);

            boxToolStripMenuItem.Image = Image.FromFile(Files.box1);
            boxToolStripButton.Image = Image.FromFile(Files.box1); ;

            pipeToolStripMenuItem.Image = Image.FromFile(Files.pipe_green_up);
            pipeToolStripButton.Image = Image.FromFile(Files.pipe_green_up); ;

            pointStarToolStripMenuItem.Image = Image.FromFile(Files.star);
            starToolStripButton.Image = Image.FromFile(Files.star); ;

            platformToolStripMenuItem.Image = Image.FromFile(Files.brick_blue);
            bricksToolStripMenuItem.Image = Image.FromFile(Files.brick_blue);
            bricksToolStripButton.Image = Image.FromFile(Files.brick_blue); ;

            enemyToolStripMenuItem.Image = Image.FromFile(AnimateImage.FirstImageStr(Files.turtle_green));
            turtleToolStripMenuItem.Image = Image.FromFile(AnimateImage.FirstImageStr(Files.turtle_green));
            turtleToolStripButton.Image = Image.FromFile(AnimateImage.FirstImageStr(Files.turtle_green));

            spikaToolStripMenuItem.Image = Image.FromFile(Files.spika_green);
            spikaToolStripButton.Image = Image.FromFile(Files.spika_green); ;

            gumbaToolStripMenuItem.Image = Image.FromFile(AnimateImage.FirstImageStr(Files.gumba_brown));
            gumbaToolStripButton.Image = Image.FromFile(AnimateImage.FirstImageStr(Files.gumba_brown));

            levelEndToolStripMenuItem.Image = Image.FromFile(Files.levelend_house);
            houseToolStripMenuItem.Image = Image.FromFile(Files.levelend_house);
            houseToolStripButton.Image = Image.FromFile(Files.levelend_house); ;

            gameLevelbeginToolStripMenuItem.Image = Image.FromFile(Files.icon_png);
            gameWindowToolStripMenuItem.Image = Image.FromFile(Files.icon_png);

            startGameCurrentToolStripMenuItem.Image = Image.FromFile(Files.icon_png);
            startGameCurrentToolStripButton.Image = Image.FromFile(Files.icon_png);
            #endregion
        }
Exemple #2
0
 private void Editor_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (tmpHandler.SaveChanges())
     {
         tmpHandler.Dispose();
         tmpHandler = null;
     }
     else
         e.Cancel = true;
 }