Commit 0958ae10 authored by haiyoucuv's avatar haiyoucuv

init

parent 7be4533e
......@@ -11998,7 +11998,7 @@
"y": 180,
"z": 0
},
"_id": "e4Xdc3OHFAuoxwSIh0Dpss"
"_id": "ecmmu1ll9Oko1T65DKrTlL"
},
{
"__type__": "cc.UITransform",
......@@ -12020,7 +12020,7 @@
"x": 0,
"y": 1
},
"_id": "fcw3wYg5ZNxrczeBtP3t4j"
"_id": "31OnLiyShPeLFjNMoLl+C3"
},
{
"__type__": "cc.Sprite",
......@@ -12056,7 +12056,7 @@
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "c1H1DjK3BHHKOlLLTBMT6l"
"_id": "4cD+qRCoFJw4m8r8FyfiwF"
},
{
"__type__": "cc.Node",
......@@ -12104,7 +12104,7 @@
"y": 0,
"z": 0
},
"_id": "54ts/kNLFFq7cpRZZvFxy1"
"_id": "2e49+nXUdNyoGYe+1qUHRQ"
},
{
"__type__": "cc.UITransform",
......@@ -12126,7 +12126,7 @@
"x": 0,
"y": 1
},
"_id": "ab9pIzkCRFda2KHJ1cAlMB"
"_id": "fdAvh4HH9Bwpydjhq4HJdF"
},
{
"__type__": "cc.Sprite",
......@@ -12162,7 +12162,7 @@
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "2furQrwXtP0pNtUrmOnfPS"
"_id": "canRtXfVpNo7jQFCVIheWe"
},
{
"__type__": "cc.Node",
......@@ -12210,7 +12210,7 @@
"y": 0,
"z": 0
},
"_id": "4fih1PDnxFG43iEneKJvEj"
"_id": "17mT565rVAeLxBsWVerWQz"
},
{
"__type__": "cc.UITransform",
......@@ -12232,7 +12232,7 @@
"x": 0,
"y": 1
},
"_id": "59LUg752pAj4CrekPyr616"
"_id": "fclB6lvnxCN6e8oI6IATqM"
},
{
"__type__": "cc.Sprite",
......@@ -12268,7 +12268,7 @@
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "7906yzUgBD0Iqf2kqpzdjO"
"_id": "c1H8tNkeFLwawoMmHjp2rO"
},
{
"__type__": "cc.UITransform",
......@@ -12460,7 +12460,7 @@
"y": 180,
"z": 0
},
"_id": "c8cL3uT29GHqtcmERKNTy2"
"_id": "27cSNAEXNGLqbve1VR8qJL"
},
{
"__type__": "cc.UITransform",
......@@ -12482,7 +12482,7 @@
"x": 0,
"y": 1
},
"_id": "7aHViiSrNPAL77pfbUI3TG"
"_id": "9c/e+r045NXJQnKyKOfeaJ"
},
{
"__type__": "cc.Sprite",
......@@ -12518,7 +12518,7 @@
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "8feWN4fB5G5qqoefvs+TO7"
"_id": "8aUVvORcFDt6QW7V4wK1yu"
},
{
"__type__": "cc.Node",
......@@ -12566,7 +12566,7 @@
"y": 0,
"z": 0
},
"_id": "ece+OTlGJJSIhZDHISwZww"
"_id": "98waMNxWFEU6ipo+3wtQby"
},
{
"__type__": "cc.UITransform",
......@@ -12588,7 +12588,7 @@
"x": 0,
"y": 1
},
"_id": "8dDHMxyNxPUbpLw5NI7JyM"
"_id": "fdDLWuHkVBKY0vUZxY9qaw"
},
{
"__type__": "cc.Sprite",
......@@ -12624,7 +12624,7 @@
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "9bHqHCAOBIUIClF+5gXS3h"
"_id": "e4xNUj9h1FsrT1n6tvg9iR"
},
{
"__type__": "cc.Node",
......@@ -12672,7 +12672,7 @@
"y": 0,
"z": 0
},
"_id": "9bs0Y34a5HrJgmfi0Yw+Il"
"_id": "54OVPvDxtMRIRXk0x2Caes"
},
{
"__type__": "cc.UITransform",
......@@ -12694,7 +12694,7 @@
"x": 0,
"y": 1
},
"_id": "67u8kYeQxEPZbkfwg+U2aA"
"_id": "48Yjbgd/BDkJHPpgmojs8c"
},
{
"__type__": "cc.Sprite",
......@@ -12730,7 +12730,7 @@
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "5cDQFrGw5NQLFoEQ4R8QwJ"
"_id": "c8QuapttNCo5TK34oHrT+A"
},
{
"__type__": "cc.UITransform",
......
......@@ -193,7 +193,7 @@
"_priority": 1073741824,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 739.6666666666667,
"_orthoHeight": 554.9402173913044,
"_near": 1,
"_far": 2000,
"_color": {
......@@ -907,7 +907,7 @@
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 1320,
"width": 1324,
"height": 0
},
"_anchorPoint": {
......@@ -961,8 +961,8 @@
"__prefab": null,
"_alignFlags": 40,
"_target": null,
"_left": 52,
"_right": 52,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
......@@ -991,7 +991,7 @@
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 1424,
"width": 1324,
"height": 630
},
"_anchorPoint": {
......@@ -1099,7 +1099,7 @@
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 1424,
"width": 1324,
"height": 630
},
"_anchorPoint": {
......@@ -1146,8 +1146,8 @@
"__prefab": null,
"_alignFlags": 45,
"_target": null,
"_left": 100,
"_right": 100,
"_left": 150,
"_right": 150,
"_top": 120,
"_bottom": 0,
"_horizontalCenter": 0,
......@@ -1643,7 +1643,9 @@
"skin2": {
"__uuid__": "08a7d346-f4a0-49b3-8be3-2564e4705eb3@f9941",
"__expectedType__": "cc.SpriteFrame"
}
},
"node1": null,
"node2": null
},
{
"__type__": "cc.PrefabInfo",
......
......@@ -45,8 +45,8 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -592,
"y": -200,
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
......
......@@ -4,6 +4,7 @@ import {observer, render} from "../store/decorators";
import {sendWebNetWithToken, WebNetName} from "db://assets/Scripts/Utils/WebNet/WebNet";
import {changeScene, showPanel} from "db://assets/Module/UIFast";
import {MyBagPanel} from "db://assets/Scripts/Panels/MyBagPanel";
import store from "../store/store";
const {ccclass, property} = _decorator;
......@@ -25,14 +26,22 @@ export default class ExchangeSuccess extends Panel {
}
async start() {
const {consumeSp, item, conditionsItem} = this.data
this.prizeName.string = item.optionName;
this.prize.spriteFrame = item.optionImg;
await sendWebNetWithToken(WebNetName.propPag)
const {
id,
optionName,
optionImg,
spDetail,
prizeId,
userLimitCount,
alreadyUserCount,
consumeCreditsNum
} = this.data;
this.prizeName.string = optionName;
this.prize.spriteFrame = optionImg;
store.getExchangeInfo();
}
clickLook = async () => {
......
import Panel from "../../Module/Panel";
import {_decorator, Button, Node, Sprite, Label} from "cc";
import {observer} from "../store/decorators";
import {showPanel, showToast} from "db://assets/Module/UIFast";
import { _decorator, Button, Node, Sprite, Label } from "cc";
import { observer } from "../store/decorators";
import { showPanel, showToast } from "db://assets/Module/UIFast";
import ExchangeSuccess from "db://assets/Scripts/Panels/ExchangeSuccess";
import {creditsCost, sendWebNetWithToken, WebNetName} from "db://assets/Scripts/Utils/WebNet/WebNet";
import {_asyncThrottle} from "../Utils/Utils";
import { creditsCost, sendWebNetWithToken, WebNetName } from "db://assets/Scripts/Utils/WebNet/WebNet";
import { _asyncThrottle } from "../Utils/Utils";
const {ccclass, property} = _decorator;
const { ccclass, property } = _decorator;
@observer
@ccclass('ProPop')
@ccclass("ProPop")
export default class ProPop extends Panel {
static bundle = "PropPop";
......@@ -22,37 +22,56 @@ export default class ProPop extends Panel {
@property(Label) explanation: Label = null;
@property(Label) num: Label = null;
exchangeInfo = {}
onLoad() {
this.closeBtn.on(Button.EventType.CLICK, this.clickClose)
this.btn.on(Button.EventType.CLICK, this.clickExchange)
this.closeBtn.on(Button.EventType.CLICK, this.clickClose);
this.btn.on(Button.EventType.CLICK, this.clickExchange);
}
start() {
const {consumeSp, item, conditionsItem} = this.data
const {
id,
optionName,
optionImg,
spDetail,
prizeId,
userLimitCount,
alreadyUserCount,
consumeCreditsNum
} = this.data;
this.explanation.string = item.spDetail;
this.explanation.string = spDetail;
const num = this.btn.getChildByName("num")
num.getComponent(Label).string = consumeSp.quantity;
const num = this.btn.getChildByName("num");
num.getComponent(Label).string = consumeCreditsNum;
this.prize.spriteFrame = item.optionImg;
this.prize.spriteFrame = optionImg;
this.prizeName.string = item.optionName;
this.prizeName.string = optionName;
}
clickClose = () => {
this.hidePanel();
}
};
clickExchange = _asyncThrottle(async () => {
const {consumeSp, item, conditionsItem} = this.data;
const num = 1;
const {
id,
optionName,
optionImg,
spDetail,
prizeId,
userLimitCount,
alreadyUserCount,
consumeCreditsNum
} = this.data;
const {
success: costSuc,
ticket
} = await creditsCost("exchang_1", "doExchange", `sp_deduct_desc`, consumeSp.quantity);
} = await creditsCost("exchange", "exchangeSp", `sp_deduct_desc`, (+consumeCreditsNum) * num);
if (!costSuc) {
showToast("网络异常,请稍后重试~");
......@@ -60,20 +79,19 @@ export default class ProPop extends Panel {
}
//兑换接口
const {success, data} = await sendWebNetWithToken(WebNetName.propExchange, {
const { success, data } = await sendWebNetWithToken(WebNetName.propExchange, {
id,
ticketNum: ticket,
ruId: item.ruleId,
gear: conditionsItem.gear,
num: num,
// ruId: item.ruleId,
});
if (!success) return;
this.exchangeInfo = data;
// if (conditionsItem.credits >= consumeSp.quantity) {
showPanel(ExchangeSuccess, {consumeSp, item, conditionsItem})
showPanel(ExchangeSuccess, this.data);
this.hidePanel();
// }
})
});
}
import {_decorator, Button, instantiate, js, Label, math, Node, Prefab, Sprite} from "cc";
import { _decorator, Button, instantiate, Label, Node, Prefab, Sprite } from "cc";
import Scene from "db://assets/Module/Scene";
import {MainGame} from "./MainGame/MainGame";
import {changeScene, showPanel, showToast} from "db://assets/Module/UIFast";
import { changeScene, showPanel, showToast } from "db://assets/Module/UIFast";
import store from "../store/store";
import {observer, render} from "../store/decorators";
import {_asyncThrottle} from "../Utils/Utils";
import { observer, render } from "../store/decorators";
import ProPop from "db://assets/Scripts/Panels/ProPop";
import {sendWebNet, WebNetName} from "db://assets/Scripts/Utils/WebNet/WebNet";
import {HomeScene} from "db://assets/Scripts/Scenes/HomeScene";
import {YXCollectionView, YXFlowLayout} from "../../Component/YXList/lib";
import {PointDetailScene} from "db://assets/Scripts/Scenes/PointDetailScene";
import Panel from "db://assets/Module/Panel";
import { HomeScene } from "db://assets/Scripts/Scenes/HomeScene";
import { PointDetailScene } from "db://assets/Scripts/Scenes/PointDetailScene";
const {ccclass, property} = _decorator;
const { ccclass, property } = _decorator;
@observer
@ccclass('PropPage')
@ccclass("PropPage")
export class PropPage extends Scene {
static bundle: string = "PropPage";
static skin: string = "PropPage";
// static group: string[] = ["HomeScene"];
@property(Node) backBtn: Node = null;
@property(Label) credits: Label = null;
......@@ -29,145 +23,82 @@ export class PropPage extends Scene {
@property(Node) content: Node = null;
@property(Node) point: Node = null;
/**
* 列表组件
*/
@property(YXCollectionView)
listComp: YXCollectionView = null;
propPageInfo: any = {};
onLoad() {
this.backBtn.on(Button.EventType.CLICK, this.clickToBack, this)
this.point.on(Button.EventType.CLICK, this.clickToChange, this)
this.backBtn.on(Button.EventType.CLICK, this.clickToBack, this);
this.point.on(Button.EventType.CLICK, this.clickToChange, this);
}
async start() {
await this.getPropPageInfo()
this.setCredits()
this.setPrizeList()
}
async getPropPageInfo() {
const {success, data} = await sendWebNet(WebNetName.propPag);
if (!success) {
return;
}
this.propPageInfo = data
// this.listComp.numberOfItems = () => data.conditions.length;
//
// this.listComp.onCellDisplay = this.onCellDisplay;
//
// let layout = new YXFlowLayout();
// layout.horizontalSpacing = 10;
// layout.verticalSpacing = 10;
// layout.itemSize = new math.Size(240, 400);
// this.listComp.layout = layout;
//
// this.listComp.reloadData();
}
// onCellDisplay = (cell: Node, indexPath) => {
// const data = this.propPageInfo.conditions[indexPath.item];
//
// const consumeSp = data.consumeSps[0];
// const item = data.options[0];
//
// cell.getChildByName("prizeName")
// .getComponent(Label).string = item.spName;
//
// cell.getChildByName("prize")
// .getComponent(Sprite).spriteFrame = item.optionImg;
//
// cell.getChildByName("explain")
// .getComponent(Label).string = item.spDetail;
//
// const btn = cell.getChildByName("btn");
//
// btn.getChildByName("num2")
// .getComponent(Label).string = consumeSp.quantity;
//
// btn.targetOff(Button.EventType.CLICK);
//
// btn.on(Button.EventType.CLICK, () => this.clickToConfirm(consumeSp, item, data));
// };
/** 积分数据*/
setCredits() {
if (this.propPageInfo.credits > 999999) {
this.credits.string = "999999+"
} else {
this.credits.string = this.propPageInfo.credits;
await store.getExchangeInfo();
this.updateInfo();
}
@render
render() {
const { remainCredits } = store.exchangeInfo;
this.credits.string = `${remainCredits}`;
}
/** 道具卡*/
setPrizeList() {
const conditions = this.propPageInfo.conditions
conditions.map((conditionsItem, conditionsIndex) => {
const consumeSp = conditionsItem.consumeSps[0]
const item = conditionsItem.options[0]
const prize = instantiate(this.prizePrefab)
this.content.addChild(prize)
const prizeName = prize.getChildByName("prizeName")
prizeName.getComponent(Label).string = item.optionName
const prizeimg = prize.getChildByName("prize")
prizeimg.getComponent(Sprite).spriteFrame = item.optionImg
updateInfo() {
const { exchangeShopList } = store.exchangeInfo;
const explain = prize.getChildByName("explain")
explain.getComponent(Label).string = item.spDetail
exchangeShopList.forEach((item, index) => {
const btn = prize.getChildByName("btn")
const num2 = btn.getChildByName("num2")
num2.getComponent(Label).string = consumeSp.quantity;
const {
id,
optionName,
optionImg,
spDetail,
prizeId,
userLimitCount,
alreadyUserCount,
consumeCreditsNum,
} = item;
const prize = instantiate(this.prizePrefab);
this.content.addChild(prize);
btn.on(Button.EventType.CLICK, () => this.clickToConfirm(consumeSp, item, conditionsItem))
prize.getChildByName("prizeName")
.getComponent(Label).string = optionName;
})
prize.getChildByName("prize")
.getComponent(Sprite).spriteFrame = optionImg;
//遍历conditions
//再遍历options
//item 获取道具卡数量,展示道具数量
//将数组内的图片、名字、道具说明加入到道具卡内
prize.getChildByName("explain")
.getComponent(Label).string = spDetail;
//遍历option
//将道具卡的预制体进行遍历
//预制体内的名字、解释、图片 进行更替
const btn = prize.getChildByName("btn");
btn.getChildByName("num2")
.getComponent(Label).string = consumeCreditsNum;
btn.on(Button.EventType.CLICK, () => this.clickToConfirm(item));
});
}
/** 点击积分按钮*/
clickToChange() {
changeScene(PointDetailScene, {ifFrom: PropPage, back: this.data.isFrom})
changeScene(PointDetailScene, { ifFrom: PropPage, back: this.data.isFrom });
}
/** 点击返回按钮*/
clickToBack = async () => {
const {isFrom, isPop} = this.data
const { isFrom, isPop } = this.data;
if (isPop == true) {
changeScene(HomeScene)
showPanel(isFrom,{tab:"TOOL"})
changeScene(HomeScene);
showPanel(isFrom, { tab: "TOOL" });
} else {
changeScene(isFrom,)
}
changeScene(isFrom);
}
};
clickToConfirm = async (item) => {
const { consumeCreditsNum, } = item;
clickToConfirm = async(consumeSp, item, conditionsItem) => {
if (this.propPageInfo.credits < consumeSp.quantity) {
showToast("积分数量不足")
if (store.exchangeInfo.remainCredits < consumeCreditsNum) {
showToast("积分数量不足");
} else {
showPanel(ProPop, {consumeSp, item, conditionsItem});
console.log(consumeSp, item)
showPanel(ProPop, item);
}
}
};
}
\ No newline at end of file
......@@ -122,12 +122,12 @@ export enum WebNetName {
/**
* 道具首页
*/
propPag = "exchang_1/listExchangeLimit.do",
propPag = "exchange/queryExchangeList.do",
/**
* 道具_兑换
*/
propExchange = "exchang_1/doExchange.do",
propExchange = "exchange/exchangeSp.do",
/**
* 任务列表
......@@ -512,7 +512,7 @@ export const sendLogList = (type: LOG_TYPE | 'exposure' | 'click', areaList: (nu
* @param credits
* @return {Promise<{ success: boolean, ticket?: any,pollingData }>}
*/
export async function creditsCost(toPlaywayId, toActionId, desc, credits = "") {
export async function creditsCost(toPlaywayId, toActionId, desc, credits: number = 0) {
// 预扣积分
const param = {
toPlaywayId,
......
......@@ -192,6 +192,20 @@ class Store {
return success;
}
exchangeInfo = {
remainCredits: 0,
exchangeShopList: [],
};
async getExchangeInfo() {
const { success, data } = await sendWebNet(WebNetName.propPag);
if (!success) {
return;
}
this.exchangeInfo = data;
}
}
......
{
"success": true,
"message": "sint commodo",
"code": "proident in deserunt",
"data": {
"prizeType": 68915736.28756568,
"prizeId": "amet",
"optionImg": "nisi aliquip ad pariatur",
"optionName": "dolor sint"
}
}
\ No newline at end of file
{
"success": true,
"message": "eu in",
"code": "enim",
"data": {
"remainCredits": 123,
"exchangeShopList": [
{
"id": "id1",
"optionName": "optionName1",
"optionImg": "optionImg1",
"prizeId": "prizeId1",
"alreadyUserCount": 21,
"userLimitCount": 121,
"consumeCreditsNum": 123
},
{
"id": "ipsum aliquip in",
"optionName": "fugiat tempor enim dolor",
"optionImg": "nisi tempor adipisicing velit",
"prizeId": "dolor",
"alreadyUserCount": 90188736.47222015,
"userLimitCount": -79072168.36165074,
"consumeCreditsNum": 31445676.271960154
},
{
"id": "culpa sint ipsum",
"optionName": "culpa deserunt velit sint ut",
"optionImg": "nisi dolor est ut",
"prizeId": "sit proident",
"alreadyUserCount": 3810352.981223941,
"userLimitCount": 36226662.41323769,
"consumeCreditsNum": 34958851.89662337
},
{
"id": "elit aliquip dolor aute",
"optionName": "officia laboris do elit dolor",
"optionImg": "consectetur in dolore quis nulla",
"prizeId": "mollit elit cillum sed laboris",
"alreadyUserCount": 11613513.750834286,
"userLimitCount": -70296789.59688011,
"consumeCreditsNum": -73457919.7008391
},
{
"id": "laborum do irure",
"optionName": "est deserunt sed ullamco sit",
"optionImg": "non ex",
"prizeId": "tempor eu cupidatat esse consectetur",
"alreadyUserCount": -88183997.52915691,
"userLimitCount": 79374337.42955035,
"consumeCreditsNum": 13252937.275845021
}
]
}
}
......@@ -48,7 +48,8 @@
}
],
"rankPopList": [],
"signPopFlag": false
"signPopFlag": false,
"bagLightFlag": true
},
"message": null,
"success": true,
......
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