Fixed XNA/MonoGame project

This commit is contained in:
badlogic 2017-07-11 16:33:14 +02:00
parent 5c71fcaaf8
commit b6f88e81b0
3 changed files with 29 additions and 40 deletions

View File

@ -119,7 +119,7 @@
<None Include="data\coin.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="data\coin.skel">
<None Include="data\coin-pro.skel">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="data\goblins.png">
@ -134,26 +134,17 @@
<Content Include="data\tank.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="data\TwoColorTest.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Game.ico" />
<Content Include="GameThumbnail.png" />
<None Include="data\tank.atlas">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="data\tank.json">
<None Include="data\tank-pro.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="data\tank.skel">
<None Include="data\tank-pro.skel">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="data\TwoColorTest.atlas">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="data\TwoColorTest.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\spine-csharp\spine-csharp.csproj">
@ -201,28 +192,28 @@
<None Include="data\coin.atlas">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="data\coin.json">
<None Include="data\coin-pro.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="data\goblins-mesh.atlas">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="data\goblins-mesh.json">
<None Include="data\goblins-pro.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="data\goblins-mesh.skel">
<None Include="data\goblins-pro.skel">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="data\raptor.atlas">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="data\raptor.json">
<None Include="data\raptor-pro.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="data\spineboy.atlas">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="data\spineboy.json">
<None Include="data\spineboy-ess.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

View File

@ -79,22 +79,21 @@ namespace Spine {
skeletonRenderer.PremultipliedAlpha = false;
skeletonRenderer.Effect = spineEffect;
// String name = "spineboy";
// String name = "goblins-mesh";
// String name = "raptor";
// String name = "tank";
// String name = "coin";
String name = "TwoColorTest";
// String name = "spineboy-ess";
// String name = "goblins-pro";
// String name = "raptor-pro";
// String name = "tank-pro";
String name = "coin-pro";
String atlasName = name.Replace("-pro", "").Replace("-ess", "");
bool binaryData = false;
Atlas atlas = new Atlas(assetsFolder + name + ".atlas", new XnaTextureLoader(GraphicsDevice));
Atlas atlas = new Atlas(assetsFolder + atlasName + ".atlas", new XnaTextureLoader(GraphicsDevice));
float scale = 1;
if (name == "spineboy") scale = 0.6f;
if (name == "raptor") scale = 0.5f;
if (name == "tank") scale = 0.3f;
if (name == "coin") scale = 1;
if (name == "TwoColorTest") scale = 0.5f;
if (name == "spineboy-ess") scale = 0.6f;
if (name == "raptor-pro") scale = 0.5f;
if (name == "tank-pro") scale = 0.3f;
if (name == "coin-pro") scale = 1;
SkeletonData skeletonData;
if (binaryData) {
@ -107,13 +106,13 @@ namespace Spine {
skeletonData = json.ReadSkeletonData(assetsFolder + name + ".json");
}
skeleton = new Skeleton(skeletonData);
if (name == "goblins-mesh") skeleton.SetSkin("goblin");
if (name == "goblins-pro") skeleton.SetSkin("goblin");
// Define mixing between animations.
AnimationStateData stateData = new AnimationStateData(skeleton.Data);
state = new AnimationState(stateData);
if (name == "spineboy") {
if (name == "spineboy-ess") {
stateData.SetMix("run", "jump", 0.2f);
stateData.SetMix("jump", "run", 0.4f);
@ -128,25 +127,22 @@ namespace Spine {
entry.End += End; // Event handling for queued animations.
state.AddAnimation(0, "run", true, 0);
}
else if (name == "raptor") {
else if (name == "raptor-pro") {
state.SetAnimation(0, "walk", true);
state.AddAnimation(1, "gungrab", false, 2);
}
else if (name == "coin") {
else if (name == "coin-pro") {
state.SetAnimation(0, "rotate", true);
}
else if (name == "tank") {
else if (name == "tank-pro") {
state.SetAnimation(0, "drive", true);
}
else if (name == "TwoColorTest") {
state.SetAnimation(0, "animation", true);
}
else {
state.SetAnimation(0, "walk", true);
}
skeleton.X = 400 + (name == "tank" ? 300: 0);
skeleton.Y = 580 + (name == "TwoColorTest" ? -400 : 0);
skeleton.X = 400 + (name == "tank-pro" ? 300: 0);
skeleton.Y = GraphicsDevice.Viewport.Height;
skeleton.UpdateWorldTransform();
headSlot = skeleton.FindSlot("head");

View File

@ -25,11 +25,13 @@ Global
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7F8F2327-C016-49C8-BB4D-F3F77971961E}.Debug|Any CPU.ActiveCfg = Debug|x86
{7F8F2327-C016-49C8-BB4D-F3F77971961E}.Debug|Any CPU.Build.0 = Debug|x86
{7F8F2327-C016-49C8-BB4D-F3F77971961E}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{7F8F2327-C016-49C8-BB4D-F3F77971961E}.Debug|Mixed Platforms.Build.0 = Debug|x86
{7F8F2327-C016-49C8-BB4D-F3F77971961E}.Debug|x86.ActiveCfg = Debug|x86
{7F8F2327-C016-49C8-BB4D-F3F77971961E}.Debug|x86.Build.0 = Debug|x86
{7F8F2327-C016-49C8-BB4D-F3F77971961E}.Release|Any CPU.ActiveCfg = Release|x86
{7F8F2327-C016-49C8-BB4D-F3F77971961E}.Release|Any CPU.Build.0 = Release|x86
{7F8F2327-C016-49C8-BB4D-F3F77971961E}.Release|Mixed Platforms.ActiveCfg = Release|x86
{7F8F2327-C016-49C8-BB4D-F3F77971961E}.Release|Mixed Platforms.Build.0 = Release|x86
{7F8F2327-C016-49C8-BB4D-F3F77971961E}.Release|x86.ActiveCfg = Release|x86