// --------------------------------------------------------------------
// @author: xxx@syg.com(必填, 创建模块的人员)
// @description:
// 这里是描述这个窗体的作用的
//
Create: 2019-03-11 14:17:34
// --------------------------------------------------------------------
var PathTool = require("pathtool");
var BrowseWindow = cc.Class({
extends: BaseView,
ctor: function () {
this.prefabPath = PathTool.getPrefabPath("heroexpedit", "browse_reward_panel");
this.viewTag = SCENE_TAG.dialogue; //该窗体所属ui层级,全屏ui需要在ui层,非全屏ui在dialogue层,这个要注意
this.win_type = WinType.Tips; //是否是全屏窗体 WinType.Full, WinType.Big, WinType.Mini, WinType.Tips
this.ctrl = arguments[0];
this.model = this.ctrl.getModel();
},
// 初始化一些配置数据,可以用于声明一些变量之类的
initConfig:function(){
this.reward_list = [];
},
// 预制体加载完成之后的回调,可以在这里捕获相关节点或者组件
openCallBack:function(){
this.background = this.root_wnd.getChildByName("background");
this.background.scale = FIT_SCALE;
var main_container = this.root_wnd.getChildByName("main_container");
var text_32 = main_container.getChildByName("Image_33").getChildByName("Text_32").getComponent(cc.Label);
text_32.string = Utils.TI18N("奖励预览");
this.btn_con = main_container.getChildByName("btn_con");
var text_33 = this.btn_con.getChildByName("Text_33").getComponent(cc.Label);
text_33.string = Utils.TI18N("确认");
this.good_con = main_container.getChildByName("good_con");
},
// 注册事件监听的接口,不需要手动调用,如果是使用gcore.GlobalEvent监听,可以直接调用addGlobalEvent
registerEvent:function(){
Utils.onTouchEnd(this.background, function () {
this.ctrl.openBrowsePanelView(false);
}.bind(this), 2);
Utils.onTouchEnd(this.btn_con, function () {
this.ctrl.openBrowsePanelView(false);
}.bind(this), 1);
},
// 预制体加载完成之后,添加到对应主节点之后的回调,也就是一个窗体的正式入口,可以设置一些数据了
openRootWnd:function(data){
if(!data)return;
// 关卡奖励
var data_reward = null;
if(data.rewards){
data_reward = data.rewards;
}
if(data_reward){
var num = data_reward.length;
var pos = [];
if(num == 2){
pos = [166,423];
}else{
pos = [166,296,423];
}
for(var i = 0;i