Commit cf5bf964 authored by zhangjinzhou's avatar zhangjinzhou

种子弹窗修改

parent b2585d9c
......@@ -4,7 +4,7 @@
<e:Group id="btn" width="170" height="241" horizontalCenter="0" verticalCenter="0">
<e:Image source="shop_goods_bg_png" horizontalCenter="0" verticalCenter="0" visible="false"/>
<e:Image id="icon" width="113" height="113" x="29" y="71"/>
<e:Label id="title" text="标题" size="26" x="0" y="32" width="170" textAlign="center" textColor="0xce5004" wordWrap="true"/>
<e:Label id="title" text="标题" size="26" x="-85" y="32" width="340" textAlign="center" textColor="0xce5004" touchEnabled="false"/>
<e:Rect id="mk" anchorOffsetX="0" anchorOffsetY="0" left="0" top="0" right="0" bottom="0" ellipseWidth="22" ellipseHeight="22" fillColor="0x6c3907" fillAlpha="0.6" visible="false"/>
<e:Image source="我要兑换按钮_png" horizontalCenter="0" bottom="1"/>
<e:Label id="stock_label" text="剩余0份" x="0" size="18" bold="true" width="171" bottom="-18" textAlign="center" textColor="0xffffff"/>
......
......@@ -6,7 +6,7 @@ import PanelCtrl from "../ctrls/panelCtrl";
import { ModuleTypes } from "../types/sceneTypes";
import SceneCtrl from "../ctrls/sceneCtrl";
import { getlogItem } from "../comm/getlogItem";
import WareHousePanel from "./WareHousePanel";
import WareHousePanel, { productData } from "./WareHousePanel";
export default class ExchangePanel extends Panel {
public closeBtn: eui.Button;
......@@ -31,8 +31,10 @@ export default class ExchangePanel extends Panel {
public titleImg: eui.Image;
public titleMask: eui.Image;
newextxt: eui.Label;
constructor(data?) {
super(data);
console.error("兑换点击==》", this.data);
}
onShowAnim() {
......@@ -58,7 +60,7 @@ export default class ExchangePanel extends Panel {
if (!this.canGet()) {
// showToast('啊哦,合成所需食材不足,快去赚食材吧');
PanelCtrl.instance.show(ModuleTypes.EXCHANGED_PANEL, {
type:"fail"
type: "fail"
});
return;
}
......@@ -94,7 +96,7 @@ export default class ExchangePanel extends Panel {
}
private initUI(): void {
private async initUI() {
this.y = 750 / window.innerWidth * window.innerHeight * 0.2;
this.titleImg.mask = this.titleMask;
this.titleImg.source = this.data.icon;
......@@ -106,6 +108,27 @@ export default class ExchangePanel extends Panel {
this.stock.text = `剩余数量:${this.data.stock}`;
this.setNeed();
this.setBtn();
let key0 = Object.keys(this.data.spMap)[0];
let changespnum = this.data.spMap[key0];
console.error("兑换id", changespnum);
let danwei = productData[key0].numLabel;
let iprice = productData[key0].price;
if (iprice == 0) {
NetManager.ins.priceInfo((success, res) => {
if (!success) {
return;
}
const data = res.data;
for (let k in productData) {
productData[k].price = data[k];
}
iprice = productData[key0].price;
this.newextxt.text = `今天我需要「${changespnum}${danwei}跟你换实物哦, 或者直接卖给我,每袋可以得「20」欢趣豆。 考虑看看呢?`;
});
} else {
this.newextxt.text = `今天我需要「${changespnum}${danwei}跟你换实物哦, 或者直接卖给我,每袋可以得「20」欢趣豆。 考虑看看呢?`;
}
}
private setBtn() {
......
......@@ -442,7 +442,6 @@ class WareHouseSeed extends Component {
// this.tipImg.visible = (data.name == 'chicken' || data.name == 'wheat');
this.tipImg.visible = false;//(data.name == 'wheat');
this.updateUI();
}
private updateUI() {
......
......@@ -8,6 +8,7 @@ import {getSkinPath} from "../../utils";
import {btnDelay, preLoadRes, showToast} from "../../comm/UtilsConst";
import {G_GetHomeDataByKey, G_UpdateHomeData, HOME} from "../Home";
import ExchangePanel from "../../Panels/ExchangePanel";
import { productData } from "../../Panels/WareHousePanel";
const ruNum = 20; // 发奖规则的个数
......@@ -40,6 +41,17 @@ export default class ExchangeScene extends Scene {
}
private initUI(): void {
if(productData.sp_1.price==0){
NetManager.ins.priceInfo((success, res) => {
if (!success) {
return;
}
const data = res.data;
for (let k in productData) {
productData[k].price = data[k];
}
});
}
this.group.height = 750 / window.innerWidth * window.innerHeight;
this.reset();
}
......
......@@ -13,6 +13,8 @@ import { CROP_TYPE } from "../Const";
import TouchEvent = egret.TouchEvent;
import Component = eui.Component;
import { Tools } from "../../../Tools";
import { getlogItem } from "../../../comm/getlogItem";
import ShopPanel from "../../../Panels/ShopPanel";
// 触发Option隐藏
const M_HideOption = function () {
......@@ -89,7 +91,7 @@ export default class OptionPanel extends Component {
this.leftBtn,
this.rightBtn
].forEach((v) => {
if(v instanceof eui.Group){
if (v instanceof eui.Group) {
v.touchChildren = false;
}
v.addEventListener(TouchEvent.TOUCH_TAP, this.onTap, this);
......@@ -149,17 +151,29 @@ export default class OptionPanel extends Component {
let colorFilter = new egret.ColorMatrixFilter(colorMatrix);
const seeds = G_GetHomeDataByKey(HOME.SEED);
let haveidx = [];
let nohaveidx = [];
for (let k in seeds) {
if (seeds[k] > 0) {
this[`${seedKV[k]}Btn`].filters = [];
haveidx.push(this[`${seedKV[k]}Btn`]);
} else {
this[`${seedKV[k]}Btn`].filters = [colorFilter];
nohaveidx.push(this[`${seedKV[k]}Btn`]);
}
this[`${seedKV[k]}Btn`].seedNum = seeds[k];
}
let itemgro: eui.Group = this.petScroll.viewport as eui.Group;
let childidx = 0;
for (let hitem of haveidx) {
itemgro.setChildIndex(hitem, childidx);
childidx++;
}
for (let nitme of nohaveidx) {
itemgro.setChildIndex(nitme, childidx);
childidx++;
}
}
private hideOption() {
......@@ -177,12 +191,15 @@ export default class OptionPanel extends Component {
private onTap(e: TouchEvent) {
const target = e.target;
if (e.target.seedNum <= 0) {
showToast('这个没有了,快去商店购买吧');
// showToast('这个没有了,快去商店购买吧');
NetManager.ins.clickLog(getlogItem(6));
PanelCtrl.instance.show(ShopPanel);
M_HideOption();
return;
}
btnDelay(target);
let petId;
console.log("aaaaa-->>",target)
console.log("aaaaa-->>", target)
switch (target) {
case this.chickBtn: // 鸡
console.log('????????fku')
......@@ -251,7 +268,7 @@ export default class OptionPanel extends Component {
}
M_HideOption();
console.log("点击了---》》",petId)
console.log("点击了---》》", petId)
PanelCtrl.instance.show(IntroducePanel, {
call: call,
petId: petId,
......
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