コード例 #1
0
        private void SelectColor(int code)
        {
            ColorDialog dialog = new ColorDialog();

            dialog.Color = TileBox.BackColor;
            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (code == 1)
            {
                TileBox.Color1 = dialog.Color;
            }
            else if (code == 2)
            {
                TileBox.Color2 = dialog.Color;
            }
            else if (code == 3)
            {
                TileBox.Color3 = dialog.Color;
            }

            UpdateButtonColors();
            TileBox.Refresh();
            UpdateTilePreview();
        }
コード例 #2
0
        public override AutoTile SaveWindowControls(StackPanel control, string name, Type type, object[] attributes)
        {
            int controlIndex = 0;

            controlIndex++;
            TileBox          lbxValue = (TileBox)control.Children[controlIndex];
            TileBoxViewModel mv       = (TileBoxViewModel)lbxValue.DataContext;

            return(mv.Tile);
        }
コード例 #3
0
        private void MenuBackColor_Click(object sender, EventArgs e)
        {
            ColorDialog dialog = new ColorDialog();

            dialog.Color = TileBox.BackColor;
            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            TileBox.BackColor = dialog.Color;
            TileBox.Refresh();
            UpdateTilePreview();
        }
コード例 #4
0
        private void UpdateTileDisplay()
        {
            int count = Tileset.Count - 1;

            if (count < 0)
            {
                count = 0;
            }

            LblTileIndex.Text = TileIndex.ToString() + " / " + count.ToString();

            if (TileIndex >= 0 && TileIndex < Tileset.Count)
            {
                TileBox.Tile = Tileset[TileIndex];
                TileBox.Refresh();
                UpdateTilePreview();
            }
        }
コード例 #5
0
        public override void LoadWindowControls(StackPanel control, string parent, string name, Type type, object[] attributes, AutoTile member)
        {
            LoadLabelControl(control, name);

            TileBox          cbxValue = new TileBox();
            TileBoxViewModel mv       = new TileBoxViewModel();

            cbxValue.DataContext = mv;

            //add lambda expression for editing a single element
            mv.OnEditItem += (AutoTile element, TileBoxViewModel.EditElementOp op) =>
            {
                TileEditForm      frmData = new TileEditForm();
                TileEditViewModel tmv     = new TileEditViewModel();
                frmData.DataContext = tmv;
                tmv.Name            = name + "/" + type.Name;

                //load as if eyedropping
                tmv.TileBrowser.TileSize = GraphicsManager.TileSize;
                tmv.LoadTile(element);

                tmv.SelectedOKEvent += () =>
                {
                    element = tmv.GetTile();
                    op(element);
                    frmData.Close();
                };
                tmv.SelectedCancelEvent += () =>
                {
                    frmData.Close();
                };

                control.GetOwningForm().RegisterChild(frmData);
                frmData.Show();
            };
            mv.LoadFromSource(member);
            control.Children.Add(cbxValue);
        }
コード例 #6
0
 private void BtnShiftDown_Click(object sender, EventArgs e)
 {
     TileBox.Tile.ShiftY(1);
     TileBox.Refresh();
     UpdateTilePreview();
 }
コード例 #7
0
 private void BtnFlipY_Click(object sender, EventArgs e)
 {
     TileBox.Tile.FlipY();
     TileBox.Refresh();
     UpdateTilePreview();
 }
コード例 #8
0
 private void BtnRotate_Click(object sender, EventArgs e)
 {
     TileBox.Tile.Rotate();
     TileBox.Refresh();
     UpdateTilePreview();
 }
コード例 #9
0
 private void BtnSwap_Click(object sender, EventArgs e)
 {
     TileBox.Tile.Swap();
     TileBox.Refresh();
     UpdateTilePreview();
 }
コード例 #10
0
 private void BtnFill_Click(object sender, EventArgs e)
 {
     TileBox.Tile.Fill(TileBox.ColorCode);
     TileBox.Refresh();
     UpdateTilePreview();
 }
コード例 #11
0
 private void BtnClear_Click(object sender, EventArgs e)
 {
     TileBox.Tile.Clear();
     TileBox.Refresh();
     UpdateTilePreview();
 }
コード例 #12
0
 private void MenuShowColorIndexes_Click(object sender, EventArgs e)
 {
     TileBox.ShowCodes = MenuShowColorIndexes.Checked;
     TileBox.Refresh();
     UpdateTilePreview();
 }
コード例 #13
0
 private void MenuShowGrid_Click(object sender, EventArgs e)
 {
     TileBox.ShowGrid = MenuShowGrid.Checked;
     TileBox.Refresh();
     UpdateTilePreview();
 }