Commit 18a17dc3 authored by 杨一航's avatar 杨一航

feat:add logic

parent 117b56ff
{
"ver": "1.1.2",
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541",
"isBundle": false,
"isBundle": true,
"bundleName": "",
"priority": 1,
"compressionType": {},
......
{
"ver": "1.1.2",
"uuid": "f9d315fe-ed32-4732-9081-a10ff8b14882",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import { playAudio, playAudioByUrl } from "../script/util";
const { ccclass, property } = cc._decorator;
@ccclass
export default class AudioBar extends cc.Component {
@property(cc.Node)
audioIcon: cc.Node = null;
private _clipUrl: string;
onLoad() {
this.node.on("click", this._playClip, this);
}
set url(url: string) {
this._clipUrl = url;
}
_playClip() {
this.node.stopAllActions();
this.audioIcon.active = true;
playAudioByUrl(this._clipUrl, this._stopAni.bind(this));
cc.tween(this.audioIcon).blink(800, 1000).start();
}
_stopAni() {
this.node.stopAllActions();
this.audioIcon.active = false;
}
// update (dt) {}
}
{
"ver": "1.0.8",
"uuid": "8b57c66f-4962-4ba9-b7b0-09226e766822",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import utils = require("../../../bin/utils");
import { playAudio } from "../script/util";
const { ccclass, property } = cc._decorator;
@ccclass
export default class Cake extends cc.Component {
@property(cc.Node)
cakes: Array<cc.Node> = [];
@property(cc.Node)
lbRoot: cc.Node = null;
@property(cc.Node)
lbNode: cc.Node = null;
@property(cc.Node)
top: cc.Node = null;
@property(cc.Node)
candle: cc.Node = null;
@property(cc.AudioClip)
candleClip: cc.AudioClip = null;
private _word: string[];
private _widths = [310, 280, 250, 220, 190];
// LIFE-CYCLE CALLBACKS:
onLoad() {
}
init(word: Array<string>,) {
this._word = word;
for (let i = 0; i < this.cakes.length; ++i) {
let cakeNode = this.cakes[i];
cakeNode.active = false;
}
this.lbRoot.removeAllChildren();
let height = 0;
let index = 0;
for (let i = word.length - 1; i >= 0; --i) {
let cakeNode = this.cakes[i];
cakeNode.active = true;
let width = this._widths[index]
let scale = width / cakeNode.width;
cakeNode.width = width;
cakeNode.height = cakeNode.height * scale;
cakeNode.y = height;
let lbNode = cc.instantiate(this.lbNode);
lbNode.parent = this.lbRoot;
lbNode.y = height + cakeNode.height * scale * 0.5;
lbNode.x = 0;
lbNode.getComponent(cc.Label).string = word[i];
height += (cakeNode.height * 0.8) * scale;
index++;
this.top.x = 0;
this.top.y = height;
console.log("height===" + height);
}
this.top.active = false;
}
insert(txt: string, index: number) {
this._word.splice(index, 0, txt);
this.init(this._word);
this.top.active = true;
this.candle.getComponent(dragonBones.ArmatureDisplay).playAnimation("newAnimation", 1);
playAudio(this.candleClip);
console.log("insert done");
}
start() {
}
// update (dt) {}
}
{
"ver": "1.0.8",
"uuid": "1e895229-fac9-4708-8a8a-6f84704bd4a1",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
const { ccclass, property } = cc._decorator;
@ccclass
export default class CakeBar extends cc.Component {
@property(cc.Node)
Cake: cc.Node = null;
init(total: number) {
for (let i = 0; i < total; ++i) {
let name = "cake_" + i;
let node = cc.instantiate(this.Cake);
node.name = name;
node.parent = this.node;
node.zIndex = i;
}
this.Cake.active = false;
}
updateUI(index: number, state: number) {
let node = this.node.getChildByName("cake_" + index);
node.getChildByName("fall").active = state == 2;
node.getChildByName("in").active = state == 0;
node.getChildByName("done").active = state == 1;
}
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start() {
}
// update (dt) {}
}
{
"ver": "1.0.8",
"uuid": "6916bba6-4e31-4b3c-8570-0a5733144508",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
const { ccclass, property } = cc._decorator;
@ccclass
export default class Candle extends cc.Component {
@property(cc.ProgressBar)
proBar: cc.ProgressBar = null;
@property(dragonBones.ArmatureDisplay)
fire: dragonBones.ArmatureDisplay = null;
@property(dragonBones.ArmatureDisplay)
fireEnd: dragonBones.ArmatureDisplay = null;
@property(cc.SpriteFrame)
skin: Array<cc.SpriteFrame> = [];
private _endCall: any;
private _totalTime: number;
private _fireOn: boolean;
private _costTime: number;
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start() {
this._fireOn = false;
this.fire.node.active = true;
this.fireEnd.node.active = false;
this.proBar.progress = 1;
}
setSkin(type: number) {
this.proBar.barSprite.spriteFrame = this.skin[type];
}
fireOn(time: number, endCall) {
this._totalTime = time;
this._costTime = 0;
this._endCall = endCall;
this._fireOn = true;
}
fireStop() {
this._fireOn = false;
}
update(dt) {
if (this._fireOn) {
this._costTime += dt;
this.proBar.progress = 1 - this._costTime / this._totalTime;
if (this.proBar.progress < 0.20) {
this.fire.node.active = false;
this.fireEnd.node.active = true;
}
if (this.proBar.progress <= 0) {
this._fireOn = false;
this._endCall && this._endCall();
this._endCall = null;
this.node.active = false;
}
}
}
}
{
"ver": "1.0.8",
"uuid": "9acadda5-083e-4fff-9397-7f16c6f3ddde",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "audioRoot",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 5
}
],
"_active": true,
"_components": [
{
"__id__": 8
},
{
"__id__": 9
},
{
"__id__": 10
}
],
"_prefab": {
"__id__": 11
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 120,
"height": 96
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
544.529,
30.405,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "voiceIcon1",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
}
],
"_prefab": {
"__id__": 4
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 37,
"height": 46
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-21,
-4,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "8d62d6c4-ea33-4431-84be-ff42de8cf82c"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "72e10335-6d78-426b-b387-5442c05cc4bc"
},
"fileId": "7cE1QhDPlGppMSSRcpVXKO",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "voiceIcon2",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 6
}
],
"_prefab": {
"__id__": 7
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 48,
"height": 46
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-21,
-4,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "fca77e13-211d-432a-ac6f-61a1bd58d833"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "72e10335-6d78-426b-b387-5442c05cc4bc"
},
"fileId": "75T4I9wtNJdoZDSsZsOCPs",
"sync": false
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "d0fd74e1-7a9a-43ac-b447-e9bca9cb81b6"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": ""
},
{
"__type__": "8b57cZvSWJLqbewCSJudmgi",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"audioIcon": {
"__id__": 5
},
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "72e10335-6d78-426b-b387-5442c05cc4bc"
},
"fileId": "",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.2.9",
"uuid": "72e10335-6d78-426b-b387-5442c05cc4bc",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.2.9",
"uuid": "d6a47707-ac66-484f-bbb0-2530e7fe376e",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.2.9",
"uuid": "acdb05df-5414-4c39-9509-9139f0792246",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.2.9",
"uuid": "b35bf7df-6c4e-4d4e-a3f2-a9a884e46774",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.2.9",
"uuid": "0d898f4a-8450-413b-9ca4-44b51f2ad63b",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
const { ccclass, property } = cc._decorator;
@ccclass
export default class ChoseNode extends cc.Component {
@property(cc.Sprite)
cake: cc.Sprite = null;
@property(cc.Sprite)
cover: cc.Sprite = null;
@property(cc.Label)
lb: cc.Label = null;
@property(cc.SpriteFrame)
cakeList: Array<cc.SpriteFrame> = [];
@property(cc.SpriteFrame)
coverList: Array<cc.SpriteFrame> = [];
private _isAnswer: boolean;
private _clickCall: Function;
// LIFE-CYCLE CALLBACKS:
onLoad() {
this.cover.node.active = false;
}
onEnable() {
this.node.on("click", this._onClickCake, this);
}
onDisable() {
this.node.off("click", this._onClickCake, this);
}
_onClickCake() {
if (this._isAnswer) {
this.cover.node.active = true;
cc.tween(this.cover).delay(0.5).hide().start();
}
this._clickCall && this._clickCall(this.node, this._isAnswer);
}
init(txt: string, isAnswer: boolean, clickCall: Function) {
this.node.active = true;
this.lb.string = txt;
this._isAnswer = isAnswer;
this._clickCall = clickCall;
}
// update (dt) {}
}
{
"ver": "1.0.8",
"uuid": "7141491e-2f44-4dfb-a78a-4688922c2811",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import { playAudio } from "./util";
const { ccclass, property, requireComponent } = cc._decorator;
@ccclass
@requireComponent(cc.Button)
export default class AudioButton extends cc.Component {
@property(cc.AudioClip)
clickAudio: cc.AudioClip = null;
onClick(callback: Function, target) {
this.node.on("click", () => {
this.clickAudio && playAudio(this.clickAudio);
callback.call(target);
}, this);
}
onceClick(callback: Function, target) {
this.node.once("click", () => {
this.clickAudio && playAudio(this.clickAudio);
callback.call(target);
}, this);
}
}
{
"ver": "1.0.8",
"uuid": "38a22141-ef61-4a2d-96ab-c008af4909cd",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
export const defaultData = {
"pic_url": "http://staging-teach.cdn.ireadabc.com/ed94332a503c31e0908bd4c6923a2665.png",
"pic_url_2": "http://staging-teach.cdn.ireadabc.com/5fb60317ade0195d35ad8034d5370a7f.png",
"text": "This is a test label.",
"audio_url": "http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3"
"questions": [{
"text": "dog",
"audio": "http://staging-teach.cdn.ireadabc.com/dfb27b510e121a1045a3b7613a530e43.mp3",
"dragonBoneData": {
"skeJsonData": {
"url": "http://staging-teach.cdn.ireadabc.com/19d1a7f807cb34e8706d2d3b0324278b.json",
"name": "right_ske.json"
},
"texJsonData": {
"url": "http://staging-teach.cdn.ireadabc.com/8593091ce08cf9fd7c2d86f332b6cd6c.json",
"name": "right_tex.json"
},
"texPngData": {
"url": "http://staging-teach.cdn.ireadabc.com/d623e6d625ef102dbc5420b2f37fa52f.png",
"name": "right_tex.png"
}
},
"waitTime": 12,
"choosewaitTime": 5,
"testWaitTime": 3,
"rightLetter": "d",
"wrongLetter": "b"
}, {
"text": "apple",
"audio": "http://staging-teach.cdn.ireadabc.com/7c18e0838dcf0707f885842ed09e1579.mp3",
"dragonBoneData": {
"skeJsonData": {
"url": "http://staging-teach.cdn.ireadabc.com/703a41d6c7afe6fe653014d585ef0d58.json",
"name": "d1_ske.json"
},
"texJsonData": {
"url": "http://staging-teach.cdn.ireadabc.com/02bbebdc4a9f4a35d9ec285f61fca19c.json",
"name": "d1_tex.json"
},
"texPngData": {
"url": "http://staging-teach.cdn.ireadabc.com/ba2041fb4f69c37be52b76f5fb274c09.png",
"name": "d1_tex.png"
}
},
"choosewaitTime": 5,
"testWaitTime": 3,
"rightLetter": "a",
"wrongLetter": "e"
}],
"title": "whats you name",
"guideAudio": "http://staging-teach.cdn.ireadabc.com/40468ef6d120d03f83541b9344c6f9ea.mp3"
}
\ No newline at end of file
......@@ -94,13 +94,13 @@ export function getScaleRateBy2Node(baseNode, targetNode, maxFlag = true) {
}
}
export function getDistance (start, end){
export function getDistance(start, end) {
var pos = cc.v2(start.x - end.x, start.y - end.y);
var dis = Math.sqrt(pos.x*pos.x + pos.y*pos.y);
var dis = Math.sqrt(pos.x * pos.x + pos.y * pos.y);
return dis;
}
export function playAudioByUrl(audio_url, cb=null) {
export function playAudioByUrl(audio_url, cb = null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
......@@ -114,21 +114,21 @@ export function playAudioByUrl(audio_url, cb=null) {
}
export function btnClickAnima(btn, time=0.15, rate=1.05) {
export function btnClickAnima(btn, time = 0.15, rate = 1.05) {
btn.tmpScale = btn.scale;
btn.on(cc.Node.EventType.TOUCH_START, () => {
cc.tween(btn)
.to(time / 2, {scale: btn.scale * rate})
.to(time / 2, { scale: btn.scale * rate })
.start()
})
btn.on(cc.Node.EventType.TOUCH_CANCEL, () => {
cc.tween(btn)
.to(time / 2, {scale: btn.tmpScale})
.to(time / 2, { scale: btn.tmpScale })
.start()
})
btn.on(cc.Node.EventType.TOUCH_END, () => {
cc.tween(btn)
.to(time / 2, {scale: btn.tmpScale})
.to(time / 2, { scale: btn.tmpScale })
.start()
})
}
......@@ -179,7 +179,7 @@ export async function asyncDelay(time) {
try {
cc.tween(cc.find('Canvas'))
.delay(time)
.call(()=>{
.call(() => {
resolve(null);
})
.start();
......@@ -355,3 +355,72 @@ export function onHomeworkFinish() {
console.log('onHomeworkFinish');
}
}
export async function asyncLoadDragonBoneAnime(node, { skeJsonData: { url: skeJsonDataUrl }, texJsonData: { url: texJsonDataUrl }, texPngData: { url: texPngDataUrl } }): Promise<cc.Node> {
if (!texPngDataUrl || !texJsonDataUrl || !texPngDataUrl
|| texPngDataUrl == '' || texJsonDataUrl == '' || texPngDataUrl == '') {
return;
}
return new Promise((resolve, reject) => {
if (node.animaNode) {
node.animaNode.removeFromParent();
}
const animaNode = new cc.Node();
animaNode.name = 'animaNode';
animaNode.parent = node;
animaNode.active = true;
node.animaNode = animaNode;
const dragonDisplay = animaNode.addComponent(dragonBones.ArmatureDisplay);
const loadTexture = new Promise((resolve, reject) => {
cc.assetManager.loadRemote(texPngDataUrl, (error, texture) => {
if (error) {
reject(error);
}
resolve(texture);
});
});
const loadTexJsonData = new Promise((resolve, reject) => {
cc.assetManager.loadAny({ url: texJsonDataUrl }, (error, atlasJson) => {
if (error) {
reject(error);
}
resolve(atlasJson);
});
});
const loadSkeJsonData = new Promise((resolve, reject) => {
cc.assetManager.loadAny({ url: skeJsonDataUrl }, (error, dragonBonesJson) => {
if (error) {
reject(error);
}
resolve(dragonBonesJson);
});
});
Promise.all([loadTexture, loadTexJsonData, loadSkeJsonData]).then(([texture, atlasJson, dragonBonesJson]) => {
const atlas = new dragonBones.DragonBonesAtlasAsset();
atlas.atlasJson = JSON.stringify(atlasJson);
//@ts-ignore
atlas.texture = texture;
const asset = new dragonBones.DragonBonesAsset();
asset.dragonBonesJson = JSON.stringify(dragonBonesJson);
dragonDisplay.dragonAtlasAsset = atlas;
dragonDisplay.dragonAsset = asset;
//@ts-ignore
let armatureNames = dragonBonesJson.armature.map(data => data.name);
if (armatureNames.length > 0) {
dragonDisplay.armatureName = armatureNames[0];
}
resolve(animaNode);
});
});
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "17a53d56-b596-4b96-a221-9399edf9f4c4",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 779,
"height": 350,
"platformSettings": {},
"subMetas": {
"WL-nicetry": {
"ver": "1.0.4",
"uuid": "9b6da2ce-b57a-4359-be31-f2650a8d70f5",
"rawTextureUuid": "17a53d56-b596-4b96-a221-9399edf9f4c4",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 779,
"height": 350,
"rawWidth": 779,
"rawHeight": 350,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "a8205389-3f19-49e2-9559-a68b5b152b9e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 314,
"height": 44,
"platformSettings": {},
"subMetas": {
"cakePiece": {
"ver": "1.0.4",
"uuid": "d60a976d-1824-4848-8947-eb07496f4c41",
"rawTextureUuid": "a8205389-3f19-49e2-9559-a68b5b152b9e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 314,
"height": 44,
"rawWidth": 314,
"rawHeight": 44,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "50ccb7f7-222a-44ce-b6d5-dcbf591300e1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 720,
"height": 199,
"platformSettings": {},
"subMetas": {
"comeon": {
"ver": "1.0.4",
"uuid": "3f321347-a19d-4bc7-afaa-72188d163811",
"rawTextureUuid": "50ccb7f7-222a-44ce-b6d5-dcbf591300e1",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 720,
"height": 199,
"rawWidth": 720,
"rawHeight": 199,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
......@@ -11,7 +11,7 @@
"height": 720,
"platformSettings": {},
"subMetas": {
"opacity_half": {
"cover": {
"ver": "1.0.4",
"uuid": "f70546ea-856a-4e13-8233-4edd2dfebdaf",
"rawTextureUuid": "03fd4c3f-44f9-4976-8e95-d7bff0a04633",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment