| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- /**
- * 租赁
- */
- import gameToast from "../Network/gameToast"
- cc.Class({
- extends: cc.Component,
- properties: {
- inputInviteValue: {
- default: '',
- visible: false
- },
- ToastParent: {
- default: null,
- type: cc.Node,
- serializable: true
- },
- //输入节点
- inputContainer: {
- default: null,
- type: cc.Node,
- serializable: true
- }
- },
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {},
- start() {
- },
- onOpenInfo() {
- this.node.active = true;
- },
- //初始化时候需要初始化一次默认值
- onToggleInput(value, evnentData) {
- console.log(value.isChecked, evnentData);
- },
- inputLeaseValue(value, e) {
- var numberTemp = new RegExp("^[A-Za-z0-9]+$");
- if (numberTemp.test(value)) {
- this.inputInviteValue = Number(value);
- console.log(this.inputInviteValue);
- } else {
- this.inputInviteValue = '';
- this.inputContainer.getComponent(cc.EditBox).string = this.inputInviteValue;
- console.log("请输入整数的倍数",this.inputInviteValue);
- // gameToast.getInstance().show(this.ToastParent, "请输入整数的倍数", 2, () => {
- // console.log("finish toast!");
- // }, this);
- }
- },
- onLeaseInfo() {
- console.log('inputInviteValue:' + this.inputInviteValue);
- if (!GlobalD.dapp) {
- console.error("onBindInviteInfo warn,dapp未初始化!");
- return;
- }
- let _self = this;
- // GlobalD.dapp.bindParent(_self.inputInviteValue).then((data) => {
- // if (data.err === null) {
- // // 返回成功,见下面消息体
- // console.log(data.res)
- // //绑定成功时候,隐藏输入框,设置父节点
- // GlobalD.Dapp.UserInfo.parent = data.res;
- // _self.parentInviteValue.string = GlobalD.Dapp.UserInfo.parent.invite_code;
- // //如果存在父节点,隐藏输入框
- // _self.inputContainer.active = false;
- // gameToast.getInstance().show(_self.ToastParent, "绑定成功!", 3, () => {
- // console.log("finish toast!");
- // }, _self);
- // } else {
- // //TODO 服务错误
- // console.log(data.err)
- // gameToast.getInstance().show(_self.ToastParent, "绑定失败!", 3, () => {
- // console.log("finish toast!");
- // }, _self);
- // }
- // })
- },
- onClose() {
- this.node.active = false;
- }
- });
|