"use strict";
|
cc._RF.push(module, '3233cqURXpAKa0bpEoK/Loq', 'action_controller');
|
// Scripts/mod/action/action_controller.js
|
|
"use strict";
|
|
// --------------------------------------------------------------------
|
// @author: xxx@syg.com(必填, 创建模块的人员)
|
// @description:
|
// 这里填写详细说明,主要填写该模块的功能简要
|
// <br/>Create: 2019-03-02 16:49:03
|
// --------------------------------------------------------------------
|
var ActionConst = require("action_const");
|
|
var MainuiController = require("mainui_controller");
|
|
var MainuiConst = require("mainui_const");
|
|
var ActionEvent = require("action_event");
|
|
var RoleController = require("role_controller");
|
|
var WelfareController = require("welfare_controller");
|
|
var OrderactionConst = require("orderaction_const");
|
|
var ActionController = cc.Class({
|
"extends": BaseController,
|
ctor: function ctor() {},
|
// 初始化配置数据
|
initConfig: function initConfig() {
|
var ActionModel = require("action_model");
|
|
this.model = new ActionModel();
|
this.model.initConfig();
|
this.mainui_ctrl = MainuiController.getInstance();
|
this.holiday_list = {}; // 活动列表类型
|
|
this.holiday_del_list = {}; // -- 需要移除的标签页缓存列表
|
|
this.holiday_award_list = {}; //未领取活动奖励的列表
|
|
this.need_show_init_red = {}; //-- 登录的时候需要显示红点的列表
|
},
|
// 返回当前的model
|
getModel: function getModel() {
|
return this.model;
|
},
|
// 注册监听事件
|
registerEvents: function registerEvents() {
|
if (this.init_role_event == null) {
|
this.init_role_event = gcore.GlobalEvent.bind(EventId.EVT_ROLE_CREATE_SUCCESS, function () {
|
gcore.GlobalEvent.unbind(this.init_role_event);
|
this.needRequireData();
|
this.init_role_event = null; // this.requestActionStatus() //-- 请求所有活动图标
|
//超值基金
|
// this.sender24700()
|
// 七天登录红点
|
// this.cs21100();
|
// 七天目标
|
// this.cs13601();
|
}.bind(this));
|
}
|
},
|
// --- 断线重连或者0点更新或者初始化需要请求的
|
needRequireData: function needRequireData() {
|
var self = this;
|
self.openActionMainPanel(false);
|
self.holiday_list = {};
|
self.holiday_award_list = {};
|
self.need_show_init_red = {};
|
self.holiday_del_list = {};
|
self.is_init_require = true;
|
self.model.clearFundSrvData(); // 断线时需要清掉基金缓存数据
|
|
self.requestActionStatus(); // 请求所有活动图标
|
|
self.requestHolidayList(ActionConst.ActionType.Wonderful); //-- 登陆的时候请求一下精彩活动的
|
},
|
// 注册协议接受事件
|
registerProtocals: function registerProtocals() {
|
// this.RegisterProtocal(1110, this.on16602);
|
this.RegisterProtocal(10922, this.on10922); //-- 全服活动状态,服务端广播
|
|
this.RegisterProtocal(16601, this.on16601); // -- 所有子活动的显示数据,主要用于活动面板左侧标签显示,以及部分面板内容显示
|
|
this.RegisterProtocal(16603, this.on16603); // -- 请求子活动
|
|
this.RegisterProtocal(16604, this.on16604); // 领取奖励
|
|
this.RegisterProtocal(10923, this.on10923); //- 主要是用于服务段更新全服活动状态数据的
|
|
this.RegisterProtocal(10924, this.on10924); //-- 个人活动状态,服务端广播
|
|
this.RegisterProtocal(10925, this.on10925); //-- 主要是用于服务段更新个人活动状态数据的
|
|
this.RegisterProtocal(16602, this.on16602); // 请求所有活动未领取奖励
|
|
this.RegisterProtocal(16606, this.on16606); // 领取活动返回
|
|
this.RegisterProtocal(16607, this.on16607); // 0点 5点更新
|
// -- 基金相关
|
|
this.RegisterProtocal(24700, this.handle24700);
|
this.RegisterProtocal(24701, this.handle24701);
|
this.RegisterProtocal(24702, this.handle24702); //7天登录
|
|
this.RegisterProtocal(21100, this.on21100); // 7天登录信息
|
|
this.RegisterProtocal(21101, this.on21101); // 领取7天登录奖励
|
// 七天目标
|
|
this.RegisterProtocal(13601, this.handle13601);
|
this.RegisterProtocal(13602, this.handle13602); // --升级有礼
|
|
this.RegisterProtocal(21200, this.handle21200);
|
this.RegisterProtocal(21201, this.handle21201); //奖励排行信息(以后可以是活动的通用)
|
|
this.RegisterProtocal(16650, this.handle16650); // 幸运转盘
|
|
this.RegisterProtocal(16637, this.handle16637);
|
this.RegisterProtocal(16638, this.handle16638);
|
this.RegisterProtocal(16639, this.handle16639);
|
this.RegisterProtocal(16641, this.handle16641);
|
this.RegisterProtocal(16642, this.handle16642);
|
this.RegisterProtocal(16643, this.handle16643); //神秘杂货铺
|
|
this.RegisterProtocal(16688, this.handle16688);
|
this.RegisterProtocal(16689, this.handle16689); // --限时礼包入口
|
|
this.RegisterProtocal(21210, this.handle21210);
|
this.RegisterProtocal(21211, this.handle21211); //-- 推送激活了显示礼包.
|
|
this.RegisterProtocal(21016, this.handle21016);
|
this.RegisterProtocal(16687, this.handle16687); // --元宵冒险
|
|
this.RegisterProtocal(24810, this.handle24810); //--获取元宵冒险 任务信息
|
|
this.RegisterProtocal(24811, this.handle24811); //--推送任务变化"
|
|
this.RegisterProtocal(24812, this.handle24812); //--任务领取
|
//触发礼包
|
|
this.RegisterProtocal(21220, this.handle21220);
|
this.RegisterProtocal(24813, this.handle24813);
|
this.RegisterProtocal(24814, this.handle24814); //时装
|
|
this.RegisterProtocal(30101, this.handle30101);
|
this.RegisterProtocal(30100, this.handle30100);
|
this.RegisterProtocal(30102, this.handle30102);
|
},
|
requestActionStatus: function requestActionStatus() {
|
this.SendProtocal(10922, {});
|
this.SendProtocal(10924, {});
|
this.on10925(OrderactionConst.OrderActionEntranceID.entrance_id);
|
},
|
handleActionStatusData: function handleActionStatusData(data) {
|
if (data) {
|
var config = Config.function_data.data_info[data.id];
|
if (config == null) return;
|
|
if (data.status == ActionConst.ActionStatus.un_finish) {
|
this.mainui_ctrl.removeFunctionIconById(data.id);
|
} else {
|
this.mainui_ctrl.addFunctionIconById(data.id, data); // -- 如果是7天排行就请求一下任务
|
|
if (data.id == MainuiConst.icon.seven_rank) {// 7天排行
|
// self:requestSevenDaysRank()
|
} else if (data.id == MainuiConst.icon.fund) {
|
this.model.checkFundRedStatus();
|
}
|
}
|
}
|
},
|
setHolidayStatus: function setHolidayStatus(bid, status) {
|
var self = this;
|
if (self.holiday_list == null || self.holiday_list[bid] == null) return;
|
|
if (self.holiday_award_list == null) {
|
self.holiday_award_list = {};
|
}
|
|
var vo = {
|
bid: bid,
|
status: status
|
};
|
var vo1;
|
|
if (status) {
|
vo1 = {
|
bid: bid,
|
num: 1
|
};
|
} else {
|
vo1 = {
|
bid: bid,
|
num: 0
|
};
|
}
|
|
self.holiday_award_list[bid] = vo;
|
var action_sub_vo = self.holiday_list[bid];
|
var function_id = MainuiConst.icon.welfare;
|
|
if (self.isSpecialBid(bid)) {
|
self.mainui_ctrl.setFunctionTipsStatus(MainuiConst.icon.welfare, vo1);
|
} else {
|
self.mainui_ctrl.setFunctionTipsStatus(action_sub_vo.cli_type, vo1);
|
function_id = action_sub_vo.cli_type;
|
}
|
|
gcore.GlobalEvent.fire(ActionEvent.UPDATE_HOLIDAY_TAB_STATUS, function_id, vo);
|
},
|
// --desc:更新全服活动全部数据
|
on10922: function on10922(data) {
|
if (this.protocal_list_22 == null) {
|
this.protocal_list_22 = {};
|
}
|
|
if (data != null && data.act_list) {
|
for (var i = 0; i < data.act_list.length; ++i) {
|
var v = data.act_list[i];
|
this.handleActionStatusData(v); // -- 先储存一下吧
|
|
if (v.status == ActionConst.ActionStatus.un_finish) {
|
this.protocal_list_22[v.id] = null;
|
} else {
|
this.protocal_list_22[v.id] = v.id;
|
}
|
}
|
}
|
},
|
on10923: function on10923(data) {
|
this.handleActionStatusData(data);
|
|
if (data) {
|
if (this.protocal_list_22 == null) {
|
this.protocal_list_22 = {};
|
}
|
|
if (data.status == ActionConst.ActionStatus.un_finish) {
|
this.protocal_list_22[data.id] = null;
|
} else {
|
this.protocal_list_22[data.id] = data.id;
|
}
|
}
|
},
|
on10924: function on10924(data) {
|
cc.log("个人活动on10924", data);
|
|
if (data != null && data.act_list) {
|
for (var i = 0; i < data.act_list.length; ++i) {
|
var v = data.act_list[i];
|
this.handleActionStatusData(v);
|
|
if (MainuiConst.first_red_point[v.id] && v.status == 1) {
|
this.mainui_ctrl.setFunctionTipsStatus(v.id, MainuiConst.first_red_point[v.id]);
|
}
|
}
|
}
|
},
|
on10925: function on10925(data) {
|
this.handleActionStatusData(data);
|
|
if (MainuiConst.first_red_point[data.id] && data.status == 1) {
|
this.mainui_ctrl.setFunctionTipsStatus(data.id, MainuiConst.first_red_point[data.id]);
|
}
|
},
|
//请求所有活动未领取奖励状态
|
requestActionAwardStatus: function requestActionAwardStatus(type) {
|
var proto = {};
|
proto.type = type;
|
this.SendProtocal(16602, proto);
|
},
|
requestHolidayList: function requestHolidayList(type) {
|
var proto = {};
|
proto.type = type;
|
this.SendProtocal(16601, proto);
|
},
|
on16602: function on16602(data) {
|
for (var i = 0; i < data.holiday_list.length; ++i) {
|
var v = data.holiday_list[i];
|
this.setHolidayStatus(v.bid, v.can_get_num != false);
|
}
|
},
|
on16601: function on16601(data) {
|
cc.log(data, "on16601");
|
var temp_sub_vo;
|
var type_list = {};
|
|
for (var i = 0; i < data.holiday_list.length; ++i) {
|
var v = data.holiday_list[i];
|
|
if (this.holiday_del_list[v.bid] == null) {
|
temp_sub_vo = this.holiday_list[v.bid];
|
|
if (temp_sub_vo == null) {
|
var ActionSubTabVo = require("action_sub_tab_vo");
|
|
temp_sub_vo = new ActionSubTabVo();
|
this.holiday_list[v.bid] = temp_sub_vo;
|
}
|
|
temp_sub_vo = this.holiday_list[v.bid];
|
|
if (temp_sub_vo != null) {
|
temp_sub_vo.update(v);
|
} //活动类的投资计划和基金不在活动面板显示
|
|
|
if (this.isSpecialBid(v.bid)) {
|
temp_sub_vo.setShowStatus(false);
|
this.cs16603(v.bid);
|
} //判断这个活动所属的图标,并且动态设置他的名字
|
|
|
if (temp_sub_vo.cli_type != 0) {
|
if (type_list[temp_sub_vo.cli_type] == null) {
|
type_list[temp_sub_vo.cli_type] = {
|
action_num: 0,
|
action_name: ""
|
};
|
}
|
|
if (!this.isSpecialBid(temp_sub_vo.bid)) {
|
type_list[temp_sub_vo.cli_type].action_num = type_list[temp_sub_vo.cli_type].action_num + 1;
|
|
if (temp_sub_vo.cli_type_name != "" && temp_sub_vo.cli_type_name != "null" && type_list[temp_sub_vo.cli_type].action_name == "") {
|
type_list[temp_sub_vo.cli_type].action_name = temp_sub_vo.cli_type_name;
|
}
|
}
|
}
|
}
|
} // -- 初始化之后请求对应的活动红点状态
|
|
|
if (this.is_init_require == true) {
|
this.requestActionAwardStatus();
|
this.is_init_require = false;
|
} //判断是增删图标
|
|
|
for (var function_id in type_list) {
|
var object = type_list[function_id];
|
|
if (object) {
|
if (object.action_num > 0) {
|
this.mainui_ctrl.addFunctionIconById(function_id, object.action_name);
|
} else {
|
this.mainui_ctrl.removeFunctionIconById(function_id);
|
}
|
}
|
}
|
},
|
on16603: function on16603(data) {
|
//节日登录红点
|
if (data.bid == ActionConst.ActionRankCommonType.common_day || data.bid == ActionConst.ActionRankCommonType.festval_day || data.bid == ActionConst.ActionRankCommonType.lover_day) {
|
this.model.updataFestvalRedStatus(data.bid, data.aim_list);
|
} else if (data.bid == 1011) {
|
this.model.updataCombineLoginRedStatus(data.aim_list);
|
} else if (data.bid == 991014) {
|
this.model.updataPreferentialRedStatus(true, MainuiConst.icon.preferential);
|
} else if (data.bid == 91014) {
|
this.model.updataPreferentialRedStatus(true, MainuiConst.icon.other_preferential);
|
} // -- 没有子活动列表了,直接移除掉标签,下次有效(现在作废)
|
// if(data.aim_list.length == 0 ){
|
// this.handleHolidayList(0, data.bid)
|
// }
|
// -- 首充连冲
|
|
|
if (data.bid == 91005) {
|
this.handle91005Data(data);
|
} else if (data.bid == ActionConst.ActionRankCommonType.seven_charge) {} // 暂时没有
|
// this.model.setSevenChargeData(data)
|
// - 现在只要活动列表是空的,那么是投资计划后者是基金就删掉标签页
|
|
|
if (this.isSpecialBid(data.bid)) {
|
if (data.finish == 0 && this.need_show_init_red[data.bid] == null && data.aim_list.length != 0) {
|
var status = false;
|
var base_config = Config.holiday_client_data.data_info[data.bid];
|
|
if (base_config) {
|
var is_open = base_config.open_lev;
|
var role_vo = RoleController.getInstance().getRoleVo();
|
|
if (is_open && role_vo.lev) {
|
if (role_vo.lev >= is_open) {
|
status = true;
|
}
|
}
|
}
|
|
this.need_show_init_red[data.bid] = status;
|
this.setHolidayStatus(data.bid, status);
|
|
if (data.bid == ActionConst.ActionSpecialID.growfund) {
|
WelfareController.getInstance().setWelfareStatus(ActionConst.ActionSpecialID.growfund, status);
|
}
|
}
|
}
|
|
gcore.GlobalEvent.fire(ActionEvent.UPDATE_HOLIDAY_SIGNLE, data);
|
},
|
isSpecialBid: function isSpecialBid(bid) {
|
return bid == ActionConst.ActionSpecialID.invest || bid == ActionConst.ActionSpecialID.growfund;
|
},
|
//每日充值额外处理
|
handle91005Data: function handle91005Data(data) {
|
// --找出今日累充和累充天数的数据
|
if (!this.today_list) {
|
this.today_list = {};
|
}
|
|
if (data.aim_list && Utils.next(data.aim_list) != null) {
|
for (var k = 0; k < data.aim_list.length; ++k) {
|
var v = data.aim_list[k];
|
|
for (var a = 0; a < v.aim_args.length; ++a) {
|
var j = v.aim_args[a];
|
|
if (j.aim_args_key == 3) {
|
if (j.aim_args_val == 1) {
|
//--今日累充
|
this.today_list[k] = v;
|
this.today_list[k].has_num = this.has_num;
|
this.today_list[k].item_effect_list = this.item_effect_list;
|
}
|
} else if (j.aim_args_key == 4) {
|
// --需要充值多少钱
|
if (this.today_list[k]) {
|
this.today_list[k].need_charge = j.aim_args_val;
|
}
|
} else if (j.aim_args_key == 5) {
|
// --目标值 需要冲多少天
|
if (this.today_list[k]) {
|
this.today_list[k].charge_day = j.aim_args_val;
|
}
|
} else if (j.aim_args_key == 6) {
|
// --计数
|
if (this.today_list[k]) {
|
this.today_list[k].has_charge = j.aim_args_val;
|
}
|
}
|
}
|
}
|
} // this.checkShowDayCharge()
|
|
},
|
//获取指定类型和指定活动的id的子活动基础数据
|
getActionSubTabVo: function getActionSubTabVo(bid) {
|
if (this.holiday_list != null) {
|
return this.holiday_list[bid];
|
}
|
},
|
getAllActionList: function getAllActionList() {
|
return this.holiday_list;
|
},
|
// --desc:请求子活动列表
|
// --time:2017-07-26 07:56:10
|
// --@bid:子活动ID
|
// --@return
|
cs16603: function cs16603(bid) {
|
var protocal = {};
|
protocal.bid = bid;
|
this.SendProtocal(16603, protocal);
|
},
|
//领取奖励
|
cs16604: function cs16604(bid, aim, arg) {
|
var protocal = {};
|
protocal.bid = bid;
|
protocal.aim = aim;
|
protocal.arg = arg || 0;
|
this.SendProtocal(16604, protocal);
|
},
|
on16604: function on16604(data) {
|
message(data.msg); // showAssetsMsg(data.msg)
|
},
|
// ------------------@ 基金相关协议
|
// -- 请求基金开启数据
|
sender24700: function sender24700() {
|
var protocal = {};
|
this.SendProtocal(24700, protocal);
|
},
|
handle24700: function handle24700(data) {
|
if (data && data.ids) {
|
this.model.setOpenFundIds(data.ids);
|
gcore.GlobalEvent.fire(ActionEvent.UPDATA_FUND_ID_LIST_EVENT);
|
}
|
},
|
//-- 请求基金数据
|
sender24701: function sender24701(id) {
|
var protocal = {};
|
protocal.id = id;
|
this.SendProtocal(24701, protocal);
|
},
|
handle24701: function handle24701(data) {
|
if (data) {
|
this.model.setFundSrvData(data);
|
gcore.GlobalEvent.fire(ActionEvent.UPDATA_FUND_DATA_EVENT, data.id);
|
}
|
},
|
// -- 请求领取基金
|
sender24702: function sender24702(id) {
|
var protocal = {};
|
protocal.id = id;
|
this.SendProtocal(24702, protocal);
|
},
|
handle24702: function handle24702(data) {
|
if (data.msg) {
|
message(data.msg);
|
}
|
},
|
// -- 打开超值基金奖励预览界面
|
openActionFundAwardWindow: function openActionFundAwardWindow(status, group_id, fund_id) {
|
var self = this;
|
|
if (status) {
|
if (!self.fund_award_win) {
|
var actionFundAward = require("action_fund_award_window");
|
|
self.fund_award_win = new actionFundAward();
|
}
|
|
if (self.fund_award_win.isOpen() == false) {
|
self.fund_award_win.open({
|
group_id: group_id,
|
fund_id: fund_id
|
});
|
}
|
} else {
|
if (self.fund_award_win) {
|
self.fund_award_win.close();
|
self.fund_award_win = null;
|
}
|
}
|
},
|
// ==============================
|
// desc:7天登录状态
|
// ==============================
|
cs21100: function cs21100() {
|
this.SendProtocal(21100, {});
|
},
|
on21100: function on21100(data) {
|
var show_red = false;
|
|
for (var i in data.status_list) {
|
if (data.status_list[i].status == 2) {
|
this.mainui_ctrl.setFunctionTipsStatus(MainuiConst.icon.seven_login, true);
|
break;
|
}
|
}
|
|
var i = 0;
|
|
for (var k in data.status_list) {
|
if (data.status_list[k].status == 3) {
|
i = i + 1;
|
}
|
}
|
|
if (i == data.status_list.length) {
|
this.mainui_ctrl.setFunctionTipsStatus(MainuiConst.icon.seven_login, false);
|
}
|
|
this.model.updateSevenLoginData(data);
|
gcore.GlobalEvent.fire(ActionEvent.UPDATE_SEVEN_LOGIN_STATUS, data);
|
},
|
// ==============================
|
// desc:7天登录领取奖励
|
// ==============================
|
cs21101: function cs21101(day) {
|
var protocal = {};
|
protocal.day = day;
|
this.SendProtocal(21101, protocal);
|
},
|
on21101: function on21101(data) {
|
message(data.msg);
|
|
if (data.code == 1) {
|
gcore.GlobalEvent.fire(ActionEvent.UPDATE_SEVEN_LOGIN_REWARDS, data);
|
this.cs21100();
|
}
|
},
|
// 打开七天登录界面
|
openSevenLoginWin: function openSevenLoginWin(status) {
|
if (status) {
|
if (!this.seven_login_win) {
|
this.seven_login_win = Utils.createClass("action_seven_login_window", this);
|
}
|
|
if (this.seven_login_win && this.seven_login_win.isOpen() == false) {
|
this.seven_login_win.open();
|
}
|
} else {
|
if (this.seven_login_win) {
|
this.seven_login_win.close();
|
this.seven_login_win = null;
|
}
|
}
|
},
|
// 打开七天目标界面
|
openSevenGoalView: function openSevenGoalView(status) {
|
if (status) {
|
if (!this.seven_goal_win) {
|
this.seven_goal_win = Utils.createClass("action_seven_goal_window", this);
|
}
|
|
if (this.seven_goal_win && this.seven_goal_win.isOpen() == false) {
|
this.seven_goal_win.open();
|
}
|
} else {
|
if (this.seven_goal_win) {
|
this.seven_goal_win.close();
|
this.seven_goal_win = null;
|
}
|
}
|
},
|
cs13601: function cs13601() {
|
this.SendProtocal(13601, {});
|
},
|
handle13601: function handle13601(data) {
|
if (data.period == 0) return;
|
this.model.setSevenGoldPeriod(data.period || 1);
|
this.model.initSevenWalfare(data.period || 1);
|
this.model.setSevenGoalWelfareList(data.welfare_list);
|
this.model.setSevenGoalGrowList(data.grow_list);
|
this.model.setHalfGiftList(data.price_list);
|
this.model.setSevenGoalBoxList(data.finish_list, data.num);
|
this.model.checkRedPoint(data.cur_day);
|
gcore.GlobalEvent.fire(ActionEvent.UPDATE_SEVENT_GOAL, data);
|
},
|
// 请求七日活动领取
|
cs13602: function cs13602(type, day, id, item) {
|
var protocal = {};
|
protocal.type = type;
|
protocal.day_type = day;
|
protocal.id = id;
|
protocal.item = item;
|
this.SendProtocal(13602, protocal);
|
},
|
handle13602: function handle13602(data) {
|
message(data.msg);
|
|
if (data.flag == 1) {
|
gcore.GlobalEvent.fire(ActionEvent.UPDATE_SEVENT_GET, data);
|
}
|
},
|
//活动主界面
|
//属于竞猜活动 还是属于节日活动,MainuiConst.icon.action 或者 MainuiConst.icon.festival
|
openActionMainPanel: function openActionMainPanel(status, function_id, action_bid) {
|
if (status == false) {
|
if (this.action_operate != null) {
|
this.action_operate.close();
|
this.action_operate = null;
|
}
|
} else {
|
if (action_bid != null) {
|
var action_vo = this.holiday_list[action_bid];
|
|
if (action_vo) {
|
function_id = action_vo.cli_type;
|
}
|
}
|
|
if (function_id == null) {
|
function_id = MainuiConst.icon.action;
|
}
|
|
if (this.action_operate == null) {
|
this.action_operate = Utils.createClass("action_main_window");
|
}
|
|
if (this.action_operate.isOpen() == false) this.action_operate.open({
|
function_id: function_id,
|
action_bid: action_bid
|
});
|
}
|
},
|
//获得指定类型活动的所有子活动列表,用于主界面显示,这里做一个排序处理吧
|
getActionSubList: function getActionSubList(function_id) {
|
var action_sub_list = [];
|
|
if (this.holiday_list) {
|
for (var k in this.holiday_list) {
|
var v = this.holiday_list[k];
|
|
if (v.cli_type == function_id && v.isShowInAction() == true) {
|
action_sub_list.push(v);
|
}
|
}
|
}
|
|
if (Utils.next(action_sub_list) != null) {
|
action_sub_list.sort(function (a, b) {
|
return a.sort_val - b.sort_val;
|
});
|
}
|
|
return action_sub_list;
|
},
|
// -------------------------------升级有礼协议-------------------------------------
|
send21200: function send21200() {
|
var protocal = {};
|
this.SendProtocal(21200, protocal);
|
},
|
handle21200: function handle21200(data) {
|
gcore.GlobalEvent.fire(ActionEvent.UPDATE_LEVEL_UP_GIFT, data);
|
},
|
send21201: function send21201(id) {
|
var protocal = {};
|
protocal.id = id;
|
this.SendProtocal(21201, protocal);
|
},
|
handle21201: function handle21201(data) {
|
message(data.msg);
|
},
|
//获取一个指定类型活动指定子活动可领取状态数据
|
getHolidayAweradsStatus: function getHolidayAweradsStatus(bid) {
|
if (this.holiday_award_list != null && this.holiday_award_list[bid] != null) {
|
return this.holiday_award_list[bid];
|
}
|
},
|
//排行榜奖励预览协议(以后可能是活动通用排行奖励信息)
|
send16650: function send16650(bid) {
|
var protocal = {};
|
protocal.bid = bid;
|
this.SendProtocal(16650, protocal);
|
},
|
handle16650: function handle16650(data) {
|
message(data.msg);
|
gcore.GlobalEvent.fire(ActionEvent.RANK_REWARD_LIST, data);
|
},
|
// --desc:活动领取返回
|
on16606: function on16606(data) {
|
this.setHolidayStatus(data.bid, data.can_get_num != false);
|
},
|
on16607: function on16607(data) {
|
if (data && data.type == 0) {
|
//--0点更新
|
this.needRequireData(true);
|
}
|
},
|
// 幸运转盘
|
requestLucky: function requestLucky() {
|
this.SendProtocal(16637, {});
|
},
|
handle16637: function handle16637(data) {
|
this.model.setTreasureInitData(data.dial_data);
|
this.model.lucklyRedPoint();
|
gcore.GlobalEvent.fire(ActionEvent.UPDATE_LUCKYROUND_GET, data);
|
},
|
send16638: function send16638(type, count) {
|
var protocal = {};
|
protocal.type = type;
|
protocal.type2 = count;
|
this.SendProtocal(16638, protocal);
|
},
|
handle16638: function handle16638(data) {
|
gcore.GlobalEvent.fire(ActionEvent.TREASURE_SUCCESS_DATA, data);
|
},
|
handle16639: function handle16639(data) {
|
gcore.GlobalEvent.fire(ActionEvent.UPDATE_LUCKLY_DATA, data);
|
},
|
send16640: function send16640(type, id) {
|
var protocal = {};
|
protocal.type = type;
|
protocal.id = id;
|
this.SendProtocal(16640, protocal);
|
},
|
handle16641: function handle16641(data) {
|
gcore.GlobalEvent.fire(ActionEvent.UPDATA_TREASURE_LOG_DATA, data);
|
},
|
send16642: function send16642(type) {
|
var protocal = {};
|
protocal.type = type;
|
this.SendProtocal(16642, protocal);
|
},
|
handle16642: function handle16642(data) {
|
message(data.msg); // -- GlobalEvent:getInstance():Fire(ActionEvent.UPDATA_TREASURE_REFRESH, data)
|
},
|
// 弹窗的
|
send16643: function send16643(type, count) {
|
var protocal = {};
|
protocal.type = type;
|
protocal.type2 = count;
|
this.SendProtocal(16643, protocal);
|
},
|
handle16643: function handle16643(data) {
|
message(data.msg);
|
|
if (data.code == 1) {
|
gcore.GlobalEvent.fire(ActionEvent.UPDATA_TREASURE_POPUPS_SEND, data);
|
}
|
},
|
// -----打开幸运探宝界面-----
|
openLuckyTreasureWin: function openLuckyTreasureWin(status, index) {
|
index = index || 1;
|
|
if (status) {
|
var is_open = this.mainui_ctrl.checkMainFunctionOpenStatus(MainuiConst.icon.lucky_treasure, MainuiConst.function_type.other, false);
|
|
if (is_open == false) {
|
return;
|
} // 高级探宝的时候
|
|
|
if (index == 2) {
|
this.model.setBuyRewardData();
|
var open_data = this.model.getBuyRewardData(index);
|
var open = this.mainui_ctrl.checkIsOpenByActivate(open_data[1].limit_open);
|
|
if (open == false) {
|
message(Utils.TI18N("人物等级不足"));
|
return;
|
}
|
}
|
|
if (!this.treasure_win) {
|
this.treasure_win = Utils.createClass("action_treasure_window", this);
|
}
|
|
if (this.treasure_win && this.treasure_win.isOpen() == false) {
|
this.treasure_win.open(index);
|
}
|
} else {
|
if (this.treasure_win) {
|
this.treasure_win.close();
|
this.treasure_win = null;
|
}
|
}
|
},
|
getTreasureView: function getTreasureView() {
|
if (this.treasure_win) {
|
return this.treasure_win;
|
}
|
},
|
checkOpenActionLimitGiftMainWindow: function checkOpenActionLimitGiftMainWindow() {
|
var self = this;
|
|
if (self.active_limit_gift_id == 2001) {
|
//-- 18级的不提示
|
self.active_limit_gift_id = null;
|
return;
|
}
|
|
if (self.active_limit_gift_id != null) {
|
var config = Config.star_gift_data.data_limit_gift[self.active_limit_gift_id];
|
|
if (config) {
|
var gift_id = self.active_limit_gift_id;
|
|
var CommonAlert = require("commonalert");
|
|
CommonAlert.show(config.desc, Utils.TI18N('前往'), function () {
|
this.openActionLimitGiftMainWindow(true, gift_id);
|
}.bind(this), Utils.TI18N('取消'));
|
}
|
}
|
|
self.active_limit_gift_id = null;
|
},
|
// --打开限时礼包入口
|
// --打开显示礼包id
|
openActionLimitGiftMainWindow: function openActionLimitGiftMainWindow(status, id) {
|
var self = this;
|
|
if (status) {
|
if (!self.action_limit_gift) {
|
var ActionLimitGiftMainWindow = require("action_limit_gift_main_window");
|
|
self.action_limit_gift = new ActionLimitGiftMainWindow();
|
}
|
|
self.action_limit_gift.open(id);
|
} else {
|
if (self.action_limit_gift) {
|
self.action_limit_gift.close();
|
self.action_limit_gift = null;
|
}
|
}
|
},
|
send21210: function send21210() {
|
var protocal = {};
|
this.SendProtocal(21210, protocal);
|
},
|
handle21210: function handle21210(data) {
|
message(data.msg);
|
gcore.GlobalEvent.fire(ActionEvent.LIMIT_GIFT_MAIN_EVENT, data);
|
},
|
// --推送激活了显示礼包.并且在某些操作后需要显示
|
handle21211: function handle21211(data) {
|
this.active_limit_gift_id = data.id;
|
},
|
// 探宝获得物品界面
|
openTreasureGetItemWindow: function openTreasureGetItemWindow(status, data, index, count_type) {
|
if (status) {
|
if (!this.treasure_get_win) {
|
var ActionTreasureGetWindow = require("action_treasure_get_window");
|
|
this.treasure_get_win = new ActionTreasureGetWindow(this, data, index, count_type);
|
}
|
|
if (this.treasure_get_win && this.treasure_get_win.isOpen() == false) {
|
this.treasure_get_win.open();
|
}
|
} else {
|
if (this.treasure_get_win) {
|
this.treasure_get_win.close();
|
this.treasure_get_win = null;
|
}
|
}
|
},
|
getSevenLoginRoot: function getSevenLoginRoot() {
|
if (this.seven_login_win) return this.seven_login_win.root_wnd;
|
},
|
getTreasureRoot: function getTreasureRoot() {
|
if (this.treasure_win) return this.treasure_win.root_wnd;
|
},
|
//是否可以创建指定活动类型,只有活动总列表里面有这个活动类型才可以创建
|
checkCanAddWonderful: function checkCanAddWonderful(function_id) {
|
if (function_id == null) return false;
|
if (this.holiday_list == null || Utils.next(this.holiday_list) == null) return false;
|
|
for (var k in this.holiday_list) {
|
var v = this.holiday_list[k];
|
|
if (v.cli_type == function_id) {
|
return true;
|
}
|
}
|
|
return false;
|
},
|
//--------------------杂货铺协议开始-------------------------------------
|
sender16688: function sender16688() {
|
this.SendProtocal(16688, {});
|
},
|
handle16688: function handle16688(data) {
|
this.model.setStoneShopData(data.buy_info);
|
gcore.GlobalEvent.fire(ActionEvent.UPDATE_STORE_DATA_EVENT);
|
},
|
sender16689: function sender16689(id, num) {
|
var protocal = {};
|
protocal.id = id;
|
protocal.num = num;
|
this.SendProtocal(16689, protocal);
|
},
|
handle16689: function handle16689(data) {
|
message(data.msg);
|
|
if (data.code == 1) {
|
gcore.GlobalEvent.fire(ActionEvent.UPDATE_STORE_DATA_SUCCESS_EVENT, data);
|
}
|
},
|
//--------------------新服限购协议结束-------------------------------------
|
// --------------------新服限购协议开始-------------------------------------
|
// 红点
|
sender16687: function sender16687(send_protocal) {
|
var protocal = send_protocal || {};
|
var len = 0;
|
|
for (var i in send_protocal) {
|
len += 1;
|
break;
|
}
|
|
if (len == 0) {
|
protocal.bid = 91029;
|
}
|
|
this.SendProtocal(16687, protocal);
|
},
|
handle16687: function handle16687(data) {
|
var status = false;
|
|
if (data.code == 1) {
|
status = true;
|
}
|
|
data.status = status;
|
|
if (data.bid == ActionConst.ActionRankCommonType.open_server) {
|
MainuiController.getInstance().setFunctionTipsStatus(MainuiConst.icon.open_server_recharge, status);
|
} else if (data.bid == ActionConst.ActionRankCommonType.high_value_gift || data.bid == ActionConst.ActionRankCommonType.mysterious_store) {
|
this.model.updateGiftRedPointStatus(data);
|
}
|
},
|
//--------------------新服限购协议结束-------------------------------------
|
// 判断是否能充值
|
sender21016: function sender21016(charge_id) {
|
var protocal = {};
|
protocal.charge_id = charge_id;
|
this.SendProtocal(21016, protocal);
|
},
|
handle21016: function handle21016(data) {
|
gcore.GlobalEvent.fire(ActionEvent.Is_Charge_Event, data);
|
},
|
// ==============================--
|
// desc:登录时候请求一些特殊活动id的红点数据
|
// time:2017-07-18 05:15:10
|
// @return
|
// ==============================--
|
requestActionRedStatus: function requestActionRedStatus() {
|
this.sender16687({
|
bid: ActionConst.ActionRankCommonType.open_server
|
}); //小额直购请求红点
|
|
this.sender16687({
|
bid: ActionConst.ActionRankCommonType.high_value_gift
|
}); //小额礼包请求红点
|
|
this.sender16687({
|
bid: ActionConst.ActionRankCommonType.mysterious_store
|
}); //神秘杂货店请求红点
|
},
|
//--------------------元宵冒险协议开始-------------------------------------
|
// -- 请求任务信息
|
sender24810: function sender24810() {
|
var protocal = {};
|
this.SendProtocal(24810, protocal);
|
},
|
handle24810: function handle24810(data) {
|
message(data.msg);
|
gcore.GlobalEvent.fire(ActionEvent.YUAN_ZHEN_DATA_EVENT, data);
|
},
|
// --推送任务
|
handle24811: function handle24811(data) {
|
gcore.GlobalEvent.fire(ActionEvent.YUAN_ZHEN_UPDATA_EVENT, data);
|
},
|
// -- 完成任务
|
sender24812: function sender24812(id) {
|
var protocal = {};
|
protocal.id = id;
|
this.SendProtocal(24812, protocal);
|
},
|
handle24812: function handle24812(data) {
|
message(data.msg);
|
|
if (data.code == true) {
|
gcore.GlobalEvent.fire(ActionEvent.YUAN_ZHEN_TASK_EVENT, data);
|
}
|
},
|
//--------------------元宵冒险协议结束-------------------------------------
|
// 触发礼包
|
openTriggerGiftWindow: function openTriggerGiftWindow(status) {
|
if (status) {
|
if (!this.action_time_gift_big) {
|
var ActionTimeGiftBigWindow = require("action_time_gift_big_window");
|
|
this.action_time_gift_big = new ActionTimeGiftBigWindow(this);
|
}
|
|
if (this.action_time_gift_big && this.action_time_gift_big.isOpen() == false) {
|
this.action_time_gift_big.open();
|
}
|
} else {
|
if (this.action_time_gift_big) {
|
this.action_time_gift_big.close();
|
this.action_time_gift_big = null;
|
}
|
}
|
},
|
sender21220: function sender21220() {
|
this.SendProtocal(21220, {});
|
},
|
handle21220: function handle21220(data) {
|
message(data.msg);
|
gcore.GlobalEvent.fire(ActionEvent.TRIGGER_GIFT_EVENT, data);
|
},
|
// --开服超值礼包界面
|
openActionOpenServerGiftWindow: function openActionOpenServerGiftWindow(status, bid) {
|
if (status) {
|
if (!this.action_open_server_recharge) {
|
var ActionOpenServerGiftWindow = require("action_open_server_gift_window");
|
|
this.action_open_server_recharge = new ActionOpenServerGiftWindow(this);
|
}
|
|
if (this.action_open_server_recharge && this.action_open_server_recharge.isOpen() == false) {
|
this.action_open_server_recharge.open(bid);
|
}
|
} else {
|
if (this.action_open_server_recharge) {
|
this.action_open_server_recharge.close();
|
this.action_open_server_recharge = null;
|
}
|
}
|
},
|
//--试炼之境
|
sender24813: function sender24813() {
|
this.SendProtocal(24813, {});
|
},
|
handle24813: function handle24813(data) {
|
message(data.msg);
|
gcore.GlobalEvent.fire(ActionEvent.YUAN_ZHEN_DATA_EVENT, data);
|
},
|
//检查活动是否存在exist
|
//@action_bid 活动基础id
|
//@camp_id 活动id 属于可以选参数, 如果有值表示需要判定 如果为nil 表示 不需要判定
|
checkActionExistByActionBid: function checkActionExistByActionBid(action_bid) {
|
if (!action_bid) return false;
|
var tab_vo = this.getActionSubTabVo(action_bid);
|
if (tab_vo) return true;
|
return false;
|
},
|
sender24814: function sender24814(id) {
|
var protocal = {};
|
protocal.id = id;
|
this.SendProtocal(24814, protocal);
|
},
|
handle24814: function handle24814(data) {
|
message(data.msg);
|
gcore.GlobalEvent.fire(ActionEvent.YUAN_ZHEN_TASK_EVENT, data);
|
},
|
//时装---------
|
sender30101: function sender30101() {
|
this.SendProtocal(30101, {});
|
},
|
handle30101: function handle30101(data) {
|
message(data.msg);
|
gcore.GlobalEvent.fire(ActionEvent.SKIN_INFO_EVENT, data);
|
},
|
sender30100: function sender30100() {
|
this.SendProtocal(30100, {});
|
},
|
handle30100: function handle30100(data) {
|
message(data.msg);
|
},
|
handle30102: function handle30102(data) {
|
MainuiController.getInstance().setFunctionTipsStatus(MainuiConst.icon.skin, data.code == 1);
|
},
|
openBuySkinWindow: function openBuySkinWindow(status) {
|
if (status) {
|
if (!this.action_buy_skin) {
|
var ActionBuySkinWindow = require("action_buy_skin_window");
|
|
this.action_buy_skin = new ActionBuySkinWindow(this);
|
|
if (this.action_buy_skin && this.action_buy_skin.isOpen() == false) {
|
this.action_buy_skin.open();
|
}
|
}
|
} else {
|
if (this.action_buy_skin) {
|
this.action_buy_skin.close();
|
this.action_buy_skin = null;
|
}
|
}
|
}
|
});
|
module.exports = ActionController;
|
|
cc._RF.pop();
|