// -------------------------------------------------------------------- // @author: shiraho@syg.com(必填, 创建模块的人员) // @description: // 通用提示框 //
Create: new Date().toISOString() // -------------------------------------------------------------------- var PathTool = require("pathtool"); var CommonAlertWin = cc.Class({ extends: BaseView, ctor:function(){ this.prefabPath = PathTool.getPrefabPath("common", "common_alert"); this.viewTag = arguments[0] || SCENE_TAG.dialogue; }, openCallBack: function () { this.main_panel = this.root_wnd.getChildByName("main_panel"); this.background = this.seekChild("background"); this.background.scale = FIT_SCALE; this.ok_btn = this.main_panel.getChildByName("ok_btn").getComponent(cc.Button); this.ok_btn_lb = this.seekChild("ok_txt", cc.Label); this.ok_btn_lo = this.seekChild("ok_txt", cc.LabelOutline); this.cancel_btn = this.main_panel.getChildByName("cancel_btn"); this.cancel_btn_lb = this.seekChild("cancel_txt", cc.Label); this.close_btn = this.main_panel.getChildByName("close_btn"); this.title_lb = this.seekChild("title_label",cc.Label) this.aler_des_rt = this.seekChild("aler_des", cc.RichText); this.click_jump_rt = this.seekChild("jumpBtn",cc.RichText) this.ok_btn.node.on("click", this.didClickOkBtn, this); this.cancel_btn.on("click", this.didClickCancleBtn, this); }, registerEvent: function () { this.close_btn.on(cc.Node.EventType.TOUCH_END, (function (event) { if(this.close_callback){ this.close_callback(); } Utils.playButtonSound(2) this.close(); }).bind(this)) }, openRootWnd: function(params) { this.aler_des_rt.string = params.str; var resArr = []; if(params.other_args && params.other_args.resArr){ resArr = params.other_args.resArr; } if(resArr && resArr.length>0){ for(let i=0;i 0){ this.ok_btn_lo.color = new cc.Color(125,125,125) self.ok_btn_lb.string = params.confirm_label + "(" + s + ")"; this.ok_btn.schedule(function(){ s-- if(s <= 0){ self.ok_btn_lo.color = new cc.Color(106,43,0); self.ok_btn.unscheduleAllCallbacks(); self.ok_btn.interactable = true; self.ok_btn.enableAutoGrayEffect = false; self.ok_btn_lb.string = params.confirm_label; }else{ self.ok_btn_lb.string = params.confirm_label + "(" + s + ")"; } },1) } } }, closeCallBack: function () { this.ok_btn.unscheduleAllCallbacks(); }, didClickOkBtn: function() { Utils.playButtonSound(1) this.close(); if (this.confirm_callback) this.confirm_callback(); }, didClickCancleBtn: function() { Utils.playButtonSound(1) this.close(); if (this.cancel_callback) this.cancel_callback(); }, }); module.exports = CommonAlertWin;