重构
This commit is contained in:
@@ -20,34 +20,20 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Debug|x64 = Debug|x64
|
Debug|x64 = Debug|x64
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
Release|x64 = Release|x64
|
Release|x64 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{ECD11621-9F72-4BCB-92A4-7D8A426F84FA}.Debug|Any CPU.ActiveCfg = Debug|x64
|
|
||||||
{ECD11621-9F72-4BCB-92A4-7D8A426F84FA}.Debug|Any CPU.Build.0 = Debug|x64
|
|
||||||
{ECD11621-9F72-4BCB-92A4-7D8A426F84FA}.Debug|x64.ActiveCfg = Debug|x64
|
{ECD11621-9F72-4BCB-92A4-7D8A426F84FA}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{ECD11621-9F72-4BCB-92A4-7D8A426F84FA}.Debug|x64.Build.0 = Debug|x64
|
{ECD11621-9F72-4BCB-92A4-7D8A426F84FA}.Debug|x64.Build.0 = Debug|x64
|
||||||
{ECD11621-9F72-4BCB-92A4-7D8A426F84FA}.Release|Any CPU.ActiveCfg = Release|x64
|
|
||||||
{ECD11621-9F72-4BCB-92A4-7D8A426F84FA}.Release|Any CPU.Build.0 = Release|x64
|
|
||||||
{ECD11621-9F72-4BCB-92A4-7D8A426F84FA}.Release|x64.ActiveCfg = Release|x64
|
{ECD11621-9F72-4BCB-92A4-7D8A426F84FA}.Release|x64.ActiveCfg = Release|x64
|
||||||
{ECD11621-9F72-4BCB-92A4-7D8A426F84FA}.Release|x64.Build.0 = Release|x64
|
{ECD11621-9F72-4BCB-92A4-7D8A426F84FA}.Release|x64.Build.0 = Release|x64
|
||||||
{CA964DA9-3649-44BC-84F7-B1108A652905}.Debug|Any CPU.ActiveCfg = Debug|x64
|
|
||||||
{CA964DA9-3649-44BC-84F7-B1108A652905}.Debug|Any CPU.Build.0 = Debug|x64
|
|
||||||
{CA964DA9-3649-44BC-84F7-B1108A652905}.Debug|x64.ActiveCfg = Debug|x64
|
{CA964DA9-3649-44BC-84F7-B1108A652905}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{CA964DA9-3649-44BC-84F7-B1108A652905}.Debug|x64.Build.0 = Debug|x64
|
{CA964DA9-3649-44BC-84F7-B1108A652905}.Debug|x64.Build.0 = Debug|x64
|
||||||
{CA964DA9-3649-44BC-84F7-B1108A652905}.Release|Any CPU.ActiveCfg = Release|x64
|
|
||||||
{CA964DA9-3649-44BC-84F7-B1108A652905}.Release|Any CPU.Build.0 = Release|x64
|
|
||||||
{CA964DA9-3649-44BC-84F7-B1108A652905}.Release|x64.ActiveCfg = Release|x64
|
{CA964DA9-3649-44BC-84F7-B1108A652905}.Release|x64.ActiveCfg = Release|x64
|
||||||
{CA964DA9-3649-44BC-84F7-B1108A652905}.Release|x64.Build.0 = Release|x64
|
{CA964DA9-3649-44BC-84F7-B1108A652905}.Release|x64.Build.0 = Release|x64
|
||||||
{ECF7297E-031B-4E37-8033-7C2345DB8766}.Debug|Any CPU.ActiveCfg = Debug|x64
|
|
||||||
{ECF7297E-031B-4E37-8033-7C2345DB8766}.Debug|Any CPU.Build.0 = Debug|x64
|
|
||||||
{ECF7297E-031B-4E37-8033-7C2345DB8766}.Debug|x64.ActiveCfg = Debug|x64
|
{ECF7297E-031B-4E37-8033-7C2345DB8766}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{ECF7297E-031B-4E37-8033-7C2345DB8766}.Debug|x64.Build.0 = Debug|x64
|
{ECF7297E-031B-4E37-8033-7C2345DB8766}.Debug|x64.Build.0 = Debug|x64
|
||||||
{ECF7297E-031B-4E37-8033-7C2345DB8766}.Release|Any CPU.ActiveCfg = Release|x64
|
|
||||||
{ECF7297E-031B-4E37-8033-7C2345DB8766}.Release|Any CPU.Build.0 = Release|x64
|
|
||||||
{ECF7297E-031B-4E37-8033-7C2345DB8766}.Release|x64.ActiveCfg = Release|x64
|
{ECF7297E-031B-4E37-8033-7C2345DB8766}.Release|x64.ActiveCfg = Release|x64
|
||||||
{ECF7297E-031B-4E37-8033-7C2345DB8766}.Release|x64.Build.0 = Release|x64
|
{ECF7297E-031B-4E37-8033-7C2345DB8766}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
|||||||
193
SpineViewer/src/ListViewSkel.Designer.cs
generated
Normal file
193
SpineViewer/src/ListViewSkel.Designer.cs
generated
Normal file
@@ -0,0 +1,193 @@
|
|||||||
|
namespace SpineViewer
|
||||||
|
{
|
||||||
|
partial class ListViewSkel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 必需的设计器变量。
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清理所有正在使用的资源。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 组件设计器生成的代码
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设计器支持所需的方法 - 不要修改
|
||||||
|
/// 使用代码编辑器修改此方法的内容。
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
tableLayoutPanel = new TableLayoutPanel();
|
||||||
|
flowLayoutPanel_Buttons = new FlowLayoutPanel();
|
||||||
|
button_Add = new Button();
|
||||||
|
button_Insert = new Button();
|
||||||
|
button_Remove = new Button();
|
||||||
|
button_MoveUp = new Button();
|
||||||
|
button_MoveDown = new Button();
|
||||||
|
listView = new ListView();
|
||||||
|
columnHeader_Name = new ColumnHeader();
|
||||||
|
columnHeader_Version = new ColumnHeader();
|
||||||
|
tableLayoutPanel.SuspendLayout();
|
||||||
|
flowLayoutPanel_Buttons.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// tableLayoutPanel
|
||||||
|
//
|
||||||
|
tableLayoutPanel.ColumnCount = 1;
|
||||||
|
tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
|
||||||
|
tableLayoutPanel.Controls.Add(flowLayoutPanel_Buttons, 0, 0);
|
||||||
|
tableLayoutPanel.Controls.Add(listView, 0, 1);
|
||||||
|
tableLayoutPanel.Dock = DockStyle.Fill;
|
||||||
|
tableLayoutPanel.Location = new Point(0, 0);
|
||||||
|
tableLayoutPanel.Margin = new Padding(0);
|
||||||
|
tableLayoutPanel.Name = "tableLayoutPanel";
|
||||||
|
tableLayoutPanel.RowCount = 2;
|
||||||
|
tableLayoutPanel.RowStyles.Add(new RowStyle());
|
||||||
|
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
|
||||||
|
tableLayoutPanel.Size = new Size(336, 445);
|
||||||
|
tableLayoutPanel.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// flowLayoutPanel_Buttons
|
||||||
|
//
|
||||||
|
flowLayoutPanel_Buttons.AutoSize = true;
|
||||||
|
flowLayoutPanel_Buttons.Controls.Add(button_Add);
|
||||||
|
flowLayoutPanel_Buttons.Controls.Add(button_Insert);
|
||||||
|
flowLayoutPanel_Buttons.Controls.Add(button_Remove);
|
||||||
|
flowLayoutPanel_Buttons.Controls.Add(button_MoveUp);
|
||||||
|
flowLayoutPanel_Buttons.Controls.Add(button_MoveDown);
|
||||||
|
flowLayoutPanel_Buttons.Dock = DockStyle.Fill;
|
||||||
|
flowLayoutPanel_Buttons.Location = new Point(3, 3);
|
||||||
|
flowLayoutPanel_Buttons.Name = "flowLayoutPanel_Buttons";
|
||||||
|
flowLayoutPanel_Buttons.Size = new Size(330, 40);
|
||||||
|
flowLayoutPanel_Buttons.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// button_Add
|
||||||
|
//
|
||||||
|
button_Add.Anchor = AnchorStyles.None;
|
||||||
|
button_Add.AutoSize = true;
|
||||||
|
button_Add.Location = new Point(3, 3);
|
||||||
|
button_Add.Name = "button_Add";
|
||||||
|
button_Add.Size = new Size(56, 34);
|
||||||
|
button_Add.TabIndex = 0;
|
||||||
|
button_Add.Text = "添加";
|
||||||
|
button_Add.UseVisualStyleBackColor = true;
|
||||||
|
button_Add.Click += button_Add_Click;
|
||||||
|
//
|
||||||
|
// button_Insert
|
||||||
|
//
|
||||||
|
button_Insert.Anchor = AnchorStyles.None;
|
||||||
|
button_Insert.AutoSize = true;
|
||||||
|
button_Insert.Enabled = false;
|
||||||
|
button_Insert.Location = new Point(65, 3);
|
||||||
|
button_Insert.Name = "button_Insert";
|
||||||
|
button_Insert.Size = new Size(56, 34);
|
||||||
|
button_Insert.TabIndex = 4;
|
||||||
|
button_Insert.Text = "插入";
|
||||||
|
button_Insert.UseVisualStyleBackColor = true;
|
||||||
|
button_Insert.Click += button_Insert_Click;
|
||||||
|
//
|
||||||
|
// button_Remove
|
||||||
|
//
|
||||||
|
button_Remove.Anchor = AnchorStyles.None;
|
||||||
|
button_Remove.AutoSize = true;
|
||||||
|
button_Remove.Enabled = false;
|
||||||
|
button_Remove.Location = new Point(127, 3);
|
||||||
|
button_Remove.Name = "button_Remove";
|
||||||
|
button_Remove.Size = new Size(56, 34);
|
||||||
|
button_Remove.TabIndex = 1;
|
||||||
|
button_Remove.Text = "移除";
|
||||||
|
button_Remove.UseVisualStyleBackColor = true;
|
||||||
|
button_Remove.Click += button_Remove_Click;
|
||||||
|
//
|
||||||
|
// button_MoveUp
|
||||||
|
//
|
||||||
|
button_MoveUp.Anchor = AnchorStyles.None;
|
||||||
|
button_MoveUp.AutoSize = true;
|
||||||
|
button_MoveUp.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
|
button_MoveUp.Enabled = false;
|
||||||
|
button_MoveUp.Location = new Point(189, 3);
|
||||||
|
button_MoveUp.Name = "button_MoveUp";
|
||||||
|
button_MoveUp.Size = new Size(56, 34);
|
||||||
|
button_MoveUp.TabIndex = 2;
|
||||||
|
button_MoveUp.Text = "上移";
|
||||||
|
button_MoveUp.UseVisualStyleBackColor = true;
|
||||||
|
button_MoveUp.Click += button_MoveUp_Click;
|
||||||
|
//
|
||||||
|
// button_MoveDown
|
||||||
|
//
|
||||||
|
button_MoveDown.Anchor = AnchorStyles.None;
|
||||||
|
button_MoveDown.AutoSize = true;
|
||||||
|
button_MoveDown.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
|
button_MoveDown.Enabled = false;
|
||||||
|
button_MoveDown.Location = new Point(251, 3);
|
||||||
|
button_MoveDown.Name = "button_MoveDown";
|
||||||
|
button_MoveDown.Size = new Size(56, 34);
|
||||||
|
button_MoveDown.TabIndex = 3;
|
||||||
|
button_MoveDown.Text = "下移";
|
||||||
|
button_MoveDown.UseVisualStyleBackColor = true;
|
||||||
|
button_MoveDown.Click += button_MoveDown_Click;
|
||||||
|
//
|
||||||
|
// listView
|
||||||
|
//
|
||||||
|
listView.Columns.AddRange(new ColumnHeader[] { columnHeader_Name, columnHeader_Version });
|
||||||
|
listView.Dock = DockStyle.Fill;
|
||||||
|
listView.FullRowSelect = true;
|
||||||
|
listView.GridLines = true;
|
||||||
|
listView.Location = new Point(3, 49);
|
||||||
|
listView.Name = "listView";
|
||||||
|
listView.ShowItemToolTips = true;
|
||||||
|
listView.Size = new Size(330, 393);
|
||||||
|
listView.TabIndex = 1;
|
||||||
|
listView.UseCompatibleStateImageBehavior = false;
|
||||||
|
listView.View = View.Details;
|
||||||
|
listView.SelectedIndexChanged += listView_SelectedIndexChanged;
|
||||||
|
//
|
||||||
|
// columnHeader_Name
|
||||||
|
//
|
||||||
|
columnHeader_Name.Text = "名称";
|
||||||
|
columnHeader_Name.Width = 150;
|
||||||
|
//
|
||||||
|
// columnHeader_Version
|
||||||
|
//
|
||||||
|
columnHeader_Version.Text = "版本";
|
||||||
|
columnHeader_Version.Width = 150;
|
||||||
|
//
|
||||||
|
// ListViewSkel
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(11F, 24F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(tableLayoutPanel);
|
||||||
|
Name = "ListViewSkel";
|
||||||
|
Size = new Size(336, 445);
|
||||||
|
tableLayoutPanel.ResumeLayout(false);
|
||||||
|
tableLayoutPanel.PerformLayout();
|
||||||
|
flowLayoutPanel_Buttons.ResumeLayout(false);
|
||||||
|
flowLayoutPanel_Buttons.PerformLayout();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private TableLayoutPanel tableLayoutPanel;
|
||||||
|
private FlowLayoutPanel flowLayoutPanel_Buttons;
|
||||||
|
private Button button_Insert;
|
||||||
|
private Button button_Remove;
|
||||||
|
private Button button_MoveUp;
|
||||||
|
private Button button_MoveDown;
|
||||||
|
private ListView listView;
|
||||||
|
private ColumnHeader columnHeader_Name;
|
||||||
|
private ColumnHeader columnHeader_Version;
|
||||||
|
private Button button_Add;
|
||||||
|
}
|
||||||
|
}
|
||||||
165
SpineViewer/src/ListViewSkel.cs
Normal file
165
SpineViewer/src/ListViewSkel.cs
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using SpineViewer.Spine;
|
||||||
|
using System.Reflection;
|
||||||
|
using SpineViewer.src;
|
||||||
|
|
||||||
|
namespace SpineViewer
|
||||||
|
{
|
||||||
|
public partial class ListViewSkel : UserControl
|
||||||
|
{
|
||||||
|
[Browsable(true), Category("自定义"), Description("用于显示骨骼属性的属性页")]
|
||||||
|
public PropertyGrid? PropertyGrid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Spine 列表
|
||||||
|
/// </summary>
|
||||||
|
[Browsable(false)]
|
||||||
|
public ReadOnlyCollection<Spine.Spine> Spines { get => spines.AsReadOnly(); }
|
||||||
|
private readonly List<Spine.Spine> spines = [];
|
||||||
|
|
||||||
|
public ListViewSkel()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 弹出添加对话框
|
||||||
|
/// </summary>
|
||||||
|
public void Add()
|
||||||
|
{
|
||||||
|
var dialog = new SkelSelectDialog();
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var spine = Spine.Spine.New(dialog.Version, dialog.SkelPath, dialog.AtlasPath);
|
||||||
|
spines.Add(spine);
|
||||||
|
listView.Items.Add(new ListViewItem([spine.Name, spine.Version.String()], -1) { ToolTipText = spine.SkelPath });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Program.Logger.Error(ex.ToString());
|
||||||
|
Program.Logger.Error($"Failed to load {dialog.SkelPath} {dialog.AtlasPath}");
|
||||||
|
MessageBox.Show(ex.ToString(), "骨骼加载失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 弹出批量添加对话框
|
||||||
|
/// </summary>
|
||||||
|
public void BatchAdd()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void button_Add_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Add();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void button_Insert_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listView.SelectedIndices.Count <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var index = listView.SelectedIndices[0];
|
||||||
|
var dialog = new SkelSelectDialog();
|
||||||
|
dialog.ShowDialog();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var spine = Spine.Spine.New(dialog.Version, dialog.SkelPath, dialog.AtlasPath);
|
||||||
|
spines.Insert(index, spine);
|
||||||
|
listView.Items.Insert(index, new ListViewItem([spine.Name, spine.Version.String()], -1) { ToolTipText = spine.SkelPath });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Program.Logger.Error(ex.ToString());
|
||||||
|
Program.Logger.Error($"Failed to load {dialog.SkelPath} {dialog.AtlasPath}");
|
||||||
|
MessageBox.Show(ex.ToString(), "骨骼加载失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void button_Remove_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listView.SelectedIndices.Count <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (var i in listView.SelectedIndices.Cast<int>().OrderByDescending(x => x))
|
||||||
|
{
|
||||||
|
spines.RemoveAt(i);
|
||||||
|
listView.Items.RemoveAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void button_MoveUp_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listView.SelectedIndices.Count <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var index = listView.SelectedIndices[0];
|
||||||
|
if (index > 0)
|
||||||
|
{
|
||||||
|
(spines[index - 1], spines[index]) = (spines[index], spines[index - 1]);
|
||||||
|
var item = listView.Items[index];
|
||||||
|
listView.Items.RemoveAt(index);
|
||||||
|
listView.Items.Insert(index - 1, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void button_MoveDown_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listView.SelectedIndices.Count <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var index = listView.SelectedIndices[0];
|
||||||
|
if (index < spines.Count - 1)
|
||||||
|
{
|
||||||
|
(spines[index], spines[index + 1]) = (spines[index + 1], spines[index]);
|
||||||
|
var item = listView.Items[index + 1];
|
||||||
|
listView.Items.RemoveAt(index + 1);
|
||||||
|
listView.Items.Insert(index, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void listView_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listView.SelectedIndices.Count <= 0)
|
||||||
|
{
|
||||||
|
button_Insert.Enabled = false;
|
||||||
|
button_Remove.Enabled = false;
|
||||||
|
button_MoveUp.Enabled = false;
|
||||||
|
button_MoveDown.Enabled = false;
|
||||||
|
if (PropertyGrid is not null)
|
||||||
|
PropertyGrid.SelectedObject = null;
|
||||||
|
}
|
||||||
|
else if (listView.SelectedIndices.Count <= 1)
|
||||||
|
{
|
||||||
|
button_Insert.Enabled = true;
|
||||||
|
button_Remove.Enabled = true;
|
||||||
|
button_MoveUp.Enabled = true;
|
||||||
|
button_MoveDown.Enabled = true;
|
||||||
|
if (PropertyGrid is not null)
|
||||||
|
PropertyGrid.SelectedObject = spines[listView.SelectedIndices[0]];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
button_Insert.Enabled = false;
|
||||||
|
button_Remove.Enabled = true;
|
||||||
|
button_MoveUp.Enabled = false;
|
||||||
|
button_MoveDown.Enabled = false;
|
||||||
|
if (PropertyGrid is not null)
|
||||||
|
PropertyGrid.SelectedObject = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
120
SpineViewer/src/ListViewSkel.resx
Normal file
120
SpineViewer/src/ListViewSkel.resx
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
157
SpineViewer/src/MainForm.Designer.cs
generated
157
SpineViewer/src/MainForm.Designer.cs
generated
@@ -29,7 +29,6 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
components = new System.ComponentModel.Container();
|
components = new System.ComponentModel.Container();
|
||||||
ListViewItem listViewItem1 = new ListViewItem(new string[] { "A Loooooooooog Name1", "A Loooooooooog Version" }, -1);
|
|
||||||
menuStrip = new MenuStrip();
|
menuStrip = new MenuStrip();
|
||||||
toolStripMenuItem_File = new ToolStripMenuItem();
|
toolStripMenuItem_File = new ToolStripMenuItem();
|
||||||
toolStripMenuItem_Open = new ToolStripMenuItem();
|
toolStripMenuItem_Open = new ToolStripMenuItem();
|
||||||
@@ -45,16 +44,7 @@
|
|||||||
splitContainer_Functional = new SplitContainer();
|
splitContainer_Functional = new SplitContainer();
|
||||||
splitContainer_Information = new SplitContainer();
|
splitContainer_Information = new SplitContainer();
|
||||||
groupBox_SkelList = new GroupBox();
|
groupBox_SkelList = new GroupBox();
|
||||||
tableLayoutPanel = new TableLayoutPanel();
|
listViewSkel = new ListViewSkel();
|
||||||
flowLayoutPanel_Buttons = new FlowLayoutPanel();
|
|
||||||
button_Add = new Button();
|
|
||||||
button_Insert = new Button();
|
|
||||||
button_Remove = new Button();
|
|
||||||
button_MoveUp = new Button();
|
|
||||||
button_MoveDown = new Button();
|
|
||||||
listView_SkelList = new ListView();
|
|
||||||
columnHeader_Name = new ColumnHeader();
|
|
||||||
columnHeader_Version = new ColumnHeader();
|
|
||||||
splitContainer_Config = new SplitContainer();
|
splitContainer_Config = new SplitContainer();
|
||||||
groupBox_SkelConfig = new GroupBox();
|
groupBox_SkelConfig = new GroupBox();
|
||||||
propertyGrid_Skel = new PropertyGrid();
|
propertyGrid_Skel = new PropertyGrid();
|
||||||
@@ -80,8 +70,6 @@
|
|||||||
splitContainer_Information.Panel2.SuspendLayout();
|
splitContainer_Information.Panel2.SuspendLayout();
|
||||||
splitContainer_Information.SuspendLayout();
|
splitContainer_Information.SuspendLayout();
|
||||||
groupBox_SkelList.SuspendLayout();
|
groupBox_SkelList.SuspendLayout();
|
||||||
tableLayoutPanel.SuspendLayout();
|
|
||||||
flowLayoutPanel_Buttons.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)splitContainer_Config).BeginInit();
|
((System.ComponentModel.ISupportInitialize)splitContainer_Config).BeginInit();
|
||||||
splitContainer_Config.Panel1.SuspendLayout();
|
splitContainer_Config.Panel1.SuspendLayout();
|
||||||
splitContainer_Config.Panel2.SuspendLayout();
|
splitContainer_Config.Panel2.SuspendLayout();
|
||||||
@@ -251,7 +239,7 @@
|
|||||||
//
|
//
|
||||||
// groupBox_SkelList
|
// groupBox_SkelList
|
||||||
//
|
//
|
||||||
groupBox_SkelList.Controls.Add(tableLayoutPanel);
|
groupBox_SkelList.Controls.Add(listViewSkel);
|
||||||
groupBox_SkelList.Dock = DockStyle.Fill;
|
groupBox_SkelList.Dock = DockStyle.Fill;
|
||||||
groupBox_SkelList.Location = new Point(0, 0);
|
groupBox_SkelList.Location = new Point(0, 0);
|
||||||
groupBox_SkelList.Name = "groupBox_SkelList";
|
groupBox_SkelList.Name = "groupBox_SkelList";
|
||||||
@@ -260,126 +248,14 @@
|
|||||||
groupBox_SkelList.TabStop = false;
|
groupBox_SkelList.TabStop = false;
|
||||||
groupBox_SkelList.Text = "模型列表";
|
groupBox_SkelList.Text = "模型列表";
|
||||||
//
|
//
|
||||||
// tableLayoutPanel
|
// listViewSkel
|
||||||
//
|
//
|
||||||
tableLayoutPanel.ColumnCount = 1;
|
listViewSkel.Dock = DockStyle.Fill;
|
||||||
tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
|
listViewSkel.Location = new Point(3, 26);
|
||||||
tableLayoutPanel.Controls.Add(flowLayoutPanel_Buttons, 0, 0);
|
listViewSkel.Name = "listViewSkel";
|
||||||
tableLayoutPanel.Controls.Add(listView_SkelList, 0, 1);
|
listViewSkel.PropertyGrid = propertyGrid_Skel;
|
||||||
tableLayoutPanel.Dock = DockStyle.Fill;
|
listViewSkel.Size = new Size(330, 703);
|
||||||
tableLayoutPanel.Location = new Point(3, 26);
|
listViewSkel.TabIndex = 0;
|
||||||
tableLayoutPanel.Name = "tableLayoutPanel";
|
|
||||||
tableLayoutPanel.RowCount = 2;
|
|
||||||
tableLayoutPanel.RowStyles.Add(new RowStyle());
|
|
||||||
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
|
|
||||||
tableLayoutPanel.Size = new Size(330, 703);
|
|
||||||
tableLayoutPanel.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// flowLayoutPanel_Buttons
|
|
||||||
//
|
|
||||||
flowLayoutPanel_Buttons.AutoSize = true;
|
|
||||||
flowLayoutPanel_Buttons.Controls.Add(button_Add);
|
|
||||||
flowLayoutPanel_Buttons.Controls.Add(button_Insert);
|
|
||||||
flowLayoutPanel_Buttons.Controls.Add(button_Remove);
|
|
||||||
flowLayoutPanel_Buttons.Controls.Add(button_MoveUp);
|
|
||||||
flowLayoutPanel_Buttons.Controls.Add(button_MoveDown);
|
|
||||||
flowLayoutPanel_Buttons.Dock = DockStyle.Fill;
|
|
||||||
flowLayoutPanel_Buttons.Location = new Point(3, 3);
|
|
||||||
flowLayoutPanel_Buttons.Name = "flowLayoutPanel_Buttons";
|
|
||||||
flowLayoutPanel_Buttons.Size = new Size(324, 40);
|
|
||||||
flowLayoutPanel_Buttons.TabIndex = 4;
|
|
||||||
//
|
|
||||||
// button_Add
|
|
||||||
//
|
|
||||||
button_Add.Anchor = AnchorStyles.None;
|
|
||||||
button_Add.AutoSize = true;
|
|
||||||
button_Add.Location = new Point(3, 3);
|
|
||||||
button_Add.Name = "button_Add";
|
|
||||||
button_Add.Size = new Size(56, 34);
|
|
||||||
button_Add.TabIndex = 0;
|
|
||||||
button_Add.Text = "添加";
|
|
||||||
button_Add.UseVisualStyleBackColor = true;
|
|
||||||
button_Add.Click += toolStripMenuItem_Open_Click;
|
|
||||||
//
|
|
||||||
// button_Insert
|
|
||||||
//
|
|
||||||
button_Insert.Anchor = AnchorStyles.None;
|
|
||||||
button_Insert.AutoSize = true;
|
|
||||||
button_Insert.Enabled = false;
|
|
||||||
button_Insert.Location = new Point(65, 3);
|
|
||||||
button_Insert.Name = "button_Insert";
|
|
||||||
button_Insert.Size = new Size(56, 34);
|
|
||||||
button_Insert.TabIndex = 4;
|
|
||||||
button_Insert.Text = "插入";
|
|
||||||
button_Insert.UseVisualStyleBackColor = true;
|
|
||||||
button_Insert.Click += button_Insert_Click;
|
|
||||||
//
|
|
||||||
// button_Remove
|
|
||||||
//
|
|
||||||
button_Remove.Anchor = AnchorStyles.None;
|
|
||||||
button_Remove.AutoSize = true;
|
|
||||||
button_Remove.Enabled = false;
|
|
||||||
button_Remove.Location = new Point(127, 3);
|
|
||||||
button_Remove.Name = "button_Remove";
|
|
||||||
button_Remove.Size = new Size(56, 34);
|
|
||||||
button_Remove.TabIndex = 1;
|
|
||||||
button_Remove.Text = "移除";
|
|
||||||
button_Remove.UseVisualStyleBackColor = true;
|
|
||||||
button_Remove.Click += button_Remove_Click;
|
|
||||||
//
|
|
||||||
// button_MoveUp
|
|
||||||
//
|
|
||||||
button_MoveUp.Anchor = AnchorStyles.None;
|
|
||||||
button_MoveUp.AutoSize = true;
|
|
||||||
button_MoveUp.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
|
||||||
button_MoveUp.Enabled = false;
|
|
||||||
button_MoveUp.Location = new Point(189, 3);
|
|
||||||
button_MoveUp.Name = "button_MoveUp";
|
|
||||||
button_MoveUp.Size = new Size(56, 34);
|
|
||||||
button_MoveUp.TabIndex = 2;
|
|
||||||
button_MoveUp.Text = "上移";
|
|
||||||
button_MoveUp.UseVisualStyleBackColor = true;
|
|
||||||
button_MoveUp.Click += button_MoveUp_Click;
|
|
||||||
//
|
|
||||||
// button_MoveDown
|
|
||||||
//
|
|
||||||
button_MoveDown.Anchor = AnchorStyles.None;
|
|
||||||
button_MoveDown.AutoSize = true;
|
|
||||||
button_MoveDown.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
|
||||||
button_MoveDown.Enabled = false;
|
|
||||||
button_MoveDown.Location = new Point(251, 3);
|
|
||||||
button_MoveDown.Name = "button_MoveDown";
|
|
||||||
button_MoveDown.Size = new Size(56, 34);
|
|
||||||
button_MoveDown.TabIndex = 3;
|
|
||||||
button_MoveDown.Text = "下移";
|
|
||||||
button_MoveDown.UseVisualStyleBackColor = true;
|
|
||||||
button_MoveDown.Click += button_MoveDown_Click;
|
|
||||||
//
|
|
||||||
// listView_SkelList
|
|
||||||
//
|
|
||||||
listView_SkelList.Columns.AddRange(new ColumnHeader[] { columnHeader_Name, columnHeader_Version });
|
|
||||||
listView_SkelList.Dock = DockStyle.Fill;
|
|
||||||
listView_SkelList.FullRowSelect = true;
|
|
||||||
listView_SkelList.GridLines = true;
|
|
||||||
listView_SkelList.Items.AddRange(new ListViewItem[] { listViewItem1 });
|
|
||||||
listView_SkelList.Location = new Point(3, 49);
|
|
||||||
listView_SkelList.Name = "listView_SkelList";
|
|
||||||
listView_SkelList.ShowItemToolTips = true;
|
|
||||||
listView_SkelList.Size = new Size(324, 651);
|
|
||||||
listView_SkelList.TabIndex = 1;
|
|
||||||
listView_SkelList.UseCompatibleStateImageBehavior = false;
|
|
||||||
listView_SkelList.View = View.Details;
|
|
||||||
listView_SkelList.SelectedIndexChanged += listView_SkelList_SelectedIndexChanged;
|
|
||||||
//
|
|
||||||
// columnHeader_Name
|
|
||||||
//
|
|
||||||
columnHeader_Name.Text = "名称";
|
|
||||||
columnHeader_Name.Width = 150;
|
|
||||||
//
|
|
||||||
// columnHeader_Version
|
|
||||||
//
|
|
||||||
columnHeader_Version.Text = "版本";
|
|
||||||
columnHeader_Version.Width = 150;
|
|
||||||
//
|
//
|
||||||
// splitContainer_Config
|
// splitContainer_Config
|
||||||
//
|
//
|
||||||
@@ -514,10 +390,6 @@
|
|||||||
((System.ComponentModel.ISupportInitialize)splitContainer_Information).EndInit();
|
((System.ComponentModel.ISupportInitialize)splitContainer_Information).EndInit();
|
||||||
splitContainer_Information.ResumeLayout(false);
|
splitContainer_Information.ResumeLayout(false);
|
||||||
groupBox_SkelList.ResumeLayout(false);
|
groupBox_SkelList.ResumeLayout(false);
|
||||||
tableLayoutPanel.ResumeLayout(false);
|
|
||||||
tableLayoutPanel.PerformLayout();
|
|
||||||
flowLayoutPanel_Buttons.ResumeLayout(false);
|
|
||||||
flowLayoutPanel_Buttons.PerformLayout();
|
|
||||||
splitContainer_Config.Panel1.ResumeLayout(false);
|
splitContainer_Config.Panel1.ResumeLayout(false);
|
||||||
splitContainer_Config.Panel2.ResumeLayout(false);
|
splitContainer_Config.Panel2.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)splitContainer_Config).EndInit();
|
((System.ComponentModel.ISupportInitialize)splitContainer_Config).EndInit();
|
||||||
@@ -551,16 +423,6 @@
|
|||||||
private ToolStripMenuItem toolStripMenuItem_Help;
|
private ToolStripMenuItem toolStripMenuItem_Help;
|
||||||
private ToolStripMenuItem toolStripMenuItem_About;
|
private ToolStripMenuItem toolStripMenuItem_About;
|
||||||
private ToolStripMenuItem toolStripMenuItem_BatchOpen;
|
private ToolStripMenuItem toolStripMenuItem_BatchOpen;
|
||||||
private TableLayoutPanel tableLayoutPanel;
|
|
||||||
private FlowLayoutPanel flowLayoutPanel_Buttons;
|
|
||||||
private Button button_Add;
|
|
||||||
private Button button_Insert;
|
|
||||||
private Button button_Remove;
|
|
||||||
private Button button_MoveUp;
|
|
||||||
private Button button_MoveDown;
|
|
||||||
private ListView listView_SkelList;
|
|
||||||
private ColumnHeader columnHeader_Name;
|
|
||||||
private ColumnHeader columnHeader_Version;
|
|
||||||
private GroupBox groupBox_Preview;
|
private GroupBox groupBox_Preview;
|
||||||
private Panel panel_Preview;
|
private Panel panel_Preview;
|
||||||
private Panel panel_PreviewContainer;
|
private Panel panel_PreviewContainer;
|
||||||
@@ -568,5 +430,6 @@
|
|||||||
private OpenFileDialog openFileDialog_Atlas;
|
private OpenFileDialog openFileDialog_Atlas;
|
||||||
private ToolTip toolTip1;
|
private ToolTip toolTip1;
|
||||||
private PropertyGrid propertyGrid_Skel;
|
private PropertyGrid propertyGrid_Skel;
|
||||||
|
private ListViewSkel listViewSkel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,14 +7,10 @@ namespace SpineViewer
|
|||||||
{
|
{
|
||||||
public partial class MainForm : Form
|
public partial class MainForm : Form
|
||||||
{
|
{
|
||||||
Manager spineManger = null;
|
|
||||||
|
|
||||||
public MainForm()
|
public MainForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
InitializeLogConfiguration();
|
InitializeLogConfiguration();
|
||||||
|
|
||||||
spineManger = new(listView_SkelList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -49,30 +45,18 @@ namespace SpineViewer
|
|||||||
|
|
||||||
private void toolStripMenuItem_Open_Click(object sender, EventArgs e)
|
private void toolStripMenuItem_Open_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var dialog = new SkelSelectDialog();
|
listViewSkel.Add();
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
spineManger.Add(Spine.Spine.New(dialog.Version, dialog.SkelPath, dialog.AtlasPath));
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Program.Logger.Error(ex.ToString());
|
|
||||||
Program.Logger.Error($"Failed to load {dialog.SkelPath} {dialog.AtlasPath}");
|
|
||||||
MessageBox.Show(ex.ToString(), "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toolStripMenuItem_BatchOpen_Click(object sender, EventArgs e)
|
private void toolStripMenuItem_BatchOpen_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
listViewSkel.BatchAdd();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toolStripMenuItem_Export_Click(object sender, EventArgs e)
|
private void toolStripMenuItem_Export_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var a = new SizeF(10, 100);
|
var a = new SizeF(10, 100);
|
||||||
spineManger.Spines[0].Position = spineManger.Spines[0].Position + a;
|
listViewSkel.Spines[0].Position = listViewSkel.Spines[0].Position + a;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toolStripMenuItem_Exit_Click(object sender, EventArgs e)
|
private void toolStripMenuItem_Exit_Click(object sender, EventArgs e)
|
||||||
@@ -82,80 +66,6 @@ namespace SpineViewer
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ģ<EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
|
||||||
|
|
||||||
// button_Add_Click => toolStripMenuItem_Open_Click
|
|
||||||
|
|
||||||
private void button_Insert_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (listView_SkelList.SelectedIndices.Count <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var index = listView_SkelList.SelectedIndices[0];
|
|
||||||
var dialog = new SkelSelectDialog();
|
|
||||||
dialog.ShowDialog();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
spineManger.Insert(index, Spine.Spine.New(dialog.Version, dialog.SkelPath, dialog.AtlasPath));
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Program.Logger.Error(ex.ToString());
|
|
||||||
Program.Logger.Error($"Failed to load {dialog.SkelPath} {dialog.AtlasPath}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void button_Remove_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (listView_SkelList.SelectedIndices.Count <= 0)
|
|
||||||
return;
|
|
||||||
spineManger.Remove(listView_SkelList.SelectedIndices.Cast<int>());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void button_MoveUp_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (listView_SkelList.SelectedIndices.Count <= 0)
|
|
||||||
return;
|
|
||||||
spineManger.MoveUp(listView_SkelList.SelectedIndices[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void button_MoveDown_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (listView_SkelList.SelectedIndices.Count <= 0)
|
|
||||||
return;
|
|
||||||
spineManger.MoveDown(listView_SkelList.SelectedIndices[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void listView_SkelList_SelectedIndexChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (listView_SkelList.SelectedIndices.Count <= 0)
|
|
||||||
{
|
|
||||||
button_Insert.Enabled = false;
|
|
||||||
button_Remove.Enabled = false;
|
|
||||||
button_MoveUp.Enabled = false;
|
|
||||||
button_MoveDown.Enabled = false;
|
|
||||||
propertyGrid_Skel.SelectedObject = null;
|
|
||||||
}
|
|
||||||
else if (listView_SkelList.SelectedIndices.Count <= 1)
|
|
||||||
{
|
|
||||||
button_Insert.Enabled = true;
|
|
||||||
button_Remove.Enabled = true;
|
|
||||||
button_MoveUp.Enabled = true;
|
|
||||||
button_MoveDown.Enabled = true;
|
|
||||||
propertyGrid_Skel.SelectedObject = spineManger.Spines[listView_SkelList.SelectedIndices[0]];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
button_Insert.Enabled = false;
|
|
||||||
button_Remove.Enabled = true;
|
|
||||||
button_MoveUp.Enabled = false;
|
|
||||||
button_MoveDown.Enabled = false;
|
|
||||||
propertyGrid_Skel.SelectedObject = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,17 @@ namespace SpineViewer
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
Application.Run(new MainForm());
|
Application.Run(new MainForm());
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Fatal(ex.ToString());
|
||||||
|
MessageBox.Show(ex.ToString(), "<22><><EFBFBD><EFBFBD><EFBFBD>ѱ<EFBFBD><D1B1><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD>
|
/// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD>
|
||||||
|
|||||||
@@ -1,115 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace SpineViewer.Spine
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 骨骼列表管理器
|
|
||||||
/// </summary>
|
|
||||||
class Manager
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 骨骼列表
|
|
||||||
/// </summary>
|
|
||||||
public ReadOnlyCollection<Spine> Spines { get => spines.AsReadOnly(); }
|
|
||||||
private readonly List<Spine> spines = [];
|
|
||||||
|
|
||||||
private readonly ListView listView;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 骨骼管理器
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="listView">用于显示骨骼信息的列表</param>
|
|
||||||
public Manager(ListView listView)
|
|
||||||
{
|
|
||||||
listView.BeginUpdate();
|
|
||||||
listView.Columns.Clear();
|
|
||||||
listView.Items.Clear();
|
|
||||||
listView.Columns.AddRange([
|
|
||||||
new() { Text = "名称", Width = 150},
|
|
||||||
new() { Text = "版本", Width = 150 }
|
|
||||||
]);
|
|
||||||
listView.EndUpdate();
|
|
||||||
this.listView = listView;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 在末尾添加一个
|
|
||||||
/// </summary>
|
|
||||||
public void Add(Spine spine)
|
|
||||||
{
|
|
||||||
spines.Add(spine);
|
|
||||||
listView.Items.Add(new ListViewItem([
|
|
||||||
Path.GetFileNameWithoutExtension(spine.SkelPath),
|
|
||||||
spine.Version.String()
|
|
||||||
], -1)
|
|
||||||
{ ToolTipText = spine.SkelPath });
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 在指定下标之前添加一个
|
|
||||||
/// </summary>
|
|
||||||
public void Insert(int index, Spine spine)
|
|
||||||
{
|
|
||||||
spines.Insert(index, spine);
|
|
||||||
listView.Items.Insert(index, new ListViewItem([
|
|
||||||
Path.GetFileNameWithoutExtension(spine.SkelPath),
|
|
||||||
spine.Version.String()
|
|
||||||
], -1)
|
|
||||||
{ ToolTipText = spine.SkelPath });
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 批量移除
|
|
||||||
/// </summary>
|
|
||||||
public void Remove(IEnumerable<int> indices)
|
|
||||||
{
|
|
||||||
foreach (var i in indices.OrderByDescending(x => x))
|
|
||||||
{
|
|
||||||
spines.RemoveAt(i);
|
|
||||||
listView.Items.RemoveAt(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 指定下标元素前移一位
|
|
||||||
/// </summary>
|
|
||||||
public void MoveUp(int index)
|
|
||||||
{
|
|
||||||
if (index > 0)
|
|
||||||
{
|
|
||||||
(spines[index - 1], spines[index]) = (spines[index], spines[index - 1]);
|
|
||||||
var item = listView.Items[index];
|
|
||||||
listView.Items.RemoveAt(index);
|
|
||||||
listView.Items.Insert(index - 1, item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 指定下标元素后移一位
|
|
||||||
/// </summary>
|
|
||||||
public void MoveDown(int index)
|
|
||||||
{
|
|
||||||
if (index < spines.Count - 1)
|
|
||||||
{
|
|
||||||
(spines[index], spines[index + 1]) = (spines[index + 1], spines[index]);
|
|
||||||
var item = listView.Items[index + 1];
|
|
||||||
listView.Items.RemoveAt(index + 1);
|
|
||||||
listView.Items.Insert(index, item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 全部移除
|
|
||||||
/// </summary>
|
|
||||||
public void Clear()
|
|
||||||
{
|
|
||||||
spines.Clear();
|
|
||||||
listView.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -136,7 +136,7 @@ namespace SpineViewer.Spine
|
|||||||
/// 获取所属版本
|
/// 获取所属版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TypeConverter(typeof(VersionTypeConverter))]
|
[TypeConverter(typeof(VersionTypeConverter))]
|
||||||
[Browsable(true), Category("基本信息"), DisplayName("运行时版本")]
|
[Browsable(true), Category("基本信息"), DisplayName("版本")]
|
||||||
public Version Version { get; }
|
public Version Version { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user