Commit 3d35f1ef authored by 13732208043's avatar 13732208043

茶叶更新

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