"use strict";
|
cc._RF.push(module, '8a1fduex61JA4dhgxDGB8wC', 'time_summon_preview_window');
|
// Scripts/mod/timesummon/view/time_summon_preview_window.js
|
|
"use strict";
|
|
// --------------------------------------------------------------------
|
// @author: xxx@syg.com(必填, 创建模块的人员)
|
// @description:
|
// 这里是描述这个窗体的作用的
|
// <br/>Create: 2019-08-08 19:40:21
|
// --------------------------------------------------------------------
|
var PathTool = require("pathtool");
|
|
var CommonScrollView = require("common_scrollview");
|
|
var TimeSummonPreviewWindow = cc.Class({
|
"extends": BaseView,
|
ctor: function ctor() {
|
this.prefabPath = PathTool.getPrefabPath("seerpalace", "seerpalace_preview_window");
|
this.viewTag = SCENE_TAG.dialogue; //该窗体所属ui层级,全屏ui需要在ui层,非全屏ui在dialogue层,这个要注意
|
|
this.win_type = WinType.Mini; //是否是全屏窗体 WinType.Full, WinType.Big, WinType.Mini, WinType.Tips
|
|
this.is_full_screen = false;
|
this.ctrl = arguments[0];
|
},
|
// 初始化一些配置数据,可以用于声明一些变量之类的
|
initConfig: function initConfig() {},
|
// 预制体加载完成之后的回调,可以在这里捕获相关节点或者组件
|
openCallBack: function openCallBack() {
|
var self = this;
|
self.background = this.root_wnd.getChildByName("background");
|
var container = self.root_wnd.getChildByName("container");
|
self.container = container;
|
var win_title = container.getChildByName("win_title").getComponent(cc.Label);
|
win_title.string = Utils.TI18N("奖励预览");
|
var list_panel = container.getChildByName("list_panel");
|
self.viewContent = this.seekChild("content");
|
list_panel.active = false;
|
this.scroll_view_size = list_panel.getContentSize();
|
var setting = {
|
item_class: "backpack_item",
|
start_x: 30,
|
// 第一个单元的X起点
|
space_x: 30,
|
// x方向的间隔
|
start_y: 8,
|
// 第一个单元的Y起点
|
space_y: 28,
|
// y方向的间隔
|
item_width: BackPackItem.Width * 0.9,
|
// 单元的尺寸width
|
item_height: BackPackItem.Height * 0.9,
|
// 单元的尺寸height
|
row: 0,
|
// 行数,作用于水平滚动类型
|
col: 4,
|
// 列数,作用于垂直滚动类
|
need_dynamic: true,
|
bottom: 20,
|
scale: 0.9,
|
//缩放
|
is_hide_effect: true
|
};
|
this.item_scrollview = new CommonScrollView();
|
var size = list_panel.getContentSize();
|
var pos = list_panel.getPosition();
|
this.item_scrollview.createScroll(container, pos, ScrollViewDir.vertical, ScrollViewStartPos.top, size, setting, cc.v2(0, 0));
|
},
|
// 注册事件监听的接口,不需要手动调用,如果是使用gcore.GlobalEvent监听,可以直接调用addGlobalEvent
|
registerEvent: function registerEvent() {
|
this.background.on("touchend", this._onClickBtnClose, this);
|
},
|
setData: function setData(data) {
|
var index = data.index;
|
var bool = data.bool;
|
var show_data = {};
|
|
if (bool) {
|
show_data = Config.recruit_holiday_elite_data.data_hero_show[index];
|
} else {
|
show_data = Config.recruit_holiday_data.data_hero_show[index];
|
} // if(index == 1){
|
// show_data = Config.recruit_high_data.data_hero_show
|
// }else{
|
// show_data = Config.recruit_holiday_elite_data.data_hero_show[index]
|
// }
|
|
|
if (show_data) {
|
var hero_tab = [];
|
|
for (var i = 0; i < show_data.length; ++i) {
|
hero_tab.push(show_data[i]);
|
}
|
|
hero_tab.sort(function (a, b) {
|
return a.id - b.id;
|
});
|
this.item_scrollview.setData(hero_tab, function (item) {
|
var TipsController = require("tips_controller");
|
|
TipsController.getInstance().showGoodsTips(Utils.getItemConfig(item.data.id));
|
}, {
|
scale: 0.9,
|
isSummonNumber: true
|
});
|
}
|
},
|
// 预制体加载完成之后,添加到对应主节点之后的回调,也就是一个窗体的正式入口,可以设置一些数据了
|
openRootWnd: function openRootWnd(params) {
|
this.setData(params);
|
},
|
_onClickBtnClose: function _onClickBtnClose() {
|
Utils.playButtonSound(2);
|
this.ctrl.openTimeSummonpreviewWindow(false);
|
},
|
// 关闭窗体回调,需要在这里调用该窗体所属controller的close方法没用于置空该窗体实例对象
|
closeCallBack: function closeCallBack() {
|
if (this.item_scrollview) {
|
this.item_scrollview.deleteMe();
|
this.item_scrollview = null;
|
}
|
|
this.ctrl.openTimeSummonpreviewWindow(false);
|
}
|
});
|
|
cc._RF.pop();
|