Преглед на файлове

Merge pull request #443 from Fenrisul/master

[Unity] Gauge example
Fenrisul преди 10 години
родител
ревизия
afd9f2595d

BIN
spine-unity/Assets/Examples/Scenes/SpineGauge.unity


+ 4 - 0
spine-unity/Assets/Examples/Scenes/SpineGauge.unity.meta

@@ -0,0 +1,4 @@
+fileFormatVersion: 2
+guid: b9ae310595c646944a1268f51fb389a4
+DefaultImporter:
+  userData: 

+ 38 - 0
spine-unity/Assets/Examples/Scripts/SpineGauge.cs

@@ -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 - 0
spine-unity/Assets/Examples/Scripts/SpineGauge.cs.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c888ce38da699d143a68153f26379a37
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 

+ 5 - 0
spine-unity/Assets/Examples/Spine/Gauge.meta

@@ -0,0 +1,5 @@
+fileFormatVersion: 2
+guid: 850ff16a039121a48a7cf86e301ef1fa
+folderAsset: yes
+DefaultImporter:
+  userData: 

+ 27 - 0
spine-unity/Assets/Examples/Spine/Gauge/Gauge.atlas.txt

@@ -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 - 0
spine-unity/Assets/Examples/Spine/Gauge/Gauge.atlas.txt.meta

@@ -0,0 +1,4 @@
+fileFormatVersion: 2
+guid: 6afa4952627478a44995c3cdf2e96a24
+TextScriptImporter:
+  userData: 

+ 42 - 0
spine-unity/Assets/Examples/Spine/Gauge/Gauge.json

@@ -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 - 0
spine-unity/Assets/Examples/Spine/Gauge/Gauge.json.meta

@@ -0,0 +1,4 @@
+fileFormatVersion: 2
+guid: af5e86c10d52bad43b0b62542815f199
+TextScriptImporter:
+  userData: 

BIN
spine-unity/Assets/Examples/Spine/Gauge/Gauge.png


+ 47 - 0
spine-unity/Assets/Examples/Spine/Gauge/Gauge.png.meta

@@ -0,0 +1,47 @@
+fileFormatVersion: 2
+guid: a11301aad15ed6b4995485a02a81b132
+TextureImporter:
+  fileIDToRecycleName: {}
+  serializedVersion: 2
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 0
+    linearTexture: 0
+    correctGamma: 0
+    fadeOut: 0
+    borderMipMap: 0
+    mipMapFadeDistanceStart: 1
+    mipMapFadeDistanceEnd: 3
+  bumpmap:
+    convertToNormalMap: 0
+    externalNormalMap: 0
+    heightScale: .25
+    normalMapFilter: 0
+  isReadable: 0
+  grayScaleToAlpha: 0
+  generateCubemap: 0
+  seamlessCubemap: 0
+  textureFormat: -3
+  maxTextureSize: 2048
+  textureSettings:
+    filterMode: -1
+    aniso: -1
+    mipBias: -1
+    wrapMode: -1
+  nPOTScale: 1
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 0
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: .5, y: .5}
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+  spritePixelsToUnits: 100
+  alphaIsTransparency: 0
+  textureType: 5
+  buildTargetSettings: []
+  spriteSheet:
+    sprites: []
+  spritePackingTag: 
+  userData: 

BIN
spine-unity/Assets/Examples/Spine/Gauge/Gauge_Atlas.asset


+ 4 - 0
spine-unity/Assets/Examples/Spine/Gauge/Gauge_Atlas.asset.meta

@@ -0,0 +1,4 @@
+fileFormatVersion: 2
+guid: e888132736b335e4c88bc0a283b474c6
+NativeFormatImporter:
+  userData: 

BIN
spine-unity/Assets/Examples/Spine/Gauge/Gauge_Material.mat


+ 4 - 0
spine-unity/Assets/Examples/Spine/Gauge/Gauge_Material.mat.meta

@@ -0,0 +1,4 @@
+fileFormatVersion: 2
+guid: 9ab9bdbda020b3e46b5a3b0558ef591d
+NativeFormatImporter:
+  userData: 

BIN
spine-unity/Assets/Examples/Spine/Gauge/Gauge_SkeletonData.asset


+ 4 - 0
spine-unity/Assets/Examples/Spine/Gauge/Gauge_SkeletonData.asset.meta

@@ -0,0 +1,4 @@
+fileFormatVersion: 2
+guid: 22b19a38b21c15a48854f0db86b0b7d3
+NativeFormatImporter:
+  userData: 

+ 1 - 0
spine-unity/Assets/spine-unity/Editor/SpineEditorUtilities.cs

@@ -727,6 +727,7 @@ public class SpineEditorUtilities : AssetPostprocessor {
 			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;