65 lines
1.4 KiB
JavaScript
65 lines
1.4 KiB
JavaScript
import GameModel from "../ts/core/GameModel";
|
|
import MsgAlert from "../ts/game/msg/MsgAlert";
|
|
|
|
let CPubFunction = require('./PubFunction');
|
|
cc.Class({
|
|
extends: cc.Component,
|
|
|
|
properties: {
|
|
editbox_xianyu: cc.EditBox,
|
|
editbox_num: cc.EditBox,
|
|
curNum: cc.Label,
|
|
|
|
},
|
|
|
|
// onLoad () {},
|
|
|
|
start() {
|
|
this.curNum.string = GameModel.player.gameData.jade;
|
|
},
|
|
|
|
// update (dt) {},
|
|
|
|
|
|
|
|
onSendBtnClick() {
|
|
let nodeCan = cc.find('Canvas');
|
|
let yuNumStr = this.editbox_xianyu.string;
|
|
let numStr = this.editbox_num.string;
|
|
//提示玩家的操作信息
|
|
if (yuNumStr < 1000) {
|
|
MsgAlert.addMsg('紅包要低於1000仙玉');
|
|
return;
|
|
}
|
|
if (numStr < 50 || numStr > 200) {
|
|
MsgAlert.addMsg('紅包數量請在50~200之間');
|
|
return;
|
|
}
|
|
GameModel.send('c2s_world_reward', {
|
|
roleid: GameModel.player.roleid,
|
|
yuNum: yuNumStr,
|
|
num: numStr
|
|
});
|
|
// let msgStr = '我發了一個大大滴紅包,快來搶。 '
|
|
// //聊天框提示
|
|
// GameModel.send('c2s_game_chat', {
|
|
// roleid: GameModel.player.roleid,
|
|
// onlyid: GameModel.player.onlyid,
|
|
// scale: 0,
|
|
// msg: msgStr,
|
|
// name: GameModel.player.name,
|
|
// resid: GameModel.player.resid,
|
|
// });
|
|
|
|
|
|
this.node.destroy();
|
|
},
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|