コード例 #1
0
ファイル: ObjectEditor.cs プロジェクト: poudink/NSMB-Editor
 public ObjectEditor(LevelEditorControl EdControl)
 {
     InitializeComponent();
     LanguageManager.ApplyToContainer(this, "ObjectEditor");
     tileset0picker.Initialise(EdControl.GFX, 0);
     tileset1picker.Initialise(EdControl.GFX, 1);
     tileset2picker.Initialise(EdControl.GFX, 2);
     this.EdControl = EdControl;
     UpdateInfo();
 }
コード例 #2
0
 public ToolsForm(LevelEditorControl edc)
 {
     InitializeComponent();
     if (Properties.Settings.Default.mdi)
     {
         this.MdiParent = MdiParentForm.instance;
     }
     LanguageManager.ApplyToContainer(this, "ToolsForm");
     this.EdControl = edc;
 }
コード例 #3
0
ファイル: EntranceEditor.cs プロジェクト: poudink/NSMB-Editor
 public EntranceEditor(LevelEditorControl ec)
 {
     InitializeComponent();
     EdControl = ec;
     UpdateList();
     if (entranceTypeComboBox.Items.Count == 0)
     {
         entranceTypeComboBox.Items.AddRange(LanguageManager.GetList("EntranceTypes").ToArray());
     }
     LanguageManager.ApplyToContainer(this, "EntranceEditor");
 }
コード例 #4
0
ファイル: SpriteEvents.cs プロジェクト: poudink/NSMB-Editor
        public SpriteEventsViewer(LevelEditorControl ed)
        {
            InitializeComponent();
            this.ed = ed;
            spriteTable.DataSource = spriteList;

            LanguageManager.ApplyToContainer(this, "SpriteEvents");
            this.EventID.HeaderText    = LanguageManager.Get("SpriteEvents", "EventID");
            this.SpriteNum.HeaderText  = LanguageManager.Get("SpriteEvents", "SpriteNumber");
            this.SpriteName.HeaderText = LanguageManager.Get("SpriteEvents", "SpriteName");
        }
コード例 #5
0
 public ViewEditor(LevelEditorControl EdControl, List <NSMBView> l, bool EdVi)
 {
     InitializeComponent();
     this.EdControl = EdControl;
     this.lst       = l;
     EditingViews   = EdVi;
     LanguageManager.ApplyToContainer(this, "ViewEditor");
     music.Items.AddRange(ROM.UserInfo.getFullList("Music").ToArray());
     lightList.Items.AddRange(LanguageManager.GetList("3DLighting").ToArray());
     UpdateList();
 }
コード例 #6
0
ファイル: LevelMinimap.cs プロジェクト: poudink/NSMB-Editor
        public LevelMinimap(NSMBLevel Level, LevelEditorControl EdControl)
        {
            InitializeComponent();
            LanguageManager.ApplyToContainer(this, "LevelMinimap");

            if (Properties.Settings.Default.mdi)
            {
                this.MdiParent = MdiParentForm.instance;
            }
            this.Level            = Level;
            this.EdControl        = EdControl;
            UnViewableBlocksBrush = new SolidBrush(Color.FromArgb(120, Color.DarkSlateGray.R, Color.DarkSlateGray.G, Color.DarkSlateGray.B));
        }
コード例 #7
0
ファイル: NSMBEntrance.cs プロジェクト: poudink/NSMB-Editor
        public void render(Graphics g, LevelEditorControl edControl)
        {
            int EntranceArrowColour = 0;

            // connected pipes have the grey blob (or did, it's kind of pointless)

            /*if (((Type >= 3 && Type <= 6) || (Type >= 16 && Type <= 19) || (Type >= 22 && Type <= 25)) && (Settings & 8) != 0) {
             *  EntranceArrowColour = 2;
             * }*/
            // doors and pipes can be exits, so mark them as one if they're not 128
            if (((Type >= 2 && Type <= 6) || (Type >= 16 && Type <= 19) || (Type >= 22 && Type <= 25)) && (Settings & 128) == 0)
            {
                EntranceArrowColour = 1;
            }

            g.DrawImage(Properties.Resources.entrances, new Rectangle(X, Y, 16, 16), new Rectangle(Math.Min(Type, 25) * 16, EntranceArrowColour * 16, 16, 16), GraphicsUnit.Pixel);
        }
コード例 #8
0
        public void render(Graphics g, LevelEditorControl ed, bool selected)
        {
            if (points.Count == 0)
            {
                return;
            }

            bool first = true;
            int  lx    = 0;
            int  ly    = 0;

            foreach (NSMBPathPoint p in points)
            {
                if (!first)
                {
                    g.DrawLine(NSMBGraphics.PathPen, lx, ly, p.X + 8 + XOffs, p.Y + 8 + YOffs);
                }

                lx    = p.X + 8 + XOffs;
                ly    = p.Y + 8 + YOffs;
                first = false;
            }

            NSMBPathPoint fp  = points[0];
            NSMBPathPoint lp  = points[points.Count - 1];
            int           num = 0;

            foreach (NSMBPathPoint p in points)
            {
                Pen pe = null;
                if (p == fp)
                {
                    pe = Pens.Green;
                }
                if (p == lp)
                {
                    pe = Pens.Red;
                }

                p.render(g, ed);
                num++;
            }
        }
コード例 #9
0
ファイル: SpriteEditor.cs プロジェクト: poudink/NSMB-Editor
        public SpriteEditor(LevelEditorControl EdControl)
        {
            InitializeComponent();
            this.EdControl = EdControl;

            SSTable = ROM.GetInlineFile(ROM.Data.File_Modifiers);

            for (int i = 0; i < SpriteData.spriteNames.Count; i++)
            {
                int    ActorID = (int)ROM.GetClassIDFromTable(i);
                string sprite  = SpriteData.spriteNames[ActorID];
                spritelist[i] = i + ": " + sprite;
            }
            if (SpriteData.spriteNames.Count == 0)
            {
                string spriteText = LanguageManager.Get("SpriteEditor", "sprite");
                for (int s = 0; s < ROM.SpriteCount; s++)
                {
                    spritelist[s] = String.Format(spriteText, s);
                }
            }

            for (int l = 0; l < ROM.SpriteCount; l++)
            {
                curSprites.Add(l);
            }
            categoryList.Items.Add(LanguageManager.Get("SpriteEditor", "All"));
            categoryList.Items.Add(LanguageManager.Get("SpriteEditor", "InLevel"));
            categoryList.Items.Add(LanguageManager.Get("SpriteEditor", "InSpriteSets"));
            foreach (string cat in SpriteData.categories)
            {
                categoryList.Items.Add(cat);
            }
            categoryList.SelectedIndex = 0;

            UpdateDataEditor();
            UpdateInfo();

            LanguageManager.ApplyToContainer(this, "SpriteEditor");
            spriteTypeUpDown.Maximum = ROM.SpriteCount - 1;
        }
コード例 #10
0
ファイル: GoodTabsPanel.cs プロジェクト: poudink/NSMB-Editor
        public GoodTabsPanel(LevelEditorControl EdControl)
        {
            InitializeComponent();
            this.EdControl = EdControl;
            ToolTips       = LanguageManager.GetList("TabText");

            images            = new ImageList();
            images.ColorDepth = ColorDepth.Depth32Bit;
            images.Images.Add(Properties.Resources.config);
            images.Images.Add(Properties.Resources.block);
            images.Images.Add(Properties.Resources.bug);
            images.Images.Add(Properties.Resources.door);
            images.Images.Add(Properties.Resources.views);
            images.Images.Add(Properties.Resources.zones);
            images.Images.Add(Properties.Resources.paths);
            images.Images.Add(Properties.Resources.paths_progress);
            tabControl1.ImageList = images;

            objects       = new ObjectEditor(EdControl);
            sprites       = new SpriteEditor(EdControl);
            entrances     = new EntranceEditor(EdControl);
            views         = new ViewEditor(EdControl, EdControl.Level.Views, true);
            zones         = new ViewEditor(EdControl, EdControl.Level.Zones, false);
            paths         = new PathEditor(EdControl, EdControl.Level.Paths);
            progresspaths = new PathEditor(EdControl, EdControl.Level.ProgressPaths);

            config = new LevelConfig(EdControl);
            config.LoadSettings();
            EdControl.config = config;

            controls = new Control[] { config, objects, sprites, entrances, views, zones, paths, progresspaths };

            foreach (Control c in controls)
            {
                AddTab(c);
            }
            tabControl1.SelectedIndex = 1;

            //Select nothing
            SelectObjects(new List <LevelItem>());
        }
コード例 #11
0
        public void render(Graphics g, LevelEditorControl ed)
        {
            Pen p   = null;
            int num = parent.points.IndexOf(this);

            if (num == 0)
            {
                p = Pens.Green;
            }
            if (num == parent.points.Count - 1)
            {
                p = Pens.Red;
            }

            g.DrawImage(Properties.Resources.pathpoint, X + NSMBPath.XOffs, Y + NSMBPath.YOffs);
            if (p != null)
            {
                g.DrawRectangle(p, X, Y, 16, 16);
                g.DrawRectangle(p, X + 1, Y + 1, 14, 14);
            }
            g.DrawString(num.ToString(), NSMBGraphics.SmallInfoFont, Brushes.White, X, Y);
        }
コード例 #12
0
ファイル: NSMBView.cs プロジェクト: poudink/NSMB-Editor
        public void render(Graphics g, LevelEditorControl ed)
        {
            Pen p = Pens.LightSteelBlue;

            if (isZone)
            {
                p = Pens.PaleGreen;
            }

            g.DrawRectangle(p, X, Y, Width - 1, Height - 1);
            g.DrawRectangle(p, X + 1, Y + 1, Width - 3, Height - 3);

            Rectangle ViewablePixels = ed.ViewablePixels;
            int       vx             = ViewablePixels.X;
            int       vy             = ViewablePixels.Y;

            if (X + Width > vx && Y + Height > vy)
            {
                int numx = X;
                int numy = Y;

                if (numx < vx)
                {
                    numx = vx;
                }
                if (numy < vy)
                {
                    numy = vy;
                }
                if (isZone)
                {
                    numy += 16;
                }
                g.DrawString(GetDisplayString(), NSMBGraphics.InfoFont, Brushes.White, (float)numx, (float)numy);
            }
        }
コード例 #13
0
 public BackgroundDragEditionMode(NSMBLevel l, LevelEditorControl edc) : base(l, edc) { }
コード例 #14
0
ファイル: EditionMode.cs プロジェクト: poudink/NSMB-Editor
 public EditionMode(NSMBLevel Level, LevelEditorControl EdControl)
 {
     this.Level     = Level;
     this.EdControl = EdControl;
 }
コード例 #15
0
        public UndoManager(ToolStripSplitButton UndoButton, ToolStripSplitButton RedoButton, LevelEditorControl editor)
        {
            undo      = UndoButton;
            redo      = RedoButton;
            EdControl = editor;

            undo.ButtonClick += new EventHandler(onUndoLast);
            redo.ButtonClick += new EventHandler(onRedoLast);
        }
コード例 #16
0
 public void SetEdControl(LevelEditorControl EdControl)
 {
     this.EdControl = EdControl;
     this.AfterSetEdControl();
 }
コード例 #17
0
//        public void Render(Graphics g, int XOffset, int YOffset, Rectangle Clip, float zoom)

        public void render(Graphics g, LevelEditorControl ed)
        {
            //This method is really messy due to the quirky rendering of .NET
            //I need to do a lot of hacks to get objects rendered correctly with
            //high and low zoom.

            if (badObject)
            {
                g.DrawRectangle(new Pen(Color.Red, 4), new Rectangle(X * 16, Y * 16, Width * 16, Height * 16));
                g.DrawLine(new Pen(Color.Red, 4), new Point(X * 16, (Y + Height) * 16), new Point((X + Width) * 16, (Y) * 16));
                g.DrawLine(new Pen(Color.Red, 4), new Point((X + Width) * 16, (Y + Height) * 16), new Point((X) * 16, (Y) * 16));
                return;
            }

            if (ed.zoom > 1)
            {
                RectangleF srcRect  = new RectangleF(0, 0, 16, 16);
                RectangleF destRect = new RectangleF(X << 4, Y << 4, 16, 16);

                for (int xx = 0; xx < CachedObj.GetLength(0); xx++)
                {
                    for (int yy = 0; yy < CachedObj.GetLength(1); yy++)
                    {
                        int t = CachedObj[xx, yy];
                        if (t < 0)
                        {
                            continue;
                        }

                        destRect.X = (X + xx) << 4;
                        destRect.Y = (Y + yy) << 4;

                        srcRect.X = (t % 16) * 16 - 0.5f;
                        srcRect.Y = (t / 16) * 16 - 0.5f;

                        g.DrawImage(GFX.Tilesets[Tileset].Map16Buffer, destRect.X, destRect.Y, srcRect, GraphicsUnit.Pixel);

                        if (!GFX.Tilesets[Tileset].UseOverrides)
                        {
                            continue;
                        }
                        int t2 = GFX.Tilesets[Tileset].Overrides[t];
                        if (t2 == -1)
                        {
                            continue;
                        }
                        if (t2 == 0)
                        {
                            continue;
                        }

                        srcRect.X = t2 * 16 - 0.5f;
                        srcRect.Y = 0 - 0.5f;

                        g.DrawImage(GFX.Tilesets[Tileset].OverrideBitmap, destRect.X, destRect.Y, srcRect, GraphicsUnit.Pixel);
                        //int overridenum = Array.IndexOf(NSMBTileset.BehaviorOverrides, GFX.Tilesets[Tileset].TileBehaviors[t]);
                        //if (overridenum > -1)
                        //    g.DrawImage(Properties.Resources.tileoverrides2, destRect.X, destRect.Y, new Rectangle(overridenum * 16, 0, 16, 16), GraphicsUnit.Pixel);
                    }
                }
            }
            else
            {
                Rectangle srcRect  = new Rectangle(0, 0, 16, 16);
                Rectangle destRect = new Rectangle(X << 4, Y << 4, 16, 16);

                for (int xx = 0; xx < CachedObj.GetLength(0); xx++)
                {
                    for (int yy = 0; yy < CachedObj.GetLength(1); yy++)
                    {
                        int t = CachedObj[xx, yy];
                        if (t < 0)
                        {
                            continue;
                        }

                        destRect.X = (X + xx) << 4;
                        destRect.Y = (Y + yy) << 4;

                        srcRect.X = (t % 16) * 16;
                        srcRect.Y = (t / 16) * 16;

                        g.DrawImage(GFX.Tilesets[Tileset].Map16Buffer, destRect.X, destRect.Y, srcRect, GraphicsUnit.Pixel);

                        if (!GFX.Tilesets[Tileset].UseOverrides)
                        {
                            continue;
                        }
                        int t2 = GFX.Tilesets[Tileset].Overrides[t];
                        if (t2 <= 0)
                        {
                            continue;
                        }

                        srcRect.X = t2 * 16;
                        srcRect.Y = 0;

                        g.DrawImage(GFX.Tilesets[Tileset].OverrideBitmap, destRect.X, destRect.Y, srcRect, GraphicsUnit.Pixel);
                        //int overridenum = Array.IndexOf(NSMBTileset.BehaviorOverrides, GFX.Tilesets[Tileset].TileBehaviors[t]);
                        //if (overridenum > -1)
                        //    g.DrawImage(Properties.Resources.tileoverrides2, destRect.X, destRect.Y, new Rectangle(overridenum * 16, 0, 16, 16), GraphicsUnit.Pixel);
                    }
                }
            }
        }
コード例 #18
0
            public SpriteDataEditor(List <LevelItem> sprites, SpriteData sd, LevelEditorControl EdControl)
            {
                this.SizeChanged += new EventHandler(this_SizeChanged);
                updating          = true;
                this.ColumnCount  = 3;
                //Talbe layout panel doesn't automatically create row or column styles
                this.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
                this.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
                this.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20F));
                this.RowCount = sd.fields.Count;
                for (int l = 0; l < this.RowCount; l++)
                {
                    this.RowStyles.Add(new RowStyle(SizeType.Absolute));
                }
                this.AutoSize     = true;
                this.AutoSizeMode = AutoSizeMode.GrowAndShrink;

                this.sprites = sprites;
                foreach (LevelItem obj in sprites)
                {
                    if (obj is NSMBSprite)
                    {
                        s = obj as NSMBSprite;
                        break;
                    }
                }
                this.sd        = sd;
                this.Dock      = DockStyle.Fill;
                this.EdControl = EdControl;

                int row = 0;

                foreach (SpriteDataField v in sd.fields)
                {
                    Control c = CreateControlFor(v);
                    c.Anchor = AnchorStyles.Left | AnchorStyles.Right;
                    if (c is CheckBox || c is Label)
                    {
                        c.Font = new System.Drawing.Font(c.Font.FontFamily, c.Font.Size * 0.9F);
                        this.Controls.Add(c, 0, row);
                        this.RowStyles[row].Height = 25;
                        if (v.notes == "")
                        {
                            this.SetColumnSpan(c, 3);
                        }
                        else
                        {
                            NotesCtrl note = new NotesCtrl();
                            this.Controls.Add(note, 2, row);
                            note.Text = v.notes;
                        }
                    }
                    else
                    {
                        this.Controls.Add(c, 1, row);
                        Label l = new Label();
                        l.Text      = v.name;
                        l.Font      = new System.Drawing.Font(l.Font.FontFamily, l.Font.Size * 0.9F);
                        l.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
                        l.Anchor    = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
                        this.Controls.Add(l, 0, row);
                        this.RowStyles[row].Height = 25;
                        if (v.notes == "")
                        {
                            this.SetColumnSpan(c, 2);
                        }
                        else
                        {
                            NotesCtrl note = new NotesCtrl();
                            this.Controls.Add(note, 2, row);
                            note.Text = v.notes;
                        }
                    }
                    row++;
                    controls.Add(v, c);
                }
                updating = false;
            }