public LevelEditor()
 {
     InitializeComponent();
     tpi   = new Bitmap(TilePanel.Width, TilePanel.Height);
     bmp   = new Bitmap(TilePanel.Width, TilePanel.Height);
     area  = new Bitmap(GameArea.Width, GameArea.Height);
     br    = new SolidBrush(GameArea.BackColor);
     tv    = new sbyte[Map.MW + 8, Map.MH + 8];
     paths = new sbyte[Config.MPC, Config.MPL];
     for (int i = 0; i < Config.MPC; i++)
     {
         for (int j = 0; j < Config.MPL; j++)
         {
             paths[i, j] = -1;
         }
     }
     map              = new sbyte[Config.MLMAX];
     sf               = new StringFormat();
     sf.Alignment     = StringAlignment.Center;
     sf.LineAlignment = StringAlignment.Center;
     MD               = false;
     obj              = new Object();
     pea              = new PaintEventArgs(TilePanel.CreateGraphics(), TilePanel.ClientRectangle);
     gpea             = new PaintEventArgs(GameArea.CreateGraphics(), GameArea.ClientRectangle);
     hb               = new HatchBrush(HatchStyle.LargeConfetti, Color.DimGray, Color.Black);
     hb2              = new HatchBrush(HatchStyle.SmallConfetti, Color.DarkRed, Color.Black);
     ti               = 0; pap = 0; pc = 0;
     WaveFile         = String.Empty;
 }
Exemple #2
0
        private void InitializeComponent()
        {
            Title        = "Open a file";
            WindowState  = ControlState.Normal;
            Width        = 40;
            OnActivated += OpenFileWindowActivated;

            stackPanel1 = new StackPanel(Orientation.Vertical)
            {
                Margin = new Thickness(1, 1, 1, 0),
            };
            label1 = new Label("Select a file for open");
            stackPanel1.AddContent(label1);
            listBox1 = new ListBox <string>()
            {
                Height = 9,
            };
            listBox1.OnSelectedIndexChanged += ListBoxSelectedIndexChanged;
            stackPanel1.AddContent(listBox1);

            tilePanel1 = new TilePanel
            {
                Tile       = '─',
                Background = this.Background,
                Foreground = this.Foreground,
                Height     = 1,
            };
            stackPanel1.AddContent(tilePanel1);
            dockPanel1 = new DockPanel()
            {
                Margin   = new Thickness(2, 0),
                AutoSize = true,
            };
            stackPanel1.AddContent(dockPanel1);

            button2 = new Button("Cancel")
            {
                Margin       = new Thickness(1, 0, 0, 0),
                DialogResult = DialogResult.Cancel,
            };
            dockPanel1.AddContent(button2, Dock.Right);

            button1 = new Button("Open")
            {
                DialogResult = DialogResult.OK,
                Width        = 10,
                TabIndex     = 1,
                IsDisabled   = true,
            };
            dockPanel1.AddContent(button1, Dock.Right);

            AddContent(stackPanel1);
        }
Exemple #3
0
    public void InitTileButton(string tileType, TilePanel panel)
    {
        selectedTileType = tileType;
        tilePanel        = panel;

        ChangeText("");

        transform.GetComponent <Image>().sprite = Globals.GetSprite(FilePath.TileSetAtlas, tileType);

        /*
         */
    }
        public void CreateNewMap(int row, int column)
        {
            if (Controls.Contains(mapPanel))
            {
                Controls.Remove(mapPanel);
                mapPanel.Dispose();
            }

            Controller.CreateNewMap(row, column);

            mapPanel              = new TableLayoutPanel();
            mapPanel.AutoSize     = true;
            mapPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            mapPanel.MaximumSize  = new Size(3000, 800);
            mapPanel.AutoScroll   = true;

            this.mapPanel.ColumnCount = column;

            /*for (int i = 0; i < column; i++)
             * {
             *  //mapPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 88F));
             * }*/
            this.mapPanel.Location = new System.Drawing.Point(124, 27);
            this.mapPanel.Name     = "mapPanel";
            this.mapPanel.RowCount = row;

            /*for (int i = 0; i < row; i++)
             * {
             *  //mapPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
             * }*/
            this.mapPanel.Size     = new System.Drawing.Size(485, 393);
            this.mapPanel.TabIndex = 2;

            for (int x = 0; x < row; x++)
            {
                for (int y = 0; y < column; y++)
                {
                    TilePanel t = new TilePanel(x, y, this);
                    t.Margin = new Padding(0);
                    mapPanel.Controls.Add(t);
                }
            }

            Controls.Add(mapPanel);
            Refresh();
        }
        private void InitializeComponent()
        {
            panel1 = new Panel
            {
                VerticalContentAlignment   = VerticalAlignment.Center,
                HorizontalContentAlignment = HorizontalAlignment.Center,
            };

            var grid = new Grid
            {
                Parent = panel1,
                Width  = 70,
                Margin = new Thickness(0, 1),
            };

            grid.RowDefinitions.Add(new RowDefinition(SizeType.Absolute, 3));
            grid.RowDefinitions.Add(new RowDefinition(SizeType.AutoSize));

            grid.ColumnDefinitions.Add(new ColumnDefinition(SizeType.Percent, 60));
            grid.ColumnDefinitions.Add(new ColumnDefinition(SizeType.Percent, 40));

            var lb1 = new Label
            {
                WordWrap = true,
                Text     = "TilePanel defines the char tiling element. It hasn't any child components, but you can tiling by char for macking specific user interfaces",
            };

            grid.AddContent(lb1, 0, 0, 2);

            targetPanel = new TilePanel('░')
            {
                Background = Color.DarkMagenta,
                Foreground = Color.Cyan,
            };

            grid.AddContent(targetPanel, 0, 1);

            descriptionLabel = new Label("Let's check how to work Tile property")
            {
                Margin   = new Thickness(1, 0, 0, 0),
                WordWrap = true,
            };
            grid.AddContent(descriptionLabel, 1, 1);
        }
Exemple #6
0
        private void HaEditor_Load(object sender, EventArgs e)
        {
            // This has to be here and not in .ctor for some reason, otherwise subwindows are not locating properly
            tilePanel = new TilePanel(hcsm)
            {
                Enabled = false
            };
            objPanel = new ObjPanel(hcsm)
            {
                Enabled = false
            };
            lifePanel = new LifePanel(hcsm)
            {
                Enabled = false
            };
            portalPanel = new PortalPanel(hcsm)
            {
                Enabled = false
            };
            bgPanel = new BackgroundPanel(hcsm)
            {
                Enabled = false
            };
            commonPanel = new CommonPanel(hcsm)
            {
                Enabled = false
            };

            List <DockContent> dockContents = new List <DockContent> {
                tilePanel, objPanel, lifePanel, portalPanel, bgPanel, commonPanel
            };

            dockContents.ForEach(x => x.Show(dockPanel));
            dockContents.ForEach(x => x.DockState = DockState.DockRight);
            dockContents.ForEach(x => x.DockAreas = DockAreas.DockRight);
            commonPanel.Pane = bgPanel.Pane = portalPanel.Pane = lifePanel.Pane = objPanel.Pane = tilePanel.Pane;

            if (!hcsm.backupMan.AttemptRestore())
            {
                hcsm.LoadMap(new Load(multiBoard, tabs, hcsm.MakeRightClickHandler()));
            }
        }
        private void InitializeComponent()
        {
            panel1 = new Panel()
            {
                HorizontalContentAlignment = HorizontalAlignment.Center,
                VerticalContentAlignment   = VerticalAlignment.Center,
                AutoSize = false,
            };

            tilePanel = new TilePanel()
            {
                Width      = 45,
                Height     = 15,
                Background = Color.Black,
                Foreground = Color.Magenta,
                Tile       = '░',
            };
            tilePanel.OnPaint += CanvasPaint;
            panel1.AddContent(tilePanel);

            AddContent(panel1);
        }
Exemple #8
0
        private void InitializeComponent()
        {
            Title        = Consts.SavingHeader;
            WindowState  = ControlState.Normal;
            Width        = 40;
            OnActivated += SaveFileWindowActivated;

            stackPanel1 = new StackPanel(Orientation.Vertical)
            {
                Margin = new Thickness(1, 1, 1, 0),
            };
            label1 = new Label("Previously saved files");
            stackPanel1.AddContent(label1);

            listBox1 = new ListBox <string>()
            {
                Height = 6,
            };
            listBox1.OnSelectedItemClick += ListBoxSelectedItemClick;
            stackPanel1.AddContent(listBox1);

            label2 = new Label("Target file name")
            {
                Margin = new Thickness(0, 1, 0, 0)
            };
            stackPanel1.AddContent(label2);

            textBox1 = new TextBox();
            textBox1.OnTextChanged += TextBox1Changed;
            stackPanel1.AddContent(textBox1);

            tilePanel1 = new TilePanel
            {
                Tile       = '─',
                Background = this.Background,
                Foreground = this.Foreground,
                Height     = 1,
            };
            stackPanel1.AddContent(tilePanel1);

            dockPanel1 = new DockPanel()
            {
                Margin   = new Thickness(2, 0),
                AutoSize = true,
            };
            stackPanel1.AddContent(dockPanel1);

            button2 = new Button("Cancel")
            {
                Margin       = new Thickness(1, 0, 0, 0),
                DialogResult = DialogResult.Cancel,
            };
            dockPanel1.AddContent(button2, Dock.Right);

            button1 = new Button("Save")
            {
                DialogResult = DialogResult.OK,
                Width        = 10,
                TabIndex     = 1,
                IsDisabled   = true,
            };
            dockPanel1.AddContent(button1, Dock.Right);

            AddContent(stackPanel1);
        }
 public void SetTilePanel(TilePanel tp)
 {
     this.tilePanel = tp;
 }
        private void InitializeComponent()
        {
            Title         = "Select maze dimension";
            Width         = 45;
            OnKeyPressed += KeyPressed;

            stackPanel1 = new StackPanel(Orientation.Vertical);
            AddContent(stackPanel1);

            stackPanel2 = new StackPanel(Orientation.Vertical)
            {
                Padding = new Thickness(2, 1),
            };
            stackPanel1.AddContent(stackPanel2);

            label1 = new Label("Select the dimension of the created maze map from the list below")
            {
                Margin   = new Thickness(0, 0, 0, 1),
                WordWrap = true,
            };
            stackPanel2.AddContent(label1);

            radioButton1 = new RadioButton("45 x 15")
            {
                Checked = true,
                Margin  = new Thickness(5, 0, 0, 0),
                Tag     = new Size(45, 15),
            };
            stackPanel2.AddContent(radioButton1);

            radioButton2 = new RadioButton("59 x 21")
            {
                Margin = new Thickness(5, 0, 0, 0),
                Tag    = new Size(59, 21),
            };
            stackPanel2.AddContent(radioButton2);

            radioButton3 = new RadioButton("119 x 27")
            {
                Margin = new Thickness(5, 0, 0, 0),
                Tag    = new Size(119, 27),
            };
            stackPanel2.AddContent(radioButton3);

            tilePanel1 = new TilePanel
            {
                Tile       = '─',
                Background = this.Background,
                Foreground = this.Foreground,
                Height     = 1,
            };
            stackPanel1.AddContent(tilePanel1);

            dockPanel1 = new DockPanel()
            {
                Margin   = new Thickness(2, 0),
                AutoSize = true,
            };
            stackPanel1.AddContent(dockPanel1);

            button2 = new Button("Cancel")
            {
                Margin       = new Thickness(1, 0, 0, 0),
                DialogResult = DialogResult.Cancel,
            };
            dockPanel1.AddContent(button2, Dock.Right);

            button1 = new Button("OK")
            {
                DialogResult = DialogResult.OK,
                Width        = 10,
                TabIndex     = 1,
            };
            dockPanel1.AddContent(button1, Dock.Right);
        }
 // Use this for initialization
 void Start()
 {
     panel = transform.parent.GetComponent <TilePanel>();
 }
Exemple #12
0
 private void Start()
 {
     _gridMap    = GridMap.Instance;
     _tilePanel  = TilePanel.Instance;
     _mainCamera = Camera.main;
 }