// --------------------------------------------------------------------
|
// @author: xxx@syg.com(必填, 创建模块的人员)
|
// @description:
|
// 活动主界面
|
// <br/>Create: 2019-05-06 14:33:44
|
// --------------------------------------------------------------------
|
var PathTool = require("pathtool");
|
var ActivityEvent = require("activity_event");
|
|
var ActivityWindow = cc.Class({
|
extends: BaseView,
|
ctor: function () {
|
this.prefabPath = PathTool.getPrefabPath("activity", "activity_window");
|
this.viewTag = SCENE_TAG.ui; //该窗体所属ui层级,全屏ui需要在ui层,非全屏ui在dialogue层,这个要注意
|
this.win_type = WinType.Full; //是否是全屏窗体 WinType.Full, WinType.Big, WinType.Mini, WinType.Tips
|
this.ctrl = arguments[0];
|
this.model = this.ctrl.getModel();
|
},
|
|
// 初始化一些配置数据,可以用于声明一些变量之类的
|
initConfig:function(){
|
|
},
|
|
// 预制体加载完成之后的回调,可以在这里捕获相关节点或者组件
|
openCallBack:function(){
|
this._main_container = this.root_wnd.getChildByName("main_container");
|
this._scoreView = this._main_container.getChildByName("scoreView");
|
var scroll_view_size = this._scoreView.getContentSize();
|
|
var ActivityItem = require("activity_item_panel");
|
var setting = {
|
item_class: ActivityItem, // 单元类
|
start_x: 7.5, // 第一个单元的X起点
|
space_x: 6, // x方向的间隔
|
start_y: 3, // 第一个单元的Y起点
|
space_y: 0, // y方向的间隔
|
item_width: 605, // 单元的尺寸width
|
item_height: 165, // 单元的尺寸height
|
row: 0, // 行数,作用于水平滚动类型
|
col: 1, // 列数,作用于垂直滚动类型
|
delay: 2
|
}
|
var CommonScrollView = require("common_scrollview");
|
this.itemScrollview = new CommonScrollView();
|
this.itemScrollview.createScroll(this._scoreView, cc.v2(0,0) , ScrollViewDir.vertical, ScrollViewStartPos.top, scroll_view_size, setting);
|
},
|
|
// 注册事件监听的接口,不需要手动调用,如果是使用gcore.GlobalEvent监听,可以直接调用addGlobalEvent
|
registerEvent:function(){
|
this.addGlobalEvent(ActivityEvent.EscortCount,function(){
|
if(this.itemScrollview){
|
var item_list = this.itemScrollview.getItemList();
|
if(item_list){
|
for(var i in item_list){
|
item_list[i].changeEscortCount();
|
}
|
}
|
}
|
}.bind(this));
|
|
this.addGlobalEvent(EventId.UPDATE_ROLE_ATTRIBUTE,function(key, value){
|
if(key == "lev"){
|
if(this.itemScrollview && Utils.next(this.dataInfo) != null){
|
this.itemScrollview.setData(this.dataInfo);
|
}
|
}
|
}.bind(this));
|
},
|
|
// 预制体加载完成之后,添加到对应主节点之后的回调,也就是一个窗体的正式入口,可以设置一些数据了
|
openRootWnd:function(params){
|
|
},
|
|
updateItemListRedStatus:function(){
|
var item_list = this.itemScrollview.getItemList();
|
if(item_list){
|
for(var i in item_list){
|
item_list[i].updateRedStatus();
|
}
|
}
|
},
|
|
// 关闭窗体回调,需要在这里调用该窗体所属controller的close方法没用于置空该窗体实例对象
|
closeCallBack:function(){
|
this.build_vo = null;
|
|
if (this.itemScrollview){
|
this.itemScrollview.deleteMe();
|
this.itemScrollview = null;
|
}
|
|
this.ctrl.openActivityView(false)
|
},
|
})
|