Commit 962ed42f authored by Li MingZhe's avatar Li MingZhe

feat: 背景色更改

parents f7228ce8 9e19eb64
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// Learn life-cycle callbacks: // Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import {localPosTolocalPos} from "./util"; import { localPosTolocalPos } from "./util";
cc.Class({ cc.Class({
extends: cc.Component, extends: cc.Component,
...@@ -75,6 +75,7 @@ cc.Class({ ...@@ -75,6 +75,7 @@ cc.Class({
}, },
start() { start() {
cc.debug.setDisplayStats(false);
let getData = this.getData.bind(this); let getData = this.getData.bind(this);
if (window && window.courseware) { if (window && window.courseware) {
// console.log('has window'); // console.log('has window');
...@@ -85,6 +86,8 @@ cc.Class({ ...@@ -85,6 +86,8 @@ cc.Class({
this.data = data || this.getDefaultData(); this.data = data || this.getDefaultData();
this.preloadItem() this.preloadItem()
}) })
console.log('cc.sys.capabilities["touches"] = ', cc.sys.capabilities["touches"]);
}, },
...@@ -180,14 +183,14 @@ cc.Class({ ...@@ -180,14 +183,14 @@ cc.Class({
addPreloadImage() { addPreloadImage() {
if (this.data.bgItem) { if (this.data.bgItem) {
this._imageResList.push({url: this.data.bgItem.url}); this._imageResList.push({ url: this.data.bgItem.url });
} }
if (!this.data.hotZoneItemArr) { if (!this.data.hotZoneItemArr) {
return; return;
} }
this.data.hotZoneItemArr.forEach((item) => { this.data.hotZoneItemArr.forEach((item) => {
if (item.gIdx == '0' && item.pic_url) { if (item.gIdx == '0' && item.pic_url) {
this._imageResList.push({url: item.pic_url}); this._imageResList.push({ url: item.pic_url });
} }
}) })
...@@ -199,7 +202,7 @@ cc.Class({ ...@@ -199,7 +202,7 @@ cc.Class({
return; return;
} }
this.data.hotZoneItemArr.forEach((item) => { this.data.hotZoneItemArr.forEach((item) => {
this._audioResList.push({url: item.audio_url}); this._audioResList.push({ url: item.audio_url });
}) })
}, },
...@@ -209,9 +212,9 @@ cc.Class({ ...@@ -209,9 +212,9 @@ cc.Class({
} }
this.data.hotZoneItemArr.forEach((item) => { this.data.hotZoneItemArr.forEach((item) => {
if (item.gIdx == '0' && item.skeJsonData) { if (item.gIdx == '0' && item.skeJsonData) {
this._animaResList.push({url: item.skeJsonData.url}); this._animaResList.push({ url: item.skeJsonData.url });
this._animaResList.push({url: item.texJsonData.url}); this._animaResList.push({ url: item.texJsonData.url });
this._animaResList.push({url: item.texPngData.url}); this._animaResList.push({ url: item.texPngData.url });
} }
}) })
...@@ -504,7 +507,7 @@ cc.Class({ ...@@ -504,7 +507,7 @@ cc.Class({
return; return;
} }
cc.loader.load({url: this.data.bgItem.url}, (err, img) => { cc.loader.load({ url: this.data.bgItem.url }, (err, img) => {
this.addMask(this.hotZoneBg); this.addMask(this.hotZoneBg);
...@@ -551,7 +554,7 @@ cc.Class({ ...@@ -551,7 +554,7 @@ cc.Class({
this.hotZoneBg.scale = Math.min(sx, sy); this.hotZoneBg.scale = Math.min(sx, sy);
// this.hotZoneBg.y = -frameSize.height / 2 * this._cocosScale + this.hotZoneBg.height / 2 * this.hotZoneBg.scaleY + (subNum * mapS * this._cocosScale); // this.hotZoneBg.y = -frameSize.height / 2 * this._cocosScale + this.hotZoneBg.height / 2 * this.hotZoneBg.scaleY + (subNum * mapS * this._cocosScale);
this.hotZoneBg.y = frameSize.height / 2 * this._cocosScale - this.hotZoneBg.height / 2 * this.hotZoneBg.scaleY ; this.hotZoneBg.y = frameSize.height / 2 * this._cocosScale - this.hotZoneBg.height / 2 * this.hotZoneBg.scaleY;
// this.hotZoneBg.opacity = 20; // this.hotZoneBg.opacity = 20;
...@@ -684,9 +687,9 @@ cc.Class({ ...@@ -684,9 +687,9 @@ cc.Class({
const atlas = data.texJsonData.url//"http://staging-teach.cdn.ireadabc.com/246f8991b729fa3e5a7f4802de828efa.json"; const atlas = data.texJsonData.url//"http://staging-teach.cdn.ireadabc.com/246f8991b729fa3e5a7f4802de828efa.json";
cc.loader.load(image, (error, texture) => { cc.loader.load(image, (error, texture) => {
cc.loader.load({url: atlas, type: 'txt'}, (error, atlasJson) => { cc.loader.load({ url: atlas, type: 'txt' }, (error, atlasJson) => {
cc.loader.load({url: ske, type: 'txt'}, (error, dragonBonesJson) => { cc.loader.load({ url: ske, type: 'txt' }, (error, dragonBonesJson) => {
const atlas = new dragonBones.DragonBonesAtlasAsset(); const atlas = new dragonBones.DragonBonesAtlasAsset();
atlas.atlasJson = atlasJson; atlas.atlasJson = atlasJson;
...@@ -751,7 +754,7 @@ cc.Class({ ...@@ -751,7 +754,7 @@ cc.Class({
picNode.data = data; picNode.data = data;
this.hotZoneBg.addChild(picNode); this.hotZoneBg.addChild(picNode);
cc.loader.load({url: data.pic_url}, (err, img) => { cc.loader.load({ url: data.pic_url }, (err, img) => {
const spr = picNode.addComponent(cc.Sprite); const spr = picNode.addComponent(cc.Sprite);
spr.spriteFrame = new cc.SpriteFrame(img) spr.spriteFrame = new cc.SpriteFrame(img)
...@@ -831,9 +834,9 @@ cc.Class({ ...@@ -831,9 +834,9 @@ cc.Class({
const atlas = data.texJsonData.url//"http://staging-teach.cdn.ireadabc.com/246f8991b729fa3e5a7f4802de828efa.json"; const atlas = data.texJsonData.url//"http://staging-teach.cdn.ireadabc.com/246f8991b729fa3e5a7f4802de828efa.json";
cc.loader.load(image, (error, texture) => { cc.loader.load(image, (error, texture) => {
cc.loader.load({url: atlas, type: 'txt'}, (error, atlasJson) => { cc.loader.load({ url: atlas, type: 'txt' }, (error, atlasJson) => {
cc.loader.load({url: ske, type: 'txt'}, (error, dragonBonesJson) => { cc.loader.load({ url: ske, type: 'txt' }, (error, dragonBonesJson) => {
const atlas = new dragonBones.DragonBonesAtlasAsset(); const atlas = new dragonBones.DragonBonesAtlasAsset();
atlas.atlasJson = atlasJson; atlas.atlasJson = atlasJson;
...@@ -976,7 +979,7 @@ cc.Class({ ...@@ -976,7 +979,7 @@ cc.Class({
_toCenterShow(node) { _toCenterShow(node) {
const bgBottom = cc.find('Canvas/bgBottom'); const bgBottom = cc.find('Canvas/bgBottom');
cc.tween(node) cc.tween(node)
.to(1, {x:0, y: 0, scale: bgBottom.scale}, {easing: 'cubicOut'}) .to(1, { x: 0, y: 0, scale: bgBottom.scale }, { easing: 'cubicOut' })
.call(() => { .call(() => {
}) })
.start(); .start();
...@@ -999,7 +1002,7 @@ cc.Class({ ...@@ -999,7 +1002,7 @@ cc.Class({
const changeNode = this._curShowItem; const changeNode = this._curShowItem;
changeNode.cantouch = false; changeNode.cantouch = false;
cc.tween(this._curShowItem) cc.tween(this._curShowItem)
.to(1, {scale: s * 0.95, x: localPos.x, y: localPos.y}, {easing: 'cubicOut'}) .to(1, { scale: s * 0.95, x: localPos.x, y: localPos.y }, { easing: 'cubicOut' })
.call(() => { .call(() => {
changeNode.cantouch = true; changeNode.cantouch = true;
}) })
...@@ -1150,8 +1153,8 @@ cc.Class({ ...@@ -1150,8 +1153,8 @@ cc.Class({
const backItem = this._curShowItem; const backItem = this._curShowItem;
cc.tween(backItem) cc.tween(backItem)
.to(0.3, {x: backItem.baseX, y: backItem.baseY}, {easing: 'elasticOut'}) .to(0.3, { x: backItem.baseX, y: backItem.baseY }, { easing: 'elasticOut' })
.call(( ) => { .call(() => {
backItem.bgBottomItem.opacity = 255; backItem.bgBottomItem.opacity = 255;
backItem.removeFromParent(); backItem.removeFromParent();
backItem.data.isDrag = false; backItem.data.isDrag = false;
......
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