Commit 03e1853f authored by AU-Pro-mac's avatar AU-Pro-mac

add new code

parent dafe8152
......@@ -2967,10 +2967,14 @@ var GoodsContainer = (function (_super) {
_this.lineArr = [];
_this.createLineTimeOut = null;
_this.goodsArr = [];
_this.createGoodTimeOut = null;
_this.createGoodTimeOut = false;
_this.intoGoods = [];
_this.gameEndFlag = false;
_this.speed = 2.5;
_this.acceleratedSpeed = 0.01;
_this.lt = 0;
_this.tt = 0;
_this.ct = 0;
_this.sum = function (m, n) {
var num = Math.floor(Math.random() * (m - n) + n);
return num;
......@@ -3092,15 +3096,13 @@ var GoodsContainer = (function (_super) {
this.removeEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this);
clearInterval(this.createLineTimeOut);
this.createLineTimeOut = null;
clearInterval(this.createGoodTimeOut);
this.createGoodTimeOut = null;
this.createGoodTimeOut = false;
this.stopGoods();
};
GoodsContainer.prototype.stopGoods = function (type) {
if (type === void 0) { type = ''; }
if (type === 'pause') {
clearInterval(this.createGoodTimeOut);
this.createGoodTimeOut = null;
this.createGoodTimeOut = false;
}
this.intoGoods = [];
this.goodsArr = [];
......@@ -3108,12 +3110,8 @@ var GoodsContainer = (function (_super) {
this.goodsContainer = null;
};
GoodsContainer.prototype.startGoods = function () {
var _this = this;
this.createGoodTimeOut = setInterval(function () {
var g = _this.createGoods();
_this.goodsArr.unshift(g);
_this.goodsContainer.addChildAt(g, -1);
}, 1000);
this.gameEndFlag = false;
this.createGoodTimeOut = true;
};
GoodsContainer.prototype.createGoods = function () {
var _this = this;
......@@ -3158,6 +3156,9 @@ var GoodsContainer = (function (_super) {
}, 750)
.call(function () {
if (cb === 'gameOver') {
if (_this.gameEndFlag)
return;
_this.gameEndFlag = true;
_this.removeAllGoods();
_this._root.gameOver();
}
......@@ -3179,6 +3180,9 @@ var GoodsContainer = (function (_super) {
}, 750)
.call(function () {
if (cb === 'gameOver') {
if (_this.gameEndFlag)
return;
_this.gameEndFlag = true;
_this.removeAllGoods();
_this._root.gameOver();
}
......@@ -3230,7 +3234,7 @@ var GoodsContainer = (function (_super) {
};
GoodsContainer.prototype.fallGood = function (good, index) {
good.speed += this.acceleratedSpeed + 0.0006;
if (good.y > 1300) {
if (good.y >= 1500) {
good.fadeOut(index);
}
else if (!good.turn) {
......@@ -3254,8 +3258,7 @@ var GoodsContainer = (function (_super) {
this.goodsContainer.removeChild(g);
};
GoodsContainer.prototype.removeAllGoods = function () {
clearInterval(this.createGoodTimeOut);
this.createGoodTimeOut = null;
this.createGoodTimeOut = false;
this.goodsArr = [];
this.goodsContainer.removeChildren();
};
......@@ -3340,6 +3343,23 @@ var GoodsContainer = (function (_super) {
};
GoodsContainer.prototype.onEnterFrame = function () {
var _this = this;
if (this.createGoodTimeOut) {
if (this.lt) {
var nt = new Date().getTime();
var dt = nt - this.lt;
this.tt += (dt / 1000) >> 0;
if (this.tt != this.ct) {
this.ct = this.tt;
var g = this.createGoods();
this.goodsArr.unshift(g);
this.goodsContainer.addChildAt(g, -1);
this.lt = nt;
}
}
else {
this.lt = new Date().getTime();
}
}
if (this._root.gameStartFlag)
this.goodsArr.forEach(function (good, index) { _this.fallGood(good, index); });
this.lineArr.forEach(function (line, index) { _this.fallLine(line, index); });
......@@ -15117,7 +15137,7 @@ exports.Star = Star;
Object.defineProperty(exports, "__esModule", { value: true });
exports.config = void 0;
exports.config = {
time: 30,
time: 120,
first: 1000,
second: 2000,
third: 3000,
......
This diff is collapsed.
......@@ -2969,10 +2969,14 @@ var GoodsContainer = (function (_super) {
_this.lineArr = [];
_this.createLineTimeOut = null;
_this.goodsArr = [];
_this.createGoodTimeOut = null;
_this.createGoodTimeOut = false;
_this.intoGoods = [];
_this.gameEndFlag = false;
_this.speed = 2.5;
_this.acceleratedSpeed = 0.01;
_this.lt = 0;
_this.tt = 0;
_this.ct = 0;
_this.sum = function (m, n) {
var num = Math.floor(Math.random() * (m - n) + n);
return num;
......@@ -3094,15 +3098,13 @@ var GoodsContainer = (function (_super) {
this.removeEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this);
clearInterval(this.createLineTimeOut);
this.createLineTimeOut = null;
clearInterval(this.createGoodTimeOut);
this.createGoodTimeOut = null;
this.createGoodTimeOut = false;
this.stopGoods();
};
GoodsContainer.prototype.stopGoods = function (type) {
if (type === void 0) { type = ''; }
if (type === 'pause') {
clearInterval(this.createGoodTimeOut);
this.createGoodTimeOut = null;
this.createGoodTimeOut = false;
}
this.intoGoods = [];
this.goodsArr = [];
......@@ -3110,12 +3112,8 @@ var GoodsContainer = (function (_super) {
this.goodsContainer = null;
};
GoodsContainer.prototype.startGoods = function () {
var _this = this;
this.createGoodTimeOut = setInterval(function () {
var g = _this.createGoods();
_this.goodsArr.unshift(g);
_this.goodsContainer.addChildAt(g, -1);
}, 1000);
this.gameEndFlag = false;
this.createGoodTimeOut = true;
};
GoodsContainer.prototype.createGoods = function () {
var _this = this;
......@@ -3160,6 +3158,9 @@ var GoodsContainer = (function (_super) {
}, 750)
.call(function () {
if (cb === 'gameOver') {
if (_this.gameEndFlag)
return;
_this.gameEndFlag = true;
_this.removeAllGoods();
_this._root.gameOver();
}
......@@ -3181,6 +3182,9 @@ var GoodsContainer = (function (_super) {
}, 750)
.call(function () {
if (cb === 'gameOver') {
if (_this.gameEndFlag)
return;
_this.gameEndFlag = true;
_this.removeAllGoods();
_this._root.gameOver();
}
......@@ -3232,7 +3236,7 @@ var GoodsContainer = (function (_super) {
};
GoodsContainer.prototype.fallGood = function (good, index) {
good.speed += this.acceleratedSpeed + 0.0006;
if (good.y > 1300) {
if (good.y >= 1500) {
good.fadeOut(index);
}
else if (!good.turn) {
......@@ -3256,8 +3260,7 @@ var GoodsContainer = (function (_super) {
this.goodsContainer.removeChild(g);
};
GoodsContainer.prototype.removeAllGoods = function () {
clearInterval(this.createGoodTimeOut);
this.createGoodTimeOut = null;
this.createGoodTimeOut = false;
this.goodsArr = [];
this.goodsContainer.removeChildren();
};
......@@ -3342,6 +3345,23 @@ var GoodsContainer = (function (_super) {
};
GoodsContainer.prototype.onEnterFrame = function () {
var _this = this;
if (this.createGoodTimeOut) {
if (this.lt) {
var nt = new Date().getTime();
var dt = nt - this.lt;
this.tt += (dt / 1000) >> 0;
if (this.tt != this.ct) {
this.ct = this.tt;
var g = this.createGoods();
this.goodsArr.unshift(g);
this.goodsContainer.addChildAt(g, -1);
this.lt = nt;
}
}
else {
this.lt = new Date().getTime();
}
}
if (this._root.gameStartFlag)
this.goodsArr.forEach(function (good, index) { _this.fallGood(good, index); });
this.lineArr.forEach(function (line, index) { _this.fallLine(line, index); });
......@@ -15119,7 +15139,7 @@ exports.Star = Star;
Object.defineProperty(exports, "__esModule", { value: true });
exports.config = void 0;
exports.config = {
time: 30,
time: 120,
first: 1000,
second: 2000,
third: 3000,
......
......@@ -28,9 +28,11 @@ export default class GoodsContainer extends FYGE.Container {
// 掉落物皮肤
goodsTextures;
// 产生掉落物 的 interval函数
createGoodTimeOut = null
createGoodTimeOut = false
// 进入可被滑动的 掉落物
intoGoods = [];
// 游戏结束 flag
gameEndFlag = false;
private speed = 2.5 // 初速度
private acceleratedSpeed = 0.01 // 加速度
......@@ -123,6 +125,7 @@ export default class GoodsContainer extends FYGE.Container {
}
// 收到 滑动方向
getDirection (direction) {
// console.log(this.intoGoods)
......@@ -175,15 +178,16 @@ export default class GoodsContainer extends FYGE.Container {
)
clearInterval(this.createLineTimeOut)
this.createLineTimeOut = null
clearInterval(this.createGoodTimeOut)
this.createGoodTimeOut = null
// clearInterval(this.createGoodTimeOut)
this.createGoodTimeOut = false
this.stopGoods()
}
// 暂停掉落物循环
stopGoods (type = '') {
if (type === 'pause') {
clearInterval(this.createGoodTimeOut)
this.createGoodTimeOut = null
// clearInterval(this.createGoodTimeOut)
this.createGoodTimeOut = false
}
this.intoGoods = []
this.goodsArr = []
......@@ -193,11 +197,8 @@ export default class GoodsContainer extends FYGE.Container {
// 掉落物开始掉落
startGoods () {
this.createGoodTimeOut = setInterval(() => {
let g = this.createGoods()
this.goodsArr.unshift(g)
this.goodsContainer.addChildAt(g, -1)
}, 1000)
this.gameEndFlag = false
this.createGoodTimeOut = true
}
createGoods () {
......@@ -244,6 +245,8 @@ export default class GoodsContainer extends FYGE.Container {
}, 750)
.call(() => {
if (cb === 'gameOver') {
if (this.gameEndFlag) return
this.gameEndFlag = true
this.removeAllGoods()
this._root.gameOver()
}
......@@ -266,6 +269,8 @@ export default class GoodsContainer extends FYGE.Container {
}, 750)
.call(() => {
if (cb === 'gameOver') {
if (this.gameEndFlag) return
this.gameEndFlag = true
this.removeAllGoods()
this._root.gameOver()
}
......@@ -321,7 +326,7 @@ export default class GoodsContainer extends FYGE.Container {
// 掉落物 掉落
fallGood (good, index) {
good.speed += this.acceleratedSpeed + 0.0006
if (good.y > 1300) {
if (good.y >= 1500) {
good.fadeOut(index)
// this.removeGood(index)
} else if (!good.turn) {
......@@ -352,8 +357,8 @@ export default class GoodsContainer extends FYGE.Container {
// 移除所有掉落物
removeAllGoods () {
clearInterval(this.createGoodTimeOut)
this.createGoodTimeOut = null
// clearInterval(this.createGoodTimeOut)
this.createGoodTimeOut = false
this.goodsArr = []
this.goodsContainer.removeChildren()
}
......@@ -460,7 +465,35 @@ export default class GoodsContainer extends FYGE.Container {
}
}
lt = 0
tt = 0
ct = 0
onEnterFrame () {
if (this.createGoodTimeOut) {
if (this.lt) {
let nt = new Date().getTime()
let dt = nt - this.lt
this.tt += (dt / 1000) >> 0
if (this.tt != this.ct) {
// console.log(this.tt)
this.ct = this.tt
let g = this.createGoods()
this.goodsArr.unshift(g)
this.goodsContainer.addChildAt(g, -1)
this.lt = nt
}
} else {
this.lt = new Date().getTime()
}
}
if (this._root.gameStartFlag) this.goodsArr.forEach((good, index) => { this.fallGood(good, index) })
this.lineArr.forEach((line, index) => { this.fallLine(line, index) })
this.leftCsdArr.forEach((line, index) => { this.fallCsdLine(line, index) })
......
export const config = {
//倒计时时间s
time: 30,
time: 120,
//3关分数
first: 1000,
second: 2000,
......
......@@ -478,7 +478,11 @@ Page({
// 页面显示
onShow() {
if (this.userLogin) this.getGameInfo()
this.setData({ missionRefresh: true })
this.setData({
missionRefresh: true,
showChooseGame: app.openYDGame
})
app.openYDGame = false
},
closeMissionRefresh () {
......
......@@ -2969,10 +2969,14 @@ var GoodsContainer = (function (_super) {
_this.lineArr = [];
_this.createLineTimeOut = null;
_this.goodsArr = [];
_this.createGoodTimeOut = null;
_this.createGoodTimeOut = false;
_this.intoGoods = [];
_this.gameEndFlag = false;
_this.speed = 2.5;
_this.acceleratedSpeed = 0.01;
_this.lt = 0;
_this.tt = 0;
_this.ct = 0;
_this.sum = function (m, n) {
var num = Math.floor(Math.random() * (m - n) + n);
return num;
......@@ -3094,15 +3098,13 @@ var GoodsContainer = (function (_super) {
this.removeEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this);
clearInterval(this.createLineTimeOut);
this.createLineTimeOut = null;
clearInterval(this.createGoodTimeOut);
this.createGoodTimeOut = null;
this.createGoodTimeOut = false;
this.stopGoods();
};
GoodsContainer.prototype.stopGoods = function (type) {
if (type === void 0) { type = ''; }
if (type === 'pause') {
clearInterval(this.createGoodTimeOut);
this.createGoodTimeOut = null;
this.createGoodTimeOut = false;
}
this.intoGoods = [];
this.goodsArr = [];
......@@ -3110,12 +3112,8 @@ var GoodsContainer = (function (_super) {
this.goodsContainer = null;
};
GoodsContainer.prototype.startGoods = function () {
var _this = this;
this.createGoodTimeOut = setInterval(function () {
var g = _this.createGoods();
_this.goodsArr.unshift(g);
_this.goodsContainer.addChildAt(g, -1);
}, 1000);
this.gameEndFlag = false;
this.createGoodTimeOut = true;
};
GoodsContainer.prototype.createGoods = function () {
var _this = this;
......@@ -3160,6 +3158,9 @@ var GoodsContainer = (function (_super) {
}, 750)
.call(function () {
if (cb === 'gameOver') {
if (_this.gameEndFlag)
return;
_this.gameEndFlag = true;
_this.removeAllGoods();
_this._root.gameOver();
}
......@@ -3181,6 +3182,9 @@ var GoodsContainer = (function (_super) {
}, 750)
.call(function () {
if (cb === 'gameOver') {
if (_this.gameEndFlag)
return;
_this.gameEndFlag = true;
_this.removeAllGoods();
_this._root.gameOver();
}
......@@ -3232,7 +3236,7 @@ var GoodsContainer = (function (_super) {
};
GoodsContainer.prototype.fallGood = function (good, index) {
good.speed += this.acceleratedSpeed + 0.0006;
if (good.y > 1300) {
if (good.y >= 1500) {
good.fadeOut(index);
}
else if (!good.turn) {
......@@ -3256,8 +3260,7 @@ var GoodsContainer = (function (_super) {
this.goodsContainer.removeChild(g);
};
GoodsContainer.prototype.removeAllGoods = function () {
clearInterval(this.createGoodTimeOut);
this.createGoodTimeOut = null;
this.createGoodTimeOut = false;
this.goodsArr = [];
this.goodsContainer.removeChildren();
};
......@@ -3342,6 +3345,23 @@ var GoodsContainer = (function (_super) {
};
GoodsContainer.prototype.onEnterFrame = function () {
var _this = this;
if (this.createGoodTimeOut) {
if (this.lt) {
var nt = new Date().getTime();
var dt = nt - this.lt;
this.tt += (dt / 1000) >> 0;
if (this.tt != this.ct) {
this.ct = this.tt;
var g = this.createGoods();
this.goodsArr.unshift(g);
this.goodsContainer.addChildAt(g, -1);
this.lt = nt;
}
}
else {
this.lt = new Date().getTime();
}
}
if (this._root.gameStartFlag)
this.goodsArr.forEach(function (good, index) { _this.fallGood(good, index); });
this.lineArr.forEach(function (line, index) { _this.fallLine(line, index); });
......@@ -15119,7 +15139,7 @@ exports.Star = Star;
Object.defineProperty(exports, "__esModule", { value: true });
exports.config = void 0;
exports.config = {
time: 30,
time: 120,
first: 1000,
second: 2000,
third: 3000,
......
......@@ -159,8 +159,8 @@ Component({
// 游戏开始 获取用户信息
async gameStartInfo () {
// test - code
this.gameStartInfo_test()
return
// this.gameStartInfo_test()
// return
// 游戏重新开始 获取游戏次数
let gt = true
......@@ -170,7 +170,7 @@ Component({
if (!success) { console.warn(res); commonToast(res && res.message) }
else {
console.log('%c-----获取游戏信息\n' + '-----yd.getGameInfo\n', ConsoleStyle, data)
if (data.gameTimes == '0' || data.gameTimes == 0) gt = false
if (data.gameTimes == 0) gt = false
}
}
......@@ -249,8 +249,8 @@ Component({
// 游戏结束 获取开奖
getGameOverPrize () {
// test - code
this.getGameOverPrize_test()
return
// this.getGameOverPrize_test()
// return
API.gameOver({activityId: app.activityId, type: this.gameType == 1 ? 'slide' : 'timeline', isWin: this.isWin})
.then(res => {
......@@ -413,7 +413,7 @@ Component({
getGameOverPrize_test (){
this.gamePrize = {
name: '一碗热翔',
name: '一碗',
image: '//yun.duiba.com.cn/spark/assets/43081f4ee9aed1c4d89d9e0882b2b5210a93ef17.png',
type: 3
}
......
......@@ -4,7 +4,7 @@ import { clickStat } from '../../md';
import resList from '../../resconfig/resList.js'
const { tbcc } = app;
const { SHARE_CONFIG, REDIRECT_URL } = tbcc.constants;
const { commonToast, getAuthUserInfo, navigateToOutside, ConsoleStyle, checkShopFavoredStatus, debounce } = tbcc.tb;
const { commonToast, getAuthUserInfo, navigateToOutside, ConsoleStyle, checkShopFavoredStatus, debounce, redirectTo } = tbcc.tb;
Page({
data: {
......@@ -111,6 +111,9 @@ Page({
confirmCallback: async () => {
this.setData({ rotateFlag: false })
this.closeCommonModalT1()
app.openYDGame = true
my.navigateBack()
// redirectTo('/pages/homePage/homePage')
},
btnImg: resList['8aa6d279-6105-430a-8b5a-2132a983fa8a'].url
})
......
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