// --------------------------------------------------------------------
// @author: xxx@syg.com(必填, 创建模块的人员)
// @description:
// 这里填写详细说明,主要填写该模块的功能简要
//
Create: 2019-05-16 17:20:08
// --------------------------------------------------------------------
var VedioEvent = require("vedio_event")
var VedioConst = require("vedio_const")
var VedioController = cc.Class({
extends: BaseController,
ctor: function () {
},
// 初始化配置数据
initConfig: function () {
var VedioModel = require("vedio_model");
this.model = new VedioModel();
this.model.initConfig();
},
// 返回当前的model
getModel: function () {
return this.model;
},
// 注册监听事件
registerEvents: function () {
},
// 注册协议接受事件
registerProtocals: function () {
// this.RegisterProtocal(1110, this.on1110);
this.RegisterProtocal(19901,this.handle19901.bind(this)) //个人录像数据返回
this.RegisterProtocal(19902,this.handle19902.bind(this)) //录像大厅数据返回
this.RegisterProtocal(19903,this.handle19903.bind(this)) //点赞返回
this.RegisterProtocal(19904,this.handle19904.bind(this)) //收藏返回
this.RegisterProtocal(19905,this.handle19905.bind(this)) //分享返回
this.RegisterProtocal(19906,this.handle19906.bind(this)) //今日点赞数
this.RegisterProtocal(19907,this.handle19907.bind(this)) //伙伴信息数据
this.RegisterProtocal(19908,this.handle19908.bind(this)) //查看分享录像
},
handle19901(data){
if(data){
if(data.type == VedioConst.MyVedio_Type.Myself){
gcore.GlobalEvent.fire(VedioEvent.UpdateMyselfVedioEvent, data.replay_list)
}else if(data.type == VedioConst.MyVedio_Type.Collect){
gcore.GlobalEvent.fire(VedioEvent.UpdateCollectVedioEvent, data.replay_list)
}
}
},
handle19902(data){
if(data){
this.model.setPublicVedioData(data)
gcore.GlobalEvent.fire(VedioEvent.UpdatePublicVedioEvent, data.type)
}
},
handle19903(data){
message(data.msg)
if(data.code == 1){
gcore.GlobalEvent.fire(VedioEvent.CLICK_Like_Vedio_EVENT)
}
},
handle19904(data){
message(data.msg)
if(data.code == 1 && data.type == 1){ //-- 收藏成功
let new_data = this.model.updateVedioData(this.vedioType_flag, data.id, "is_collect", 1)
gcore.GlobalEvent.fire(VedioEvent.UpdateVedioDataEvent, new_data)
gcore.GlobalEvent.fire(VedioEvent.CollectSuccessVedioEvent, data.id)
}
if(data.type == 0){
gcore.GlobalEvent.fire(VedioEvent.CancelCollectVedioEvent, data.id)
}
},
handle19905(data){
message(data.msg)
},
handle19906(data){
if(data.like != null){
this.model.setTodayLikeNum(data.like)
gcore.GlobalEvent.fire(VedioEvent.UpdateTodayLikeNum)
}
},
handle19907(data){
if(data){
let config = Config.partner_data.data_partner_base[data.bid]
let camp_type = 1
if(config){
camp_type = config.camp_type
}
data.camp_type = camp_type
data.ext_data = data.ext
data.name = config.name
for(let i=0;i