Commit 9d03152a authored by asdf's avatar asdf

.

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