Commit 2746966d authored by wildfirecode13's avatar wildfirecode13

update

parent b916b3b6
{"code":null,"data":88363694.04933754,"message":"reprehenderit ullamco minim esse","success":true}
\ No newline at end of file
{
"code": null,
"data": 0,
"message": "reprehenderit ullamco minim esse",
"success": true
}
\ No newline at end of file
{"code":null,"data":true,"message":"occaecat","success":true}
\ No newline at end of file
{
"code": null,
"data": 0,
"message": "occaecat",
"success": true
}
\ No newline at end of file
{"code":null,"data":{"alreadyOpenAccount":true,"assistFriendAmount":-14187613.920878664,"assistFriendNum":-91701800.34001528,"assistIncrAmount":-80077469.46236338,"canWithdraw":true,"experienceAmount":-87194523.90880549,"maxExperienceAmount":-24988940.25989467,"yesterdayIncome":"velit dolor magna non anim","sumIncome":"in enim nulla","millionShares":"pariatur reprehenderit ea ut eiusmod","sevenDayAnnualization":"exercitation consectetur nostrud ea et"},"message":"fugiat","success":false}
\ No newline at end of file
{
"code": null,
"data": {
"alreadyOpenAccount": true,
"assistFriendAmount": -14187613.920878664,
"assistFriendNum": -91701800.34001528,
"assistIncrAmount": -80077469.46236338,
"canWithdraw": true,
"experienceAmount": -87194523.90880549,
"maxExperienceAmount": -24988940.25989467,
"yesterdayIncome": "velit dolor magna non anim",
"sumIncome": "in enim nulla",
"millionShares": "pariatur reprehenderit ea ut eiusmod",
"sevenDayAnnualization": "exercitation consectetur nostrud ea et"
},
"message": "fugiat",
"success": true
}
\ No newline at end of file
......@@ -75,20 +75,15 @@ export class Main {
if (isShare()) {
changeScene(ShareScene, { query: getQueryParams() });
} else {
const indexResult = await sendWebNet(WebNetName.index)
if (indexResult && indexResult.success && indexResult.data) {
if (indexResult.data.isNewbie) {
updateShare('inNewbieScene', indexResult.data.shareCode, 0, 0);
changeScene(NewbieScene, { shareCode: indexResult.data.shareCode });
const alreadyAcquiredResult = await sendWebNet(WebNetName.alreadyAcquired)
if (!alreadyAcquiredResult.data) {
updateShare('inNewbieScene', '', 0, 0);
changeScene(NewbieScene);
}
else {
updateShare('inIndexScene', indexResult.data.shareCode, indexResult.data.amount1, indexResult.data.amount2)
changeScene(IndexScene)
}
} else {
//网络异常??
changeScene(IndexScene);
}
}
}
......
......@@ -31,24 +31,6 @@ export enum WebNetName {
/**
* 首页
*/
index = "/projectx/{projectId}/game/index.do",
/**
* 是否可分享
*/
canshare = "/projectx/{projectId}/game/canshare.do",
/**
* 参与
*/
join = "/projectx/{projectId}/game/join.do",
/**
* 获取结果
*/
queryResult = "/projectx/{projectId}/game/queryResult.do",
}
......
......@@ -11,6 +11,15 @@ import { Tools } from "../Tools";
import updateShare from "../updateShare";
import { getWebData, sendWebNet, WebNetName } from "../WebNet";
let createItemResultComplete, myWalletResultComplete;
const checkUpdateShare = () => {
if (createItemResultComplete && myWalletResultComplete) {
updateShare('inPrizePanel',
createItemResultComplete.data,
myWalletResultComplete.data.sumIncome, myWalletResultComplete.data.experienceAmount)
}
}
export class PrizePanel extends Panel {
amountTxt: FYGE.TextField;
percentTxt: FYGE.TextField;
......@@ -47,8 +56,17 @@ export class PrizePanel extends Panel {
async start(data) {
super.start();
const indexResult = await sendWebNet(WebNetName.index)
updateShare('inPrizePanel', data.shareCode, indexResult.data.amount1, indexResult.data.amount2)
sendWebNet(WebNetName.createItem).then(createItemResult => {
createItemResultComplete = createItemResult;
checkUpdateShare();
});
sendWebNet(WebNetName.myWallet).then(myWalletResult => {
myWalletResultComplete = myWalletResult;
checkUpdateShare();
});
}
hidePanel() {
......
......@@ -6,7 +6,18 @@ import Marquee from '../common/Marquee';
import { DrawPanel } from '../panels/draw';
import { ShareFailPanel } from '../panels/share_fail';
import { ShareSuccessPanel } from '../panels/share_success';
import updateShare from '../updateShare';
import { sendWebNet, WebNetName } from '../WebNet';
let createItemResultComplete, myWalletResultComplete;
const checkUpdateShare = () => {
if (createItemResultComplete && myWalletResultComplete) {
updateShare('inIndexScene',
createItemResultComplete.data,
myWalletResultComplete.data.sumIncome, myWalletResultComplete.data.experienceAmount)
}
}
export class IndexScene extends Scene {
get groupNames() { return ["index"] }
get skinName() { return "index" }
......@@ -31,10 +42,10 @@ export class IndexScene extends Scene {
console.log('carouselInfo ', res);
const template = '{phone}邀请了{friend}位好友,获得了{amount}体验金';
const datas = res.data.map(item=>{
let str = template.replace('{phone}',item.nickname);
str = str.replace('{friend}',item.friend);
str = str.replace('{amount}',item.amount);
const datas = res.data.map(item => {
let str = template.replace('{phone}', item.nickname);
str = str.replace('{friend}', item.friend);
str = str.replace('{amount}', item.amount);
return str
});
const q = this.addChild(new Marquee(datas));
......@@ -42,6 +53,17 @@ export class IndexScene extends Scene {
q.x = 50;
});
sendWebNet(WebNetName.createItem).then(createItemResult => {
createItemResultComplete = createItemResult;
checkUpdateShare();
});
sendWebNet(WebNetName.myWallet).then(myWalletResult => {
myWalletResultComplete = myWalletResult;
checkUpdateShare();
});
}
async showSharePanel() {
......@@ -55,9 +77,9 @@ export class IndexScene extends Scene {
onPageVisibilityChange = async (visible) => {
console.log('页面visible', visible);
if(!visible)return;
if (!visible) return;
const current = PanelCtrl.instance.current;
if(current)
if (current)
console.log('有弹窗就不重复弹分享弹窗了');
if (visible && !current) {
this.showSharePanel();
......
......@@ -29,17 +29,19 @@ export class NewbieScene extends Scene {
const query = getQueryParams();
if (query.autoprize == 1) {
this.openPrize(data);
this.openPrize();
}
}
openPrize(data) {
openPrize() {
prize = 1;
showPanel(PrizePanel, data);
sendWebNet(WebNetName.acquireExperienceAmount).then(acquireExperienceAmount => {
showPanel(PrizePanel, acquireExperienceAmount.data);
})
}
onClick_prizeBtn() {
this.openPrize(this.data);
this.openPrize()
}
onClick_ruleBtn() {
......@@ -60,10 +62,10 @@ export class NewbieScene extends Scene {
console.log('carouselInfo ', res);
const template = '{phone}邀请了{friend}位好友,获得了{amount}体验金';
const datas = res.data.map(item=>{
let str = template.replace('{phone}',item.nickname);
str = str.replace('{friend}',item.friend);
str = str.replace('{amount}',item.amount);
const datas = res.data.map(item => {
let str = template.replace('{phone}', item.nickname);
str = str.replace('{friend}', item.friend);
str = str.replace('{amount}', item.amount);
return str
});
const q = this.addChild(new Marquee(datas));
......
......@@ -69,7 +69,7 @@ export class LoadingScene extends Scene {
.call(() => {
if (pro >= 1) {
this.removeEventListener(FYGE.Event.PROGRESS, this.progressEvent, this);
changeScene(StartScene,getWebData(WebNetName.index).data)
// changeScene(StartScene,getWebData(WebNetName.index).data)
}
})
}
......
......@@ -46,16 +46,16 @@ export class StartScene extends Scene {
initEvents() {
super.initEvents();
//开始游戏
this.startBtn.addEventListener(FYGE.MouseEvent.CLICK, async () => {
showWaiting();
var res = await sendWebNet(WebNetName.join)
hideWaiting();
if (res.success) {
changeScene(PlayScene, { ...res.data });
} else {
//TODO
}
}, this)
// this.startBtn.addEventListener(FYGE.MouseEvent.CLICK, async () => {
// showWaiting();
// var res = await sendWebNet(WebNetName)
// hideWaiting();
// if (res.success) {
// changeScene(PlayScene, { ...res.data });
// } else {
// //TODO
// }
// }, this)
//规则按钮
this.ruleBtn.addEventListener(FYGE.MouseEvent.CLICK, () => {
showPanel(RulePanel)
......
const updateShare = (type, shareCode, amount1, amount2) => {
console.log('updateShare', 'type=', type, 'shareCode=', shareCode, 'amount1=', amount1, 'amount2=', amount2)
const updateShare = (type, shareCode, sumIncome, experienceAmount) => {
console.log('updateShare', 'type=', type, 'shareCode=', shareCode, 'sumIncome=', sumIncome, 'experienceAmount=', experienceAmount)
}
export default updateShare
\ No newline at end of file
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