Skip to content

Commit

Permalink
[Unity] Spine Gauge Example and misc importer tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Fenrisul committed Jun 25, 2015
1 parent 8e49f78 commit 5ee7823
Show file tree
Hide file tree
Showing 18 changed files with 192 additions and 0 deletions.
Binary file not shown.
4 changes: 4 additions & 0 deletions spine-unity/Assets/Examples/Scenes/SpineGauge.unity.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions spine-unity/Assets/Examples/Scripts/SpineGauge.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using UnityEngine;
using System.Collections;

[ExecuteInEditMode]
[RequireComponent(typeof(SkeletonRenderer))]
public class SpineGauge : MonoBehaviour{

[Range(0,1)]
public float fill = 0;

[SpineAnimation]
public string fillAnimationName;
Spine.Animation fillAnimation;

SkeletonRenderer skeletonRenderer;

void Start () {
skeletonRenderer = GetComponent<SkeletonRenderer>();
}

void Update () {

var skeleton = skeletonRenderer.skeleton;

if (skeleton == null)
return;

if (fillAnimation == null) {
fillAnimation = skeleton.Data.FindAnimation(fillAnimationName);
if (fillAnimation == null)
return;
}

fillAnimation.Apply(skeleton, 0, fill, false, null);
skeleton.Update(Time.deltaTime);
skeleton.UpdateWorldTransform();
}
}
8 changes: 8 additions & 0 deletions spine-unity/Assets/Examples/Scripts/SpineGauge.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions spine-unity/Assets/Examples/Spine/Gauge.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions spine-unity/Assets/Examples/Spine/Gauge/Gauge.atlas.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

Gauge.png
size: 1024,64
format: RGBA8888
filter: Linear,Linear
repeat: none
Background
rotate: false
xy: 254, 30
size: 224, 32
orig: 224, 32
offset: 0, 0
index: -1
Bar
rotate: false
xy: 480, 30
size: 224, 32
orig: 224, 32
offset: 0, 0
index: -1
Border
rotate: false
xy: 2, 2
size: 250, 60
orig: 250, 60
offset: 0, 0
index: -1
4 changes: 4 additions & 0 deletions spine-unity/Assets/Examples/Spine/Gauge/Gauge.atlas.txt.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions spine-unity/Assets/Examples/Spine/Gauge/Gauge.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"skeleton": { "hash": "IKLl/62j+Y1bsQ8rdHoVK9PDip8", "spine": "2.1.27", "width": 250, "height": 60, "images": "./images/" },
"bones": [
{ "name": "root" },
{ "name": "Bar", "parent": "root", "x": -112.29 }
],
"slots": [
{ "name": "Background", "bone": "root", "attachment": "Background" },
{ "name": "Bar", "bone": "Bar", "attachment": "Bar" },
{ "name": "Border", "bone": "root", "attachment": "Border" }
],
"skins": {
"default": {
"Background": {
"Background": { "width": 224, "height": 32 }
},
"Bar": {
"Bar": { "x": 112.29, "width": 224, "height": 32 }
},
"Border": {
"Border": { "width": 250, "height": 60 }
}
}
},
"animations": {
"Fill": {
"bones": {
"Bar": {
"scale": [
{
"time": 0,
"x": 0.002,
"y": 1,
"curve": [ 0.25, 0, 0.75, 1 ]
},
{ "time": 1, "x": 1, "y": 1 }
]
}
}
}
}
}
4 changes: 4 additions & 0 deletions spine-unity/Assets/Examples/Spine/Gauge/Gauge.json.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added spine-unity/Assets/Examples/Spine/Gauge/Gauge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions spine-unity/Assets/Examples/Spine/Gauge/Gauge.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,7 @@ static AtlasAsset IngestSpineAtlas (TextAsset atlasText) {
Texture2D texture = (Texture2D)AssetDatabase.LoadAssetAtPath(texturePath, typeof(Texture2D));

TextureImporter texImporter = (TextureImporter)TextureImporter.GetAtPath(texturePath);
texImporter.textureType = TextureImporterType.Advanced;
texImporter.textureFormat = TextureImporterFormat.AutomaticTruecolor;
texImporter.mipmapEnabled = false;
texImporter.alphaIsTransparency = false;
Expand Down

0 comments on commit 5ee7823

Please sign in to comment.