源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

600 lines
23 KiB

DailyRechargeSubView = DailyRechargeSubView or BaseClass(BaseItem)
local DailyRechargeSubView = DailyRechargeSubView
-- DailyRechargeSubView.Width = 200
-- DailyRechargeSubView.Height = 90
function DailyRechargeSubView:__init(parent_wnd,prefab_asset,layer_name,sub_type)
self.base_file = "dailyRecharge"
self.layout_file = "DailyRechargeSubView"
self.layer_name = layer_name
self.model = RechargeActivityModel:getInstance()
self.base_type = CustomActivityModel.CustomActBaseType.DAILY_RECHARGE
self.sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(CustomActivityModel.CustomActBaseType.DAILY_RECHARGE)
self.model:SetDailyRechargeLoginCookie(self.sub_type)
self.model:CheckDailyRechargeMainIconRedDot(self.sub_type)
self.select_index = 4
self.show_tab_extra = false
self.light_pos_index = {
[1] = 151,
[2] = 77,
[3] = 5,
[4] = -67,
[5] = -141,
}
self.first_open = true
self:Load()
end
function DailyRechargeSubView:Load_callback()
self.nodes = {
"scroll_1", "scroll_1/Viewport/Content_1",
"lb_des_1:tmp",
"btn_1:img:obj","red_mid_1:obj", "pelletBtn/pelletBtnRed:obj",
"btn_1/lb_btn_1:tmp","nameText:tmp", "closeBtn:obj", "pelletBtn:obj",
--页签相关
"tabScroll/Viewport/tabCon/lb_2:obj:tmp", "tabScroll/Viewport/tabCon/red_3:obj", "tabScroll/Viewport/tabCon/red_4:obj", "tabScroll/Viewport/tabCon/red_2:obj", "tabScroll/Viewport/tabCon/red_1:obj", "tabScroll/Viewport/tabCon/lb_4:obj:tmp", "tabScroll/Viewport/tabCon/lb_3:obj:tmp",
"tabScroll/Viewport/tabCon/lb_5:obj:tmp", "tabScroll/Viewport/tabCon/red_5:obj", "tabScroll/Viewport/tabCon/lb_1:obj:tmp", "tabScroll/Viewport/tabCon/di_select:obj:img",
"tabScroll/Viewport/tabCon/di_tab_5:obj",
"tabScroll/Viewport/tabCon/lb_4_cur:tmp", "tabScroll/Viewport/tabCon/lb_5_cur:tmp", "tabScroll/Viewport/tabCon/lb_1_cur:tmp", "tabScroll/Viewport/tabCon/lb_2_cur:tmp", "tabScroll/Viewport/tabCon/lb_3_cur:tmp",
"tabScroll/Viewport/tabCon/di_tab_1:obj", "tabScroll/Viewport/tabCon/di_tab_2:obj", "tabScroll/Viewport/tabCon/di_tab_3:obj", "tabScroll/Viewport/tabCon/di_tab_4:obj",
"tabScroll/Viewport/tabCon/tab_name1:tmp", "tabScroll/Viewport/tabCon/tab_name5:tmp", "tabScroll/Viewport/tabCon/tab_name2:tmp", "tabScroll/Viewport/tabCon/tab_name4:tmp", "tabScroll/Viewport/tabCon/tab_name3:tmp",
"bg:raw", "showBg:img", "tabScroll:scroll", "tabScroll/Viewport/tabCon",
--气泡头像称号相关节点
"dressCon:obj","dressCon/designationImg:img:obj", "dressCon/imgCon:img:obj","dressCon/bubbleCon",
"dressCon/headCon","roleCon:obj","effect:obj",
"awardEffect", "btn_1/goBtnEffect",
}
self:GetChildren(self.nodes)
lua_resM:setOutsideRawImage(self, self.bg_raw, GameResPath.GetViewBigBg("dailyRecharge_bg2"), false)
-- 称号起点位置
self.ori_dsg_pos = self.dressCon.anchoredPosition.y + 70
SetAnchoredPositionY(self.dressCon, self.ori_dsg_pos)
self.up_dsg_pos = self.ori_dsg_pos + 15
self.down_dsg_pos = self.ori_dsg_pos - 15
self:ArrowAnimation(0)
self:AddEvents()
self:UpdateView()
end
function DailyRechargeSubView:AddEvents( )
local function call_back( target )
if target == self.di_tab_1_obj then
self.wait_change_next_time = nil
self.select_index = 1
-- self.select_index = self.show_tab_extra and self.select_index or self.select_index - 1
self:UpdateView()
elseif target == self.di_tab_2_obj then
self.wait_change_next_time = nil
self.select_index = 2
-- self.select_index = self.show_tab_extra and self.select_index or self.select_index - 1
self:UpdateView()
elseif target == self.di_tab_3_obj then
self.wait_change_next_time = nil
self.select_index = 3
-- self.select_index = self.show_tab_extra and self.select_index or self.select_index - 1
self:UpdateView()
elseif target == self.di_tab_4_obj then
self.wait_change_next_time = nil
self.select_index = 4
-- self.select_index = self.show_tab_extra and self.select_index or self.select_index - 1
self:UpdateView()
elseif target == self.di_tab_5_obj then
self.wait_change_next_time = nil
self.select_index = 5
-- self.select_index = self.show_tab_extra and self.select_index or self.select_index - 1
self:UpdateView()
elseif target == self.btn_1_obj then
if not self.act_list then return end
local grade = self.tab_list[self.select_index].grade
local status_1 = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 1, "status")--领取状态
if status_1 == 1 then
--可领取--已领取
CustomActivityModel:getInstance():Fire(CustomActivityModel.PROTO_CCMD_EVENT,33105,self.base_type,self.sub_type,grade)
self.wait_change_next_time = TimeUtil:getServerTime()--一定时间内返回的更新函数会自动切换标签
elseif status_1 == 2 then
Message.show("该档位奖励已领取!","fault")
else
OpenFun.Open(450,1)
end
elseif target == self.closeBtn_obj then
if self.close_call_back then
self.close_call_back()
end
elseif target == self.pelletBtn_obj then
if self.pellet_call_back then
self.pellet_call_back()
end
end
end
AddClickEvent(self.di_tab_1_obj,call_back,false)
AddClickEvent(self.di_tab_2_obj,call_back,false)
AddClickEvent(self.di_tab_3_obj,call_back,false)
AddClickEvent(self.di_tab_4_obj,call_back,false)
AddClickEvent(self.di_tab_5_obj,call_back,false)
AddClickEvent(self.btn_1_obj,call_back,false)
AddClickEvent(self.closeBtn_obj,call_back,false)
AddClickEvent(self.pelletBtn_obj,call_back,false)
local function UPDATE_TODAY_RECHARGE_INFO( )
self:UpdateView()
end
self:BindEvent(self.model, RechargeActivityModel.UPDATE_TODAY_RECHARGE_INFO, UPDATE_TODAY_RECHARGE_INFO)
local function UPDATE_ACTIVITY_INFO( base_type )
if base_type == self.base_type then
self:UpdateView()
end
end
self:BindEvent(CustomActivityModel:getInstance(), CustomActivityModel.UPDATE_ACTIVITY_INFO, UPDATE_ACTIVITY_INFO)
end
function DailyRechargeSubView:CheckShowNum( )
self.show_tab_extra = false
self.act_list = CustomActivityModel:getInstance():getOneActRewardList(self.base_type,self.sub_type)
self.tab_list = self.model:GetDailyRechargeTabList( self.sub_type )
if (not self.tab_list) or (not self.act_list) then return end
-------------------------
local grade = self.tab_list[#self.tab_list].grade
local condition_list_1 = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 1, "condition_list")--条件列表
local need_add = self.model:GetConditionInfo(condition_list_1,"show_gold")--需要充值额
local today_add = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 1, "progress")--今日已经充值
self.show_tab_extra = tonumber(today_add) >= tonumber(need_add)
if self.wait_change_next_time then
if TimeUtil:getServerTime() - self.wait_change_next_time <= 2 then
self.first_open = true
end
end
if self.first_open then
--(0未达成 1未领 2已领)
--玩家打开界面时如果有可领取的档位,则默认焦距在最小的可领取档位,如无可领取档位,则聚焦在玩家未达成的最小档位
local min_can_get = false
local min_no_get = false
for i,v in pairs(self.tab_list) do
if i == 5 and (not self.show_tab_extra) then
--消费够了,但是充值不够,隐藏页签不开
else
local status_1 = self.model:GetInfoFromActList(self.act_list.reward_list, v.grade, 1, "status")--领取状态
local status_2 = self.model:GetInfoFromActList(self.act_list.reward_list, v.grade, 2, "status")--领取状态
if not min_can_get then
if (status_1 == 1) or (status_2 == 1) then
min_can_get = i
end
end
if (status_1 == 0) or (status_2 == 0) then
min_no_get = i
end
end
end
-------------------------
self.select_index = false
self.select_index = min_can_get
self.select_index = self.select_index or min_no_get
self.select_index = self.select_index or 4
-------------------------
self.first_open = false
end
end
function DailyRechargeSubView:UpdateView( )
if not self.is_loaded then return end
self:CheckShowNum()
self:RefreshLeft()
self:RefreshMid()
self:RefreshRed()
if self.swith_tab_index ~= self.select_index then
self.swith_tab_index = self.select_index
self:PlaySwithTabAnim()
end
end
function DailyRechargeSubView:RefreshLeft( )
--奖励配置
local tab_len = self.show_tab_extra and 5 or 4
for i=1,tab_len do
local name_list = self.tab_list[i] and Split(self.tab_list[i].name,"@") or {"",""}
if self.select_index == i then
self["lb_" .. i .. "_tmp"].text = ""
self["lb_" .. i .. "_cur_tmp"].text = name_list[1] or ""
else
self["lb_" .. i .. "_tmp"].text = name_list[1] or ""
self["lb_" .. i .. "_cur_tmp"].text = ""
end
self["tab_name" .. i .. "_tmp"].text = name_list[2] or ""
end
self.di_select_obj:SetActive(true)
local pos_x,pos_y = GetAnchoredPosition(self["di_tab_"..self.select_index])
SetAnchoredPositionY(self.di_select.transform, pos_y+1)
lua_resM:setImageSprite(self, self.di_select_img, "dailyRecharge_asset", self.select_index >= 4 and "dailyRecharge_di_66" or "dailyRecharge_di_6")
local scroll_pos_x,scroll_pos_y = GetAnchoredPosition(self.tabCon)
SetAnchoredPositionY(self.tabCon.transform, self.select_index==5 and 90 or scroll_pos_y)
self.tabScroll_scroll.enabled = self.show_tab_extra
self.lb_5_obj:SetActive(self.show_tab_extra)
self.di_tab_5_obj:SetActive(self.show_tab_extra)
self.tab_name5.gameObject:SetActive(self.show_tab_extra)
if not self.show_tab_extra then
self.lb_5_cur_tmp.text = ""
end
end
function DailyRechargeSubView:RefreshMid( )
if (not self.act_list) or (not self.tab_list) then return end
local grade = self.tab_list[self.select_index].grade
self.nameText_tmp.text = Trim(self.tab_list[self.select_index].desc)
--(0未达成 1未领 2已领)
local status_1 = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 1, "status")--领取状态
local status_2 = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 2, "status")--领取状态
local condition_list_1 = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 1, "condition_list")--条件列表
local condition_list_2 = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 2, "condition_list")--条件列表
local have_get_add = status_1 == 2--已领取1
local today_add = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 1, "progress")--今日已经充值
local need_add = self.model:GetConditionInfo(condition_list_1,"gold")--需要充值额
self:ClearUIEffect(self.goBtnEffect)
if tonumber(today_add) >= tonumber(need_add) then
self.lb_des_1_tmp.text = "<color=#2cf89a>今日已达标</color>"
SetImageGray( self.btn_1_img, have_get_add )
self.lb_btn_1_tmp.text = have_get_add and "已领取" or "领取"
SetTMPSharedMaterial(self.lb_btn_1_tmp, have_get_add and ShaderTools.TMPSharedMaterialType.FZZZOutlineDarkGrayBtn or ShaderTools.TMPSharedMaterialType.FZZZOutlineDarkOrangeBtn)
else
-- self.lb_des_1_tmp.text = string.format( "今日充值:%s %d / %s",
-- WordManager:GetMoneyFaceStr( 1 ), today_add, HtmlColorTxt( need_add , '#fdffc2') )
self.lb_des_1_tmp.text = string.format( "还需充值:%s <size=115%%>%s</size>",
WordManager:GetMoneyFaceStr( 1 ), HtmlColorTxt(need_add - today_add, ColorUtil.GREEN_DARK))
SetImageGray( self.btn_1_img, false )
self.lb_btn_1_tmp.text = "充点小钱"
SetTMPSharedMaterial(self.lb_btn_1_tmp, ShaderTools.TMPSharedMaterialType.FZZZOutlineDarkOrangeBtn)
end
if status_1 ~= 2 then
self:AddUIEffect("ui_icon02", self.goBtnEffect, self.layer_name, Vector3(0, 0, 0), 1, true)
end
self.red_mid_1_obj:SetActive(status_1 == 1)
self.pelletBtnRed_obj:SetActive(self.model:GetPelletRed())
--这里展示聚焦特效逻辑
self:ClearUIEffect(self.awardEffect)
local need_show_jujiao_effect = true
if status_1 == 2 or not self.model.need_show_daily_recharge_effect or self.select_index ~= 4 then
need_show_jujiao_effect = false
else
local cookie_bool = self.model:GetDailyActCookie(self.model.need_show_daily_recharge_effect)
if not cookie_bool then
self.model:SetDailyActCookie(self.model.need_show_daily_recharge_effect)
else
need_show_jujiao_effect = false
end
self.model.need_show_daily_recharge_effect = false
end
if need_show_jujiao_effect then
self:AddUIEffect("ui_jujiaodianji", self.awardEffect, "Activity", Vector3(39,-39,0), 1, true)
end
local function get_start_x( goods_num )
local off_x = 7
if goods_num <= 6 then
off_x = off_x + (6-goods_num) * 51 + 5
end
return off_x
end
local show_list_1 = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 1, "reward_info")
self.award_item_con_1 = self.award_item_con_1 or self:AddUIComponent(UI.ItemListCreator)
-- data_list = sort_award(show_list_1),
self.mode_goods = show_list_1[1]
local tab_info_list = {
data_list = show_list_1,
item_con = self.Content_1,
scroll_view = self.scroll_1,
obj_pool_type = UIObjPool.UIType.AwardItem,
item_width = 78,
item_height = 78,
start_x = 14,
start_y = -17,
space_x = 16,
space_y = 15,
create_frequency = 0.01,
show_col = 4,
alignment = UnityEngine.TextAnchor.UpperLeft,
on_update_item = function(item, i, v)
item:SetIsAct(true)
item:SetDataWithMapId(v.goods_id, v.goods_count, v.goods_kind)
item:SetItemSize(78, 78)
if (self.select_index == 4 or self.select_index == 5) and i == 1 then
item:SetNumLimitVisible(true,32)
else
item:SetNumLimitVisible(false)
end
if i == 1 and self.select_index == 4 and need_show_jujiao_effect then
local function call_back( target,x,y )
self:ClearUIEffect(self.awardEffect)
UIToolTipMgr:getInstance():AppendGoodsTips(v.goods_id, x, y,nil,nil,nil,nil,true)
end
item:SetCallBack(call_back)
end
end,
}
self.award_item_con_1:UpdateItems(tab_info_list)
-------------------------
if self.tab_list[self.select_index] and self.tab_list[self.select_index].condition_list then
local conditon = self.tab_list[self.select_index].condition_list
local show_data = nil
for i,v in ipairs(conditon) do
if v[1] == "show" then
show_data = v
elseif v[1] == "show_bg_res" then
lua_resM:setOutsideImageSprite(self, self.showBg_img, GameResPath.GetRechargeActivityImage(Trim(v[2])), true)
end
end
if show_data then
self:UpdateModelCon(show_data)
else
self:UpdateImage()
end
end
end
function DailyRechargeSubView:RefreshRed( )
if (not self.act_list) or (not self.tab_list) then return end
local tab_len = self.show_tab_extra and 5 or 4
local index = false
local grade = false
local status_1 = false
local status_2 = false
for i=1,tab_len do
grade = self.tab_list[i].grade
status_1 = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 1, "status")--领取状态
status_2 = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 2, "status")--领取状态
self["red_" .. i .. "_obj"]:SetActive(status_1 == 1 or status_2 == 1)
end
if not self.show_tab_extra then
self.red_5_obj:SetActive(false)
end
end
function DailyRechargeSubView:__delete( )
self:ClearUIEffect(self.awardEffect)
self:ClearUIEffect(self.goBtnEffect)
self:StopSwithTabAnim()
self:DeleteDressEffect()
self:ClearUIEffect(self.effect)
self:StopAnim()
end
function DailyRechargeSubView:UpdateImage( )
self.roleCon_obj:SetActive(false)
self.imgCon_obj:SetActive(true)
self.dressCon_obj:SetActive(true)
self.bubbleCon.gameObject:SetActive(false)
self.designationImg.gameObject:SetActive(false)
self.headCon.gameObject:SetActive(false)
if self.mode_goods and self.mode_goods.goods_id then
local goods_base_vo = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.mode_goods.goods_id)
if goods_base_vo and goods_base_vo.goods_icon then
if self.enlarge == 1 then--自动放大
local is_design = false
for k,v in pairs(Config.Dsgt) do
if v.goods_id == goods_base_vo.goods_icon then
is_design = true
break
end
end
if is_design then
local designation_id = DesignationModel:GetInstance():GetDesignationIdByGoodsId(goods_base_vo.goods_icon)
lua_resM:setOutsideImageSprite(self, self.imgCon_img, GameResPath.GetDesignImage(designation_id))
SetSizeDelta(self.imgCon,256,105)
else
lua_resM:setOutsideImageSprite(self, self.imgCon_img, GameResPath.GetGoodsIcon(goods_base_vo.goods_icon))
SetSizeDelta(self.imgCon,200,200)
end
else
if LimitGiftConst.ResByGoodsId[self.mode_goods.goods_id] then
local resname = LimitGiftConst.ResByGoodsId[self.mode_goods.goods_id]
lua_resM:setOutsideImageSprite(self, self.imgCon_img, GameResPath.GetLimitGiftImage(resname),true)
end
end
end
end
end
--图片上下移动
function DailyRechargeSubView:ArrowAnimation(time)
self:StopAnim()
local call_fun = function ()
local function onCompleted()
self:ArrowAnimation(time)
end
self.dsgcon_move_up_id = TweenLite.to(self, self.dressCon, TweenLite.UiAnimationType.POSY, self.up_dsg_pos, 1.2, onCompleted)
end
local onDelay = function( )
self.dsg_con_move_down_id = TweenLite.to(self, self.dressCon, TweenLite.UiAnimationType.POSY, self.down_dsg_pos, 1.2, call_fun)
end
self.dsg_move_delay_id = setTimeout(onDelay, time)
end
function DailyRechargeSubView:StopAnim()
if self.dsg_con_move_down_id then
TweenLite.Stop(self.dsg_con_move_down_id)
self.dsg_con_move_down_id = nil
end
if self.dsgcon_move_up_id then
TweenLite.Stop(self.dsgcon_move_up_id)
self.dsgcon_move_up_id = nil
end
if self.dsg_move_delay_id then
GlobalTimerQuest:CancelQuest(self.dsg_move_delay_id)
self.dsg_move_delay_id = nil
end
end
--更新模型
function DailyRechargeSubView:UpdateModelCon( figure_data )
if figure_data then
local show_type = tonumber(figure_data[2])
self.imgCon_obj:SetActive(show_type == 1)
self.roleCon_obj:SetActive(show_type == 2)
self.dressCon_obj:SetActive(show_type == 3 or show_type == 1)
if show_type == 1 then -- 展示图片
self.bubbleCon.gameObject:SetActive(false)
self.designationImg.gameObject:SetActive(false)
self.headCon.gameObject:SetActive(false)
elseif show_type == 2 then -- 展示模型
local model_cfg = CustomActivityModel:getInstance():GetActModelConShowCfg(self.base_type,tonumber(figure_data[3]),tonumber(figure_data[4]))
local scale = model_cfg and model_cfg.scale or 200
local position = model_cfg and model_cfg.position or Vector3(0,0,-300)
local career = RoleManager.Instance.mainRoleInfo.career
if tonumber(figure_data[3]) == FuncOpenModel.TypeId.FWeapon then--武器位置调高一点
if career == 3 or career == 4 then
scale = scale*1.7
position = Vector3(0,0,-300)
end
end
if figure_data[1] == "show" then
local res_data = {
father_node = self,
transform = self.roleCon,
fashion_type = tonumber(figure_data[3]),
raycast_size = Vector2(0,0),
scale = scale,
figure_id = tonumber(figure_data[4]),
position = position,
layer_name = self.layer_name,
ui_model_type = UIModelCommon.ModelType.Model,
show_shadow = false,
use_bloom = false,
}
FuncOpenModel:getInstance():SetModelRes(res_data)
else
end
elseif show_type == 3 then -- 展示称号/气泡/头像
local dress_type = tonumber(figure_data[3])
self.bubbleCon.gameObject:SetActive(dress_type == FuncOpenModel.DressTypeId.Pupple)
self.designationImg.gameObject:SetActive(dress_type == FuncOpenModel.DressTypeId.Design)
self.headCon.gameObject:SetActive(dress_type == FuncOpenModel.DressTypeId.RoleHead or dress_type == FuncOpenModel.DressTypeId.Head)
if dress_type == FuncOpenModel.DressTypeId.Design then--称号
self:UpdateDesignShow(figure_data)
elseif dress_type == FuncOpenModel.DressTypeId.Head then--头像框
self:UpdateHead(figure_data)
elseif dress_type == FuncOpenModel.DressTypeId.RoleHead then--头像
self:UpdateRoleHead(figure_data)
elseif dress_type == FuncOpenModel.DressTypeId.Pupple then--气泡
self:UpdatePupple(figure_data)
end
end
else
-- 什么都不展示的话,就可以发现问题
self.imgCon_obj:SetActive(false)
self.roleCon_obj:SetActive(false)
self.dressCon_obj:SetActive(false)
end
end
-- 更新称号效果
function DailyRechargeSubView:UpdateDesignShow(dsg_data)
local data = {
parent = self,
dress_id = dsg_data[4],
designationImg = self.designationImg,
}
FuncOpenModel:getInstance():ShowDesign(data)
end
--更新头像框
function DailyRechargeSubView:UpdateHead( dsg_data )
if not self.mainRoleHeadItem then
self.mainRoleHeadItem = HeadRoleItem.New(self.headCon)
self.mainRoleHeadItem:SetItemSize(180,180)
end
local data = {
parent = self,
dress_id = dsg_data[4],
mainRoleHeadItem = self.mainRoleHeadItem,
}
FuncOpenModel:getInstance():ShowHead(data)
end
--更新头像
function DailyRechargeSubView:UpdateRoleHead( dsg_data )
if not self.mainRoleHeadItem then
self.mainRoleHeadItem = HeadRoleItem.New(self.headCon)
self.mainRoleHeadItem:SetItemSize(180,180)
end
local data = {
parent = self,
dress_id = dsg_data[4],
mainRoleHeadItem = self.mainRoleHeadItem,
}
FuncOpenModel:getInstance():ShowRoleHead(data)
end
--更新气泡
function DailyRechargeSubView:UpdatePupple( dsg_data )
SetSizeDelta(self.bubbleCon, 250, 70)
local data = {
parent = self,
dress_id = dsg_data[4],
bubbleCon = self.bubbleCon,
}
FuncOpenModel:getInstance():ShowBubble(data)
end
function DailyRechargeSubView:DeleteDressEffect( )
if self.designationImg then
cc.ActionManager:getInstance():removeAllActionsFromTarget(self.designationImg.transform)
end
if self.mainRoleHeadItem ~= nil then
self.mainRoleHeadItem:DeleteMe()
self.mainRoleHeadItem = nil
end
end
--设置方法回调
function DailyRechargeSubView:SetFuncCallBack( pellet_call_back,close_call_back )
self.pellet_call_back = pellet_call_back
self.close_call_back = close_call_back
end
-- 播放切换页签动画
function DailyRechargeSubView:PlaySwithTabAnim( )
self:StopSwithTabAnim()
-- 隐藏并调整目标节点
self.showBg_img.color = Color(1,1,1,0)
local offer_x = KfActivityConst.LimitShopOfferX + 50
SetAnchoredPositionX(self.showBg, -78 - offer_x)
-- 进度百分比回调
local function cg_callback(percent)
self.showBg_img.color = Color(1,1,1,percent)
SetAnchoredPositionX(self.showBg, -78 + offer_x * (percent - 1))
end
local pec_action = cc.CustomUpdate.New(KfActivityConst.LimitShopTime+0.1, cg_callback)
cc.ActionManager:getInstance():addAction(pec_action, self.showBg)
end
function DailyRechargeSubView:StopSwithTabAnim( )
if self.is_loaded then
cc.ActionManager:getInstance():removeAllActionsFromTarget(self.showBg)
end
end