Inheritance: MonoBehaviour
コード例 #1
0
        public MapEditor(Map map)
        {
            Map = map;

            camera = new Camera(map, new Vector2(0, 0), new Viewport(0, 0, (int)map.Game.InternalSize.Width, (int)map.Game.InternalSize.Height))
            {
                CanOverrideLimits = true
            };
            MapSectionContainers = new Dictionary <int, MapSectionContainer>();
            cursorPosition       = new EditorLabel(map)
            {
                IsVisible = true,
                Position  = new Vector2(8, 256),
                Color     = Color.White,
                Text      = "0;0"
            };
            frame       = new Box(map.Game, new Rectangle(0, 0, (int)map.Game.InternalSize.Width, (int)map.Game.InternalSize.Height), Color.BlueViolet);
            gridTexture = map.Game.Content.Load <Texture2D>("EngineGraphics/Editor/grid");

            foreach (var section in map.Sections)
            {
                MapSectionContainers[section.Key] = new MapSectionContainer(map, this, section.Key, section.Value.Bounds);
            }

            Cursor = new Cursor(map, camera);
        }
コード例 #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                // Create our editor label
                EditorLabel label = new EditorLabel(Globals.Game, cbFontType.Text + cbFontSize.Text, RenderWindow);
                label.Text = tbText.Text;
                label.Name = "lb" + tbText.Text.TrimStart(' ').Trim();

                // init it
                label.Initialize();

                // Add it to our scene
                Globals.ObjectAdded.Invoke(label);

                // Select it
                Globals.ObjectSelected.Invoke(label);

                Globals.IsDialogWindowOpen = false;

                // Close the dialog window
                Close();
            }
            catch (Exception er)
            {
                throw new Exception(er.Message);
            }
        }
コード例 #3
0
        public MapSectionContainer(Map map, MapEditor editor, int index, Rectangle bounds)
        {
            Map         = map;
            Index       = index;
            this.editor = editor;
            this.bounds = bounds;

            previousSectionPosition = new Point(0, 0);

            box       = new Box(map.Game, bounds, Color.Ivory);
            preview   = new MapSectionPreview(this);
            sizeLabel = new EditorLabel(map)
            {
                Text     = "64x128",
                Color    = Color.White,
                Position = box.Bounds.Location.ToVector2()
            };
            positionLabel = new EditorLabel(map)
            {
                Text     = "64x128",
                Color    = Color.White,
                Position = box.Bounds.Location.ToVector2()
            };
        }
コード例 #4
0
 protected override void AddControls(List<Control> controls)
 {
     this._label = new Label();
     this._label.BackColor = Color.Transparent;
     this._label.ForeColor = base.ActionPanel.LabelForeColor;
     this._label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
     this._label.UseMnemonic = false;
     this._readOnlyTextBoxLabel = new EditorLabel();
     this._readOnlyTextBoxLabel.BackColor = Color.Transparent;
     this._readOnlyTextBoxLabel.ForeColor = base.ActionPanel.LabelForeColor;
     this._readOnlyTextBoxLabel.TabStop = true;
     this._readOnlyTextBoxLabel.TextAlign = System.Drawing.ContentAlignment.TopLeft;
     this._readOnlyTextBoxLabel.UseMnemonic = false;
     this._readOnlyTextBoxLabel.Visible = false;
     this._readOnlyTextBoxLabel.MouseClick += new MouseEventHandler(this.OnReadOnlyTextBoxLabelClick);
     this._readOnlyTextBoxLabel.Enter += new EventHandler(this.OnReadOnlyTextBoxLabelEnter);
     this._readOnlyTextBoxLabel.Leave += new EventHandler(this.OnReadOnlyTextBoxLabelLeave);
     this._readOnlyTextBoxLabel.KeyDown += new KeyEventHandler(this.OnReadOnlyTextBoxLabelKeyDown);
     this._textBox = new System.Windows.Forms.TextBox();
     this._textBox.BorderStyle = BorderStyle.None;
     this._textBox.TextAlign = HorizontalAlignment.Left;
     this._textBox.Visible = false;
     this._textBox.TextChanged += new EventHandler(this.OnTextBoxTextChanged);
     this._textBox.KeyDown += new KeyEventHandler(this.OnTextBoxKeyDown);
     this._textBox.LostFocus += new EventHandler(this.OnTextBoxLostFocus);
     controls.Add(this._readOnlyTextBoxLabel);
     controls.Add(this._textBox);
     controls.Add(this._label);
 }
コード例 #5
0
 public EditorLabelAccessibleObject(EditorLabel owner)
     : base(owner)
 {
 }