Example #1
0
        private void Item_SelectionRangeChanged(object sender, unvell.ReoGrid.Events.RangeEventArgs e)
        {
            if (e == null)
            {
                return;
            }
            var cellLine = e.Range.StartPos.Row;

            if (Editing != null)
            {
                string local;
                if (Editing.Data == null)
                {
                    local = "";
                }
                else
                {
                    local = Editing.Data.ToString();
                }

                if (local != lastMainEdtiorText)
                {
                    mainEditor.Text = local;
                }
            }

            if (Editing != null && !IsCurrentPackageSteamWorkshop)
            {
                reoGridControl2.CurrentWorksheet[Editing.Position] = GetClear(mainEditor.Text);
                reoGridControl2.CurrentWorksheet.Cells[Editing.Position].Style.TextWrap = TextWrapMode.WordBreak;
                reoGridControl2.CurrentWorksheet.AutoFitRowHeight(Editing.Position.Row, false);
                reoGridControl2.CurrentWorksheet.SetRowsHeight(Editing.Position.Row, 1, 20);
                mainEditor.Text = "";
                Editing         = null;
            }
            var nameSheet = reoGridControl2.CurrentWorksheet.Name;

            for (int i = 0; i < 25; i++)
            {
                if (reoGridControl2.CurrentWorksheet[0, i] == null)
                {
                    continue;
                }
                var name    = reoGridControl2.CurrentWorksheet[0, i].ToString().ToLower();
                var current = reoGridControl2.CurrentWorksheet[cellLine, i];

                if (cellLine == 0)
                {
                    return;
                }

                if (current == null)
                {
                    if ((nameSheet == "Card" && name == "code") || (nameSheet == "Character" && name == "fieldcode"))
                    {
                        Editing = reoGridControl2.CurrentWorksheet.Cells[cellLine, i];
                    }

                    if (nameSheet == "Card")
                    {
                        switch (name)
                        {
                        case "id":
                            if (EdLib.HasFile(EdLib.path_AppData + "\\icon.png") && lastPicture != EdLib.path_AppData + "\\icon.png")
                            {
                                Image image = System.Drawing.Image.FromFile(EdLib.path_AppData + "\\icon.png");
                                pictureBox1.Image = image;
                                lastPicture       = EdLib.path_AppData + "\\icon.png";
                            }
                            break;

                        case "displayname":
                            label4.Text = "无名称";
                            break;

                        case "description":
                            label5.Text = "无描述";
                            break;

                        case "energyreq":
                            label6.Text = "0";
                            break;

                        case "range":
                            label7.Text = "0";
                            break;

                        case "code":
                            mainEditor.Text = "";
                            break;

                        case "spreadradius":
                            label8.Text = "0";
                            break;

                        case "backgroundid":
                            var pos2 = Form1.GetPath("{game}\\TetraProject_Data\\StreamingAssets\\Packages\\Builtin\\CardBackground\\5\\Card.png");
                            if (EdLib.HasFile(pos2, false) && lastPictureBG != pos2)
                            {
                                lastPictureBG = pos2;
                                Image image = System.Drawing.Image.FromFile(pos2);
                                pictureBox3.Image = image;
                            }
                            break;
                        }
                    }
                    if (nameSheet == "Character")
                    {
                        switch (name)
                        {
                        case "fieldcode":
                            mainEditor.Text = "";
                            break;

                        case "id":
                            if (EdLib.HasFile(EdLib.path_AppData + "\\icon.png") && lastASE != EdLib.path_AppData + "\\icon.png")
                            {
                                Image image = System.Drawing.Image.FromFile(EdLib.path_AppData + "\\icon.png");
                                pictureBox4.Image = image;
                                lastASE           = EdLib.path_AppData + "\\icon.png";
                            }
                            break;
                        }
                    }

                    continue;
                }
                if (nameSheet == "Card")
                {
                    switch (name)
                    {
                    case "id":
                        var pos = Form1.GetPath(Form1.path_CurrentPackage) + "\\CardArt\\" + current.ToString().Trim() + ".png";
                        if (EdLib.HasFile(pos, false) && lastPicture != pos)
                        {
                            lastPicture = pos;
                            Image image = System.Drawing.Image.FromFile(pos);
                            pictureBox1.Image = image;
                        }
                        else if (EdLib.HasFile(EdLib.path_AppData + "\\icon.png") && lastPicture != EdLib.path_AppData + "\\icon.png")
                        {
                            Image image = System.Drawing.Image.FromFile(EdLib.path_AppData + "\\icon.png");
                            pictureBox1.Image = image;
                            lastPicture       = EdLib.path_AppData + "\\icon.png";
                        }
                        break;

                    case "displayname":
                        label4.Text = current.ToString().Trim();
                        break;

                    case "description":
                        label5.Text = current.ToString().Trim();
                        break;

                    case "energyreq":
                        label6.Text = current.ToString().Trim();
                        break;

                    case "range":
                        label7.Text = current.ToString().Trim();
                        break;

                    case "code":

                        Editing = reoGridControl2.CurrentWorksheet.Cells[cellLine, i];
                        OptimizeVision(current.ToString());
                        lastMainEdtiorText = Editing.Data.ToString();
                        break;

                    case "spreadradius":
                        label8.Text = current.ToString().Trim();
                        break;

                    case "backgroundid":
                        var pos2 = Form1.GetPath("{game}\\TetraProject_Data\\StreamingAssets\\Packages\\Builtin\\CardBackground\\" + current.ToString().Trim() + "\\Card.png");
                        if (EdLib.HasFile(pos2, false) && lastPictureBG != pos2)
                        {
                            lastPictureBG = pos2;
                            Image image = System.Drawing.Image.FromFile(pos2);
                            //pictureBox2.Image = ZoomImage(new Bitmap(image), -25,-25);
                            pictureBox3.Image = image;
                            // pictureBox3.BackgroundImageLayout = ImageLayout.Stretch;
                            //pictureBox3.SizeMode = PictureBoxSizeMode.Zoom;
                        }
                        var pos3 = Form1.GetPath("{game}\\TetraProject_Data\\StreamingAssets\\Packages\\Builtin\\CardBackground\\" + current.ToString().Trim() + "\\CardGlow.png");
                        if (EdLib.HasFile(pos3, false) && lastPictureBG2 != pos3)
                        {
                            lastPictureBG2 = pos3;
                            Image image = System.Drawing.Image.FromFile(pos3);
                            //pictureBox2.Image = ZoomImage(new Bitmap(image), -25,-25);
                            //pictureBox2.Image = image;
                            //pictureBox2.BackgroundImageLayout = ImageLayout.Stretch;
                            //pictureBox2.SizeMode = PictureBoxSizeMode.Zoom;
                        }
                        break;
                    }
                }
                if (nameSheet == "Character")
                {
                    switch (name)
                    {
                    case "id":
                        var pos = Form1.GetPath(Form1.path_CurrentPackage) + "\\CharacterModel\\" + current.ToString().Trim() + ".ase";

                        if (EdLib.HasFile(pos, false) && lastASE != pos)
                        {
                            lastASE = pos;
                            var bytes = System.IO.File.ReadAllBytes(pos);
                            var ase   = Aseprite.ASEParser.Parse(bytes);
                            if (ase == null)
                            {
                                break;
                            }
                            var image = EdLib.GetImageFromAseCel(ase);
                            if (image != null)
                            {
                                pictureBox4.Image = image;
                            }
                            //pictureBox4.BackgroundImageLayout = ImageLayout.Stretch;
                            //pictureBox4.SizeMode = PictureBoxSizeMode.Zoom;
                        }
                        break;

                    case "fieldcode":

                        Editing = reoGridControl2.CurrentWorksheet.Cells[cellLine, i];

                        OptimizeVision(current.ToString());
                        lastMainEdtiorText = Editing.Data.ToString();

                        break;

                    default:
                        break;
                    }
                }
            }

            //Text = e.Cell.Data.ToString();
        }
Example #2
0
 private void CurrentWorksheet_SelectionRangeChanged(object sender, unvell.ReoGrid.Events.RangeEventArgs e)
 {
     FunctionBar = (sender as Worksheet).GetCellData(e.Range.StartPos)?.ToString();
     NotifyOfPropertyChange("FunctionBar");
 }
Example #3
0
 private void CurrentWorksheet_SelectionRangeChanging(object sender, unvell.ReoGrid.Events.RangeEventArgs e)
 {
     Console.WriteLine("SelectionRangeChanging");
 }
 private void worksheet_SelectionRangeChanged(object sender, unvell.ReoGrid.Events.RangeEventArgs e)
 {
     this.RefreshTextBoxes();
 }