Commit 9d03152a authored by asdf's avatar asdf

.

parent df41b208
{
"ver": "1.2.9",
"ver": "1.2.7",
"uuid": "196ced84-f877-4734-bed7-931dcdf479fc",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
......
{
"ver": "1.2.9",
"ver": "1.2.7",
"uuid": "d49720e9-3f1f-42ec-9b9b-dc90d989fee4",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
......
{
"ver": "1.2.9",
"ver": "1.2.7",
"uuid": "57ea7c61-9b8b-498a-b024-c98ee9124beb",
"asyncLoadAssets": false,
"autoReleaseAssets": true,
......
......@@ -19,7 +19,7 @@ cc.Class({
this.node.off('touchend', this.onTouchEnd, this);
},
onTouchEnd() {
onTouchEnd(event) {
this.scheduleOnce(() => {
if (GameData._isPageTurning) {
return;
......@@ -65,9 +65,7 @@ cc.Class({
if (this.data.type == 'Image') {
return;
}
this.dragonBone.dragonAtlasAsset = null;
this.dragonBone.dragonAsset = null;
this.dragonBone.armatureName = '';
GameData.loadDBCount++;
var imageUrl = this.data.tex_png;
var skeUrl = this.data.ske_json;
var atlasUrl = this.data.tex_json;
......@@ -106,8 +104,22 @@ cc.Class({
this.dragonBone.armatureName = data.name;
this.animationName = data.animation[0].name;
this.dragonBone.animationName = this.animationName;
this.dragonBone.premultipliedAlpha = true;
atlas.texture.setPremultiplyAlpha(true);
GameData.loadDBCb.push(() => {
if(this.hadSetPremultiplyAlpha){
return;
}
this.hadSetPremultiplyAlpha = true;
this.dragonBone.premultipliedAlpha = true;
this.dragonBone.dragonAtlasAsset.texture.setPremultiplyAlpha(true);
})
GameData.loadDBCount--;
if (GameData.loadDBCount <= 0) {
for (let i = 0; i < GameData.loadDBCb.length; i++) {
GameData.loadDBCb[i] && GameData.loadDBCb[i]();
}
}
this.setSpineScale(data.canvas);
}
});
......@@ -209,7 +221,6 @@ cc.Class({
this.textIndex = 0;
this.schedule(this.chengeTextColor, this.textDuration, this.layoutText.childrenCount, 0.01)
});
this.playSpine();
},
stopAudio() {
cc.audioEngine.stop(this.audioID);
......@@ -221,7 +232,12 @@ cc.Class({
this.dragonBone.playAnimation(this.animationName, 1);
},
stopSpine() {
this.loadSpine();
this.dragonBone.dragonAtlasAsset = null;
this.dragonBone.dragonAsset = null;
this.dragonBone.armatureName = '';
this.scheduleOnce(()=>{
this.loadSpine();
})
},
chengeTextColor() {
......@@ -247,11 +263,9 @@ cc.Class({
playPageUp() {
this.anim.play('pageUp');
this.stopAudio();
},
playPageDown() {
this.anim.play('pageDown');
this.stopAudio();
},
showMask() {
......
......@@ -17,6 +17,8 @@ cc.Class({
onLoad() {
this.initSceneData();
this.initSize();
},
onEnable() {
......@@ -71,7 +73,6 @@ cc.Class({
_audioResList: null,
_animaResList: null,
initSceneData() {
this._currPageIndex = 0;
this._startX = 0;
this._endX = 0;
this._pagesList = [];
......@@ -80,7 +81,10 @@ cc.Class({
this._audioResList = [];
this._animaResList = [];
window.GameData = {};
GameData._currPageIndex = 0;
GameData._isPageTurning = false;
GameData.loadDBCount = 0;
GameData.loadDBCb = [];
},
_designSize: null, // 设计分辨率
......@@ -138,7 +142,7 @@ cc.Class({
},
getDefaultData() {
const dataJson = '{"contentObj":{"version":"1.1","key":"DataKey_Cocos_Test","haveCover":true,"dataArray":[{"type":"Spine","text":"没 有 数 据","image_url":""},{"type":"Spine","text":"没 有 数 据","image_url":""}]}}'
const dataJson = '{"contentObj":{"version":"1.1","key":"DataKey_Cocos_Test","haveCover":true,"dataArray":[{"type":"Spine","text":"没 有 数 据","image_url":""},{"type":"Spine","text":"没 有 数 据","image_url":""},{"type":"Spine","text":"没 有 数 据","image_url":""},{"type":"Spine","text":"没 有 数 据","image_url":""}]}}'
const data = JSON.parse(dataJson);
return data;
},
......@@ -306,18 +310,18 @@ cc.Class({
}
// 已经是最后一页了
let len = this.data.contentObj.dataArray.length;
if (this._currPageIndex + 1 >= len) {
if (GameData._currPageIndex + 1 >= len) {
return;
}
this.showPageMask(this._currPageIndex + 1);
this.hidePageMaskAction(this._currPageIndex + 1);
this.stopPageAudio(this._currPageIndex);
this.stopPageAudio(this._currPageIndex + 1);
this._pagesList[this._currPageIndex].playPageDown();
this._currPageIndex++;
this.showPageMask(GameData._currPageIndex + 1);
this.hidePageMaskAction(GameData._currPageIndex + 1);
this.stopPageAudio(GameData._currPageIndex);
this.stopPageAudio(GameData._currPageIndex + 1);
this._pagesList[GameData._currPageIndex].playPageDown();
GameData._currPageIndex++;
GameData._isPageTurning = true;
this.scheduleOnce(this.onPageDownDone, 0.75)
this._pagesList[this._currPageIndex].onCurrPage();
this._pagesList[GameData._currPageIndex].onCurrPage();
cc.audioEngine.play(this.audTurnPage);
},
// 上一页
......@@ -326,18 +330,18 @@ cc.Class({
return;
}
// 已经是第一页了
if (this._currPageIndex == 0) {
if (GameData._currPageIndex == 0) {
return;
}
this._currPageIndex--;
this.hidePageMask(this._currPageIndex + 1);
this.showPageMaskAction(this._currPageIndex + 1);
this.stopPageAudio(this._currPageIndex);
this.stopPageAudio(this._currPageIndex + 1);
this._pagesList[this._currPageIndex].playPageUp();
GameData._currPageIndex--;
this.hidePageMask(GameData._currPageIndex + 1);
this.showPageMaskAction(GameData._currPageIndex + 1);
this.stopPageAudio(GameData._currPageIndex);
this.stopPageAudio(GameData._currPageIndex + 1);
this._pagesList[GameData._currPageIndex].playPageUp();
GameData._isPageTurning = true;
this.scheduleOnce(this.onPageUpDone, 0.75)
this._pagesList[this._currPageIndex].onCurrPage();
this._pagesList[GameData._currPageIndex].onCurrPage();
cc.audioEngine.play(this.audTurnPage);
},
// 显示下一页的黑色遮罩
......@@ -390,11 +394,11 @@ cc.Class({
refreshIndicator(isPageDown) {
if (isPageDown) {
this._indicatorList[this._currPageIndex] && this._indicatorList[this._currPageIndex].select();
this._indicatorList[this._currPageIndex - 1] && this._indicatorList[this._currPageIndex - 1].unselect();
this._indicatorList[GameData._currPageIndex] && this._indicatorList[GameData._currPageIndex].select();
this._indicatorList[GameData._currPageIndex - 1] && this._indicatorList[GameData._currPageIndex - 1].unselect();
} else {
this._indicatorList[this._currPageIndex] && this._indicatorList[this._currPageIndex].select();
this._indicatorList[this._currPageIndex + 1] && this._indicatorList[this._currPageIndex + 1].unselect();
this._indicatorList[GameData._currPageIndex] && this._indicatorList[GameData._currPageIndex].select();
this._indicatorList[GameData._currPageIndex + 1] && this._indicatorList[GameData._currPageIndex + 1].unselect();
}
},
......
......@@ -3,6 +3,6 @@
"packages": "packages",
"name": "play",
"id": "9af72fd2-44a6-4131-8ea3-3e1b3fa22231",
"version": "2.4.3",
"version": "2.4.0",
"isNew": false
}
\ No newline at end of file
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