Commit eb739a36 authored by liujiangnan's avatar liujiangnan

feat: 全屏

parent 2a172259
This diff is collapsed.
...@@ -226,8 +226,9 @@ cc.Class({ ...@@ -226,8 +226,9 @@ cc.Class({
}); });
this.barTag.off(cc.Node.EventType.TOUCH_MOVE); this.barTag.off(cc.Node.EventType.TOUCH_MOVE);
this.barTag.on(cc.Node.EventType.TOUCH_MOVE,(e) => { this.barTag.on(cc.Node.EventType.TOUCH_MOVE,(e) => {
console.log("TOUCH_MOVE");
var delta = e.getDelta(); var delta = e.getDelta();
let newX = this.barTag.x+delta.x*2; let newX = this.barTag.x+delta.x;
newX = Math.min(maxX, Math.max(newX, minX)); newX = Math.min(maxX, Math.max(newX, minX));
this.barTag.x = newX; this.barTag.x = newX;
...@@ -238,10 +239,10 @@ cc.Class({ ...@@ -238,10 +239,10 @@ cc.Class({
}); });
this.barTag.off(cc.Node.EventType.TOUCH_ENDED); this.barTag.off(cc.Node.EventType.TOUCH_ENDED);
this.barTag.on(cc.Node.EventType.TOUCH_ENDED, (e) => { this.barTag.on(cc.Node.EventType.TOUCH_ENDED, (e) => {
console.log("TOUCH_ENDED"); console.log("TOUCH_ENDED");
this.userDragStart = false; this.userDragStart = false;
this.updateBarByPos(this.barTag.x); this.updateBarByPos(this.barTag.x);
this.triggerInteractive() this.triggerInteractive()
}); });
this.barTag.on(cc.Node.EventType.MOUSE_UP, (e) => { this.barTag.on(cc.Node.EventType.MOUSE_UP, (e) => {
console.log("MOUSE_UP"); console.log("MOUSE_UP");
...@@ -315,7 +316,6 @@ cc.Class({ ...@@ -315,7 +316,6 @@ cc.Class({
}); });
const animaNode = animNode['animaNode']; const animaNode = animNode['animaNode'];
animaNode.scale = 0.667;
animaNode.x = 500; animaNode.x = 500;
const db = animaNode.getComponent(dragonBones.ArmatureDisplay); const db = animaNode.getComponent(dragonBones.ArmatureDisplay);
const anis = db.getAnimationNames("armatureName"); const anis = db.getAnimationNames("armatureName");
...@@ -389,7 +389,7 @@ cc.Class({ ...@@ -389,7 +389,7 @@ cc.Class({
const minX = 0; const minX = 0;
let newX = percent * maxX; let newX = percent * maxX;
newX = Math.min(maxX, Math.max(newX, minX)); newX = Math.min(maxX, Math.max(newX, minX));
this.barTag.x = newX; this.barTag.x = newX>=(maxX-90)?(maxX-90):newX;
this.bar.width = newX; this.bar.width = newX;
this.bar.x = 0 - (maxX / 2); this.bar.x = 0 - (maxX / 2);
}, },
...@@ -465,6 +465,43 @@ cc.Class({ ...@@ -465,6 +465,43 @@ cc.Class({
cc.audioEngine.playEffect(audio.clip, false); cc.audioEngine.playEffect(audio.clip, false);
}, },
isVideoFull: false,
fullScreen() {
if (this.isVideoFull) {
return;
}
console.log("====进入全屏===");
this.isVideoFull = true;
cc.find(`Canvas/Controls/fullscreen`).active = !this.isVideoFull;
cc.find(`Canvas/Controls/exitfull`).active = this.isVideoFull;
cc.find(`Canvas/video_node`).width = this.node.width;
cc.find(`Canvas/video_node`).height = this.node.height;
cc.find(`Canvas/bg_empty`).width = this.node.width;
cc.find(`Canvas/bg_empty`).height = this.node.height;
this.videoPlayer.node.width = this.node.width;
this.videoPlayer.node.height = this.node.height;
},
exitFullScreen() {
if (!this.isVideoFull) {
return;
}
console.log("====退出全屏===");
this.isVideoFull = false;
cc.find(`Canvas/Controls/fullscreen`).active = !this.isVideoFull;
cc.find(`Canvas/Controls/exitfull`).active = this.isVideoFull;
cc.find(`Canvas/video_node`).width = 1377;
cc.find(`Canvas/video_node`).height = 775;
cc.find(`Canvas/bg_empty`).width = 1377;
cc.find(`Canvas/bg_empty`).height = 775;
this.videoPlayer.node.width = 1377;
this.videoPlayer.node.height = 775;
},
// called every frame // called every frame
update: function (dt) { update: function (dt) {
...@@ -499,6 +536,9 @@ cc.Class({ ...@@ -499,6 +536,9 @@ cc.Class({
if (this.pauseButton.node.active) { if (this.pauseButton.node.active) {
this.pauseButton.node.active = false; this.pauseButton.node.active = false;
} }
if (this.restartButton.node.active) {
this.playButton.node.active = false;
}
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
export const defaultData = { export const defaultData = {
"title": "Hello Apples", "title": "Hello Apples",
"tipSwitch": 1, "tipSwitch": 0,
"audio": "https://staging-teach.cdn.ireadabc.com/c03129693e6cabf061661fba349fa031.mp3", "audio": "https://staging-teach.cdn.ireadabc.com/c03129693e6cabf061661fba349fa031.mp3",
"imgAni": { "imgAni": {
"ske": { "ske": {
......
{
"ver": "2.3.5",
"uuid": "eca6275d-4886-4508-b957-b359c4d6c6b4",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 64,
"height": 64,
"platformSettings": {},
"subMetas": {
"exitfull": {
"ver": "1.0.4",
"uuid": "0a604615-4a1e-4bb1-b106-3a95f04d3e88",
"rawTextureUuid": "eca6275d-4886-4508-b957-b359c4d6c6b4",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 1,
"trimY": 1,
"width": 62,
"height": 62,
"rawWidth": 64,
"rawHeight": 64,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "2da91cfa-5880-4e41-bfbd-997e31f618c6",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 64,
"height": 64,
"platformSettings": {},
"subMetas": {
"fullscreen": {
"ver": "1.0.4",
"uuid": "e6977100-ddff-47b9-8887-5f6476bdca44",
"rawTextureUuid": "2da91cfa-5880-4e41-bfbd-997e31f618c6",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 64,
"height": 64,
"rawWidth": 64,
"rawHeight": 64,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ 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