Commit 4104ce72 authored by AU-Pro-mac's avatar AU-Pro-mac

add new code & fixed some bugs --01

parent abcff205
......@@ -126,7 +126,6 @@ var RES;
for (var key in resList) {
list.push(resList[key]);
}
console.log("开始加载spark资源1");
var p = new Promise(function (resolve, reject) {
loadResList(function (s) {
if (s) {
......@@ -174,7 +173,6 @@ var RES;
RES.loadGroup = loadGroup;
function getResAsync(str, comFun, thisObj) {
var type = str.substring(str.lastIndexOf(".") + 1, str.length);
console.log("开始加载spark资源4", type);
if (type == "png" || type == "jpg") {
if (FYGE.TextureCache[str]) {
comFun && comFun.call(thisObj, FYGE.TextureCache[str], str);
......@@ -186,7 +184,6 @@ var RES;
return new Promise(function (resolve, reject) {
FYGE.GlobalLoader.loadImage(function (s, image) {
if (s) {
console.log("加载成功图片", image);
FYGE.Texture.addToCache(FYGE.Texture.from(image), str);
comFun && comFun.call(thisObj, FYGE.TextureCache[str], str);
resolve(FYGE.TextureCache[str]);
......@@ -261,7 +258,6 @@ var RES;
if (!countAll)
callback(true);
var mark = true;
console.log("开始加载spark资源2");
for (var i = 0; i < countAll; i++) {
var resName = arr[i]['url'];
getResAsync("" + resName, function (res, str) {
......@@ -269,7 +265,6 @@ var RES;
mark = false;
if (++count == countAll)
callback(mark);
console.log("开始加载spark资源3");
}, this);
}
}
......@@ -1878,6 +1873,7 @@ var Main = (function () {
return new Promise(function (resolve, reject) {
FYGE.GlobalLoader.loadImage(function (s, image) {
if (s) {
console.log('ssss', image);
FYGE.createTextureSheet(new FYGE.BaseTexture(image), lottieTexture);
resolve('complete');
}
......@@ -1920,7 +1916,6 @@ var Main = (function () {
return [4, RES_1.RES.loadSparkAssets(resCanvasList)];
case 1:
_a.sent();
console.log("FYGE.TextureCache", FYGE.TextureCache);
console.log('resloadingList 加载完毕');
this.loadImageTextures(resCanvasList).then(function (res) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
......
This diff is collapsed.
......@@ -128,7 +128,6 @@ var RES;
for (var key in resList) {
list.push(resList[key]);
}
console.log("开始加载spark资源1");
var p = new Promise(function (resolve, reject) {
loadResList(function (s) {
if (s) {
......@@ -176,7 +175,6 @@ var RES;
RES.loadGroup = loadGroup;
function getResAsync(str, comFun, thisObj) {
var type = str.substring(str.lastIndexOf(".") + 1, str.length);
console.log("开始加载spark资源4", type);
if (type == "png" || type == "jpg") {
if (FYGE.TextureCache[str]) {
comFun && comFun.call(thisObj, FYGE.TextureCache[str], str);
......@@ -188,7 +186,6 @@ var RES;
return new Promise(function (resolve, reject) {
FYGE.GlobalLoader.loadImage(function (s, image) {
if (s) {
console.log("加载成功图片", image);
FYGE.Texture.addToCache(FYGE.Texture.from(image), str);
comFun && comFun.call(thisObj, FYGE.TextureCache[str], str);
resolve(FYGE.TextureCache[str]);
......@@ -263,7 +260,6 @@ var RES;
if (!countAll)
callback(true);
var mark = true;
console.log("开始加载spark资源2");
for (var i = 0; i < countAll; i++) {
var resName = arr[i]['url'];
getResAsync("" + resName, function (res, str) {
......@@ -271,7 +267,6 @@ var RES;
mark = false;
if (++count == countAll)
callback(mark);
console.log("开始加载spark资源3");
}, this);
}
}
......@@ -1880,6 +1875,7 @@ var Main = (function () {
return new Promise(function (resolve, reject) {
FYGE.GlobalLoader.loadImage(function (s, image) {
if (s) {
console.log('ssss', image);
FYGE.createTextureSheet(new FYGE.BaseTexture(image), lottieTexture);
resolve('complete');
}
......@@ -1922,7 +1918,6 @@ var Main = (function () {
return [4, RES_1.RES.loadSparkAssets(resCanvasList)];
case 1:
_a.sent();
console.log("FYGE.TextureCache", FYGE.TextureCache);
console.log('resloadingList 加载完毕');
this.loadImageTextures(resCanvasList).then(function (res) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
......
......@@ -6,8 +6,8 @@ var fs = require("fs");
// fs.readFileSync("./output.js")
// )
// var endPath = 'D:/duibaGame/测试项目0527/taobaominiTest/client/pages/index1/';
var endPath = "C:/Users/Duiba/Desktop/work/雅顿/new/new_taobao/taobao_mini/client/pages/pagecanvas/"
// var endPath = '/Applications/DUIBA-TAOBAO/YD/new_taobao/taobao_mini/client/pages/pagecanvas/';
// var endPath = "C:/Users/Duiba/Desktop/work/雅顿/new/new_taobao/taobao_mini/client/pages/pagecanvas/"
var endPath = '/Applications/DUIBA-TAOBAO/YD/new_taobao/taobao_mini/client/pages/pagecanvas/';
var version = Math.round(new Date().getTime() / 1000);
......
......@@ -98,8 +98,11 @@ export class Main {
FYGE.GlobalLoader.loadImage(
(s, image) => {
if (s) {
FYGE.createTextureSheet(new FYGE.BaseTexture(image), lottieTexture);
resolve('complete')
console.log('ssss', image)
setTimeout(() => {
FYGE.createTextureSheet(new FYGE.BaseTexture(image), lottieTexture);
resolve('complete')
}, 60);
}
}, resCanvasList['63cb446e-1158-4a94-bf0c-c19ecc7d2cc6'].url)
// [
......
......@@ -94,18 +94,21 @@ Page({
// 开始旋转 转盘
async startDraw () {
console.log('%cstartDraw run', ConsoleStyle)
if (this.data.rotateFlag) return
this.setData({ rotateFlag: true })
console.log('%cstartDraw run', ConsoleStyle)
if (!this.data.leftTimes > 0) {
commonToast('您还没有抽奖次数')
setTimeout(() => { this.setData({ rotateFlag: false }) }, 300)
return
}
const { success, data } = await API.drawLotteryPrize({ activityId: this.activityId}).catch(res => {
commonToast(res && res.message)
this.setData({ rotateFlag: false })
return
}) || {}
console.log('%c--------领取实物奖品\n' + '-----yd.receiveObjectPrize\n', ConsoleStyle, data)
console.log('%c--------转盘抽奖\n' + '-----yd.drawLotteryPrize\n', ConsoleStyle, data)
// test code -
// let success = true
......@@ -115,9 +118,6 @@ Page({
// name: '一碗热翔',
// image: '//yun.duiba.com.cn/spark/assets/9be08f492b1e9fb4006cd676bcf5df760856b74a.png'
// }
// test code -
this.setData({ rotateFlag: true })
if (success && data) {
......@@ -132,7 +132,7 @@ Page({
// 1:权益(优惠券),2:积分,3:实物
} else if (data.type == 1 || data.type == 2 || data.type == 3) {
this.data.listTurnTable.forEach((item, index) => {
if (item._id == data.id) {
if (item._id == data.prizeId) {
rotateT = index + 1
rotateT = 4 + 1
this.setData({ rewardsInfo: data })
......@@ -144,56 +144,61 @@ Page({
}
// 调整位置-归零
this.animateRotation(this.timerCount ? 360 * (++this.timerCount * 2) : 0, 1)
this.animateRotation(this.timerCount ? 360 * (++this.timerCount * 2) : 0, 20)
rotateDeg = rotateT * 60 - 30
this.timerCount += 1
// 开始动画
setTimeout(() => {
this.animateRotation(360 * (++this.timerCount * 2) + rotateDeg, 1000 * (rotateDeg / 360) + 1000)
// 更改 rotateFlag - 弹窗 结果弹窗
setTimeout(() => {
this.setData({ rotateFlag: false })
if (data.type !== 5) {
this.showCommonMoadalT2({
title: '恭喜你',
content: `恭喜您获得${data.name}`,
confirmCallback1: async () => {
await this.getGameInfo()
this.closeCommonModalT2()
this.gotoMyPrize()
},
confirmCallback2: async () => {
await this.getGameInfo()
this.closeCommonModalT2()
},
btnImg1: resList['240b56fa-66ce-414c-86ea-4ac13a3ac4e2'].url,
btnImg2: resList['8d3b3b51-d535-48e6-a76c-d61920da4826'].url,
rewardsImg: data.image
})
} else {
this.showCommonMoadalT1({
title: '很遗憾',
content: `奖励与你擦肩而过\n 再接再厉哦~`,
confirmCallback: async () => {
await this.getGameInfo()
this.closeCommonModalT1()
},
btnImg: resList['fd0d94ef-fe1a-4771-8ba2-ad7aadacafc0'].url
})
}
}, 1000 * (rotateDeg / 360) + 1000 + 20)
this.animateRotation(360 * (this.timerCount * 2) + rotateDeg, 1000 * (rotateDeg / 360) + 40)
}, 300)
// 更改 rotateFlag - 弹窗 结果弹窗
setTimeout(() => {
if (data.type !== 5) {
this.showCommonMoadalT2({
title: '恭喜你',
content: `恭喜您获得${data.name}`,
confirmCallback1: async () => {
this.setData({ rotateFlag: false })
await this.getGameInfo()
this.closeCommonModalT2()
this.gotoMyPrize()
},
confirmCallback2: async () => {
this.setData({ rotateFlag: false })
await this.getGameInfo()
this.closeCommonModalT2()
},
btnImg1: resList['240b56fa-66ce-414c-86ea-4ac13a3ac4e2'].url,
btnImg2: resList['8d3b3b51-d535-48e6-a76c-d61920da4826'].url,
rewardsImg: data.image
})
} else {
this.showCommonMoadalT1({
title: '很遗憾',
content: `奖励与你擦肩而过\n 再接再厉哦~`,
confirmCallback: async () => {
this.setData({ rotateFlag: false })
await this.getGameInfo()
this.closeCommonModalT1()
},
btnImg: resList['fd0d94ef-fe1a-4771-8ba2-ad7aadacafc0'].url
})
}
}, 1000 * (rotateDeg / 360) + 1000 + 100)
let time = this.data.leftTimes - 1
this.setData({ leftTimes: time })
} else {
commonToast('网络拥堵,请稍后再试')
this.setData({ rotateFlag: false })
}
},
// 旋转动画rot:旋转角度,timegap:旋转时间
animateRotation (rot, timegap) {
console.log('animateRotation run')
console.log('animateRotation run', rot, timegap)
let animation = my.createAnimation({
transformOrigin: 'center center',
duration: timegap,
......@@ -296,11 +301,11 @@ Page({
// 通用弹层 - 关闭 - T1
closeCommonModalT1() {
this.setData({ commonModalVisibleT1: false });
this.setData({ commonModalVisibleT1: false, rotateFlag: false });
},
// 通用弹层 - 关闭 - T2
closeCommonModalT2() {
this.setData({ commonModalVisibleT2: false });
this.setData({ commonModalVisibleT2: false, rotateFlag: false });
},
onModalT2One () { this.data.onModalT2One() },
......
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