Commit d7d3265a authored by haiyoucuv's avatar haiyoucuv

fixProgress

parent c8927989
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"success": true,
"message": "",
"data": true
}
......@@ -3,39 +3,41 @@
"data": {
"guideStep": 8,
"guideIsEnd": true,
"waterDrops": 999,
"waterDrops": 94,
"plants": [
{
"level": "",
"waterRestCount": "",
"plant": false,
"waterTime": "",
"level": 2,
"waterRestCount": 1,
"totalTime": 3000,
"plant": true,
"waterTime": 1591954069560,
"index": 1,
"plantType": ""
"plantType": "CHESTNUT"
},
{
"level": 2,
"level": 3,
"waterRestCount": 0,
"totalTime": 120000,
"plant": true,
"waterTime": 1591881517849,
"totalTime": 0,
"plant": false,
"waterTime": "",
"index": 2,
"plantType": "PECAN"
"plantType": "CHESTNUT"
},
{
"level": "",
"waterRestCount": "",
"level": 3,
"waterRestCount": 0,
"totalTime": 0,
"plant": false,
"waterTime": "",
"index": 3,
"plantType": ""
"plantType": "CHESTNUT"
},
{
"level": 2,
"level": 3,
"waterRestCount": 0,
"totalTime": 120000,
"plant": true,
"waterTime": 1591882423283,
"totalTime": 0,
"plant": false,
"waterTime": "",
"index": 4,
"plantType": "CHESTNUT"
}
......
{
"code": "000000",
"data": true,
"success": true,
"data": true
"message": "成功"
}
This diff is collapsed.
This diff is collapsed.
......@@ -113,11 +113,7 @@
"name": "shopPanel"
},
{
"keys": "浇水动效.svga",
"name": "svga"
},
{
"keys": "task_browseGoods_icon.png,task_done.png,task_follow_icon.png,task_go.png,task_icon.png,task_invites_icon.png,task_item_bg.png,task_joinGroup_icon.png,task_member_icon.png,task_order_icon.png,task_sign_icon.png",
"keys": "task_browseGoods_icon.png,task_btn_bg.png,task_done.png,task_follow_icon.png,task_get.png,task_go.png,task_icon.png,task_invites_icon.png,task_item_bg.png,task_joinGroup_icon.png,task_member_icon.png,task_order_icon.png,task_sign_icon.png",
"name": "taskPanel"
},
{
......
......@@ -6879,16 +6879,12 @@ export const ResJson = {
}
},
{
"keys": "浇水动效.svga",
"name": "svga"
},
{
"keys": "task_browseGoods_icon.png,task_done.png,task_follow_icon.png,task_go.png,task_icon.png,task_invites_icon.png,task_item_bg.png,task_joinGroup_icon.png,task_member_icon.png,task_order_icon.png,task_sign_icon.png",
"keys": "task_browseGoods_icon.png,task_btn_bg.png,task_done.png,task_follow_icon.png,task_get.png,task_go.png,task_icon.png,task_invites_icon.png,task_item_bg.png,task_joinGroup_icon.png,task_member_icon.png,task_order_icon.png,task_sign_icon.png",
"name": "taskPanel",
"atlas": {
"task_browseGoods_icon.png": {
"x": 790,
"y": 141,
"x": 697,
"y": 176,
"w": 137,
"h": 137,
"ox": 0,
......@@ -6897,9 +6893,20 @@ export const ResJson = {
"sh": 137,
"ro": false
},
"task_btn_bg.png": {
"x": 836,
"y": 141,
"w": 129,
"h": 66,
"ox": 0,
"oy": 0,
"sw": 129,
"sh": 66,
"ro": true
},
"task_done.png": {
"x": 765,
"y": 280,
"x": 836,
"y": 272,
"w": 71,
"h": 24,
"ox": 29,
......@@ -6919,9 +6926,20 @@ export const ResJson = {
"sh": 137,
"ro": false
},
"task_get.png": {
"x": 929,
"y": 133,
"w": 129,
"h": 66,
"ox": 0,
"oy": 0,
"sw": 129,
"sh": 66,
"ro": true
},
"task_go.png": {
"x": 697,
"y": 176,
"x": 929,
"y": 2,
"w": 129,
"h": 66,
"ox": 0,
......@@ -7104,5 +7122,5 @@ export const ResJson = {
}
}
],
"path": "https://yun.duiba.com.cn/db_games/activity/anything/1591879548/resource/"
"path": "https://yun.duiba.com.cn/db_games/activity/anything/1591954961/resource/"
}
\ No newline at end of file
import { showToast, wait, clearWait } from "../module/ctrls";
import { commonToast, getUserAddress } from "./utils";
// @ts-ignore
......@@ -47,6 +48,8 @@ export enum TbNetName {
guide = 'qiaqiaHome.doNoviceGuide',
receiveTaskRewards = 'qiaqia2.receiveTaskRewards',
// 游戏信息
gameInfo = 'qiaqiaHome.getGameInfo',
......@@ -86,76 +89,130 @@ export function setTbData(key: TbNetName, data) {
* @param hideMsg
*/
export function sendTbNet(netName: TbNetName, parameter: any, callback: Function, hideMsg: boolean = false) {
let query = netName.split('.');
let invoke = (query.length >= 2) ? query[0] : 'qiaqiaHome';
let route = (query.length >= 2) ? query[1] : query[0];
parameter.activityId = activityId;
//网络超时
let waitObj = wait(() => {
if (!hideMsg) showToast("网络超时")
callback(false)
}, 5000)
//@ts-ignore 本地开发,直接取数据
if (!my) {
var url = "../../mock/miniTb/" + netName + ".json";
fetchAsync(url)
.then((data) => {
//清除超时
clearWait(waitObj)
return new Promise((resolve, reject) => {
let query = netName.split('.');
let invoke = (query.length >= 2) ? query[0] : 'qiaqiaHome';
let route = (query.length >= 2) ? query[1] : query[0];
parameter.activityId = activityId;
//网络超时
let waitObj = wait(() => {
if (!hideMsg) showToast("网络超时")
resolve();
callback(false)
}, 5000)
//@ts-ignore 本地开发,直接取数据
if (!my) {
var url = "../../mock/miniTb/" + netName + ".json";
fetchAsync(url)
.then((data) => {
//清除超时
clearWait(waitObj)
//记录数据
dataRecord[netName] = data;
//统一错误信息提示
if (!hideMsg && !data.success) showToast(data.message || "网络异常")
//回调
resolve(data);
callback(data.success, data);
// 打印一下
console.log(
`\n%c[ mock ]\n`
+ `NAME : ${netName} \n`
+ `STATE : %o \n`
+ `PARAM : %o \n`
+ `%cDATA : %o \n`
, `${data.success ? 'color:green' : 'color:red'}`
, data.success
, parameter
, `${data.success ? 'color:green' : 'color:red'}`
, data
);
}, () => {
});
return;
}
//@ts-ignore
if (!fc) fc = getApp().cloud.function;
//第一个参数视项目而定
fc.invoke(invoke, parameter, route)
.then((res: dataOut) => {
clearWait(waitObj);
//记录数据
dataRecord[netName] = data;
dataRecord[netName] = res;
// console.log("返回数据" + JSON.stringify(res));
//统一错误信息提示
if (!hideMsg && !data.success) showToast(data.message || "网络异常")
if (!hideMsg && !res.success) showToast(codeMsg[res.code] || res.message || "网络异常")
//回调
callback(data.success, data);
// 打印一下
resolve(res);
callback(res.success, res);
console.log(
`\n%c[ mock ]\n`
+ `NAME : ${netName} \n`
+ `STATE : %o \n`
+ `PARAM : %o \n`
+ `%cDATA : %o \n`
, `${data.success ? 'color:green' : 'color:red'}`
, data.success
, `${res.success ? 'color:green' : 'color:red'}`
, res.success
, parameter
, `${data.success ? 'color:green' : 'color:red'}`
, data
, `${res.success ? 'color:green' : 'color:red'}`
, res
);
})
})
}
}, () => {
});
return;
}
//@ts-ignore
if (!fc) fc = getApp().cloud.function;
//第一个参数视项目而定
fc.invoke(invoke, parameter, route)
.then((res: dataOut) => {
clearWait(waitObj);
//记录数据
dataRecord[netName] = res;
// console.log("返回数据" + JSON.stringify(res));
//统一错误信息提示
if (!hideMsg && !res.success) showToast(codeMsg[res.code] || res.message || "网络异常")
//回调
callback(res.success, res);
console.log(
`\n%c[ mock ]\n`
+ `NAME : ${netName} \n`
+ `STATE : %o \n`
+ `PARAM : %o \n`
+ `%cDATA : %o \n`
, `${res.success ? 'color:green' : 'color:red'}`
, res.success
, parameter
, `${res.success ? 'color:green' : 'color:red'}`
, res
);
export async function getUserAddress11(prizeId) {
const userAddress = await getUserAddress().catch(res => {
commonToast(res.errorMessage)
})
if (userAddress) {
// @ts-ignore
const {error, provinceName, countyName, cityName, streetName, detailInfo, name, telNumber, cityCode} = userAddress;
let address = [provinceName, cityName, countyName, streetName, detailInfo].join('');
//@ts-ignore
my.confirm({
title: '提示',
content: '确认使用该收货地址:' + name + telNumber + address,
confirmButtonText: '确定',
cancelButtonText: '取消',
success: (result) => {
const {confirm} = result
if (confirm) {
//发接口提交地址
// @ts-ignore
const {cloud, activityId} = my && getApp()
cloud.function.invoke('qiaqia2', {
activityId,
_id: prizeId,
address,
name,
telNumber,
cityCode
// address: JSON.stringify(userAddress.duibaAddress)
}, "receiveObjectPrize")
.then(res => {
if (res && res.success) {
console.log("提交成功");
} else {
console.log("提交失败1");
}
})
.catch(() => {
console.log("云函数调用失败");
})
} else {
console.log("用户取消");
}
},
})
}
}
/**
......
......@@ -86,9 +86,9 @@ export class Tool {
return;
}
const src = `cloud://21DC968488CF65B20EC98D34D07B7B9D//${name}.svga`;
// cloud://21DC968488CF65B20EC98D34D07B7B9D//浇水动效.svga
// const src = `../resource/svga/${name}.svga`; /// TODO 线上替换
const src = `cloud://21DC968488CF65B20EC98D34D07B7B9D//${name}.svga`;
// const src = `../svga/${name}.svga`; /// TODO 线上替换
SvgaParser.loadSvga(src, (v) => {
Tool.svgaCache[name] = v; // 做一个缓存
const mv = new MovieClip(v);
......
......@@ -67,7 +67,6 @@ export default class PlantEffectPool {
// this.seed[type] = [new SeedEffect(type)];
this.seed[type] = [];
}
console.log(this.plant);
}
/**
......
import { Panel } from "../../module/views/Panel";
import { Tool } from "../Tools";
import { layers } from "../../module/views/layers";
import { activityId, sendTbNet, TbNetName } from "../TaoBaoNet";
import { activityId, getUserAddress11, sendTbNet, TbNetName } from "../TaoBaoNet";
import { RES } from "../../module/RES";
import Sprite = FYGE.Sprite;
import Tween = FYGE.Tween;
......@@ -51,7 +51,7 @@ export default class ExRecordPanel extends Panel {
activityId: activityId
}, (success, res) => {
if (!success) return;
this.scroll.updateData(res.data);
this.scroll.updateData(res.data, true);
});
}
......@@ -123,7 +123,7 @@ class RecordItem extends Container implements IScrollListItem {
this.btn.texture = RES.getRes('record_en.png');
this.btn.addEventListener(MouseEvent.CLICK, () => {
if (this.data.type == 1) {
/// todo 权益
// 权益
sendTbNet(TbNetName.receiveEname, {
_id: this.data._id,
activityId: activityId
......@@ -135,7 +135,10 @@ class RecordItem extends Container implements IScrollListItem {
GDispatcher.dispatchEvent(G_EVENT.GET_MY_PRIZE_LIST);
});
} else if (this.data.type == 3) {
// todo 实物
// 实物
getUserAddress11(this.data._id).then(() => {
GDispatcher.dispatchEvent(G_EVENT.GET_MY_PRIZE_LIST);
});
}
}, this);
} else {
......
......@@ -6,6 +6,7 @@ import TextField = FYGE.TextField;
import Texture = FYGE.Texture;
import { showToast } from "../../module/ctrls";
import PanelCtrl from "../../module/ctrls/panelCtrl";
import { getUserAddress11 } from "../TaoBaoNet";
export default class ExSuccessPanel extends Panel {
get groupNames() {
......@@ -27,7 +28,7 @@ export default class ExSuccessPanel extends Panel {
// 图片
this.prizeImg = this.addChild(new Sprite());
this.prizeImg.texture = Texture.fromUrl(this.data.image);
this.prizeImg.width = 427;
this.prizeImg.width = 200;//427;
this.prizeImg.height = 200;
this.prizeImg.position.set((this.width - this.prizeImg.width) / 2, 677);
......@@ -44,12 +45,14 @@ export default class ExSuccessPanel extends Panel {
}
private clickBtn() {
if (+this.data.type == 1 && (this.data.drawStatus == 4 || this.data.drawStatus == 6)) {
if (+this.data.type == 1 && (+this.data.drawStatus == 4)) {
showToast('奖品发放失败\n请前往我的奖品处进行处理');
this.hideAll();
} else if (+this.data.type == 3) {
/// TODO 淘宝地址选择页?
getUserAddress11(this.data._id).then(() => {
this.hideAll();
});
}
this.hideAll();
}
private hideAll() {
......
......@@ -42,12 +42,10 @@ export class ExchangePanel extends Panel {
prizeImg.mask = imgMask;
let enough = true;
'exchange_btn_en.png';
for (let i = 0; i < this.data.exchangeInfo.length; i++) {
let d = this.data.exchangeInfo[i];
if (d.value > d.storage) {
enough = false;
'exchange_btn_dis.png';
break;
}
}
......@@ -63,7 +61,7 @@ export class ExchangePanel extends Panel {
introduction.textAlign = TEXT_ALIGN.LEFT;
introduction.position.set(139, 980);
// if (this.data.type == 1) {
// if (+this.data.type == 1) {
// // let sDate = new Date(this.data.startTime);
// let eDate = new Date(this.data.endTime);
// // let sLabel = `${sDate.getFullYear()}/${sDate.getMonth() + 1}/${sDate.getDate()}`;
......@@ -75,9 +73,9 @@ export class ExchangePanel extends Panel {
if (this.data.isLimitStock) {
// 库存剩余label
let stock = this.addChild(Tool.getText(`剩余数量:${this.data.restStock}/${this.data.stock}份`, 20, '#dbd2ca'));
introduction.textWidth = 470;
introduction.lineType = TEXT_lINETYPE.MULTI;
introduction.textAlign = TEXT_ALIGN.LEFT;
stock.textWidth = 470;
stock.lineType = TEXT_lINETYPE.MULTI;
stock.textAlign = TEXT_ALIGN.LEFT;
stock.position.set(137, introduction.y + introduction.textHeight + 5);
}
......@@ -92,6 +90,10 @@ export class ExchangePanel extends Panel {
return;
}
let data = res.data;
if (+data.drawStatus == 6) {
showToast('今日兑换已达上限');
return;
}
PanelCtrl.instance.show(ExSuccessPanel, data);
});
});
......
......@@ -43,6 +43,7 @@ export default class GuidePanel extends Panel {
if (!res.data) {
showToast('请稍后再试');
}
GDispatcher.dispatchEvent('getWater');
GDispatcher.dispatchEvent(G_EVENT.GUIDE2);
this.hidePanel();
});
......
......@@ -6,6 +6,7 @@ import { ExchangePanel } from "./ExchangePanel";
import { GDispatcher } from "../Main";
import { G_EVENT } from "../const/GEVENT";
import { activityId, sendTbNet, TbNetName } from "../TaoBaoNet";
import { s_PlantData } from "../const/staticData";
import Sprite = FYGE.Sprite;
import Tween = FYGE.Tween;
import Container = FYGE.Container;
......@@ -16,7 +17,7 @@ import Graphics = FYGE.Graphics;
import TextField = FYGE.TextField;
import Ease = FYGE.Ease;
import MouseEvent = FYGE.MouseEvent;
import { s_PlantData } from "../const/staticData";
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
export default class ShopPanel extends Panel {
get groupNames() {
......@@ -74,7 +75,7 @@ export default class ShopPanel extends Panel {
activityId: activityId
}, (success, res) => {
if (!success) return;
this.scroll.updateData(res.data);
this.scroll.updateData(res.data, true);
});
}
......@@ -141,10 +142,14 @@ class ShopItem extends Container implements IScrollListItem {
let n = exchangeInfoRoot.addChild(new Container())
let img = n.addChild(Tool.getSprite(`种植框_${s_PlantData[v.type].name}.png`));
let textNode = n.addChild(new Container());
let leftText = textNode.addChild(Tool.getText(`${v.storage}`, 22, v.storage >= v.value ? '#8b572b' : '#ff0000'));
textNode.addChild(Tool.getText(`/${v.value}`, 22, '#8b572b'))
.position.set(leftText.x + leftText.textWidth, leftText.y);
leftText.textAlign = TEXT_ALIGN.LEFT;
let rightText = textNode.addChild(Tool.getText(`/${v.value}`, 22, '#8b572b'));
rightText.position.set(leftText.x + leftText.textWidth, leftText.y);
rightText.textAlign = TEXT_ALIGN.LEFT;
if (textNode.width > img.width) {
img.x = (textNode.width - img.width);
......@@ -182,8 +187,10 @@ class ShopItem extends Container implements IScrollListItem {
this.itemName = this.addChild(Tool.getText('', 26, '#4a4a4a'));
this.itemName.position.set(185, 24);
this.itemName.textAlign = TEXT_ALIGN.LEFT;
this.itemNum = this.addChild(Tool.getText('剩余0份', 18, '#f94c2a'));
this.itemNum.textWidth = 400;
this.itemNum.position.set((this.width - this.itemNum.textWidth) / 2, 176);
}
......
This diff is collapsed.
......@@ -8,6 +8,7 @@ import { Tool } from "../../Tools";
import { layers } from "../../../module/views/layers";
import { G_wareHouseEffect } from "../UI/UILayer";
import { activityId, getTbData, sendTbNet, TbNetName } from "../../TaoBaoNet";
import { getAdjustBottomHeight } from "../../const/myLab";
/**
......@@ -115,14 +116,14 @@ export default class GameLayer extends Container {
getEffect.mouseEnable = false;
getEffect.position.set(this.landList[id].x + 185, this.landList[id].y + 55);
let _x = 375 - getEffect.width / 2;
let _y = layers.stageHeight - layers.stageOffsetY - 205;
let _y = layers.stageHeight - layers.stageHeight * (1624 - 1382 - 133) / 1624 - 133 + layers.stageOffsetY;
let __y = getEffect.y;
Tween.get(getEffect)
.to({y: __y - 15}, 200)
.to({y: __y}, 200)
.to({y: __y - 15}, 200)
.to({y: __y}, 200)
.to({x: _x, y: _y, scaleX: 1.2, scaleY: 1.2}, 1000, Ease.quadInOut)
.to({x: _x, y: _y, scaleX: 1.2, scaleY: 1.2}, 700, Ease.quadInOut)
.call(() => {
Tween.get(getEffect)
.to({alpha: 0}, 300)
......
......@@ -284,7 +284,7 @@ export default class GuideLayer extends Container {
Tween.get(this.guide6)
.set({visible: true, alpha: 0})
.to({alpha: 1}, 350);
this.taskBtn.once(MouseEvent.CLICK, () => {
this.stage.once(MouseEvent.CLICK, () => {
sendTbNet(TbNetName.guide, {
activityId: activityId,
index: 6
......@@ -304,7 +304,7 @@ export default class GuideLayer extends Container {
Tween.get(this.guide7)
.set({visible: true, alpha: 0})
.to({alpha: 1}, 350);
this.wareHouseBtn.once(MouseEvent.CLICK, () => {
this.stage.once(MouseEvent.CLICK, () => {
sendTbNet(TbNetName.guide, {
activityId: activityId,
index: 7
......@@ -324,7 +324,7 @@ export default class GuideLayer extends Container {
Tween.get(this.guide8)
.set({visible: true, alpha: 0})
.to({alpha: 1}, 350);
this.storeBtn.once(MouseEvent.CLICK, () => {
this.stage.once(MouseEvent.CLICK, () => {
sendTbNet(TbNetName.guide, {
activityId: activityId,
index: 8
......
......@@ -82,6 +82,7 @@ export class Land extends Container {
timestamp: -1,
fullTime: 3,
});
this.progressBar.position.set(80, 130);
// 添加事件
this.addEvent();
......@@ -182,6 +183,8 @@ export class Land extends Container {
type: data.plantType,
timestamp: +data.waterTime,
fullTime: +data.totalTime,
// timestamp: Date.now()+3000,
// fullTime: 3000,
});
this.progressBar.show();
......
import { PLANT_TYPE, s_PlantData } from "../../const/staticData";
import { Tool } from "../../Tools";
import { RES } from "../../../module/RES";
import GameLayer from "./GameLayer";
import { Land } from "./Land";
import { GDispatcher } from "../../Main";
import { G_EVENT } from "../../const/GEVENT";
import Container = FYGE.Container;
import IScrollListItem = FYGE.IScrollListItem;
import ScrollList = FYGE.ScrollList;
import TextField = FYGE.TextField;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import VERTICAL_ALIGN = FYGE.VERTICAL_ALIGN;
import Sprite = FYGE.Sprite;
import { RES } from "../../../module/RES";
import Tween = FYGE.Tween;
import Ease = FYGE.Ease;
import GameLayer from "./GameLayer";
import MouseEvent = FYGE.MouseEvent;
import { Land } from "./Land";
import { activityId, sendTbNet, TbNetName } from "../../TaoBaoNet";
import { showToast } from "../../../module/ctrls";
import { GDispatcher } from "../../Main";
import { G_EVENT } from "../../const/GEVENT";
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
export default class PlantList extends Container {
......@@ -50,7 +48,7 @@ export default class PlantList extends Container {
isGuide: isGuide
});
}
this.scrollList.updateData(data);
this.scrollList.updateData(data, true);
this.scrollList.x = (this.width - 500) / 2;
......@@ -126,7 +124,7 @@ class ListPlant extends Container implements IScrollListItem {
this.timeLabel.text = s_PlantData[key].time + 'h';
this.nameLabel.x = (this.width - this.nameLabel.textWidth) / 2;
this.timeLabel.x = 72 + (35 - this.timeLabel.textWidth) / 2;
// this.timeLabel.x = 72 + (35 - this.timeLabel.textWidth) / 2;
}
private nameLabel: TextField;
......@@ -154,10 +152,11 @@ class ListPlant extends Container implements IScrollListItem {
// 需要时间的label
this.timeLabel = this.addChild(new TextField());
this.timeLabel.position.set(75, 85);
this.timeLabel.position.set(73, 85);
this.timeLabel.size = 17;
this.timeLabel.textAlign = TEXT_ALIGN.CENTER;
this.timeLabel.verticalAlign = VERTICAL_ALIGN.MIDDLE;
this.timeLabel.textWidth = 34;
this.img = this.addChild(new Sprite());
......
......@@ -6,6 +6,7 @@ import Graphics = FYGE.Graphics;
import Tween = FYGE.Tween;
import Ease = FYGE.Ease;
import { PLANT_TYPE, s_PlantData } from "../../const/staticData";
import VERTICAL_ALIGN = FYGE.VERTICAL_ALIGN;
export default class ProgressBar extends Container {
......@@ -18,14 +19,14 @@ export default class ProgressBar extends Container {
super();
this.addChild(Tool.getSprite('进度_bg.png'))
.position.set(80, 130);
.position.set(0, 0);
// 进度
this.fill = this.addChild(Tool.getSprite('进度_fill.png'));
this.fill.position.set(136, 131);
this.fill.position.set(56, 1);
// mask
const mask = this.addChild(new Graphics());
mask.drawRect(136, 131, 139, 29);
mask.drawRect(56, 1, 139, 29);
this.fill.mask = mask;
this.fill.x = -59;
......@@ -35,14 +36,19 @@ export default class ProgressBar extends Container {
this.nameLabel.size = 16;
this.nameLabel.fillColor = '#333333';
this.nameLabel.text = '山核桃';
this.nameLabel.position.set(80 + (56 - this.nameLabel.textWidth) / 2, 139);
this.nameLabel.position.set((56 - this.nameLabel.textWidth) / 2, 0);
this.nameLabel.textHeight = 31;
this.nameLabel.verticalAlign = VERTICAL_ALIGN.MIDDLE;
// timeLabel
this.timeLabel = this.addChild(new TextField());
this.timeLabel.size = 16;
this.timeLabel.fillColor = '#fffefe';
this.timeLabel.text = '0时0分后浇水';
this.timeLabel.position.set(136 + (136 - this.timeLabel.textWidth) / 2, 139);
this.timeLabel.position.set(56 + (56 - this.timeLabel.textWidth) / 2, 0);
this.timeLabel.textHeight = 31;
this.timeLabel.verticalAlign = VERTICAL_ALIGN.MIDDLE;
this.visible = false;
}
......@@ -62,18 +68,18 @@ export default class ProgressBar extends Container {
this.visible = false;
return;
}
if(data.timestamp <= 0 || data.timestamp <= Date.now()){
if (data.timestamp <= 0 || data.timestamp <= Date.now()) {
this.dispatchEvent('endTime');
return;
}
this.nameLabel.text = s_PlantData[data.type].name;
this.nameLabel.position.set(80 + (56 - this.nameLabel.textWidth) / 2, 139);
this.nameLabel.position.set((56 - this.nameLabel.textWidth) / 2, 0);
this.fullTime = data.fullTime / 1000;
this.cutTime = (data.timestamp - Date.now()) / 1000 + 3;
if (this.cutTime <= 3) {
this.cutTime = 3;
this.cutTime = (data.timestamp - Date.now()) / 1000 + 1;
if (this.cutTime <= 1) {
this.cutTime = 1;
}
this.setTime();
this.interval && clearInterval(this.interval);
......@@ -98,10 +104,10 @@ export default class ProgressBar extends Container {
const hour = ~~(this.cutTime / 3600);
const min = ~~((this.cutTime - hour * 3600 + 59) / 60);
this.timeLabel.text = `${hour}${min}分后浇水`;
this.timeLabel.position.set(136 + (136 - this.timeLabel.textWidth) / 2, 139);
this.timeLabel.position.set(56 + (136 - this.timeLabel.textWidth) / 2, 0);
const progress = 1 - this.cutTime / this.fullTime;
this.fill.x = (195 - 59) * progress;
this.fill.x = (this.width - 56) * progress - this.fill.width + 49;
}
/**
......
......@@ -6,12 +6,12 @@ import { UserInfoGroup } from "./UserInfoGroup";
import { Tool } from "../../Tools";
import { getAdjustBottomHeight, getAdjustTopHeight } from "../../const/myLab";
import PanelCtrl from "../../../module/ctrls/panelCtrl";
import TaskPanel from "../../panels/TaskPanel";
import WareHousePanel from "../../panels/WareHousePanel";
import ShopPanel from "../../panels/ShopPanel";
import RulePanel from "../../panels/RulePanel";
import { getTbData, TbNetName } from "../../TaoBaoNet";
import ExRecordPanel from "../../panels/ExRecordPanel";
import TaskPanel from "../../panels/TaskPanel";
export let G_wareHouseEffect = () => {
};
......
......@@ -38,13 +38,12 @@ export class GameScene extends Scene {
// UI层
this.uiLayer = this.addChild(new UILayer());
console.log(this.uiLayer)
// 广告按钮
this.adBtn = this.addChild(Tool.getSprite('广告.png'));
this.adBtn.position.set(30, (1624 - this.adBtn.height) / 2);
this.adBtn.name = '广告';
this.adBtn.visible = false;
}
......
......@@ -32,25 +32,18 @@ export class LoadingScene extends Scene {
private tips: TextField;
async initUi() {
console.log(1);
setActiveId()
console.log(2);
gameResource.forEach((v) => {
RES.loadGroup(v);
});
console.log(3);
Tool.getSvga('浇水动效');
console.log(4);
// 游戏信息
await sendTbNet(TbNetName.baseInfo, {
activityId: activityId
}, (success, res) => {
console.log(success, res);
});
console.log(5);
// 用户信息
var userInfo: any = await getAuthUserInfo().catch(() => {
})
......@@ -60,8 +53,8 @@ export class LoadingScene extends Scene {
data: userInfo
});
/// test
var isFollow = true;
// @ts-ignore
// isFollow = await checkShopFavoredStatus(sellerId).catch((err) => {
// console.log(err);
......@@ -69,30 +62,35 @@ export class LoadingScene extends Scene {
// });
console.log('isFollow', isFollow);
if (isFollow !== undefined || isFollow !== null) {
console.log('isFollow1', isFollow);
setTbData(TbNetName.isFollow, {
data: isFollow
});
// 登陆接口
await sendTbNet(TbNetName.login, {
activityId: activityId,
userNick: userInfo.nickName,
avatar: userInfo.avatar,
isFollow: isFollow
}, (success, res) => {
console.log(success, res);
});
setTbData(TbNetName.isFollow, {
data: isFollow
});
// 登陆接口
// @ts-ignore
let inviteId = undefined;
// @ts-ignore
if(my){
// @ts-ignore
inviteId = getApp.inviteId;
}
}
// 游戏信息
await sendTbNet(TbNetName.gameInfo, {
activityId: activityId
}, (success, res) => {
console.log(success, res);
});
await sendTbNet(TbNetName.login, {
activityId: activityId,
userNick: userInfo.nickName,
avatar: userInfo.avatar,
isFollow: isFollow,
inviteId: inviteId
}, async (success, res) => {
// 游戏信息
// @ts-ignore
getApp()['openId'] = res.data.openId;
});
await sendTbNet(TbNetName.gameInfo, {
activityId: activityId
}, (success, res) => {
});
}
// bg
this.addChild(Tool.getSprite('loading_bg.jpg'));
......
......@@ -19,8 +19,6 @@ export const commonToast = (content, duration = 3000) => {
*/
export const getAuthUserInfo = () => {
return new Promise((resolve, reject) => {
// @ts-ignore
console.log(11111, my);
// @ts-ignore
if (!my) {
resolve({
......@@ -290,24 +288,28 @@ export const getUserAddress = (opts = {}) => {
searchAddress,
locateAddress
}, res => {
const {error, provinceName, countyName, cityName, streetName, detailInfo, name, telNumber} = res;
// const {error, provinceName, countyName, cityName, streetName, detailInfo, name, telNumber} = res;
// 如果有error为用户取消操作不做操作
if (error) {
if (res.error) {
resolve(false);
} else {
resolve({
...res,
duibaAddress: {
name,
phone: telNumber,
address: [provinceName, cityName, countyName, streetName, detailInfo].join(joinTag)
}
...res
// ,
// duibaAddress: {
// name,
// phone: telNumber,
// address: [provinceName, cityName, countyName, streetName, detailInfo].join(joinTag)
// }
});
}
}, res => {
reject(res);
})
},
fail:(err)=>{
console.log(err);
}
});
});
};
......
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