Skip to content

Commit 1f07986

Browse files
committed
# Conflicts: # SpineViewerWPF/PublicFunction/Player/Player_2_1_08.cs # SpineViewerWPF/PublicFunction/Player/Player_2_1_25.cs # SpineViewerWPF/PublicFunction/Player/Player_3_1_07.cs # SpineViewerWPF/PublicFunction/Player/Player_3_4_02.cs # SpineViewerWPF/PublicFunction/Player/Player_3_5_51.cs # SpineViewerWPF/PublicFunction/Player/Player_3_6_32.cs # SpineViewerWPF/PublicFunction/Player/Player_3_6_53.cs # SpineViewerWPF/PublicFunction/Player/Player_3_7_83.cs
2 parents 144155b + 01ea010 commit 1f07986

File tree

4 files changed

+58
-40
lines changed

4 files changed

+58
-40
lines changed

SpineViewerWPF/MainWindow.xaml.cs

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,8 @@ public static void SetCBAnimeName()
106106
{
107107
for (int i = 0; i < App.GV.AnimeList.Count; i++)
108108
{
109-
MasterMain.cb_AnimeList.Items.Add(App.GV.AnimeList[i]);
109+
MasterMain.cb_AnimeList.Items.Add(App.GV.AnimeList[i]);
110110
}
111-
112111
for (int i = 0; i < App.GV.SkinList.Count; i++)
113112
{
114113
MasterMain.cb_SkinList.Items.Add(App.GV.SkinList[i]);
@@ -206,30 +205,43 @@ private void loadFileToolStripMenuItem_Click(object sender, RoutedEventArgs e)
206205
MasterMain.cb_SkinList.Items.Clear();
207206
if (Player.Content != null)
208207
{
209-
App.isNew = true;
210-
App.AppXC.ContentManager.Dispose();
211-
App.AppXC.Initialize = null;
212-
App.AppXC.Update = null;
213-
App.AppXC.LoadContent = null;
214-
App.AppXC.Draw = null;
215-
btn_PlayControl.Content = this.FindResource("img_pause");
216-
217-
DependencyObject xnaParent = ((UserControl)Player.Content).Parent;
218-
if (xnaParent != null)
208+
if(App.GV.SpineVersion != cb_Version.SelectionBoxItem.ToString())
219209
{
220-
xnaParent.SetValue(ContentPresenter.ContentProperty, null);
210+
App.GV.SpineVersion = cb_Version.SelectionBoxItem.ToString();
211+
App.isNew = true;
212+
App.AppXC.ContentManager.Dispose();
213+
App.AppXC.Initialize = null;
214+
App.AppXC.Update = null;
215+
App.AppXC.LoadContent = null;
216+
App.AppXC.Draw = null;
217+
btn_PlayControl.Content = this.FindResource("img_pause");
218+
219+
DependencyObject xnaParent = ((UserControl)Player.Content).Parent;
220+
if (xnaParent != null)
221+
{
222+
xnaParent.SetValue(ContentPresenter.ContentProperty, null);
223+
}
224+
Canvas oldCanvas = (Canvas)App.AppXC.Parent;
225+
if (oldCanvas != null)
226+
{
227+
oldCanvas.Children.Clear();
228+
}
229+
Player.Content = null;
230+
UC_Player = new UCPlayer();
231+
Player.Content = UC_Player;
221232
}
222-
Canvas oldCanvas = (Canvas)App.AppXC.Parent;
223-
if (oldCanvas != null)
233+
else
224234
{
225-
oldCanvas.Children.Clear();
235+
UC_Player.Reload();
226236
}
227-
Player.Content = null;
228-
UC_Player = null;
229237
}
230-
App.GV.SpineVersion = cb_Version.SelectionBoxItem.ToString();
231-
UC_Player = new UCPlayer();
232-
Player.Content = UC_Player;
238+
else
239+
{
240+
App.GV.SpineVersion = cb_Version.SelectionBoxItem.ToString();
241+
UC_Player = new UCPlayer();
242+
Player.Content = UC_Player;
243+
}
244+
233245

234246
}
235247
}

SpineViewerWPF/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// 您可以指定所有的值,或將組建編號或修訂編號設為預設值
5252
// 指定為預設值:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("2.0.4.0")]
55-
[assembly: AssemblyFileVersion("2.0.4.0")]
54+
[assembly: AssemblyVersion("2.0.5.0")]
55+
[assembly: AssemblyFileVersion("2.0.5.0")]

SpineViewerWPF/PublicFunction/Player/Player_3_6_39.cs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ public class Player_3_6_39 : IPlayer
1414
private Skeleton skeleton;
1515
private AnimationState state;
1616
private SkeletonRenderer skeletonRenderer;
17-
private ExposedList<Animation> listAnimation;
18-
private ExposedList<Skin> listSkin;
1917
private Atlas atlas;
2018
private SkeletonData skeletonData;
2119
private AnimationStateData stateData;
@@ -59,21 +57,8 @@ public void LoadContent(ContentManager contentManager)
5957

6058
state = new AnimationState(stateData);
6159

62-
List<string> AnimationNames = new List<string>();
63-
listAnimation = state.Data.skeletonData.Animations;
64-
foreach (Animation An in listAnimation)
65-
{
66-
AnimationNames.Add(An.name);
67-
}
68-
App.GV.AnimeList = AnimationNames;
69-
70-
List<string> SkinNames = new List<string>();
71-
listSkin = state.Data.skeletonData.Skins;
72-
foreach (Skin Sk in listSkin)
73-
{
74-
SkinNames.Add(Sk.name);
75-
}
76-
App.GV.SkinList = SkinNames;
60+
App.GV.AnimeList = state.Data.skeletonData.Animations.Select(x => x.Name).ToList();
61+
App.GV.SkinList = state.Data.skeletonData.Skins.Select(x => x.Name).ToList();
7762

7863
if (App.GV.SelectAnimeName != "")
7964
{

SpineViewerWPF/Views/UCPlayer.xaml.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,26 @@ public void ChangeSet()
121121
{
122122
player.ChangeSet();
123123
}
124+
125+
public void Reload()
126+
{
127+
Frame.Children.Remove(App.AppXC);
128+
App.AppXC.Initialize -= player.Initialize;
129+
App.AppXC.Update -= player.Update;
130+
App.AppXC.LoadContent -= player.LoadContent;
131+
App.AppXC.Draw -= player.Draw;
132+
133+
134+
App.AppXC.Initialize += player.Initialize;
135+
App.AppXC.Update += player.Update;
136+
App.AppXC.LoadContent += player.LoadContent;
137+
App.AppXC.Draw += player.Draw;
138+
App.AppXC.Width = App.GV.FrameWidth;
139+
App.AppXC.Height = App.GV.FrameHeight;
140+
141+
Frame.Children.Add(App.AppXC);
142+
player.ChangeSet();
143+
MainWindow.SetCBAnimeName();
144+
}
124145
}
125146
}

0 commit comments

Comments
 (0)