1062 lines
34 KiB
TypeScript
1062 lines
34 KiB
TypeScript
import SKUIUtil from "./gear_2.3.4/util/SKUIUtil";
|
|
import FGUtil from "./gear_2.3.4/fgui/FGUtil";
|
|
import MsgAlert from "./game/msg/MsgAlert";
|
|
import GameModel from "./core/GameModel";
|
|
import SKLocalUtil from "./gear_2.3.4/util/SKLocalUtil";
|
|
import GameUtil from "./core/GameUtil";
|
|
import ItemUtil from "./core/ItemUtil";
|
|
import SKDataUtil from "./gear_2.3.4/util/SKDataUtil";
|
|
import FGHUD from "./gear_2.3.4/fgui/FGHUD";
|
|
import RechargeReward from "./rechargeReward/RechargeReward";
|
|
const { ccclass, property } = cc._decorator;
|
|
@ccclass
|
|
export default class Shop extends cc.Component {
|
|
/**
|
|
* 單例實例
|
|
*/
|
|
public static Instance : Shop = null;
|
|
|
|
/**
|
|
* 主面板
|
|
*/
|
|
mainPanel : fgui.GComponent = null;
|
|
|
|
/**
|
|
* 擺攤面板
|
|
*/
|
|
saleView : fgui.GComponent = null;
|
|
|
|
/**
|
|
* 多寶閣面板
|
|
*/
|
|
duobaoView : fgui.GComponent = null;
|
|
duobaoList : any = null;
|
|
duobaoType : number = 0;
|
|
/**
|
|
* 積分面板
|
|
*/
|
|
scoreView : fgui.GComponent = null;
|
|
scoreList : any = null;
|
|
scoreType : number = 3;
|
|
|
|
/**
|
|
* 充值面板
|
|
*/
|
|
rechargeView : fgui.GComponent = null;
|
|
|
|
/**
|
|
* 選擇的商品信息
|
|
*/
|
|
selectedGoodItemsInfo : any = null
|
|
|
|
prefabObject : any = {}
|
|
onLoad() {
|
|
if (Shop.Instance === null) {
|
|
Shop.Instance = this;
|
|
this.loadPrefab();
|
|
} else {
|
|
this.destroy();
|
|
return;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 加載預製體
|
|
*/
|
|
loadPrefab() {
|
|
// 加載所需的預製體
|
|
var prefabList = [
|
|
{ url: "Prefabs/ChargeWebUI", name: "ChargeWebUI" }
|
|
]
|
|
this.prefabObject = {}
|
|
for (let item of prefabList) {
|
|
cc.loader.loadRes(item.url, cc.Prefab, (err, prefab) => {
|
|
if (err)
|
|
console.warn(err);
|
|
else {
|
|
this.prefabObject[item.name] = prefab;
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
openShopMainPanel(openCharge : boolean = false) {
|
|
if (!SKUIUtil.isFGUIValid(this.mainPanel)) {
|
|
this.mainPanel = FGUtil.create("main_ui", "shop_panel");
|
|
FGUtil.root().addChild(this.mainPanel);
|
|
this.mainPanel.makeFullScreen();
|
|
}
|
|
|
|
FGUtil.getComponent(this.mainPanel, "mask").onClick(this.closeAll, this);
|
|
FGUtil.getButton(this.mainPanel, "alert/close").onClick(this.closeAll, this);
|
|
|
|
|
|
// 刷新頂部貨幣
|
|
this.refreshTopMoney();
|
|
|
|
// 頂部金幣組件動畫
|
|
// var trans: fgui.Transition = this.mainPanel.getTransition("drop");
|
|
// trans.play();
|
|
|
|
var shopView = FGUtil.getComponent(this.mainPanel, "alert")
|
|
FGUtil.getButton(shopView, "n36").onClick(this.openBaiTanView, this)
|
|
FGUtil.getButton(shopView, "n37").onClick(this.openDuoBaoView, this)
|
|
FGUtil.getButton(shopView, "n38").onClick(this.openJiFenView, this)
|
|
FGUtil.getButton(shopView, "n39").onClick(this.openChongZhiView, this)
|
|
|
|
if (!openCharge)
|
|
this.openDuoBaoView()
|
|
else
|
|
this.openChongZhiView();
|
|
}
|
|
|
|
|
|
/**
|
|
* 刷新頂部貨幣
|
|
*/
|
|
refreshTopMoney() {
|
|
if (!SKUIUtil.isFGUIValid(this.mainPanel)) return;
|
|
var topMoney = FGUtil.getComponent(this.mainPanel, "top_money");
|
|
FGUtil.getRichTextField(topMoney, "shigong/title").text = `[color=${GameUtil.getNumColorRich(GameModel.player.gameData.bangscore)}]${GameModel.player.gameData.bangscore}[/color]`;
|
|
FGUtil.getRichTextField(topMoney, "yinliang/title").text = `[color=${GameUtil.getNumColorRich(GameModel.player.gameData.money)}]${GameModel.player.gameData.money}[/color]`;
|
|
FGUtil.getRichTextField(topMoney, "xianyu/title").text = `[color=${GameUtil.getNumColorRich(GameModel.player.gameData.jade)}]${GameModel.player.gameData.jade}[/color]`;
|
|
FGUtil.getRichTextField(topMoney, "bangding/title").text = `[color=${GameUtil.getNumColorRich(GameModel.player.gameData.bindjade)}]${GameModel.player.gameData.bindjade}[/color]`;
|
|
FGUtil.getRichTextField(topMoney, "other/score").text = `[color=${GameUtil.getNumColorRich(GameModel.player.gameData.shuilugj)}]${GameModel.player.gameData.shuilugj}[/color]`;
|
|
}
|
|
|
|
openBaiTanView() {
|
|
MsgAlert.addMsg("暫未開放")
|
|
return
|
|
FGUtil.getControl(this.mainPanel, "alert/page").selectedIndex = 0
|
|
this.hideOther();
|
|
if (!SKUIUtil.isFGUIValid(this.saleView)) {
|
|
// 獲取主面板
|
|
var pView = FGUtil.getComponent(this.mainPanel, "alert/box");
|
|
this.saleView = FGUtil.create("main_ui", "view_set");
|
|
pView.addChild(this.saleView);
|
|
} else {
|
|
this.saleView.visible = true;
|
|
}
|
|
}
|
|
|
|
openDuoBaoView() {
|
|
FGUtil.getControl(this.mainPanel, "alert/page").selectedIndex = 1
|
|
// 頂部金幣組件動畫
|
|
var trans : fgui.Transition = this.mainPanel.getTransition("drop");
|
|
trans.play();
|
|
var topMoney = FGUtil.getComponent(this.mainPanel, "top_money");
|
|
FGUtil.getControl(topMoney, "shopOther").selectedIndex = 0;
|
|
|
|
this.hideOther();
|
|
if (!SKUIUtil.isFGUIValid(this.duobaoView)) {
|
|
// 獲取主面板
|
|
var pView = FGUtil.getComponent(this.mainPanel, "alert/box");
|
|
this.duobaoView = FGUtil.create("main_ui", "duobaogeBox");
|
|
pView.addChild(this.duobaoView);
|
|
|
|
GameModel.send("c2s_get_mall", {
|
|
roleid: GameModel.player.roleid
|
|
})
|
|
|
|
var list = FGUtil.getList(this.duobaoView, "list")
|
|
list.itemRenderer = this.initDuoBaoItem.bind(this);
|
|
list.setVirtual();
|
|
|
|
FGUtil.getButton(this.duobaoView, "n0").onClick(this.clickDuoBaoType0, this);
|
|
FGUtil.getButton(this.duobaoView, "n3").onClick(this.clickDuoBaoType1, this);
|
|
FGUtil.getButton(this.duobaoView, "n4").onClick(this.clickDuoBaoType2, this);
|
|
FGUtil.getButton(this.duobaoView, "n5").onClick(this.clickDuoBaoType3, this);
|
|
FGUtil.getButton(this.duobaoView, "n29").onClick(this.clickDuoBaoType4, this);
|
|
FGUtil.getButton(this.duobaoView, "n29").visible = false
|
|
FGUtil.getTextField(this.duobaoView, "des/des").fontSize = 20;
|
|
|
|
FGUtil.getButton(this.duobaoView, "numbg").onClick(this.showCalc_dbg, this);
|
|
FGUtil.getButton(this.duobaoView, "sub").onClick(this.reduceGoods_dbg, this);
|
|
FGUtil.getButton(this.duobaoView, "add").onClick(this.addGoods_dbg, this);
|
|
FGUtil.getButton(this.duobaoView, "buyBtn").onClick(this.buyGoods_dbg, this);
|
|
this.initCalcPad_dbg(FGUtil.getButton(this.duobaoView, "calc"));
|
|
} else {
|
|
this.duobaoView.visible = true;
|
|
}
|
|
}
|
|
|
|
buyGoods_dbg() {
|
|
var num = parseInt(FGUtil.getTextField(this.duobaoView, "num").text);
|
|
var price = parseInt(FGUtil.getButton(this.duobaoView, "buyBtn").title);
|
|
|
|
if (this.duobaoType < 4) {
|
|
let jade = GameModel.player.gameData.jade;
|
|
if (jade < price) {
|
|
FGHUD.hideLoading();
|
|
MsgAlert.addMsg(`您的仙玉不足!`);
|
|
return;
|
|
}
|
|
} else {
|
|
let jade = GameModel.player.gameData.bindjade;
|
|
if (jade < price) {
|
|
FGHUD.hideLoading();
|
|
MsgAlert.addMsg(`您的綁定仙玉不足!`);
|
|
return;
|
|
}
|
|
}
|
|
|
|
var typeNum;
|
|
if (this.duobaoType == 0)
|
|
typeNum = 3;
|
|
if (this.duobaoType == 1)
|
|
typeNum = 0;
|
|
if (this.duobaoType == 2)
|
|
typeNum = 1;
|
|
if (this.duobaoType == 3)
|
|
typeNum = 2;
|
|
if (this.duobaoType == 4)
|
|
typeNum = 5;
|
|
|
|
GameModel.send("c2s_buymall_items", {
|
|
type: typeNum,
|
|
mallid: this.selectedGoodItemsInfo.id,
|
|
mallnum: num,
|
|
mallprices: price
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 初始化多寶閣數據
|
|
* @param data
|
|
*/
|
|
initDuoBaoGeData(data) {
|
|
if (!this.duobaoList) this.duobaoList = []
|
|
|
|
this.duobaoList[0] = []
|
|
this.duobaoList[1] = []
|
|
this.duobaoList[2] = []
|
|
this.duobaoList[3] = []
|
|
this.duobaoList[4] = []
|
|
|
|
for (let key in data[3]) {
|
|
this.duobaoList[0].push(data[3][key])
|
|
}
|
|
|
|
for (let key in data[0]) {
|
|
this.duobaoList[1].push(data[0][key])
|
|
}
|
|
|
|
for (let key in data[1]) {
|
|
this.duobaoList[2].push(data[1][key])
|
|
}
|
|
|
|
for (let key in data[2]) {
|
|
this.duobaoList[3].push(data[2][key])
|
|
}
|
|
|
|
for (let key in data[4]) {
|
|
this.duobaoList[4].push(data[4][key])
|
|
}
|
|
|
|
if (this.duobaoType == 0)
|
|
Shop.Instance.clickDuoBaoType0();
|
|
else if (this.duobaoType == 1)
|
|
Shop.Instance.clickDuoBaoType1();
|
|
else if (this.duobaoType == 2)
|
|
Shop.Instance.clickDuoBaoType2();
|
|
else if (this.duobaoType == 3)
|
|
Shop.Instance.clickDuoBaoType3();
|
|
else if (this.duobaoType == 4)
|
|
Shop.Instance.clickDuoBaoType4();
|
|
}
|
|
|
|
/**
|
|
* 點擊多寶閣“多寶推薦”
|
|
* @returns
|
|
*/
|
|
clickDuoBaoType0() {
|
|
if (!SKUIUtil.isFGUIValid(this.duobaoView)) return;
|
|
FGUtil.getControl(this.duobaoView, "type").selectedIndex = 0;
|
|
this.duobaoType = 0;
|
|
|
|
let list = FGUtil.getList(this.duobaoView, "list");
|
|
list.numItems = this.duobaoList[this.duobaoType].length;
|
|
list.selectNone()
|
|
FGUtil.getControl(this.duobaoView, "choose").selectedIndex = 0;
|
|
}
|
|
|
|
/**
|
|
* 點擊多寶閣“新鮮玩意”
|
|
* @returns
|
|
*/
|
|
clickDuoBaoType1() {
|
|
if (!SKUIUtil.isFGUIValid(this.duobaoView)) return;
|
|
FGUtil.getControl(this.duobaoView, "type").selectedIndex = 1;
|
|
this.duobaoType = 1;
|
|
|
|
let list = FGUtil.getList(this.duobaoView, "list");
|
|
list.numItems = this.duobaoList[this.duobaoType].length;
|
|
list.selectNone()
|
|
FGUtil.getControl(this.duobaoView, "choose").selectedIndex = 0;
|
|
}
|
|
|
|
/**
|
|
* 點擊多寶閣“強化材料”
|
|
* @returns
|
|
*/
|
|
clickDuoBaoType2() {
|
|
if (!SKUIUtil.isFGUIValid(this.duobaoView)) return;
|
|
FGUtil.getControl(this.duobaoView, "type").selectedIndex = 2;
|
|
this.duobaoType = 2;
|
|
|
|
let list = FGUtil.getList(this.duobaoView, "list");
|
|
list.numItems = this.duobaoList[this.duobaoType].length;
|
|
list.selectNone()
|
|
FGUtil.getControl(this.duobaoView, "choose").selectedIndex = 0;
|
|
}
|
|
|
|
/**
|
|
* 點擊多寶閣“每日限購”
|
|
* @returns
|
|
*/
|
|
clickDuoBaoType3() {
|
|
if (!SKUIUtil.isFGUIValid(this.duobaoView)) return;
|
|
FGUtil.getControl(this.duobaoView, "type").selectedIndex = 3;
|
|
this.duobaoType = 3;
|
|
|
|
let list = FGUtil.getList(this.duobaoView, "list");
|
|
list.numItems = this.duobaoList[this.duobaoType].length;
|
|
list.selectNone()
|
|
FGUtil.getControl(this.duobaoView, "choose").selectedIndex = 0;
|
|
}
|
|
|
|
/**
|
|
* 點擊多寶閣“綁定商店”
|
|
* @returns
|
|
*/
|
|
clickDuoBaoType4() {
|
|
if (!SKUIUtil.isFGUIValid(this.duobaoView)) return;
|
|
FGUtil.getControl(this.duobaoView, "type").selectedIndex = 4;
|
|
this.duobaoType = 4;
|
|
|
|
let list = FGUtil.getList(this.duobaoView, "list");
|
|
list.numItems = this.duobaoList[this.duobaoType].length;
|
|
list.selectNone()
|
|
FGUtil.getControl(this.duobaoView, "choose").selectedIndex = 0;
|
|
}
|
|
|
|
/**
|
|
* 初始化多寶閣項目
|
|
*/
|
|
initDuoBaoItem(idx, obj : fairygui.GObject) {
|
|
var item = obj.asCom;
|
|
var info = this.duobaoList[this.duobaoType][idx];
|
|
var itemInfo = ItemUtil.getItemData(info.itemid);
|
|
|
|
if (itemInfo == null) return
|
|
|
|
FGUtil.getLoader(item, "icon").url = `ui://main_ui/${itemInfo.icon}`;
|
|
FGUtil.getLoader(item, "goldIcon").url = `ui://main_ui/9004`;
|
|
FGUtil.getTextField(item, "name").text = itemInfo.name;
|
|
FGUtil.getComponent(this.duobaoView, "n9").visible = true;
|
|
if (SKDataUtil.hasProperty(info, "discount") && info.discount != 0 && info.discount != null) {
|
|
FGUtil.getControl(item, "zhekou").selectedIndex = 1
|
|
var dis = (info.discount / 10);
|
|
var isSmallNum = (info.discount % 10) != 0
|
|
var realDis = "";
|
|
if (isSmallNum) {
|
|
realDis = dis.toFixed(1).toString().replace(".", "")
|
|
} else {
|
|
realDis = dis.toString()
|
|
}
|
|
FGUtil.getTextField(item, "n12").text = `${realDis}折`
|
|
FGUtil.getTextField(item, "n13").text = `原價:${info.price}`
|
|
FGUtil.getTextField(item, "price").text = `${info.discountPrice}`;
|
|
} else {
|
|
FGUtil.getControl(item, "zhekou").selectedIndex = 0
|
|
FGUtil.getTextField(item, "price").text = `${info.price}`;
|
|
}
|
|
|
|
if (SKDataUtil.hasProperty(info, "time") && info.time != 0) {
|
|
FGUtil.getControl(item, "limit").selectedIndex = 1
|
|
var num = info.time - info.count
|
|
num = num < 0 ? 0 : num
|
|
FGUtil.getTextField(item, "limit").text = `限購${num}`
|
|
} else
|
|
FGUtil.getControl(item, "limit").selectedIndex = 0
|
|
|
|
item.node["idx"] = idx;
|
|
item.onClick(this.clickDuoBaoItem, this);
|
|
}
|
|
|
|
/**
|
|
* 點擊多寶閣商品
|
|
* @param e
|
|
*/
|
|
clickDuoBaoItem(e : Event) {
|
|
var id = 0;
|
|
if (SKDataUtil.hasProperty(e.target, "idx"))
|
|
id = e.target["idx"];
|
|
var info = this.duobaoList[this.duobaoType][id];
|
|
FGUtil.getControl(this.duobaoView, "choose").selectedIndex = 1;
|
|
var itemData = ItemUtil.getItemData(info.itemid);
|
|
FGUtil.getComponent(this.duobaoView, "n9").visible = false;
|
|
FGUtil.getTextField(this.duobaoView, "name").text = itemData.name;
|
|
FGUtil.getTextField(this.duobaoView, "des/des").text = itemData.description;
|
|
this.selectedGoodItemsInfo = info;
|
|
FGUtil.getTextField(this.duobaoView, "num").text = "1";
|
|
var realPirce = info.discountPrice ? info.discountPrice : info.price
|
|
FGUtil.getButton(this.duobaoView, "buyBtn").title = realPirce.toString();
|
|
}
|
|
|
|
showCalc_dbg() {
|
|
FGUtil.getComponent(this.duobaoView, "calc").visible = true;
|
|
FGUtil.getTextField(this.duobaoView, "num").text = "";
|
|
var realPirce = this.selectedGoodItemsInfo.discountPrice ? this.selectedGoodItemsInfo.discountPrice : this.selectedGoodItemsInfo.price
|
|
FGUtil.getButton(this.duobaoView, "buyBtn").title = realPirce.toString();
|
|
}
|
|
|
|
initCalcPad_dbg(pad) {
|
|
for (let i = 0; i < 10; i++) {
|
|
FGUtil.getButton(pad, `n${i}`).clearClick();
|
|
FGUtil.getButton(pad, `n${i}`).onClick(() => {
|
|
// 在原基礎數字末尾添加數字
|
|
var numStr = FGUtil.getTextField(this.duobaoView, "num").text;
|
|
numStr += i;
|
|
var num = parseInt(numStr);
|
|
if (num >= 99999)
|
|
num = 99999
|
|
FGUtil.getTextField(this.duobaoView, "num").text = num.toString();
|
|
var realPirce = this.selectedGoodItemsInfo.discountPrice ? this.selectedGoodItemsInfo.discountPrice : this.selectedGoodItemsInfo.price
|
|
FGUtil.getButton(this.duobaoView, "buyBtn").title = (num * realPirce).toString();
|
|
})
|
|
}
|
|
|
|
FGUtil.getButton(pad, `n10`).clearClick();
|
|
FGUtil.getButton(pad, `n10`).onClick(() => {
|
|
FGUtil.getTextField(this.duobaoView, "num").text = "";
|
|
var realPirce = this.selectedGoodItemsInfo.discountPrice ? this.selectedGoodItemsInfo.discountPrice : this.selectedGoodItemsInfo.price
|
|
FGUtil.getButton(this.duobaoView, "buyBtn").title = (realPirce).toString();
|
|
})
|
|
FGUtil.getButton(pad, `n12`).clearClick();
|
|
FGUtil.getButton(pad, `n12`).onClick(() => {
|
|
FGUtil.getComponent(this.duobaoView, "calc").visible = false;
|
|
var numStr = FGUtil.getTextField(this.duobaoView, "num").text;
|
|
if (numStr == "") {
|
|
FGUtil.getTextField(this.duobaoView, "num").text = "1";
|
|
var realPirce = this.selectedGoodItemsInfo.discountPrice ? this.selectedGoodItemsInfo.discountPrice : this.selectedGoodItemsInfo.price
|
|
FGUtil.getButton(this.duobaoView, "buyBtn").title = (realPirce).toString();
|
|
}
|
|
})
|
|
FGUtil.getButton(pad, `mask`).clearClick();
|
|
FGUtil.getButton(pad, `mask`).onClick(() => {
|
|
FGUtil.getComponent(this.duobaoView, "calc").visible = false;
|
|
var numStr = FGUtil.getTextField(this.duobaoView, "num").text;
|
|
if (numStr == "") {
|
|
FGUtil.getTextField(this.duobaoView, "num").text = "1";
|
|
var realPirce = this.selectedGoodItemsInfo.discountPrice ? this.selectedGoodItemsInfo.discountPrice : this.selectedGoodItemsInfo.price
|
|
FGUtil.getButton(this.duobaoView, "buyBtn").title = (realPirce).toString();
|
|
}
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 減少商品數量
|
|
*/
|
|
reduceGoods_dbg() {
|
|
if (!SKUIUtil.isFGUIValid(this.duobaoView)) return
|
|
var num = parseInt(FGUtil.getTextField(this.duobaoView, "num").text);
|
|
if (num <= 1)
|
|
return
|
|
num--;
|
|
FGUtil.getTextField(this.duobaoView, "num").text = num.toString();
|
|
var realPirce = this.selectedGoodItemsInfo.discountPrice ? this.selectedGoodItemsInfo.discountPrice : this.selectedGoodItemsInfo.price
|
|
FGUtil.getButton(this.duobaoView, "buyBtn").title = (num * realPirce).toString();
|
|
}
|
|
/**
|
|
* 增加商品數量
|
|
*/
|
|
addGoods_dbg() {
|
|
if (!SKUIUtil.isFGUIValid(this.duobaoView)) return
|
|
var num = parseInt(FGUtil.getTextField(this.duobaoView, "num").text);
|
|
if (num >= 99999)
|
|
return
|
|
num++;
|
|
FGUtil.getTextField(this.duobaoView, "num").text = num.toString();
|
|
var realPirce = this.selectedGoodItemsInfo.discountPrice ? this.selectedGoodItemsInfo.discountPrice : this.selectedGoodItemsInfo.price
|
|
FGUtil.getButton(this.duobaoView, "buyBtn").title = (num * realPirce).toString();
|
|
}
|
|
|
|
openJiFenView() {
|
|
FGUtil.getControl(this.mainPanel, "alert/page").selectedIndex = 2;
|
|
this.hideOther();
|
|
|
|
// 頂部金幣組件動畫
|
|
var trans : fgui.Transition = this.mainPanel.getTransition("drop");
|
|
trans.play();
|
|
var topMoney = FGUtil.getComponent(this.mainPanel, "top_money");
|
|
FGUtil.getControl(topMoney, "shopOther").selectedIndex = 1;
|
|
|
|
if (!SKUIUtil.isFGUIValid(this.scoreView)) {
|
|
// 獲取主面板
|
|
var pView = FGUtil.getComponent(this.mainPanel, "alert/box");
|
|
this.scoreView = FGUtil.create("main_ui", "jifenBox");
|
|
pView.addChild(this.scoreView);
|
|
|
|
|
|
GameModel.send("c2s_integral_mall", {
|
|
roleid: GameModel.player.roleid
|
|
})
|
|
|
|
var list = FGUtil.getList(this.scoreView, "list")
|
|
list.itemRenderer = this.initJiFenItem.bind(this);
|
|
list.setVirtual();
|
|
|
|
FGUtil.getButton(this.scoreView, "n11").onClick(this.clickJiFenType0, this);
|
|
FGUtil.getButton(this.scoreView, "n12").onClick(this.clickJiFenType1, this);
|
|
FGUtil.getButton(this.scoreView, "n13").onClick(this.clickJiFenType2, this);
|
|
FGUtil.getButton(this.scoreView, "n14").onClick(this.clickJiFenType3, this);
|
|
FGUtil.getButton(this.scoreView, "n15").onClick(this.clickJiFenType4, this);
|
|
FGUtil.getButton(this.scoreView, "n16").onClick(this.clickJiFenType5, this);
|
|
FGUtil.getButton(this.scoreView, "n17").onClick(this.clickJiFenType6, this);
|
|
FGUtil.getButton(this.scoreView, "n18").onClick(this.clickJiFenType7, this);
|
|
FGUtil.getTextField(this.scoreView, "des/des").fontSize = 20;
|
|
|
|
FGUtil.getButton(this.scoreView, "numbg").onClick(this.showCalc_jf, this);
|
|
FGUtil.getButton(this.scoreView, "sub").onClick(this.reduceGoods_jf, this);
|
|
FGUtil.getButton(this.scoreView, "add").onClick(this.addGoods_jf, this);
|
|
FGUtil.getButton(this.scoreView, "buyBtn").onClick(this.buyGoods_jf, this);
|
|
this.initCalcPad_jf(FGUtil.getButton(this.scoreView, "calc"));
|
|
} else {
|
|
this.scoreView.visible = true;
|
|
}
|
|
}
|
|
|
|
buyGoods_jf() {
|
|
var num = parseInt(FGUtil.getTextField(this.scoreView, "num").text);
|
|
var price = parseInt(FGUtil.getButton(this.scoreView, "buyBtn").title);
|
|
|
|
GameModel.send("c2s_buymall_items", {
|
|
type: 4,
|
|
mallid: this.selectedGoodItemsInfo.id,
|
|
mallnum: num,
|
|
mallprices: price,
|
|
})
|
|
|
|
}
|
|
/**
|
|
* 初始化積分數據
|
|
* @param data
|
|
*/
|
|
initJiFenData(data) {
|
|
if (!this.scoreList) this.scoreList = []
|
|
|
|
this.scoreList[0] = []
|
|
this.scoreList[1] = []
|
|
this.scoreList[2] = []
|
|
this.scoreList[3] = []
|
|
this.scoreList[4] = []
|
|
this.scoreList[5] = []
|
|
this.scoreList[6] = []
|
|
this.scoreList[7] = []
|
|
|
|
for (let key in data) {
|
|
this.scoreList[data[key].item_kind - 1].push(data[key])
|
|
}
|
|
// for (let key in data[0]) {
|
|
// this.scoreList[0].push(data[0][key])
|
|
// }
|
|
|
|
// for (let key in data[1]) {
|
|
// this.scoreList[1].push(data[1][key])
|
|
// }
|
|
|
|
// for (let key in data[2]) {
|
|
// this.scoreList[2].push(data[2][key])
|
|
// }
|
|
|
|
// for (let key in data[3]) {
|
|
// this.scoreList[3].push(data[3][key])
|
|
// }
|
|
|
|
// for (let key in data[4]) {
|
|
// this.scoreList[4].push(data[4][key])
|
|
// }
|
|
|
|
// for (let key in data[5]) {
|
|
// this.scoreList[5].push(data[5][key])
|
|
// }
|
|
|
|
// for (let key in data[6]) {
|
|
// this.scoreList[6].push(data[6][key])
|
|
// }
|
|
|
|
// for (let key in data[7]) {
|
|
// this.scoreList[7].push(data[7][key])
|
|
// }
|
|
|
|
if (this.scoreType == 0)
|
|
Shop.Instance.clickJiFenType0();
|
|
else if (this.scoreType == 1)
|
|
Shop.Instance.clickJiFenType1();
|
|
else if (this.scoreType == 2)
|
|
Shop.Instance.clickJiFenType2();
|
|
else if (this.scoreType == 3)
|
|
Shop.Instance.clickJiFenType3();
|
|
else if (this.scoreType == 4)
|
|
Shop.Instance.clickJiFenType4();
|
|
else if (this.scoreType == 5)
|
|
Shop.Instance.clickJiFenType5();
|
|
else if (this.scoreType == 6)
|
|
Shop.Instance.clickJiFenType6();
|
|
else if (this.scoreType == 7)
|
|
Shop.Instance.clickJiFenType7();
|
|
}
|
|
|
|
/**
|
|
* 點擊積分“郭氏”
|
|
* @returns
|
|
*/
|
|
clickJiFenType0() {
|
|
MsgAlert.addMsg("暫未開放")
|
|
return;
|
|
if (!SKUIUtil.isFGUIValid(this.scoreView)) return;
|
|
FGUtil.getControl(this.scoreView, "type").selectedIndex = 0;
|
|
this.scoreType = 0;
|
|
|
|
let list = FGUtil.getList(this.scoreView, "list");
|
|
list.numItems = this.scoreList[this.scoreType].length;
|
|
list.selectNone()
|
|
FGUtil.getControl(this.scoreView, "choose").selectedIndex = 0;
|
|
FGUtil.getButton(this.scoreView, "buyBtn").icon = "ui://main_ui/ui_common_score_guo_shi"
|
|
}
|
|
|
|
/**
|
|
* 點擊積分“降魔”
|
|
* @returns
|
|
*/
|
|
clickJiFenType1() {
|
|
// MsgAlert.addMsg("暫未開放")
|
|
// return;
|
|
if (!SKUIUtil.isFGUIValid(this.scoreView)) return;
|
|
FGUtil.getControl(this.scoreView, "type").selectedIndex = 1;
|
|
this.scoreType = 1;
|
|
|
|
let list = FGUtil.getList(this.scoreView, "list");
|
|
list.numItems = this.scoreList[this.scoreType].length;
|
|
list.selectNone()
|
|
FGUtil.getControl(this.scoreView, "choose").selectedIndex = 0;
|
|
FGUtil.getButton(this.scoreView, "buyBtn").icon = "ui://main_ui/ui_common_score_xiangmo";
|
|
this.refreshTopMoneyByOther("ui://main_ui/ui_common_score_xiangmo", GameModel.player.gameData.xiuscore);
|
|
}
|
|
|
|
/**
|
|
* 點擊積分“大鬧”
|
|
* @returns
|
|
*/
|
|
clickJiFenType2() {
|
|
MsgAlert.addMsg("暫未開放")
|
|
return;
|
|
if (!SKUIUtil.isFGUIValid(this.scoreView)) return;
|
|
FGUtil.getControl(this.scoreView, "type").selectedIndex = 2;
|
|
this.scoreType = 2;
|
|
|
|
let list = FGUtil.getList(this.scoreView, "list");
|
|
list.numItems = this.scoreList[this.scoreType].length;
|
|
list.selectNone()
|
|
FGUtil.getControl(this.scoreView, "choose").selectedIndex = 0;
|
|
FGUtil.getButton(this.scoreView, "buyBtn").icon = "ui://main_ui/9004"
|
|
this.refreshTopMoneyByOther("ui://main_ui/ui_common_score_shuilu", GameModel.player.gameData.shuilugj)
|
|
}
|
|
|
|
/**
|
|
* 點擊積分“功績”
|
|
* @returns
|
|
*/
|
|
clickJiFenType3() {
|
|
if (!SKUIUtil.isFGUIValid(this.scoreView)) return;
|
|
FGUtil.getControl(this.scoreView, "type").selectedIndex = 3;
|
|
this.scoreType = 3;
|
|
|
|
let list = FGUtil.getList(this.scoreView, "list");
|
|
list.numItems = this.scoreList[this.scoreType].length;
|
|
list.selectNone()
|
|
FGUtil.getControl(this.scoreView, "choose").selectedIndex = 0;
|
|
FGUtil.getButton(this.scoreView, "buyBtn").icon = "ui://main_ui/ui_common_score_shuilu";
|
|
this.refreshTopMoneyByOther("ui://main_ui/ui_common_score_shuilu", GameModel.player.gameData.shuilugj);
|
|
}
|
|
|
|
/**
|
|
* 點擊積分“地宮”
|
|
* @returns
|
|
*/
|
|
clickJiFenType4() {
|
|
// MsgAlert.addMsg("暫未開放")
|
|
// return;
|
|
if (!SKUIUtil.isFGUIValid(this.scoreView)) return;
|
|
FGUtil.getControl(this.scoreView, "type").selectedIndex = 4;
|
|
this.scoreType = 4;
|
|
|
|
let list = FGUtil.getList(this.scoreView, "list");
|
|
list.numItems = this.scoreList[this.scoreType].length;
|
|
list.selectNone()
|
|
FGUtil.getControl(this.scoreView, "choose").selectedIndex = 0;
|
|
FGUtil.getButton(this.scoreView, "buyBtn").icon = "ui://main_ui/ui_common_score_underground";
|
|
this.refreshTopMoneyByOther("ui://main_ui/ui_common_score_underground", GameModel.player.gameData.discore);
|
|
}
|
|
|
|
/**
|
|
* 點擊積分“競技場”
|
|
* @returns
|
|
*/
|
|
clickJiFenType5() {
|
|
if (!SKUIUtil.isFGUIValid(this.scoreView)) return;
|
|
FGUtil.getControl(this.scoreView, "type").selectedIndex = 5;
|
|
this.scoreType = 5;
|
|
|
|
let list = FGUtil.getList(this.scoreView, "list");
|
|
list.numItems = this.scoreList[this.scoreType].length;
|
|
list.selectNone()
|
|
FGUtil.getControl(this.scoreView, "choose").selectedIndex = 0;
|
|
FGUtil.getButton(this.scoreView, "buyBtn").icon = "ui://main_ui/ui_common_score_arena"
|
|
this.refreshTopMoneyByOther("ui://main_ui/ui_common_score_arena", GameModel.player.gameData.jpoint)
|
|
}
|
|
|
|
/**
|
|
* 點擊積分“龍戰”
|
|
* @returns
|
|
*/
|
|
clickJiFenType6() {
|
|
MsgAlert.addMsg("暫未開放")
|
|
return;
|
|
if (!SKUIUtil.isFGUIValid(this.scoreView)) return;
|
|
FGUtil.getControl(this.scoreView, "type").selectedIndex = 6;
|
|
this.scoreType = 6;
|
|
|
|
let list = FGUtil.getList(this.scoreView, "list");
|
|
list.numItems = this.scoreList[this.scoreType].length;
|
|
list.selectNone()
|
|
FGUtil.getControl(this.scoreView, "choose").selectedIndex = 0;
|
|
FGUtil.getButton(this.scoreView, "buyBtn").icon = "ui://main_ui/9004"
|
|
}
|
|
|
|
/**
|
|
* 點擊積分“好心值”
|
|
* @returns
|
|
*/
|
|
clickJiFenType7() {
|
|
MsgAlert.addMsg("暫未開放")
|
|
return;
|
|
if (!SKUIUtil.isFGUIValid(this.scoreView)) return;
|
|
FGUtil.getControl(this.scoreView, "type").selectedIndex = 7;
|
|
this.scoreType = 7;
|
|
|
|
let list = FGUtil.getList(this.scoreView, "list");
|
|
list.numItems = this.scoreList[this.scoreType].length;
|
|
list.selectNone()
|
|
FGUtil.getControl(this.scoreView, "choose").selectedIndex = 0;
|
|
FGUtil.getButton(this.scoreView, "buyBtn").icon = "ui://main_ui/ui_common_score_chivalrous"
|
|
}
|
|
|
|
/**
|
|
* 刷新其他頂部貨幣
|
|
*/
|
|
refreshTopMoneyByOther(icon : string, num : number) {
|
|
if (!SKUIUtil.isFGUIValid(this.mainPanel)) return;
|
|
// 頂部金幣組件動畫
|
|
var trans : fgui.Transition = this.mainPanel.getTransition("drop");
|
|
trans.play();
|
|
|
|
var topMoney = FGUtil.getComponent(this.mainPanel, "top_money");
|
|
FGUtil.getControl(topMoney, "shopOther").selectedIndex = 1;
|
|
|
|
var otherItem = FGUtil.getButton(topMoney, "shopOther");
|
|
otherItem.icon = icon;
|
|
otherItem.title = `[color=${GameUtil.getNumColorRich(num)}]${num}[/color]`;
|
|
otherItem.node["score"] = num;
|
|
}
|
|
refreshTopMoneyByType() {
|
|
if (!SKUIUtil.isFGUIValid(this.mainPanel)) return;
|
|
var topMoney = FGUtil.getComponent(this.mainPanel, "top_money");
|
|
FGUtil.getControl(topMoney, "shopOther").selectedIndex = 1;
|
|
var otherItem = FGUtil.getButton(topMoney, "shopOther");
|
|
var num = 0;
|
|
if (this.scoreType == 1)
|
|
num = GameModel.player.gameData.xiuscore;
|
|
if (this.scoreType == 3)
|
|
num = GameModel.player.gameData.shuilugj;
|
|
if (this.scoreType == 4)
|
|
num = GameModel.player.gameData.discore;
|
|
if (this.scoreType == 5)
|
|
num = GameModel.player.gameData.jpoint;
|
|
otherItem.title = `[color=${GameUtil.getNumColorRich(num)}]${num}[/color]`;
|
|
}
|
|
/**
|
|
* 初始化積分項目
|
|
*/
|
|
initJiFenItem(idx, obj : fairygui.GObject) {
|
|
var item = obj.asCom;
|
|
var info = this.scoreList[this.scoreType][idx];
|
|
var itemInfo = ItemUtil.getItemData(info.itemid);
|
|
|
|
var iconArr = [
|
|
"ui_common_score_guo_shi",
|
|
"ui_common_score_xiangmo",
|
|
"9004",
|
|
"ui_common_score_shuilu",
|
|
"ui_common_score_underground",
|
|
"ui_common_score_arena",
|
|
"9004",
|
|
"ui_common_score_chivalrous",
|
|
];
|
|
FGUtil.getLoader(item, "icon").url = `ui://main_ui/${itemInfo.icon}`;
|
|
FGUtil.getLoader(item, "goldIcon").url = `ui://main_ui/${iconArr[this.scoreType]}`;
|
|
FGUtil.getTextField(item, "name").text = itemInfo.name;
|
|
FGUtil.getComponent(this.scoreView, "n9").visible = true;
|
|
if (SKDataUtil.hasProperty(info, "discount") && info.discount != 0 && info.discount != null) {
|
|
FGUtil.getControl(item, "zhekou").selectedIndex = 1
|
|
var dis = (info.discount / 10);
|
|
var isSmallNum = (info.discount % 10) != 0
|
|
var realDis = "";
|
|
if (isSmallNum) {
|
|
realDis = dis.toFixed(1).toString().replace(".", "")
|
|
} else {
|
|
realDis = dis.toString()
|
|
}
|
|
FGUtil.getTextField(item, "n12").text = `${realDis}折`
|
|
FGUtil.getTextField(item, "n13").text = `原價:${info.price}`
|
|
FGUtil.getTextField(item, "price").text = `${info.discountPrice}`;
|
|
} else {
|
|
FGUtil.getControl(item, "zhekou").selectedIndex = 0
|
|
FGUtil.getTextField(item, "price").text = `${info.price}`;
|
|
}
|
|
|
|
if (SKDataUtil.hasProperty(info, "time") && info.time != 0) {
|
|
FGUtil.getControl(item, "limit").selectedIndex = 1
|
|
var num = info.time - info.count
|
|
num = num < 0 ? 0 : num
|
|
FGUtil.getTextField(item, "limit").text = `限購${num}`
|
|
} else
|
|
FGUtil.getControl(item, "limit").selectedIndex = 0
|
|
|
|
item.node["idx"] = idx;
|
|
item.onClick(this.clickJiFenItem, this);
|
|
}
|
|
|
|
/**
|
|
* 點擊積分商品
|
|
* @param e
|
|
*/
|
|
clickJiFenItem(e : Event) {
|
|
var id = 0;
|
|
if (SKDataUtil.hasProperty(e.target, "idx"))
|
|
id = e.target["idx"];
|
|
var info = this.scoreList[this.scoreType][id];
|
|
FGUtil.getControl(this.scoreView, "choose").selectedIndex = 1;
|
|
var itemData = ItemUtil.getItemData(info.itemid);
|
|
FGUtil.getComponent(this.scoreView, "n9").visible = false;
|
|
FGUtil.getTextField(this.scoreView, "name").text = itemData.name;
|
|
FGUtil.getTextField(this.scoreView, "des/des").text = itemData.description;
|
|
this.selectedGoodItemsInfo = info;
|
|
FGUtil.getTextField(this.scoreView, "num").text = "1"
|
|
var realPirce = info.discountPrice ? info.discountPrice : info.price
|
|
FGUtil.getButton(this.scoreView, "buyBtn").title = realPirce.toString();
|
|
}
|
|
|
|
showCalc_jf() {
|
|
FGUtil.getComponent(this.scoreView, "calc").visible = true;
|
|
FGUtil.getTextField(this.scoreView, "num").text = "";
|
|
var realPirce = this.selectedGoodItemsInfo.discountPrice ? this.selectedGoodItemsInfo.discountPrice : this.selectedGoodItemsInfo.price
|
|
FGUtil.getButton(this.scoreView, "buyBtn").title = (realPirce).toString();
|
|
}
|
|
|
|
initCalcPad_jf(pad) {
|
|
for (let i = 0; i < 10; i++) {
|
|
FGUtil.getButton(pad, `n${i}`).clearClick();
|
|
FGUtil.getButton(pad, `n${i}`).onClick(() => {
|
|
// 在原基礎數字末尾添加數字
|
|
var numStr = FGUtil.getTextField(this.scoreView, "num").text;
|
|
numStr += i;
|
|
var num = parseInt(numStr);
|
|
if (num >= 99999)
|
|
num = 99999
|
|
FGUtil.getTextField(this.scoreView, "num").text = num.toString();
|
|
var realPirce = this.selectedGoodItemsInfo.discountPrice ? this.selectedGoodItemsInfo.discountPrice : this.selectedGoodItemsInfo.price
|
|
FGUtil.getButton(this.scoreView, "buyBtn").title = (num * realPirce).toString();
|
|
})
|
|
}
|
|
|
|
FGUtil.getButton(pad, `n10`).clearClick();
|
|
FGUtil.getButton(pad, `n10`).onClick(() => {
|
|
FGUtil.getTextField(this.scoreView, "num").text = "";
|
|
var realPirce = this.selectedGoodItemsInfo.discountPrice ? this.selectedGoodItemsInfo.discountPrice : this.selectedGoodItemsInfo.price
|
|
FGUtil.getButton(this.scoreView, "buyBtn").title = (realPirce).toString();
|
|
})
|
|
FGUtil.getButton(pad, `n12`).clearClick();
|
|
FGUtil.getButton(pad, `n12`).onClick(() => {
|
|
FGUtil.getComponent(this.scoreView, "calc").visible = false;
|
|
var numStr = FGUtil.getTextField(this.scoreView, "num").text;
|
|
if (numStr == "") {
|
|
FGUtil.getTextField(this.scoreView, "num").text = "1";
|
|
var realPirce = this.selectedGoodItemsInfo.discountPrice ? this.selectedGoodItemsInfo.discountPrice : this.selectedGoodItemsInfo.price
|
|
FGUtil.getButton(this.scoreView, "buyBtn").title = (realPirce).toString();
|
|
}
|
|
})
|
|
FGUtil.getButton(pad, `mask`).clearClick();
|
|
FGUtil.getButton(pad, `mask`).onClick(() => {
|
|
FGUtil.getComponent(this.scoreView, "calc").visible = false;
|
|
var numStr = FGUtil.getTextField(this.scoreView, "num").text;
|
|
if (numStr == "") {
|
|
FGUtil.getTextField(this.scoreView, "num").text = "1";
|
|
var realPirce = this.selectedGoodItemsInfo.discountPrice ? this.selectedGoodItemsInfo.discountPrice : this.selectedGoodItemsInfo.price
|
|
FGUtil.getButton(this.scoreView, "buyBtn").title = (realPirce).toString();
|
|
}
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 減少商品數量
|
|
*/
|
|
reduceGoods_jf() {
|
|
if (!SKUIUtil.isFGUIValid(this.scoreView)) return
|
|
var num = parseInt(FGUtil.getTextField(this.scoreView, "num").text);
|
|
if (num <= 1)
|
|
return
|
|
num--;
|
|
FGUtil.getTextField(this.scoreView, "num").text = num.toString();
|
|
var realPirce = this.selectedGoodItemsInfo.discountPrice ? this.selectedGoodItemsInfo.discountPrice : this.selectedGoodItemsInfo.price
|
|
FGUtil.getButton(this.scoreView, "buyBtn").title = (num * realPirce).toString();
|
|
}
|
|
/**
|
|
* 增加商品數量
|
|
*/
|
|
addGoods_jf() {
|
|
if (!SKUIUtil.isFGUIValid(this.scoreView)) return
|
|
var num = parseInt(FGUtil.getTextField(this.scoreView, "num").text);
|
|
if (num >= 99999)
|
|
return
|
|
num++;
|
|
FGUtil.getTextField(this.scoreView, "num").text = num.toString();
|
|
var realPirce = this.selectedGoodItemsInfo.discountPrice ? this.selectedGoodItemsInfo.discountPrice : this.selectedGoodItemsInfo.price
|
|
FGUtil.getButton(this.scoreView, "buyBtn").title = (num * realPirce).toString();
|
|
}
|
|
|
|
openChongZhiView() {
|
|
FGUtil.getControl(this.mainPanel, "alert/page").selectedIndex = 3
|
|
this.hideOther();
|
|
if (!SKUIUtil.isFGUIValid(this.rechargeView)) {
|
|
// 獲取主面板
|
|
var pView = FGUtil.getComponent(this.mainPanel, "alert/box");
|
|
this.rechargeView = FGUtil.create("main_ui", "chongzhiBox");
|
|
pView.addChild(this.rechargeView);
|
|
var chargeData = [
|
|
{
|
|
id: 1,
|
|
zeng: 30,
|
|
xianyu: 30000000,
|
|
price: 30,
|
|
},
|
|
{
|
|
id: 2,
|
|
zeng: 98,
|
|
xianyu: 98000000,
|
|
price: 98,
|
|
},
|
|
{
|
|
id: 3,
|
|
zeng: 198,
|
|
xianyu: 198000000,
|
|
price: 198,
|
|
},
|
|
{
|
|
id: 4,
|
|
zeng: 328,
|
|
xianyu: 328000000,
|
|
price: 328,
|
|
},
|
|
{
|
|
id: 5,
|
|
zeng: 648,
|
|
xianyu: 648000000,
|
|
price: 648,
|
|
},
|
|
{
|
|
id: 6,
|
|
zeng: 998,
|
|
xianyu: 998000000,
|
|
price: 998,
|
|
}
|
|
]
|
|
for (let i = 0; i < 6; i++) {
|
|
let item = FGUtil.getComponent(this.rechargeView, `n${i}`);
|
|
FGUtil.getTextField(item, "zeng").text = chargeData[i].zeng.toString()
|
|
FGUtil.getTextField(item, "zeng").font = "xiuweiNum"
|
|
FGUtil.getTextField(item, "xianyu").text = chargeData[i].xianyu.toString()
|
|
FGUtil.getTextField(item, "xianyu").font = "mallNo"
|
|
FGUtil.getTextField(item, "price").text = chargeData[i].price.toString()
|
|
item.node["info"] = chargeData[i]
|
|
item.onClick(this.clickChargeItem, this);
|
|
}
|
|
// FGUtil.getButton(this.rechargeView, "n7").onClick(this.openChargeReward, this);
|
|
FGUtil.getButton(this.rechargeView, "n7").visible = false
|
|
} else {
|
|
this.rechargeView.visible = true;
|
|
}
|
|
}
|
|
openChargeReward() {
|
|
RechargeReward.Instance.openRewardPanel3();
|
|
}
|
|
hideOther() {
|
|
if (!SKUIUtil.isFGUIValid(this.mainPanel))
|
|
return;
|
|
|
|
var pView = FGUtil.getComponent(this.mainPanel, "alert/box");
|
|
for (let i = 0; i < pView._children.length; i++) {
|
|
var item = pView.getChildAt(i);
|
|
item.visible = false
|
|
}
|
|
}
|
|
|
|
closeAll() {
|
|
this.closeView(this.saleView)
|
|
this.closeView(this.duobaoView)
|
|
this.closeView(this.scoreView)
|
|
this.closeView(this.rechargeView)
|
|
this.closeView(this.mainPanel)
|
|
}
|
|
|
|
closeView(view) {
|
|
if (view) {
|
|
FGUtil.dispose(view);
|
|
view = null;
|
|
}
|
|
}
|
|
|
|
|
|
clickChargeItem(e : Event) {
|
|
if (!GameUtil.hasCharge) {
|
|
MsgAlert.addMsg("暫未開通線上充值,請聯繫管理!")
|
|
return;
|
|
}
|
|
if (!SKDataUtil.hasProperty(e.target, "info")) {
|
|
MsgAlert.addMsg("未獲取到充值數據")
|
|
return;
|
|
}
|
|
var data = e.target["info"]
|
|
if (data) {
|
|
let send_data = {
|
|
roleid: GameModel.player.roleid,
|
|
goodsid: data.id,
|
|
goodscount: 1,
|
|
money: data.price,
|
|
};
|
|
if (!this.prefabObject["ChargeWebUI"]) {
|
|
MsgAlert.addMsg("未找到資源!")
|
|
return
|
|
}
|
|
let node = cc.instantiate(this.prefabObject["ChargeWebUI"]);
|
|
node.name = "ChargeWebUI";
|
|
node.parent = this.mainPanel.node;
|
|
let webUI = node.getComponent('ChargeWebUI');
|
|
if (webUI) {
|
|
webUI.setData(send_data);
|
|
}
|
|
}
|
|
}
|
|
|
|
} |