예제 #1
0
        // -------------------------------------------------------------------
        // LoadSystemGraphic
        // -------------------------------------------------------------------

        public static void LoadSystemGraphic(SystemGraphic graphic, GraphicsDevice device)
        {
            if (!TexCharacters.ContainsKey(graphic))
            {
                TexCharacters[graphic] = graphic.LoadTexture(device);
            }
        }
예제 #2
0
        // -------------------------------------------------------------------
        // LoadEventSpriteTexture
        // -------------------------------------------------------------------

        public void LoadSpriteTexture(SystemGraphic graphic)
        {
            if (!graphic.IsTileset())
            {
                MapEditor.LoadSystemGraphic(graphic, Device);
            }
        }
예제 #3
0
 public SystemAutotile(int id, string n, SystemGraphic graphic, Collision collision)
 {
     Id        = id;
     Name      = n;
     Graphic   = graphic;
     Collision = collision;
 }
        // -------------------------------------------------------------------
        // LoadBar
        // -------------------------------------------------------------------

        public void LoadBar(SystemGraphic graphic)
        {
            PictureBoxIcon.Image = graphic.LoadImage();

            int width, height;

            if (PictureBoxIcon.Image.Size.Width > PanelBar.Size.Width)
            {
                width = PanelBar.Size.Width;
            }
            else
            {
                width = PictureBoxIcon.Image.Size.Width;
            }

            if (PictureBoxIcon.Image.Size.Height > PanelBar.Size.Height)
            {
                height = PanelBar.Size.Height;
            }
            else
            {
                height = PictureBoxIcon.Image.Size.Height;
            }

            PictureBoxIcon.Size     = new Size(width, height);
            PictureBoxIcon.Location = new Point(0, 0);
        }
        // -------------------------------------------------------------------
        // ResetGraphics
        // -------------------------------------------------------------------

        public void ResetGraphics()
        {
            panel.Image   = null;
            panel.Frame   = 0;
            panel.Graphic = SystemGraphic.GetDefaultEventGraphic();
            panel.Invalidate();
        }
예제 #6
0
 public SystemElement(int id, Dictionary <string, string> names, SystemGraphic icon)
 {
     Id    = id;
     Names = names;
     Icon  = icon;
     SetName();
 }
 public SystemStatistics(int id, Dictionary<string, string> names, SystemGraphic bar, GameOverOptions gameOverOptions)
 {
     Id = id;
     Names = names;
     Bar = bar;
     SetName();
     AllGameOverOptions = gameOverOptions;
 }
예제 #8
0
 public SystemEventPage(SystemGraphic graphic, DrawType graphicDrawType, PageOptions options, EventTrigger trigger, EventCommandConditions conditionsTree, NTree <EventCommand> commandsTree)
 {
     Graphic         = graphic;
     GraphicDrawType = graphicDrawType;
     Options         = options;
     Trigger         = trigger;
     ConditionsTree  = conditionsTree;
     CommandsTree    = commandsTree;
 }
        // -------------------------------------------------------------------
        // LoadTexture
        // -------------------------------------------------------------------

        public void LoadTexture(SystemGraphic graphic, float zoom = -1)
        {
            Image = graphic.LoadImage();
            if (zoom == -1)
            {
                zoom = WANOK.RELATION_SIZE;
            }
            Size     = new Size((int)(Image.Width * zoom), (int)(Image.Height * zoom));
            Location = new Point(0, 0);
        }
예제 #10
0
 public SystemTileset(int id, string n, SystemGraphic graphic, Collision collision, List <int> autotiles, List <int> reliefs, List <object[]> reliefTop)
 {
     Id        = id;
     Name      = n;
     Graphic   = graphic;
     Collision = collision;
     Autotiles = autotiles;
     Reliefs   = reliefs;
     ReliefTop = reliefTop;
 }
예제 #11
0
        // -------------------------------------------------------------------
        // DrawSprites
        // -------------------------------------------------------------------

        public void DrawSprites(GraphicsDevice device, AlphaTestEffect effect, Camera camera)
        {
            foreach (KeyValuePair <SystemGraphic, Dictionary <int[], Sprites> > entry in Sprites)
            {
                SystemGraphic graphic = entry.Key.IsTileset() ? null : entry.Key;
                foreach (KeyValuePair <int[], Sprites> entry2 in entry.Value)
                {
                    entry2.Value.Draw(device, effect, camera, graphic == null ? entry2.Key[2] * WANOK.SQUARE_SIZE : entry2.Key[2], graphic == null ? entry2.Key[3] * WANOK.SQUARE_SIZE : entry2.Key[3], graphic);
                }
            }
        }
예제 #12
0
        // -------------------------------------------------------------------
        // InitializeParameters
        // -------------------------------------------------------------------

        public void InitializeParameters(Collision collision, SystemGraphic graphic)
        {
            if (!graphic.IsNone())
            {
                LoadPicture(passagePicture, graphic);
                collision = GetPassageColision(collision);
                passagePicture.InitializeParameters(collision.PassableCollision);
            }
            else
            {
                LoadNonePicture(passagePicture);
            }
        }
예제 #13
0
        // -------------------------------------------------------------------
        // InitializeListParameters
        // -------------------------------------------------------------------

        public void InitializeListParameters(SystemGraphic graphic, SystemGraphic graphicTileset = null)
        {
            GraphicTileset = graphicTileset;
            panel.Graphic  = graphic;
            if (panel.Graphic.IsNone())
            {
                ResetGraphics();
            }
            else if (panel.Graphic.IsTileset())
            {
                panel.Image = GraphicTileset.LoadImage();
                panel.Refresh();
            }
            else
            {
                panel.Image = panel.Graphic.LoadImage();
                panel.Refresh();
            }
        }
예제 #14
0
 private void graphicControl1_ClosingDialogEvent(SystemGraphic graphic)
 {
     graphicControl1.panel.Frame = 0;
     Control.Model.Pages[tabControl1.SelectedIndex].Graphic = graphic;
 }
예제 #15
0
        // -------------------------------------------------------------------
        // Draw
        // -------------------------------------------------------------------

        public void Draw(GraphicsDevice device, AlphaTestEffect effect, Camera camera, int width, int height, SystemGraphic characterGraphic = null)
        {
            if (VB != null)
            {
                if (characterGraphic == null)
                {
                    effect.Texture = MapEditor.TexTileset;
                }
                else
                {
                    effect.Texture = MapEditor.TexCharacters[characterGraphic];
                }
                device.SetVertexBuffer(VB);
                device.Indices = IB;
                foreach (int[] coords in ListSprites.Keys)
                {
                    ListSprites[coords].Draw(device, effect, VerticesArray, IndexesArray, camera, coords, width, height);
                }
            }
        }
예제 #16
0
        // -------------------------------------------------------------------
        // LoadIcon
        // -------------------------------------------------------------------

        public void LoadIcon(SystemGraphic graphic)
        {
            PictureBoxIcon.Image    = graphic.LoadImage();
            PictureBoxIcon.Size     = new Size((WANOK.BASIC_SQUARE_SIZE / 2), (WANOK.BASIC_SQUARE_SIZE / 2));
            PictureBoxIcon.Location = new Point(0, 0);
        }
        // -------------------------------------------------------------------
        // Constructor
        // -------------------------------------------------------------------

        public DialogPreviewGraphicSelectFrame(SystemGraphic graphic, OptionsKind optionsKind, SystemGraphic graphicTileset = null) : base(graphic, optionsKind, graphicTileset)
        {
            OptionsKind = optionsKind;

            // Picture
            PictureBox                   = new TilesetSelectorPicture();
            PictureBox.SizeMode          = PictureBoxSizeMode.StretchImage;
            PictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
            PictureBox.BackColor         = WANOK.COLOR_BACKGROUND_PREVIEW_IMAGE;

            panelPicture.Controls.Clear();
            panelPicture.Controls.Add(PictureBox);

            // Options
            GrowLabel label = new GrowLabel();

            label.Dock = DockStyle.Fill;
            switch (optionsKind)
            {
            case OptionsKind.CharacterSelection:
                label.Text = "Select the number of frames and if there are diagonals:";
                break;
            }
            label.Margin = new Padding(0, 0, 0, 20);
            tableLayoutPanel4.Controls.Add(label, 0, 2);

            TableLayoutPanel panelRectangle = new TableLayoutPanel();

            panelRectangle.Dock        = DockStyle.Fill;
            panelRectangle.RowCount    = 3;
            panelRectangle.ColumnCount = 2;
            tableLayoutPanel4.Controls.Add(panelRectangle, 0, 3);
            Label rectangleLabel = new Label();

            rectangleLabel.Text      = "Frames:";
            rectangleLabel.TextAlign = ContentAlignment.MiddleLeft;
            panelRectangle.Controls.Add(rectangleLabel, 0, 0);
            rectangleLabel           = new Label();
            rectangleLabel.Text      = "Diagonals:";
            rectangleLabel.TextAlign = ContentAlignment.MiddleLeft;
            panelRectangle.Controls.Add(rectangleLabel, 0, 1);

            NumericFrames.Minimum = 1;
            NumericFrames.Maximum = 999;
            NumericFrames.Value   = (int)graphic.Options[(int)SystemGraphic.OptionsEnum.Frames];
            panelRectangle.Controls.Add(NumericFrames, 1, 0);
            ComboBoxDialog.DropDownStyle = ComboBoxStyle.DropDownList;
            ComboBoxDialog.Items.Add("No");
            ComboBoxDialog.Items.Add("Yes");
            ComboBoxDialog.SelectedIndex = (int)graphic.Options[(int)SystemGraphic.OptionsEnum.Diagonal];
            panelRectangle.Controls.Add(ComboBoxDialog, 1, 1);

            panelRectangle.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 63));
            panelRectangle.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100));
            panelRectangle.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            panelRectangle.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            panelRectangle.RowStyles.Add(new RowStyle(SizeType.Percent, 100));


            // Actualize list (delete _act) and adding tileset
            List <ListViewItem> list = new List <ListViewItem>();

            for (int i = 0; i < listView1.Items.Count; i++)
            {
                list.Add(listView1.Items[i]);
            }

            for (int i = 1; i < list.Count; i++)
            {
                string path = Path.GetFileNameWithoutExtension(list[i].Text);
                if (path.Length - 4 >= 0)
                {
                    if (path.Substring(path.Length - 4, 4) == "_act")
                    {
                        listView1.Items.Remove(list[i]);
                    }
                }
            }
            listView1.Items.Insert(1, WANOK.TILESET_IMAGE_STRING);

            // Events
            PictureBox.MouseEnter               += PictureBox_MouseEnter;
            PictureBox.MouseDown                += PictureBox_MouseDown;
            PictureBox.MouseUp                  += PictureBox_MouseUp;
            listView1.SelectedIndexChanged      += ListView1_SelectedIndexChanged;
            NumericFrames.ValueChanged          += NumericFrames_ValueChanged;
            ComboBoxDialog.SelectedIndexChanged += ComboBoxDialog_SelectedIndexChanged;
        }
예제 #18
0
        // -------------------------------------------------------------------
        // Constructor
        // -------------------------------------------------------------------

        public DialogPreviewGraphicSelectRectangle(SystemGraphic graphic, OptionsKind optionsKind, SystemGraphic graphicTileset = null) : base(graphic, optionsKind, graphicTileset)
        {
            OptionsKind = optionsKind;

            // Picture
            PictureBox                   = new PixelSelectPictureBox();
            PictureBox.SizeMode          = PictureBoxSizeMode.StretchImage;
            PictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
            PictureBox.BackColor         = WANOK.COLOR_BACKGROUND_PREVIEW_IMAGE;
            panelPicture.Controls.Clear();
            panelPicture.Controls.Add(PictureBox);

            // Options
            GrowLabel label = new GrowLabel();

            label.Dock = DockStyle.Fill;
            switch (optionsKind)
            {
            case OptionsKind.BarSelection:
                label.Text = "Select the rectangle that represents the filled bar:";
                break;
            }
            label.Margin = new Padding(0, 0, 0, 20);
            tableLayoutPanel4.Controls.Add(label, 0, 2);

            TableLayoutPanel panelRectangle = new TableLayoutPanel();

            panelRectangle.Dock        = DockStyle.Fill;
            panelRectangle.RowCount    = 5;
            panelRectangle.ColumnCount = 2;

            tableLayoutPanel4.Controls.Add(panelRectangle, 0, 3);
            Label rectangleLabel = new Label();

            rectangleLabel.Text      = "X:";
            rectangleLabel.TextAlign = ContentAlignment.MiddleLeft;
            panelRectangle.Controls.Add(rectangleLabel, 0, 0);
            rectangleLabel           = new Label();
            rectangleLabel.Text      = "Y:";
            rectangleLabel.TextAlign = ContentAlignment.MiddleLeft;
            panelRectangle.Controls.Add(rectangleLabel, 0, 1);
            rectangleLabel           = new Label();
            rectangleLabel.Text      = "Width:";
            rectangleLabel.TextAlign = ContentAlignment.MiddleLeft;
            panelRectangle.Controls.Add(rectangleLabel, 0, 2);
            rectangleLabel           = new Label();
            rectangleLabel.Text      = "Height:";
            rectangleLabel.TextAlign = ContentAlignment.MiddleLeft;
            panelRectangle.Controls.Add(rectangleLabel, 0, 3);

            numericButtonX.Minimum      = 0;
            numericButtonY.Minimum      = 0;
            numericButtonWidth.Minimum  = 1;
            numericButtonHeight.Minimum = 1;
            numericButtonX.Maximum      = 32000;
            numericButtonY.Maximum      = 32000;
            numericButtonWidth.Maximum  = 32000;
            numericButtonHeight.Maximum = 32000;
            numericButtonX.Value        = (int)graphic.Options[0];
            numericButtonY.Value        = (int)graphic.Options[1];
            numericButtonWidth.Value    = (int)graphic.Options[2];
            numericButtonHeight.Value   = (int)graphic.Options[3];
            panelRectangle.Controls.Add(numericButtonX, 1, 0);
            panelRectangle.Controls.Add(numericButtonY, 1, 1);
            panelRectangle.Controls.Add(numericButtonWidth, 1, 2);
            panelRectangle.Controls.Add(numericButtonHeight, 1, 3);

            panelRectangle.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 50));
            panelRectangle.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100));
            panelRectangle.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            panelRectangle.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            panelRectangle.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            panelRectangle.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            panelRectangle.RowStyles.Add(new RowStyle(SizeType.Percent, 100));

            // Update image rectangle
            PictureBox.SelectionRectangle.X      = (int)numericButtonX.Value;
            PictureBox.SelectionRectangle.Y      = (int)numericButtonY.Value;
            PictureBox.SelectionRectangle.Width  = (int)numericButtonWidth.Value;
            PictureBox.SelectionRectangle.Height = (int)numericButtonHeight.Value;
            PictureBox.Refresh();

            // Events
            PictureBox.MouseEnter            += PictureBox_MouseEnter;
            PictureBox.MouseDown             += PictureBox_MouseDown;
            PictureBox.MouseUp               += PictureBox_MouseUp;
            PictureBox.MouseMove             += PictureBox_MouseMove;
            numericButtonX.ValueChanged      += UpdateRectangle;
            numericButtonY.ValueChanged      += UpdateRectangle;
            numericButtonWidth.ValueChanged  += UpdateRectangle;
            numericButtonHeight.ValueChanged += UpdateRectangle;
            listView1.SelectedIndexChanged   += UpdateRectangle;
        }
예제 #19
0
        // -------------------------------------------------------------------
        // LoadPicture
        // -------------------------------------------------------------------

        public void LoadPicture(PictureBox pb, SystemGraphic graphic)
        {
            pb.Image = graphic.LoadImage();
            pb.Size  = new Size((int)(pb.Image.Width * WANOK.RELATION_SIZE), (int)(pb.Image.Height * WANOK.RELATION_SIZE));
        }
예제 #20
0
            // -------------------------------------------------------------------
            // Constructors
            // -------------------------------------------------------------------

            public SystemEventPage() : this(SystemGraphic.GetDefaultEventGraphic(), DrawType.None, new PageOptions(), EventTrigger.ActionButton, new EventCommandConditions(), GetDefaultTreeCommands())
            {
            }
예제 #21
0
        // -------------------------------------------------------------------
        // Constructor
        // -------------------------------------------------------------------

        public DialogPreviewGraphic(SystemGraphic graphic, OptionsKind optionsKind, SystemGraphic graphicTileset = null)
        {
            InitializeComponent();

            GraphicTileset = graphicTileset;

            // Control
            Control = new DialogPreviewGraphicControl(graphic.CreateCopy());

            Text = graphic.GraphicKind.ToString() + " graphic preview";

            // list
            listView1.Select();
            listView1.HeaderStyle = ColumnHeaderStyle.None;
            ColumnHeader header = new ColumnHeader();

            header.Text = "";
            header.Name = "";
            listView1.Columns.Add(header);
            listView1.Columns[0].Width  = listView1.Size.Width - 4;
            listView1.Items[0].Selected = true;

            List <string> LocalFiles = Control.GetLocalFiles();
            List <string> RTPFiles   = Control.GetRTPFiles();

            for (int i = 0; i < LocalFiles.Count; i++)
            {
                listView1.Items.Add(Path.GetFileName(LocalFiles[i]), 0);
                if (!graphic.IsNone() && graphic.GraphicName == listView1.Items[i + 1].Text && !graphic.IsRTP)
                {
                    listView1.Items[i + 1].Selected = true;
                }
            }
            for (int i = LocalFiles.Count; i < LocalFiles.Count + RTPFiles.Count; i++)
            {
                listView1.Items.Add(Path.GetFileName(RTPFiles[i - LocalFiles.Count]), 1);
                if (!graphic.IsNone() && graphic.GraphicName == listView1.Items[i + 1].Text && graphic.IsRTP)
                {
                    listView1.Items[i + 1].Selected = true;
                }
            }

            // Picture
            PictureBox.SizeMode          = PictureBoxSizeMode.StretchImage;
            PictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
            PictureBox.BackColor         = WANOK.COLOR_BACKGROUND_PREVIEW_IMAGE;
            //panelPicture.Controls.Add(PictureBox);
            TilesetPictureBox.SizeMode          = PictureBoxSizeMode.StretchImage;
            TilesetPictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
            TilesetPictureBox.LoadTexture(graphicTileset == null ? new SystemGraphic(GraphicKind.Tileset) : graphicTileset, WANOK.RELATION_SIZE);
            TilesetPictureBox.BackColor = WANOK.COLOR_BACKGROUND_PREVIEW_IMAGE;
            if (graphic.IsTileset())
            {
                TilesetPictureBox.SetCurrentTexture((int)graphic.Options[0] * WANOK.BASIC_SQUARE_SIZE, (int)graphic.Options[1] * WANOK.BASIC_SQUARE_SIZE, (int)graphic.Options[2], (int)graphic.Options[3]);
            }
            else
            {
                TilesetPictureBox.SetCurrentTexture(0, 0, 1, 1);
            }

            // Zoom
            trackBarZoom.Minimum = -ZoomTime;
            trackBarZoom.Maximum = ZoomTime;

            // Paint groupBox
            groupBox1.Paint += MainForm.PaintBorderGroupBox;

            // Events
            AddEvent();
        }