// --------------------------------------------------------------------
// @author: xxx@syg.com(必填, 创建模块的人员)
// @description:
// 这里是描述这个窗体的作用的
//
Create: 2019-08-15 17:44:42
// --------------------------------------------------------------------
var PathTool = require("pathtool");
var VipController = require("vip_controller");
var NewFirstChargeEvent = require("newfirstcharge_event");
var RoleController = require("role_controller");
var Newfirstcharge1Window = cc.Class({
extends: BaseView,
ctor: function () {
this.prefabPath = PathTool.getPrefabPath("newfirstcharge", "newfirstcharge1_window");
this.viewTag = SCENE_TAG.dialogue; //该窗体所属ui层级,全屏ui需要在ui层,非全屏ui在dialogue层,这个要注意
this.win_type = WinType.Big; //是否是全屏窗体 WinType.Full, WinType.Big, WinType.Mini, WinType.Tips
this.ctrl = arguments[0];
this.model = this.ctrl.getModel();
},
// 初始化一些配置数据,可以用于声明一些变量之类的
initConfig:function(){
this.effect_list = []
this.cur_node = null
this.item_list = {}
this.recharge_list = {}
this.select = new cc.Color().fromHEX("#AB382B")
this.notSelect = new cc.Color().fromHEX("#EC9A3B")
this.item_reward_list = [];
for(var i = 1;i<=3;i++){
this.item_reward_list[i] = {};
}
},
// 预制体加载完成之后的回调,可以在这里捕获相关节点或者组件
openCallBack:function(){
this.background = this.root_wnd.getChildByName("background");
this.background.scale = FIT_SCALE;
let bg_sp = this.seekChild("bg",cc.Sprite)
this.loadRes(PathTool.getBigBg("action/txt_cn_action_bigbg_30506"),function(res){
bg_sp.spriteFrame = res
}.bind(this))
this.close_btn = this.seekChild("newfirstcharge_btn_close");
this.btn_recharge = this.seekChild("newfirstcharge_btn_bottom")
this.loadRes(PathTool.getUIIconPath("newfirstcharge","newfirstcharge_btn_bottom"),function(res){
this.btn_recharge.getComponent(cc.Sprite).spriteFrame = res
}.bind(this))
this.recharge_6_nd = this.seekChild("toggle1");
this.recharge_6_lb = this.seekChild(this.recharge_6_nd,"Label",cc.Label)
this.recharge_100_nd = this.seekChild("toggle2");
this.recharge_100_lb = this.seekChild(this.recharge_100_nd,"Label",cc.Label)
this.text_rt = this.seekChild("Text",cc.RichText)
this.text_rt.string = Utils.TI18N("机会仅1次!以下仅可选择一个充值档位获得四倍钻石!")
this.recharge_6_lb.string = Utils.TI18N("首充赠礼")
this.recharge_100_lb.string = Utils.TI18N("100元赠礼")
this.tab_view = [this.recharge_6_nd,this.recharge_100_nd]
this.remain_charge = this.seekChild("recharge_num",cc.Label)
this.remain_charge.string = Utils.TI18N("已累充: ");
for(let i=0;i累充100元可领取更多豪礼!")
for(let i in this.recharge_list){
let obj = this.recharge_list[i]
obj.node.active = false
}
this.btn_recharge.active = true;
if(totle == 0){
this.get_gift_id = 0;
this.btn_label.string = Utils.TI18N("前往充值");
}else if(totle == 1 || totle == 3 || totle == 5){
this.btn_label.string = Utils.TI18N("领取奖励");
}else if(totle == 2 || totle == 4){
this.btn_label.string = Utils.TI18N("明日再来");
}else if(totle == 6){
this.btn_label.string = Utils.TI18N("领取完毕");
}
}
},
setRedPointTab(){
var status_1 = false;
for(var i = 1;i<=3;i++){
var get_data = this.model.getFirstBtnStatus(i);
if(get_data){
if(get_data == 1){
status_1 = true;
break;
}
}
}
Utils.addRedPointToNodeByStatus(this.tab_view[0],status_1)
var status_2 = false;
for(var i = 4;i<=6;i++){
var get_data = this.model.getFirstBtnStatus(i);
if(get_data){
if(get_data == 1){
status_2 = true;
break;
}
}
}
Utils.addRedPointToNodeByStatus(this.tab_view[1],status_2)
},
fillItemList:function(list){
var scale = 0.7;
var size = 119 * scale;
var create_index = 1;
for(let i=0;i