فهرست منبع

[phaser] Mix-and-match example, rework example index.

Mario Zechner 2 سال پیش
والد
کامیت
0815c4433b
3فایلهای تغییر یافته به همراه74 افزوده شده و 32 حذف شده
  1. 14 1
      spine-ts/index.html
  2. 0 31
      spine-ts/spine-phaser/example/index.html
  3. 60 0
      spine-ts/spine-phaser/example/mix-and-match.html

+ 14 - 1
spine-ts/index.html

@@ -18,7 +18,20 @@
 		</ul>
 		</ul>
 		<li>Phaser</li>
 		<li>Phaser</li>
 		<ul>
 		<ul>
-			<li><a href="/spine-phaser/example/index.html">Examples</a></li>
+			<li><a href="/spine-phaser/example/basic-example.html">Basic example</a></li>
+			<li><a href="/spine-phaser/example/batching-test.html">Batching test</a></li>
+			<li><a href="/spine-phaser/example/multi-scene-test.html">Multi-scene test</a></li>
+			<li><a href="/spine-phaser/example/bounds-test.html">Bounds test</a></li>
+			<li><a href="/spine-phaser/example/visibility-test.html">Visibility test</a></li>
+			<li><a href="/spine-phaser/example/arcade-physics-test.html">Arcade physics example</a></li>
+			<li><a href="/spine-phaser/example/blend-test.html">Blend test</a></li>
+			<li><a href="/spine-phaser/example/camera-pipeline-test.html">Camera pipeline test</a></li>
+			<li><a href="/spine-phaser/example/control-bones-test.html">Control bones</a></li>
+			<li><a href="/spine-phaser/example/extended-class-test.html">Extended class</a></li>
+			<li><a href="/spine-phaser/example/canvas-test.html">Canvas test</a></li>
+			<li><a href="/spine-phaser/example/depth-test.html">Depth test</a></li>
+			<li><a href="/spine-phaser/example/render-to-texture-test.html">Render to texture test</a></li>
+			<li><a href="/spine-phaser/example/mix-and-match.html">Mix and match</a></li>
 		</ul>
 		</ul>
 		<li>Player</li>
 		<li>Player</li>
 		<ul>
 		<ul>

+ 0 - 31
spine-ts/spine-phaser/example/index.html

@@ -1,31 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-
-<head>
-    <meta charset="UTF-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <script src="//cdn.jsdelivr.net/npm/[email protected]/dist/phaser.js"></script>
-    <title>Spine Phaser Example</title>
-</head>
-
-<body>
-    <h1>Spine Phaser</h1>
-    <ul>
-        <li><a href="./basic-example.html">Basic example</a></li>
-        <li><a href="./batching-test.html">Batching test</a></li>
-        <li><a href="./multi-scene-test.html">Multi-scene test</a></li>
-        <li><a href="./bounds-test.html">Bounds test</a></li>
-        <li><a href="./visibility-test.html">Visibility test</a></li>
-        <li><a href="./arcade-physics-test.html">Arcade physics example</a></li>
-        <li><a href="./blend-test.html">Blend test</a></li>
-        <li><a href="./camera-pipeline-test.html">Camera pipeline test</a></li>
-        <li><a href="./control-bones-test.html">Control bones</a></li>
-        <li><a href="./extended-class-test.html">Extended class</a></li>
-        <li><a href="./canvas-test.html">Canvas test</a></li>
-        <li><a href="./depth-test.html">Depth test</a></li>
-        <li><a href="./render-to-texture-test.html">Render to texture test</a></li>
-    </ul>
-</body>
-
-</html>

+ 60 - 0
spine-ts/spine-phaser/example/mix-and-match.html

@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+    <meta charset="UTF-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <script src="//cdn.jsdelivr.net/npm/[email protected]/dist/phaser.js"></script>
+    <title>Spine Phaser Example</title>
+</head>
+
+<body>
+    <h1>Mix and match</h1>
+</body>
+<script>
+    var config = {
+        type: Phaser.AUTO,
+        width: 800,
+        height: 600,
+        type: Phaser.WEBGL,
+        scene: {
+            preload: preload,
+            create: create,
+            pack: {
+                files: [
+                    { type: "scenePlugin", key: "spine.SpinePlugin", url: "../dist/iife/spine-phaser.js", sceneKey: "spine" }
+                ]
+            }
+        }
+    };
+
+    let game = new Phaser.Game(config);
+
+    function preload() {
+        this.load.spineBinary("mix-and-match-data", "assets/mix-and-match-pro.skel");
+        this.load.spineAtlas("mix-and-match-atlas", "assets/mix-and-match-pma.atlas");
+    }
+
+    function create() {
+        let mixAndMatch = this.add.spine(400, 500, 'mix-and-match-data', "mix-and-match-atlas");
+        mixAndMatch.scale = 0.5;
+        mixAndMatch.animationState.setAnimation(0, "walk", true);
+
+        let skeletonData = mixAndMatch.skeleton.data;
+        let skin = new spine.Skin("custom");
+        skin.addSkin(skeletonData.findSkin("skin-base"));
+        skin.addSkin(skeletonData.findSkin("nose/short"));
+        skin.addSkin(skeletonData.findSkin("eyelids/girly"));
+        skin.addSkin(skeletonData.findSkin("eyes/violet"));
+        skin.addSkin(skeletonData.findSkin("hair/brown"));
+        skin.addSkin(skeletonData.findSkin("clothes/hoodie-orange"));
+        skin.addSkin(skeletonData.findSkin("legs/pants-jeans"));
+        skin.addSkin(skeletonData.findSkin("accessories/bag"));
+        skin.addSkin(skeletonData.findSkin("accessories/hat-red-yellow"));        
+        mixAndMatch.skeleton.setSkin(skin);
+        mixAndMatch.skeleton.setToSetupPose();
+    }
+</script>
+
+</html>