Commit 39b31330 authored by xytk's avatar xytk

提交代码

parent 3bdab7f3
......@@ -13,6 +13,37 @@
(audioUploaded)="onAudioUploadSuccess($event, 'bt_audio_url')"
></app-audio-recorder>
</div>
<div *ngFor="let option of item.pic_or_dragonBone; let i = index">
<span style="font-size: 30px;">位置:{{i+1}}</span>
<br>
<input type="radio" id="img{{i}}" name="type{{i}}" (click)="setType('img',i)">
图片
<input id="dragonBone{{i}}" type="radio" name="type{{i}}" (click)="setType('dragonBone',i)">
骨骼动画
<div *ngIf="(option.type == 'dragonBone')" style="margin-top: 5px">
<span style="height: 30px; font-size: 18px;">上传骨骼动画(建议上传尺寸为280x368像素):</span>
<app-upload-dragon-bone [btnName]="[['配置骨骼动画']]" [animaNames]="[[['normal']]]"
[skeJsonData]=option.skeJsonData [texJsonData]=option.texJsonData
[texPngData]=option.texPngData (save)="saveAnima($event, item.pic_or_dragonBone,i)"
(refreshEmitter)="refresh()">
</app-upload-dragon-bone>
<br/>
</div>
<div *ngIf="(option.type == 'img')" style="width: 300px;" align='center'>
<span>图片(建议上传尺寸为280x368像素): </span>
<app-upload-image-with-preview
[picUrl]="option.pic_url"
(imageUploaded)="onImageUploadSuccess($event, 'pic_url',i)">
</app-upload-image-with-preview>
<br/>
</div>
<span style="height: 30px; font-size: 18px;">上传音频:</span>
<app-audio-recorder
[audioUrl]="item.audio_url"
(audioUploaded)="onAudioUploadSuccess2($event, 'audio_url',i)"
></app-audio-recorder>
</div>
<!--
<div style="margin-top: 5px">
<span style="height: 30px; font-size: 18px;">上传骨骼动画(建议上传尺寸为280x368像素):</span>
<app-upload-dragon-bone [btnName]="[['配置骨骼动画']]" [animaNames]="[[['normal']]]"
......@@ -56,7 +87,7 @@
(audioUploaded)="onAudioUploadSuccess($event, 'pic_C_audio_url')"
></app-audio-recorder>
</div>
-->
<div style="width: 300px; margin-top: 15px;">
<span>底部文本: </span>
<input type="text" nz-input [(ngModel)]="item.bottom_text" (blur)="save()">
......
......@@ -38,16 +38,42 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.item = {
bt_text:"",
bt_audio_url:"",
dragonBone:{
"skeJsonData": { "url": "" },
"texJsonData": { "url": "" },
"texPngData": { "url": "" },
},
dragonBone_audio_url:"",
pic_A_url:"",
pic_A_audio_url:"",
pic_C_url:"",
pic_C_audio_url:"",
pic_or_dragonBone:[
{
type:"dragonBone",
audio_url:"",
pic_url:"",
"skeJsonData": { "url": "" },
"texJsonData": { "url": "" },
"texPngData": { "url": "" },
},
{
type:"img",
audio_url:"",
pic_url:"",
"skeJsonData": { "url": "" },
"texJsonData": { "url": "" },
"texPngData": { "url": "" },
},
{
type:"img",
audio_url:"",
pic_url:"",
"skeJsonData": { "url": "" },
"texJsonData": { "url": "" },
"texPngData": { "url": "" },
}
],
// dragonBone:{
// "skeJsonData": { "url": "" },
// "texJsonData": { "url": "" },
// "texPngData": { "url": "" },
// },
// dragonBone_audio_url:"",
// pic_A_url:"",
// pic_A_audio_url:"",
// pic_C_url:"",
// pic_C_audio_url:"",
bottom_text:"",
bottom_audio_url:""
};
......@@ -65,6 +91,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.refresh();
}, this.saveKey);
}
ngOnChanges() {
......@@ -74,23 +101,45 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
init() {
setTimeout(()=>{
for (let i = 0; i < this.item.pic_or_dragonBone.length; i++) {
const type = this.item.pic_or_dragonBone[i].type;
if(type=="img"){
//@ts-ignore
document.getElementById('dragonBone'+i).checked =false;
var r = document.getElementById('img'+i)
//@ts-ignore
r.checked = true;
}else{
//@ts-ignore
document.getElementById('dragonBone'+i).checked =true;
var r = document.getElementById('img'+i)
//@ts-ignore
r.checked = false;
}
}
},500);
}
setType(val,i){
this.item.pic_or_dragonBone[i].type = val;
this.save();
}
saveAnima(event, group) {
group.skeJsonData = event.skeJsonData;
group.texJsonData = event.texJsonData;
group.texPngData = event.texPngData;
saveAnima(event, group,i) {
group[i].skeJsonData = event.skeJsonData;
group[i].texJsonData = event.texJsonData;
group[i].texPngData = event.texPngData;
this.save();
}
/**
* 储存图片数据
* @param e
*/
onImageUploadSuccess(e, key) {
onImageUploadSuccess(e, key,i) {
this.item[key] = e.url;
this.item.pic_or_dragonBone[i][key] = e.url;
this.save();
}
......@@ -102,7 +151,14 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.item[key] = e.url;
this.save();
}
/**
* 储存音频数据2
* @param e
*/
onAudioUploadSuccess2(e, key,i) {
this.item.pic_or_dragonBone[i][key] = e.url;
this.save();
}
onWordAudioUploadSuccess(e, idx) {
this.item.wordList[idx].audio = e.url;
this.save();
......
......@@ -81,28 +81,28 @@
"__id__": 16
},
{
"__id__": 32
"__id__": 30
},
{
"__id__": 42
"__id__": 40
},
{
"__id__": 44
"__id__": 42
}
],
"_active": true,
"_components": [
{
"__id__": 54
"__id__": 52
},
{
"__id__": 55
"__id__": 53
},
{
"__id__": 57
"__id__": 55
},
{
"__id__": 56
"__id__": 54
}
],
"_prefab": null,
......@@ -192,7 +192,7 @@
"array": [
0,
0,
586.5427680068793,
587.2719034940045,
0,
0,
0,
......@@ -710,16 +710,16 @@
"__id__": 23
},
{
"__id__": 27
"__id__": 26
}
],
"_active": true,
"_components": [
{
"__id__": 30
"__id__": 28
},
{
"__id__": 31
"__id__": 29
}
],
"_prefab": null,
......@@ -1058,9 +1058,6 @@
},
{
"__id__": 25
},
{
"__id__": 26
}
],
"_prefab": null,
......@@ -1111,36 +1108,6 @@
"groupIndex": 0,
"_id": "7aZr/4CVNGTatn+RFZh7kf"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 23
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": null,
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "c3a+SuRTtCfZEdA/lKdzfR"
},
{
"__type__": "cc.Widget",
"_name": "",
......@@ -1195,10 +1162,7 @@
"_active": true,
"_components": [
{
"__id__": 28
},
{
"__id__": 29
"__id__": 27
}
],
"_prefab": null,
......@@ -1249,42 +1213,12 @@
"groupIndex": 0,
"_id": "eaPfUaETlHwZ/5GqT5VgvK"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 27
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": null,
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "3c3MU8idVAibDF4ufQHJCy"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 27
"__id__": 26
},
"_enabled": true,
"_clip": null,
......@@ -1307,10 +1241,10 @@
"__id__": 22
},
"picAAudioSource": {
"__id__": 26
"__id__": 25
},
"picCAudioSource": {
"__id__": 29
"__id__": 27
},
"_id": "a2RsgrevxLALki66+UKTAy"
},
......@@ -1350,19 +1284,19 @@
},
"_children": [
{
"__id__": 33
"__id__": 31
},
{
"__id__": 37
"__id__": 35
}
],
"_active": true,
"_components": [
{
"__id__": 40
"__id__": 38
},
{
"__id__": 41
"__id__": 39
}
],
"_prefab": null,
......@@ -1418,19 +1352,19 @@
"_name": "label",
"_objFlags": 0,
"_parent": {
"__id__": 32
"__id__": 30
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 34
"__id__": 32
},
{
"__id__": 35
"__id__": 33
},
{
"__id__": 36
"__id__": 34
}
],
"_prefab": null,
......@@ -1486,7 +1420,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 33
"__id__": 31
},
"_enabled": true,
"_materials": [
......@@ -1522,7 +1456,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 33
"__id__": 31
},
"_enabled": true,
"_color": {
......@@ -1540,7 +1474,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 33
"__id__": 31
},
"_enabled": true,
"_clip": null,
......@@ -1556,16 +1490,16 @@
"_name": "doc",
"_objFlags": 0,
"_parent": {
"__id__": 32
"__id__": 30
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 38
"__id__": 36
},
{
"__id__": 39
"__id__": 37
}
],
"_prefab": null,
......@@ -1621,7 +1555,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 37
"__id__": 35
},
"_enabled": true,
"_materials": [
......@@ -1653,7 +1587,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 37
"__id__": 35
},
"_enabled": true,
"_defaultClip": {
......@@ -1672,14 +1606,14 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 32
"__id__": 30
},
"_enabled": true,
"doc": {
"__id__": 37
"__id__": 35
},
"text": {
"__id__": 33
"__id__": 31
},
"_id": "624Q23nvtEgp2teq8h6WHj"
},
......@@ -1688,7 +1622,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 32
"__id__": 30
},
"_enabled": true,
"alignMode": 1,
......@@ -1721,7 +1655,7 @@
"_active": false,
"_components": [
{
"__id__": 43
"__id__": 41
}
],
"_prefab": null,
......@@ -1777,7 +1711,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 42
"__id__": 40
},
"_enabled": true,
"_materials": [
......@@ -1821,13 +1755,13 @@
},
"_children": [
{
"__id__": 45
"__id__": 43
},
{
"__id__": 48
"__id__": 46
},
{
"__id__": 51
"__id__": 49
}
],
"_active": false,
......@@ -1885,11 +1819,11 @@
"_name": "font",
"_objFlags": 0,
"_parent": {
"__id__": 44
"__id__": 42
},
"_children": [
{
"__id__": 46
"__id__": 44
}
],
"_active": true,
......@@ -1947,13 +1881,13 @@
"_name": "BRLNSDB",
"_objFlags": 0,
"_parent": {
"__id__": 45
"__id__": 43
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 47
"__id__": 45
}
],
"_prefab": null,
......@@ -2009,7 +1943,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 46
"__id__": 44
},
"_enabled": true,
"_materials": [
......@@ -2045,11 +1979,11 @@
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 44
"__id__": 42
},
"_children": [
{
"__id__": 49
"__id__": 47
}
],
"_active": true,
......@@ -2107,13 +2041,13 @@
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 48
"__id__": 46
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 50
"__id__": 48
}
],
"_prefab": null,
......@@ -2169,7 +2103,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 49
"__id__": 47
},
"_enabled": true,
"_materials": [
......@@ -2201,11 +2135,11 @@
"_name": "audio",
"_objFlags": 0,
"_parent": {
"__id__": 44
"__id__": 42
},
"_children": [
{
"__id__": 52
"__id__": 50
}
],
"_active": true,
......@@ -2263,13 +2197,13 @@
"_name": "btn",
"_objFlags": 0,
"_parent": {
"__id__": 51
"__id__": 49
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 53
"__id__": 51
}
],
"_prefab": null,
......@@ -2325,7 +2259,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 52
"__id__": 50
},
"_enabled": true,
"_clip": {
......@@ -2364,25 +2298,25 @@
},
"_enabled": true,
"loadInAudioSource": {
"__id__": 56
"__id__": 54
},
"dragonBonesNode": {
"__id__": 19
},
"pic_a_sprite": {
"__id__": 24
"__id__": 23
},
"pic_c_sprite": {
"__id__": 28
"__id__": 26
},
"tittleJs": {
"__id__": 15
},
"middleJs": {
"__id__": 30
"__id__": 28
},
"bottomJs": {
"__id__": 40
"__id__": 38
},
"_id": "e687yyoRBIzZAOVRL8Sseh"
},
......
......@@ -21,12 +21,24 @@ export default class NewClass extends cc.Component {
this.dragonBoneAudioSource.node.on(cc.Node.EventType.TOUCH_START,()=>{
this.dragonBoneAudioSource.play();
let ad = this.dragonBoneAudioSource.node.getComponent(dragonBones.ArmatureDisplay);
if(ad){
ad.playAnimation("normal", 1);
}
})
this.picAAudioSource.node.on(cc.Node.EventType.TOUCH_START,()=>{
this.picAAudioSource.play();
let ad = this.picAAudioSource.node.getComponent(dragonBones.ArmatureDisplay);
if(ad){
ad.playAnimation("normal", 1);
}
})
this.picCAudioSource.node.on(cc.Node.EventType.TOUCH_START,()=>{
this.picCAudioSource.play();
let ad = this.picCAudioSource.node.getComponent(dragonBones.ArmatureDisplay);
if(ad){
ad.playAnimation("normal", 1);
}
})
}
......
......@@ -10,8 +10,8 @@ cc.Class({
properties: {
loadInAudioSource:cc.AudioSource,
dragonBonesNode:cc.Node,
pic_a_sprite:cc.Sprite,
pic_c_sprite:cc.Sprite,
pic_a_sprite:cc.Node,
pic_c_sprite:cc.Node,
tittleJs:Tittle,
middleJs:Middle,
bottomJs:Bottom
......@@ -70,7 +70,7 @@ cc.Class({
if (window && window.courseware) {
getData = window.courseware.getData;
}
this.dragonBonesNode.on(cc.Node.EventType.TOUCH_START,this.playDragonAnimation,this)
// this.dragonBonesNode.on(cc.Node.EventType.TOUCH_START,this.playDragonAnimation,this)
getData((data) => {
cc.log('data:', data);
this.data = data || this.getDefaultData();
......@@ -84,7 +84,6 @@ cc.Class({
if(ad){
ad.playAnimation("normal", 1);
}
},
getData(cb) {
......@@ -92,7 +91,7 @@ cc.Class({
},
getDefaultData() {
const dataJson = '{"bt_text":"11111","bt_audio_url":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","dragonBone":{"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/14ca834d522122b031a2e18be5129251.json","name":"sb_boy_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/ecc48e23d55b1af8eb40d997dc573791.json","name":"sb_boy_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/2d668f8049bc98c0e026921ef316a0fd.png","name":"sb_boy_tex.png"}},"dragonBone_audio_url":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","pic_A_url":"http://staging-teach.cdn.ireadabc.com/79f4b6912d1ffad13da6c05dda328237.jpg","pic_C_url":"http://staging-teach.cdn.ireadabc.com/79f4b6912d1ffad13da6c05dda328237.jpg","bottom_text":"底部的文本","bottom_audio_url":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","pic_A_audio_url":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","pic_C_audio_url":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","dragonBone_animationName":"unit1_boy_jump","dragonBone_armatureName":"Armature"}'
const dataJson = '{"bt_text":"111","bt_audio_url":"http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8.mp3","pic_or_dragonBone":[{"type":"dragonBone","audio_url":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","pic_url":"http://staging-teach.cdn.ireadabc.com/db8a7ed8fb354558fad66edfbba43d89.jpg","skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/14ca834d522122b031a2e18be5129251.json","name":"sb_boy_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/ecc48e23d55b1af8eb40d997dc573791.json","name":"sb_boy_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/2d668f8049bc98c0e026921ef316a0fd.png","name":"sb_boy_tex.png"}},{"type":"img","audio_url":"http://staging-teach.cdn.ireadabc.com/0f0482ddb8c0d3329165ab0612683148.mp3","pic_url":"http://staging-teach.cdn.ireadabc.com/2d668f8049bc98c0e026921ef316a0fd.png","skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/14ca834d522122b031a2e18be5129251.json","name":"sb_boy_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/ecc48e23d55b1af8eb40d997dc573791.json","name":"sb_boy_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/2d668f8049bc98c0e026921ef316a0fd.png","name":"sb_boy_tex.png"}},{"type":"dragonBone","audio_url":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","pic_url":"http://staging-teach.cdn.ireadabc.com/2d668f8049bc98c0e026921ef316a0fd.png","skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/14ca834d522122b031a2e18be5129251.json","name":"sb_boy_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/ecc48e23d55b1af8eb40d997dc573791.json","name":"sb_boy_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/2d668f8049bc98c0e026921ef316a0fd.png","name":"sb_boy_tex.png"}}],"bottom_text":"9999999999999","bottom_audio_url":"http://staging-teach.cdn.ireadabc.com/784cd4188bf126d6c3c9395d9a807619.mp3"}'
const data = JSON.parse(dataJson);
return data;
},
......@@ -108,7 +107,7 @@ cc.Class({
addPreloadImage() {
this._imageResList.push({ url: this.data.pic_A_url });
this._imageResList.push({ url: this.data.pic_C_url });
this._imageResList.push({ url: this.data.dragonBone.texPngData.url });
// this._imageResList.push({ url: this.data.dragonBone.texPngData.url });
},
addPreloadAudio() {
......@@ -120,9 +119,9 @@ cc.Class({
},
addPreloadAnima() {
this._animaResList.push({url: this.data.dragonBone.skeJsonData.url});
this._animaResList.push({url: this.data.dragonBone.texJsonData.url});
this._animaResList.push({url: this.data.dragonBone.texPngData.url});
// this._animaResList.push({url: this.data.dragonBone.skeJsonData.url});
// this._animaResList.push({url: this.data.dragonBone.texJsonData.url});
// this._animaResList.push({url: this.data.dragonBone.texPngData.url});
},
preload() {
......@@ -161,13 +160,13 @@ cc.Class({
this.getAudioByUrl(this.data.bottom_audio_url,(ac)=>{
this.bottomJs.setAudioClip(ac);
});
this.getAudioByUrl(this.data.dragonBone_audio_url,(ac)=>{
this.getAudioByUrl(this.data.pic_or_dragonBone[0].audio_url,(ac)=>{
this.middleJs.setAudioClip(ac,0);
});
this.getAudioByUrl(this.data.pic_A_audio_url,(ac)=>{
this.getAudioByUrl(this.data.pic_or_dragonBone[1].audio_url,(ac)=>{
this.middleJs.setAudioClip(ac,1);
});
this.getAudioByUrl(this.data.pic_C_audio_url,(ac)=>{
this.getAudioByUrl(this.data.pic_or_dragonBone[2].audio_url,(ac)=>{
this.middleJs.setAudioClip(ac,2);
});
},
......@@ -179,15 +178,18 @@ cc.Class({
this.initTile();
//this.initBtn();
this.initIcon();
this.loadDragonBones();
// this.loadDragonBones();
},
loadDragonBones(){
var animNode = this.dragonBonesNode;
loadDragonBones(node,urlData){
var animNode = node;
var dragonDisplay = animNode.addComponent(dragonBones.ArmatureDisplay);
var image = this.data.dragonBone.texPngData.url;
var ske = this.data.dragonBone.skeJsonData.url;
var atlas = this.data.dragonBone.texJsonData.url;
var image = urlData.texPngData.url;
var ske = urlData.skeJsonData.url;
var atlas = urlData.texJsonData.url;
// var image = this.data.dragonBone.texPngData.url;
// var ske = this.data.dragonBone.skeJsonData.url;
// var atlas = this.data.dragonBone.texJsonData.url;
var item = this.data;
cc.loader.load(image, (error, texture) => {
cc.loader.load({ url: atlas, type: 'txt' }, (error, atlasJson) => {
......@@ -244,6 +246,28 @@ cc.Class({
pic1: null,
pic2: null,
initPic() {
// debugger
if(this.data.pic_or_dragonBone[0].type == "img"){
this.loadPic(this.dragonBonesNode,this.data.pic_or_dragonBone[0].pic_url);
}else{
this.loadDragonBones(this.dragonBonesNode,this.data.pic_or_dragonBone[0]);
}
if(this.data.pic_or_dragonBone[1].type == "img"){
this.loadPic(this.pic_a_sprite,this.data.pic_or_dragonBone[1].pic_url);
}else{
this.loadDragonBones(this.pic_a_sprite,this.data.pic_or_dragonBone[1]);
}
if(this.data.pic_or_dragonBone[2].type == "img"){
this.loadPic(this.pic_c_sprite,this.data.pic_or_dragonBone[2].pic_url);
}else{
this.loadDragonBones(this.pic_c_sprite,this.data.pic_or_dragonBone[2]);
}
// dragonBonesNode:cc.Node,
// pic_a_sprite:cc.Node,
// pic_c_sprite:cc.Node,
/*
this.getSpriteFrimeByUrl(this.data.pic_A_url,(spriteFrame)=>{
let width = this.pic_a_sprite.node.width;
let height = this.pic_a_sprite.node.height;
......@@ -265,7 +289,22 @@ cc.Class({
this.pic_c_sprite.node.scale = height/this.pic_c_sprite.node.height;
}
});
*/
},
loadPic(node,pic_url){
this.getSpriteFrimeByUrl(pic_url,(spriteFrame)=>{
let width = node.width;
let height = node.height;
let sprite = node.addComponent(cc.Sprite);
sprite.spriteFrame = spriteFrame;
// cc.log(this.pic_a_sprite.node.scale);
if(node.width/node.height > width/height){
node.scale = width/node.width;
}else{
node.scale = height/node.height;
}
});
},
initIcon() {},
......
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