Commit da91fda0 authored by Tt's avatar Tt

滑动翻页增加

parent a4583969
This diff is collapsed.
...@@ -89,6 +89,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -89,6 +89,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
private layers: Array<cc.Node>; private layers: Array<cc.Node>;
initView() { initView() {
pg.view.touchOn(this.btn_auto, this.onTouchAuto, this); pg.view.touchOn(this.btn_auto, this.onTouchAuto, this);
pg.view.visible(pg.view.find(this, 'tip_record'), false);
pg.view.visible(pg.view.find(this, 'tip_nopic'), false);
} }
resetView() { resetView() {
...@@ -108,6 +110,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -108,6 +110,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.view.touchOn(btn_right, this.onTouchRecordRight, this); pg.view.touchOn(btn_right, this.onTouchRecordRight, this);
pg.view.touchOn(btn_play, this.onTouchRecordPlay, this); pg.view.touchOn(btn_play, this.onTouchRecordPlay, this);
pg.view.touchOn(btn_stop, this.onTouchRecordStop, this); pg.view.touchOn(btn_stop, this.onTouchRecordStop, this);
pg.view.touchMoveOn(this.layer_touch, this.onTouchPanelMove, this);
} }
private get LastData() { private get LastData() {
...@@ -199,6 +203,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -199,6 +203,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
@property(cc.Node) @property(cc.Node)
public btn_record: cc.Node = null; public btn_record: cc.Node = null;
@property(cc.Node)
public layer_touch: cc.Node = null;
log(str) { log(str) {
const node = cc.find('middleLayer'); const node = cc.find('middleLayer');
if (node) { if (node) {
...@@ -452,10 +459,6 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -452,10 +459,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
preLayer() { preLayer() {
// 积分需要计算,未获取的内容 // 积分需要计算,未获取的内容
if (!this.LastData) {
this.touchForbid = false;
return;
}
pg.hw.playLocalAudio('pagenext') pg.hw.playLocalAudio('pagenext')
this.tempCount = 0; this.tempCount = 0;
cc.audioEngine.stopEffect(this.currentAudioId); cc.audioEngine.stopEffect(this.currentAudioId);
...@@ -623,20 +626,59 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -623,20 +626,59 @@ export default class SceneComponent extends MyCocosSceneComponent {
let move = touchPoint.clone().subtract(startPoint); let move = touchPoint.clone().subtract(startPoint);
console.log(move.toString()); console.log(move.toString());
if (move.x < -10) { if (move.x < -10) {
this.touchForbid = true;
console.log("lastPage")
this.lastPage();
} else if (move.x > 10) {
this.touchForbid = true; this.touchForbid = true;
console.log("nextPage") console.log("nextPage")
this.nextPage(); this.nextPage();
} else if (move.x > 10) {
this.touchForbid = true;
console.log("lastPage")
this.lastPage();
} }
} }
lastPage() { lastPage() {
if (!this.LastData) {
this.touchForbid = false;
let tip = pg.view.find(this, 'tip_nopic');
pg.view.visible(tip, true);
tip.opacity = 255;
cc.Tween.stopAllByTarget(tip)
cc.tween(tip).delay(0.8).to(0.5, { opacity: 0 }).start();
return;
}
if (this.recording) {
this.touchForbid = false;
// 显示提示
let tip = pg.view.find(this, 'tip_record');
pg.view.visible(tip, true);
tip.opacity = 255;
cc.Tween.stopAllByTarget(tip)
cc.tween(tip).delay(0.8).to(0.5, { opacity: 0 }).start();
return;
}
// 停止当前所有动作 // 停止当前所有动作
this.preLayer(); this.preLayer();
} }
nextPage() { nextPage() {
if (!this.NextData) {
this.touchForbid = false;
let tip = pg.view.find(this, 'tip_nopic');
pg.view.visible(tip, true);
tip.opacity = 255;
cc.Tween.stopAllByTarget(tip)
cc.tween(tip).delay(0.8).to(0.5, { opacity: 0 }).start();
return;
}
if (this.recording) {
this.touchForbid = false;
// 显示提示
let tip = pg.view.find(this, 'tip_record');
pg.view.visible(tip, true);
tip.opacity = 255;
cc.Tween.stopAllByTarget(tip)
cc.tween(tip).delay(0.8).to(0.5, { opacity: 0 }).start();
return;
}
if (this.recordFlag) { if (this.recordFlag) {
if (this.count + 1 <= this.maxCurrent) { if (this.count + 1 <= this.maxCurrent) {
this.nextLayer(); this.nextLayer();
......
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