Commit 3d35f1ef authored by 13732208043's avatar 13732208043

茶叶更新

parent 57aa8bf6
This diff is collapsed.
...@@ -194,7 +194,6 @@ ...@@ -194,7 +194,6 @@
var nowNum = TeaNums.nowNum + 1; var nowNum = TeaNums.nowNum + 1;
var surplus = nowNum - totalNum; var surplus = nowNum - totalNum;
if (surplus == 0) { if (surplus == 0) {
console.log('达到最大长度');
this.progressbarImg.x = this.teaFullFlagImg.width / 2; this.progressbarImg.x = this.teaFullFlagImg.width / 2;
this.teaHalfFlagImg.visible = false; this.teaHalfFlagImg.visible = false;
this.teaFullFlagImg.visible = !this.teaHalfFlagImg.visible; this.teaFullFlagImg.visible = !this.teaHalfFlagImg.visible;
...@@ -202,21 +201,17 @@ ...@@ -202,21 +201,17 @@
this.addOneSvga.stop(); this.addOneSvga.stop();
return; return;
} }
console.log('surplus', surplus);
var width = this.progressbarImg.width; var width = this.progressbarImg.width;
var myDate = new Date(); var myDate = new Date();
var nowData = myDate.getTime(); var nowData = myDate.getTime();
var serverData = TeaNums.serverData; var serverData = TeaNums.serverData;
var fbdvalue = Math.abs((nowData - serverData)); var fbdvalue = Math.abs((nowData - serverData));
console.log('fbdvalue', fbdvalue);
var dataDiff = 0; var dataDiff = 0;
var x = -width * (1 - nowNum / totalNum); var x = -width * (1 - nowNum / totalNum);
console.log('x', x); showLog('parseFloat(x.toFixed(3))', parseFloat(x.toFixed(3)));
console.log('parseFloat(x.toFixed(3))', parseFloat(x.toFixed(3)));
this.progressbarImg.x = parseFloat(x.toFixed(3)) + this.teaFullFlagImg.width / 2 - Math.abs(this.teaFullFlagImg.x); this.progressbarImg.x = parseFloat(x.toFixed(3)) + this.teaFullFlagImg.width / 2 - Math.abs(this.teaFullFlagImg.x);
console.log('this.progressbarImg.x', this.progressbarImg.x); showLog('this.progressbarImg.x', this.progressbarImg.x);
var step = (this.teaFullFlagImg.width / 2 - this.progressbarImg.x) / surplus; var step = (this.teaFullFlagImg.width / 2 - this.progressbarImg.x) / surplus;
console.log('step', step);
this.addOneSvga.play(1, true); this.addOneSvga.play(1, true);
var speed = props.pickTeaSpeed; var speed = props.pickTeaSpeed;
var teaFullRotation = engine.Tween.get(this.teaHalfFlagImg, { loop: true }) var teaFullRotation = engine.Tween.get(this.teaHalfFlagImg, { loop: true })
...@@ -225,7 +220,6 @@ ...@@ -225,7 +220,6 @@
}); });
this.schedule = setInterval(function () { this.schedule = setInterval(function () {
if (nowNum == totalNum) { if (nowNum == totalNum) {
console.log('达到最大长度');
clearInterval(_this.schedule); clearInterval(_this.schedule);
engine.Tween.removeTweens(teaFullRotation); engine.Tween.removeTweens(teaFullRotation);
_this.progressbarImg.x = _this.teaFullFlagImg.width / 2; _this.progressbarImg.x = _this.teaFullFlagImg.width / 2;
...@@ -234,7 +228,6 @@ ...@@ -234,7 +228,6 @@
_this.addOneSvga.visible = !_this.teaHalfFlagImg.visible; _this.addOneSvga.visible = !_this.teaHalfFlagImg.visible;
_this.addOneSvga.stop(); _this.addOneSvga.stop();
} }
console.log('nowNum', nowNum, 'totalNum', totalNum);
_this.getTeaPercentage(nowNum, totalNum); _this.getTeaPercentage(nowNum, totalNum);
if (_this.progressbarImg.x < _this.teaFullFlagImg.width / 2 + step) { if (_this.progressbarImg.x < _this.teaFullFlagImg.width / 2 + step) {
_this.progressbarImg.x -= step; _this.progressbarImg.x -= step;
...@@ -244,8 +237,6 @@ ...@@ -244,8 +237,6 @@
myDate = new Date(); myDate = new Date();
nowData = myDate.getTime(); nowData = myDate.getTime();
if (Math.abs((nowData - serverData)) - dataDiff > (fbdvalue + 3000)) { if (Math.abs((nowData - serverData)) - dataDiff > (fbdvalue + 3000)) {
console.log('校准数据前后数据偏差过大');
console.log(Math.abs((nowData - serverData)) - dataDiff - (fbdvalue + 3000));
clearInterval(_this.schedule); clearInterval(_this.schedule);
engine.Tween.removeTweens(teaFullRotation); engine.Tween.removeTweens(teaFullRotation);
engine.globalEvent.dispatchEvent('event-setchange-TeaNum'); engine.globalEvent.dispatchEvent('event-setchange-TeaNum');
...@@ -265,7 +256,6 @@ ...@@ -265,7 +256,6 @@
if (nowNum < (portion * 2)) { if (nowNum < (portion * 2)) {
teaPercentage = 1; teaPercentage = 1;
} }
console.log('teaPercentage', teaPercentage);
if (this.nowPercentage != teaPercentage) { if (this.nowPercentage != teaPercentage) {
this.nowPercentage = teaPercentage; this.nowPercentage = teaPercentage;
this.updateTeaPercentage(teaPercentage); this.updateTeaPercentage(teaPercentage);
......
This diff is collapsed.
...@@ -316,7 +316,7 @@ export default class GameView extends engine.Container { ...@@ -316,7 +316,7 @@ export default class GameView extends engine.Container {
let surplus = nowNum - totalNum; let surplus = nowNum - totalNum;
if (surplus == 0) { if (surplus == 0) {
console.log('达到最大长度'); showLog('达到最大长度');
this.progressbarImg.x = this.teaFullFlagImg.width / 2 this.progressbarImg.x = this.teaFullFlagImg.width / 2
this.teaHalfFlagImg.visible = false; this.teaHalfFlagImg.visible = false;
this.teaFullFlagImg.visible = !this.teaHalfFlagImg.visible this.teaFullFlagImg.visible = !this.teaHalfFlagImg.visible
...@@ -324,14 +324,14 @@ export default class GameView extends engine.Container { ...@@ -324,14 +324,14 @@ export default class GameView extends engine.Container {
this.addOneSvga.stop(); this.addOneSvga.stop();
return; return;
} }
console.log('surplus', surplus); showLog('surplus', surplus);
let width = this.progressbarImg.width; let width = this.progressbarImg.width;
let myDate = new Date(); let myDate = new Date();
let nowData = myDate.getTime(); let nowData = myDate.getTime();
let serverData = TeaNums.serverData; let serverData = TeaNums.serverData;
//前后端本身的差值 //前后端本身的差值
let fbdvalue = Math.abs((nowData - serverData)) let fbdvalue = Math.abs((nowData - serverData))
console.log('fbdvalue', fbdvalue) showLog('fbdvalue', fbdvalue)
/**/ /**/
//设置数据校正 //设置数据校正
// let serverData = 0; // let serverData = 0;
...@@ -340,17 +340,17 @@ export default class GameView extends engine.Container { ...@@ -340,17 +340,17 @@ export default class GameView extends engine.Container {
//let rate = (443 - width * (1 - nowNum / totalNum)) //let rate = (443 - width * (1 - nowNum / totalNum))
//已经走得 //已经走得
let x = -width * (1 - nowNum / totalNum) let x = -width * (1 - nowNum / totalNum)
console.log('x', x); showLog('x', x);
console.log('parseFloat(x.toFixed(3))', parseFloat(x.toFixed(3))) showLog('parseFloat(x.toFixed(3))', parseFloat(x.toFixed(3)))
this.progressbarImg.x = parseFloat(x.toFixed(3)) + this.teaFullFlagImg.width / 2 - Math.abs(this.teaFullFlagImg.x)//)//this.teaFullFlagImg.width - Math.abs(this.teaFullFlagImg.x) this.progressbarImg.x = parseFloat(x.toFixed(3)) + this.teaFullFlagImg.width / 2 - Math.abs(this.teaFullFlagImg.x)//)//this.teaFullFlagImg.width - Math.abs(this.teaFullFlagImg.x)
console.log('this.progressbarImg.x', this.progressbarImg.x) showLog('this.progressbarImg.x', this.progressbarImg.x)
let step = (this.teaFullFlagImg.width / 2 - this.progressbarImg.x) / surplus let step = (this.teaFullFlagImg.width / 2 - this.progressbarImg.x) / surplus
console.log('step', step) showLog('step', step)
//step = parseFloat(step.toFixed(6)); //step = parseFloat(step.toFixed(6));
//console.log('进图条每秒比例step', step) //showLog('进图条每秒比例step', step)
this.addOneSvga.play(1, true); this.addOneSvga.play(1, true);
let speed = props.pickTeaSpeed; let speed = props.pickTeaSpeed;
...@@ -361,7 +361,7 @@ export default class GameView extends engine.Container { ...@@ -361,7 +361,7 @@ export default class GameView extends engine.Container {
}) })
this.schedule = setInterval(() => { this.schedule = setInterval(() => {
if (nowNum == totalNum) { if (nowNum == totalNum) {
console.log('达到最大长度'); showLog('达到最大长度');
clearInterval(this.schedule); clearInterval(this.schedule);
engine.Tween.removeTweens(teaFullRotation); engine.Tween.removeTweens(teaFullRotation);
this.progressbarImg.x = this.teaFullFlagImg.width / 2 this.progressbarImg.x = this.teaFullFlagImg.width / 2
...@@ -370,7 +370,7 @@ export default class GameView extends engine.Container { ...@@ -370,7 +370,7 @@ export default class GameView extends engine.Container {
this.addOneSvga.visible = !this.teaHalfFlagImg.visible this.addOneSvga.visible = !this.teaHalfFlagImg.visible
this.addOneSvga.stop(); this.addOneSvga.stop();
} }
console.log('nowNum', nowNum, 'totalNum', totalNum) //showLog('nowNum', nowNum, 'totalNum', totalNum)
this.getTeaPercentage(nowNum, totalNum); this.getTeaPercentage(nowNum, totalNum);
if (this.progressbarImg.x < this.teaFullFlagImg.width / 2 + step) { if (this.progressbarImg.x < this.teaFullFlagImg.width / 2 + step) {
this.progressbarImg.x -= step; this.progressbarImg.x -= step;
...@@ -381,8 +381,8 @@ export default class GameView extends engine.Container { ...@@ -381,8 +381,8 @@ export default class GameView extends engine.Container {
nowData = myDate.getTime(); nowData = myDate.getTime();
if (Math.abs((nowData - serverData)) - dataDiff > (fbdvalue + 3000)) { if (Math.abs((nowData - serverData)) - dataDiff > (fbdvalue + 3000)) {
console.log('校准数据前后数据偏差过大'); showLog('校准数据前后数据偏差过大');
console.log(Math.abs((nowData - serverData)) - dataDiff - (fbdvalue + 3000)) showLog(Math.abs((nowData - serverData)) - dataDiff - (fbdvalue + 3000))
clearInterval(this.schedule); clearInterval(this.schedule);
engine.Tween.removeTweens(teaFullRotation); engine.Tween.removeTweens(teaFullRotation);
engine.globalEvent.dispatchEvent('event-setchange-TeaNum'); engine.globalEvent.dispatchEvent('event-setchange-TeaNum');
...@@ -402,7 +402,7 @@ export default class GameView extends engine.Container { ...@@ -402,7 +402,7 @@ export default class GameView extends engine.Container {
if (nowNum < (portion * 2)) { if (nowNum < (portion * 2)) {
teaPercentage = 1; teaPercentage = 1;
} }
console.log('teaPercentage', teaPercentage) showLog('teaPercentage', teaPercentage)
if (this.nowPercentage != teaPercentage) { if (this.nowPercentage != teaPercentage) {
showLog('状态改变') showLog('状态改变')
this.nowPercentage = teaPercentage; this.nowPercentage = teaPercentage;
......
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