// --------------------------------------------------------------------
// @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_input_alert");
this.viewTag = 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");
this.ok_label = this.ok_btn.getChildByName("label").getComponent(cc.Label);
this.cancel_btn = this.main_panel.getChildByName("cancel_btn");
this.cancel_label = this.cancel_btn.getChildByName("label").getComponent(cc.Label);
this.close_btn = this.main_panel.getChildByName("close_btn");
this.input = this.main_panel.getChildByName("editbox").getComponent(cc.EditBox);
this.place_label = this.main_panel.getChildByName("editbox").getChildByName("PLACEHOLDER_LABEL").getComponent(cc.Label);
this.input_desc = this.main_panel.getChildByName("input_label").getComponent(cc.Label);
this.msg = this.main_panel.getChildByName("msg").getComponent(cc.RichText);
this.gold_sp = this.seekChild(this.main_panel,"gold",cc.Sprite);
if(this.gold_res!=null){
this.setGoldImg(this.gold_res,this.gold_pos)
}
},
registerEvent: function () {
},
openRootWnd: function(data){
// var data = { input_desc: input_desc, desc_str:desc_str, placeholder_str:placeholder_str, confirm_label: confirm_label, confirm_callback: confirm_callback, cancel_label: cancel_label, cancel_callback: cancel_callback, close:close, close_callback: close_callback, other_args: other_args};
this.input_desc.string = data.input_desc || "";
this.msg.string = data.desc_str || "";
this.place_label.string = data.placeholder_str || "";
this.ok_label.string = data.confirm_label || Utils.TI18N("确认");
this.cancel_label.string = data.cancel_label || Utils.TI18N("取消");
if(data.other_args && data.other_args.maxLength){
this.input.maxLength = data.other_args.maxLength;
}
var resArr = [];
if(data.other_args && data.other_args.resArr){
resArr = data.other_args.resArr;
}
if(resArr && resArr.length>0){
for(let i=0;i