Commit ed420918 authored by 邱旭's avatar 邱旭

仓库

parent dcc46ad4
This diff is collapsed.
......@@ -147,5 +147,8 @@ export enum NetName {
PROPINFO,
USER_PROP,
NEW_USER_PRIZE,
AREA_PRICE,
UNLOCK_LAND,
QUESTION_LIST,
}
import { Data } from '../data/Data';
import { TwLang } from "../util/TwLang";
import { DataManager } from "./DataManager";
import { NetName } from '../enum/NetName';
import { ABNetManager } from '../../tc/manager/ABNetManager';
import { INetData } from '../../tc/interface/INetData';
import { GTime } from '../../tc/util/GTime';
import { IExposureData } from '../data/common/IExposureData';
import { GDispatcher } from '../../tc/util/GDispatcher';
import { onNotSuccess } from "../../../src/comm/onNotSuccess";
import {Data} from '../data/Data';
import {TwLang} from "../util/TwLang";
import {DataManager} from "./DataManager";
import {NetName} from '../enum/NetName';
import {ABNetManager} from '../../tc/manager/ABNetManager';
import {INetData} from '../../tc/interface/INetData';
import {GTime} from '../../tc/util/GTime';
import {IExposureData} from '../data/common/IExposureData';
import {GDispatcher} from '../../tc/util/GDispatcher';
import {onNotSuccess} from "../../../src/comm/onNotSuccess";
export class NetManager extends ABNetManager {
private static instance: NetManager;
......@@ -2370,18 +2370,23 @@ export class NetManager extends ABNetManager {
* @param desc
* @param credits
*/
public creditsCost(callback: Function, toPlaywayId, toActionId, desc, credits) {
public creditsCost(callback: Function, toPlaywayId, toActionId, credits, desc) {
const param: any = {
toPlaywayId: toPlaywayId,
toActionId: toActionId,
credits: credits,
};
if (desc) {
param.desc = desc;
}
const net: INetData = {
name: NetName.CREDITS_COST,
uri: '/projectx/{projectId}/credits/creditsCost.do',
type: 'post',
dataType: 'json',
param: {
toPlaywayId: toPlaywayId,
toActionId: toActionId,
desc: desc,
credits: credits,
},
param: param,
callback: callback
};
this.send(net);
......@@ -2759,7 +2764,7 @@ export class NetManager extends ABNetManager {
this.send(net);
}
public propExchange(callback: Function, spId, ticket) {
public propExchange(callback: Function, spId, ticket, num) {
const net: INetData = {
name: NetName.PROP_EXCHANGE,
uri: '/projectx/{projectId}/join_7/join.do',
......@@ -2767,8 +2772,9 @@ export class NetManager extends ABNetManager {
dataType: 'json',
hideMsg: true,
param: {
spId: spId,
ticket: ticket
spId,
ticket,
num
},
callback: callback
};
......@@ -2787,6 +2793,12 @@ export class NetManager extends ABNetManager {
this.send(net);
}
/**
* 使用道具
* @param callback
* @param spId
* @param landId
*/
public useProp(callback: Function, spId, landId) {
const net: INetData = {
name: NetName.USER_PROP,
......@@ -2801,6 +2813,59 @@ export class NetManager extends ABNetManager {
};
this.send(net);
}
/**
* 土地价格
* @param callback
*/
public areaPrice(callback: Function) {
const net: INetData = {
name: NetName.AREA_PRICE,
uri: '/projectx/{projectId}/area/areaPrice.do',
type: 'get',
dataType: 'json',
param: {},
callback: callback
};
this.send(net);
}
/**
* 问题列表
* @param callback
*/
public questionList(callback: Function) {
const net: INetData = {
name: NetName.QUESTION_LIST,
uri: '/projectx/{projectId}/question/join.do',
type: 'get',
dataType: 'json',
param: {},
callback: callback
};
this.send(net);
}
/**
* 解锁土地
* @param callback
* @param tickNum
* @param landId
*/
public unlockLand(callback: Function, tickNum, landId) {
const net: INetData = {
name: NetName.UNLOCK_LAND,
uri: '/projectx/{projectId}/area/join.do',
type: 'post',
dataType: 'json',
param: {
tickNum,
landId
},
callback: callback
};
this.send(net);
}
}
// window['nt'] = NetManager.ins;
......
......@@ -13,7 +13,7 @@
"name": "loading_scene"
},
{
"keys": "index_bg_png,小E_png",
"keys": "index_bg_png,小E_png,xiaoETip_bg_png,xiaoETip_item_btn_png",
"name": "main_scene"
},
{
......@@ -49,7 +49,7 @@
"name": "bar"
},
{
"keys": "room_back_png,room_market_png,room_farm_png,room_medals_png,room_ad_png,room_bg_png,room_sp_achv_4_dis_png,room_sp_achv_2_dis_png,room_sp_achv_3_dis_png,room_sp_achv_1_dis_png",
"keys": "room_back_png,room_market_png,room_farm_png,room_medals_png,room_ad_png,room_bg_png,room_sp_achv_4_dis_png,room_sp_achv_2_dis_png,room_sp_achv_3_dis_png,room_sp_achv_1_dis_png,room_table_png,room_panda_png",
"name": "room"
},
{
......@@ -99,6 +99,10 @@
{
"keys": "shopPanel_table_prop_png,shopPanel_bg_png,shopPanel_table_seed_png,shopPanel_table_prop_dis_png,shopPanel_table_seed_dis_png,shop_item_bg_png,shop_item_btn_png,shop_item_btn_dis_png",
"name": "shop"
},
{
"keys": "room_panda_png,room_table_png",
"name": "preload"
}
],
"resources": [
......@@ -1171,6 +1175,26 @@
"url": "assets/warehouse_panel/warehouse_none_seed.png",
"type": "image",
"name": "warehouse_none_seed_png"
},
{
"url": "assets/index_scene/xiaoE/xiaoETip_bg.png",
"type": "image",
"name": "xiaoETip_bg_png"
},
{
"url": "assets/index_scene/xiaoE/xiaoETip_item_btn.png",
"type": "image",
"name": "xiaoETip_item_btn_png"
},
{
"url": "assets/room/room_panda.png",
"type": "image",
"name": "room_panda_png"
},
{
"url": "assets/room/room_table.png",
"type": "image",
"name": "room_table_png"
}
]
}
\ No newline at end of file
......@@ -5,7 +5,23 @@
<e:Image id="bg" source="index_bg_png" scaleX="1" scaleY="1" horizontalCenter="0" verticalCenter="0" locked="true"/>
<e:Group id="gameLayer" left="0" right="0" horizontalCenter="0" verticalCenter="0" height="1624">
</e:Group>
<e:Group id="houseBtn" width="252" height="372" x="0" anchorOffsetX="0" anchorOffsetY="0" verticalCenter="-383"/>
<e:Group id="houseBtn" width="252" height="372" x="0" anchorOffsetX="0" anchorOffsetY="0" verticalCenter="-383">
</e:Group>
<e:Group id="xiaoEGroup" x="30" y="537" anchorOffsetX="0" anchorOffsetY="0" visible="false">
<e:Image source="xiaoETip_bg_png" x="0" y="0"/>
<e:Label text="哈喽小主人,你想了解哪些内容?" x="26" y="20" textColor="0x785332" size="24" bold="true"/>
<e:Scroller width="390" height="160" x="26" y="60">
<e:Group>
<e:List id="xiaoEGroupList" top="0" right="0" left="0" bottom="0"/>
</e:Group>
</e:Scroller>
</e:Group>
<e:Group id="xiaoEAnswer" x="30" y="537" anchorOffsetX="0" anchorOffsetY="0" touchChildren="false" visible="false">
<e:Image source="xiaoETip_bg_png" x="0" y="0"/>
<e:Label id="answerTitle" text="哈喽小主人,你想了解哪些内容?" x="26" y="20" size="24" bold="true" textColor="0x785332"/>
<e:Label id="answerTxt" text="" x="26" y="55" size="20" bold="true" anchorOffsetX="0" width="386" anchorOffsetY="0" height="132" textColor="0xe06200" verticalAlign="justify"/>
<e:Label text="我知道了&gt;" x="315" y="197" size="22" bold="true" anchorOffsetX="0" anchorOffsetY="0" textColor="0x785332"/>
</e:Group>
<e:Image id="xiaoE" x="24" source="小E_png" verticalCenter="62.5"/>
</e:Group>
</e:Skin>
\ No newline at end of file
......@@ -14,6 +14,8 @@
<e:Group x="61" y="388" width="182" height="26">
<e:Label id="nickname" text="欢趣使者的小屋" y="0" textColor="0xffe595" size="26" horizontalCenter="0"/>
</e:Group>
<e:Image source="room_panda_png" x="261" y="813"/>
<e:Image source="room_table_png" x="125" y="1029"/>
</e:Group>
</e:Group>
</e:Skin>
\ No newline at end of file
......@@ -2,7 +2,7 @@
<e:Skin class="CreditsTip" width="750" height="1624" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<e:Image y="500.33" source="unlock_bg_png" horizontalCenter="0"/>
<e:Image id="closeBtn" source="closeBtn_png" x="532" y="433.33"/>
<e:Label id="label" text="一个鸡蛋=50个欢趣豆" y="640.83" size="24" textColor="0x66492f" horizontalCenter="0"/>
<e:Label id="label" text="增加一块可使用的土地\n需要消耗5000欢趣豆" y="635" size="24" textColor="0x66492f" anchorOffsetX="0" width="445" horizontalCenter="0" textAlign="center" lineSpacing="15"/>
<e:Button id="cancel" label="" x="174" y="745.33">
<e:skinName>
<e:Skin states="up,down,disabled">
......
......@@ -15,6 +15,9 @@ import {docEvent} from "./comm/DocumentEvent";
import {Panels, Scenes, Tops} from "./types/Scenes";
import Bar from "./components/Bar";
import {NetManager} from "../libs/tw/manager/NetManager";
import {Tools} from "./Tools";
import {showToast} from "./comm/UtilsConst";
import To = egret.tween.To;
let MainStage: egret.Stage = null;
export {MainStage};
......@@ -56,7 +59,7 @@ class Main extends eui.UILayer {
private async runGame() {
await this.loadResource();
this.createGameScene();
await this.createGameScene();
}
private async loadResource() {
......@@ -83,9 +86,9 @@ class Main extends eui.UILayer {
* 创建场景界面
* Create scene interface
*/
protected createGameScene(): void {
protected async createGameScene() {
MainStage = this.stage;
// DataManager.ins.customCfgData = window["CFG"];
Buried.init();
initstatistics(); // 页面停留时长(接口)
......@@ -93,11 +96,27 @@ class Main extends eui.UILayer {
NetManager.ins.getRule((success, res) => {
});
let bar = new Bar();
this.addChild(bar);
this.getGameRes().then(() => {
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
});
this.addChild(new Bar());
await this.getGameRes();
const consumerInfo = await Tools.getConsumerInfo();
if (!consumerInfo) {
showToast('获取用户信息失败');
return;
}
await Tools.getQuestionList(); // 问题列表
const areaPrice = await Tools.getAreaPrice();
if (!areaPrice) {
showToast('获取土地价格失败');
return;
}
SceneCtrl.instance.change(ModuleTypes.MAIN_SCENE);
}
//加载游戏中的资源
......
......@@ -61,7 +61,7 @@ export default class ExchangeBuyPanel extends Panel {
showToast('兑换成功,可返回农场使用');
GDispatcher.dispatchEvent('shopUpdate');
this.onTouchClose();
}, this.data.spId, ticket);
}, this.data.spId, ticket, 1);
}).catch(() => {
this.btn.touchEnabled = true;
showToast('啊哦...目前无法兑换哦');
......@@ -86,7 +86,7 @@ export default class ExchangeBuyPanel extends Panel {
}, ticket, (res) => {
return res.data == 0;
});
}, 'join_7', 'join', '欢趣农场', this.data.price);
}, 'join_7', 'join', this.data.price, '欢趣农场');
})
}
......
......@@ -6,6 +6,11 @@ import {NetManager} from "../../libs/tw/manager/NetManager";
import TouchEvent = egret.TouchEvent;
import {G_GetHomeDataByKey, HOME} from "../Scenes/Home";
import {showToast} from "../comm/UtilsConst";
import Loading from "../loading/Loading";
import To = egret.tween.To;
import {Tools} from "../Tools";
import {GDispatcher} from "../../libs/tc/util/GDispatcher";
import {MainIns} from "../Scenes/MainScene/MainScene";
const propData = [
{
......@@ -259,20 +264,46 @@ class ShopItem extends Component {
this.setNum(this.num += (e.target == this.addBtn ? 1 : -1));
}
private tapBuy() {
if (this.num == 0) return;
private async tapBuy() {
const num = this.num;
console.log(this.num, this.data.price, this.data.price * this.num, this.data);
if (num == 0) return;
if (G_GetHomeDataByKey(HOME.GOLD) < this.data.price * this.num) {
const needGold = this.data.price * num;
console.log(`%c购买${num}个,一个价格${this.data.price}, 需要${needGold}`, 'color:green');
if (G_GetHomeDataByKey(HOME.GOLD) < needGold) {
showToast('啊哦,欢趣豆不足,快去攒豆吧');
return;
}
/// TODO 批量购买
Loading.instace.show();
Tools.creditsCost('join_7', 'join', needGold, '欢趣农场')
.then((ticket) => {
// 兑换商品
NetManager.ins.propExchange((success, res) => {
Loading.instace.hide();
if (!success) {
showToast('啊哦...目前无法兑换哦');
return;
}
showToast('兑换成功,可返回农场使用');
this.data.updateCall();
MainIns().mainUI.getPropInfo();
}, this.data.spId, ticket, num);
})
.catch(() => {
showToast('啊哦...目前无法兑换哦');
Loading.instace.hide();
});
this.setNum(0);
this.data.updateCall();
}
......
import Panel from "../views/Panel";
import {M_UpdateLand} from "../Scenes/MainScene/LandMgr";
import {Tools} from "../Tools";
import {NetManager} from "../../libs/tw/manager/NetManager";
import {showToast} from "../comm/UtilsConst";
import {G_GetHomeDataByKey, G_UpdateHomeData, HOME} from "../Scenes/Home";
export default class UnlockPanel extends Panel {
public closeBtn: eui.Image;
......@@ -37,11 +40,29 @@ export default class UnlockPanel extends Panel {
case this.btn:
/// TODO 解锁土地,刷新土地,关闭弹窗
const landId = this.data.landId;
console.log(landId);
const price = +Tools.areaPrice[landId].price;
if (G_GetHomeDataByKey(HOME.GOLD) < price) {
showToast('欢趣豆不足,快去赚欢趣豆吧');
this.hidePanel();
return;
}
Tools.creditsCost('area', 'dojoin', price).then((ticket) => {
NetManager.ins.unlockLand((success) => {
if (!success) return;
// M_UpdateLand(landId); TODO 放到动画结束的地方
this.data.call();
}, ticket, landId);
}).catch(() => {
showToast('消耗欢趣豆失败,请稍后再试');
G_UpdateHomeData();
});
M_UpdateLand(landId);
this.data.call();
this.hidePanel();
break;
case this.cancel:
......@@ -57,7 +78,7 @@ export default class UnlockPanel extends Panel {
}
private initUI(): void {
this.label.text = `增加一块可使用的土地\n需要消耗${Tools.areaPrice[this.data.landId].price}欢趣豆`;
}
destroy() {
......
......@@ -9,8 +9,11 @@ import {ModuleTypes} from "../../types/sceneTypes";
import Group = eui.Group;
import Image = eui.Image;
import {preLoadRes} from "../../comm/UtilsConst";
import PanelCtrl from "../../ctrls/panelCtrl";
import UnlockPanel from "../../Panels/UnlockPanel";
import M_EVENT from "./MSceneEnum";
import Label = eui.Label;
import {Tools} from "../../Tools";
import TouchEvent = egret.TouchEvent;
import tr = egret.sys.tr;
////////////////// Instance //////////////////
let instance: MainScene = null;
......@@ -61,7 +64,14 @@ export default class MainScene extends Scene {
public progressMgr: ProgressMgr;
public houseBtn: Group;
public xiaoE: Image;
public xiaoEGroup: eui.Group;
public xiaoEGroupList: eui.List;
public xiaoEAnswer: eui.Group;
public answerTitle: eui.Label;
public answerTxt: eui.Label;
constructor(data?) {
super(data);
......@@ -98,6 +108,25 @@ export default class MainScene extends Scene {
// 创建操作Panel(初始为隐藏状态)
this.optionPanel = OptionPanel.getInstance();
this.addChild(this.optionPanel);
MainDispatcher.addEvent(M_EVENT.HIDE_OPTION, () => {
this.xiaoEGroup.visible = false;
this.xiaoEAnswer.visible = false;
}, this);
for (let i = 0; i < Tools.xiaoEQuestion.length; i++) {
Tools.xiaoEQuestion[i]['showAnswer'] = this.showAnswer;
}
this.xiaoEGroupList.itemRenderer = QuestionItem;
this.xiaoEGroupList.dataProvider = new eui.ArrayCollection(Tools.xiaoEQuestion);
}
private showAnswer = (data) => {
this.answerTitle.text = data.content;
this.answerTxt.text = data.answer;
this.xiaoEAnswer.visible = true
this.xiaoEGroup.visible = false;
}
destroy() {
......@@ -117,6 +146,7 @@ export default class MainScene extends Scene {
[this.bg, this.onTouchTap, this], // 点到bg触发Option隐藏,因为在游戏层中其他游戏元素都在bg上层
[this.houseBtn, this.onTap, this],
[this.xiaoE, this.onTap, this],
[this.xiaoEAnswer, this.onTap, this],
]);
}
......@@ -137,9 +167,10 @@ export default class MainScene extends Scene {
SceneCtrl.instance.change(ModuleTypes.ROOM_SCENE);
break;
case this.xiaoEAnswer:
case this.xiaoE:
/// TODO 小E
console.log('点击小E');
M_HideOption();
this.xiaoEGroup.visible = true;
break;
default:
......@@ -160,3 +191,42 @@ export default class MainScene extends Scene {
}
}
// 问题列表
class QuestionItem extends eui.ItemRenderer {
label: Label;
constructor() {
super();
this.height = 40;
const label = this.label = new Label()
this.addChild(label);
label.textColor = 0xe06200;
label.size = 20;
label.y = 10;
const img = new Image();
img.source = 'xiaoETip_item_btn_png';
this.addChild(img);
img.x = 370;
img.y = 10;
this.addEventListener(TouchEvent.TOUCH_TAP, this.onTap, this);
}
dataChanged() {
this.label.text = this.data.content;
}
onTap() {
if (+this.data.type == 0) { // 跳链接的
window.location.href = this.data.redirect;
} else if (+this.data.type == 1) {
this.data.showAnswer(this.data);
}
}
}
......@@ -19,6 +19,8 @@ import GameGroupPanel from "../../Panels/GameGroupPanel";
import Guide from "../../Panels/Guide";
import ShopPanel from "../../Panels/ShopPanel";
import TopLayerCtrl from "../../ctrls/topLayerCtrl";
import {Tools} from "../../Tools";
import To = egret.tween.To;
export let propData = {
sp_food_1: {name: 'food',},
......@@ -229,6 +231,8 @@ export default class MainUI extends ComponentBase {
this[`${propData['sp_food_1'].name}Group`].visible = true;
this[`${propData['sp_food_2'].name}Group`].visible = true;
this.setPropInfo();
}
public async getPropInfoByBI() {
......@@ -251,6 +255,8 @@ export default class MainUI extends ComponentBase {
this[`${propData['sp_prop_1'].name}Group`].visible = false;
}
this.userGold.text = `欢趣豆:${G_GetHomeDataByKey(HOME.GOLD)}`;
}
public setPropInfo() {
......@@ -260,6 +266,9 @@ export default class MainUI extends ComponentBase {
DataManager.ins.updateData(propData[k].name, data[k]);
}
this[`${propData['sp_prop_1'].name}Group`].visible = (data['sp_prop_1'] > 0);
this.userGold.text = `欢趣豆:${G_GetHomeDataByKey(HOME.GOLD)}`;
}
public getGoldNum() {
......@@ -274,18 +283,21 @@ export default class MainUI extends ComponentBase {
}
private getUserInfo() {
NetManager.ins.getConsumerInfo((success, res) => {
if (!success) {
this.userName.text = '欢趣使者';
return;
}
const data = res.data;
const {newUser, nickname, ifLogin, popup, loginPresent} = data;
this.userName.text = (!data || !nickname || (nickname == 'null'))
? '欢趣使者' : ((nickname.length > 7) ? nickname.slice(0, 7) + '...' : nickname);
// 登陆奖励
const loginPrize = () => {
const consumerInfo = Tools.consumerInfo;
if (!consumerInfo) {
this.userName.text = '欢趣使者';
return;
}
const {newUser, nickname, ifLogin, popup, loginPresent} = consumerInfo;
this.userName.text = (!consumerInfo || !nickname || (nickname == 'null'))
? '欢趣使者' : ((nickname.length > 7) ? nickname.slice(0, 7) + '...' : nickname);
// 登陆奖励
const loginPrize = () => {
if (ifLogin) {
Tools.consumerInfo.ifLogin = false;
// NetManager.ins.doTask((success, res) => {
// if (!success) {
// return;
......@@ -303,24 +315,28 @@ export default class MainUI extends ComponentBase {
food: loginPresent.spFood1RewardNum,
water: loginPresent.spFood2RewardNum,
});
};
if (newUser) { // 新用户出引导,TODO 因为换了活动,则不存在老用户
PanelCtrl.instance.show(Guide, {
call: () => {
if (popup) {
PanelCtrl.instance.show(NewUserPanel, {f: loginPrize});
}
return popup;
},
f: loginPrize
}, false);
} else if (popup) { // 不是新用户,但是要弹弹窗
PanelCtrl.instance.show(OldUserPanel, {f: loginPrize});
} else if (ifLogin) { // 首次登陆
loginPrize();
}
});
};
if (newUser) { // 新用户出引导,TODO 因为换了活动,则不存在老用户
Tools.consumerInfo.newUser = false;
PanelCtrl.instance.show(Guide, {
call: () => {
if (popup) {
Tools.consumerInfo.popup = false;
PanelCtrl.instance.show(NewUserPanel, {f: loginPrize});
}
return popup;
},
f: loginPrize
}, false);
} else if (popup) { // 不是新用户,但是要弹弹窗
Tools.consumerInfo.popup = false;
PanelCtrl.instance.show(OldUserPanel, {f: loginPrize});
}
loginPrize(); // 首次登陆
}
destroy() {
......
......@@ -11,6 +11,7 @@ import Image = eui.Image;
import {loadSvga} from "../../../comm/loadSvga";
import Event = egret.Event;
import {waitAsync} from "../../../comm/UtilsConst";
import {M_UpdateLand} from "../LandMgr";
enum LAND_STATE {
NONE = 'none', // 无
......@@ -153,6 +154,9 @@ export default class Land extends eui.Component {
unlockEffect.addEventListener(Event.COMPLETE, () => {
unlockEffect.stop();
this.removeChild(unlockEffect);
M_UpdateLand(this.index); // 在动画结束的时候刷新
}, this);
this.addChild(unlockEffect);
}
......
/*
* Tools.ts
* Created by 还有醋v on 2020/12/23.
* Copyright © 2020 haiyoucuv. All rights reserved.
*/
import {NetManager} from "../libs/tw/manager/NetManager";
import To = egret.tween.To;
export class Tools {
public static consumerInfo: {
nickname: string,
newUser: boolean,
popup: boolean,
ifLogin: boolean,
loginPresent: {
spFood1RewardNum: number,
spFood2RewardNum: number,
},
};
public static getConsumerInfo(): Promise<boolean> {
return new Promise((resolve, reject) => {
NetManager.ins.getConsumerInfo((success, res) => {
if (!success) return resolve(false);
Tools.consumerInfo = res.data;
resolve(true);
});
});
}
public static areaPrice: {
landId: number,
price: number
}[] = [];
public static getAreaPrice(): Promise<boolean> {
return new Promise((resolve, reject) => {
NetManager.ins.areaPrice((success, res) => {
if (!success) return resolve(false);
res.data.forEach((v) => {
Tools.areaPrice[+v.landId] = v;
});
resolve(true);
});
});
}
public static xiaoEQuestion: {
type: 0 | 1,
content: string,
redirect?: string
answer?: string
}[] = [];
public static getQuestionList(): Promise<boolean> {
return new Promise((resolve, reject) => {
NetManager.ins.questionList((success, res) => {
if (!success) return resolve(false);
Tools.xiaoEQuestion = res.data;
resolve(true);
});
});
}
/**
* 扣积分流程
* @param toPlaywayId
* @param toActionId
* @param desc
* @param num 数量
*/
public static creditsCost(toPlaywayId, toActionId, num, desc?) {
return new Promise((resolve, reject) => {
NetManager.ins.creditsCost((success, res) => {
if (!success) {
reject();
return;
}
const ticket = res.data;
// 轮询扣积分状态
NetManager.ins.queryStatus((success, res) => {
if (!success || res.data != 1) {
reject();
return;
}
resolve(ticket);
}, ticket, (res) => {
return res.data == 0;
});
}, toPlaywayId, toActionId, num, desc);
})
}
}
\ No newline at end of file
......@@ -347,6 +347,15 @@ const config = {
'/projectx/{projectId}/join_9/join.do': {
data: './joyousManor/join_9.json'
},
'/projectx/{projectId}/area/areaPrice.do': {
data: './joyousManor/areaPrice.json'
},
'/projectx/{projectId}/area/join.do': {
data: './joyousManor/unlockLand.json'
},
'/projectx/{projectId}/question/join.do': {
data: './joyousManor/question.json'
},
};
......
{
"success": true,
"message": "",
"code": "",
"data": [
{
"landId": "1",
"price": 10
},
{
"landId": "2",
"price": 10
},
{
"landId": "3",
"price": 10
},
{
"landId": "4",
"price": 10
},
{
"landId": "5",
"price": 10
},
{
"landId": "6",
"price": 6666
}
]
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
"nickname": "啊啊啊啊啊啊啊啊啊啊",
"newUser": false,
"popup": false,
"ifLogin": true,
"ifLogin": false,
"loginPresent": {
"spFood1RewardNum": 2,
"spFood2RewardNum": 2
......
{
"success": true,
"message": "",
"code": "",
"data": [
{
"type": 0,
"content": "问题1",
"redirect": "https://www.baidu.com"
},
{
"type": 1,
"content": "问题2",
"answer": "答案4"
},
{
"type": 0,
"content": "问题3",
"redirect": "https://www.baidu.com"
},
{
"type": 1,
"content": "问题4",
"answer": "答案4"
}
]
}
\ No newline at end of file
{
"success": true,
"code": 0,
"message": "ok",
"data": null
}
\ No newline at end of file
......@@ -3,9 +3,9 @@
"message": null,
"code": null,
"data": {
"credits": "1.2万",
"credits": "1.3万",
"unitName": "欢趣豆",
"consumerCredits": 12000,
"consumerCredits": 15500,
"consumerId": 222,
"partnerUserId": "888"
}
......
......@@ -18,7 +18,7 @@
"sp_achv_2": 0,
"sp_seed_1": 0,
"sp_seed_2": 1,
"sp_seed_3": 0,
"sp_seed_3": 1,
"sp_seed_4": 0,
"sp_seed_5": 0,
"sp_seed_6": 0
......
This diff is collapsed.
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