|
|
- -- <*
- -- @Author: Saber
- -- @Description: 招财猫活动主界面
- -- *>
- FortuneCatMainView = FortuneCatMainView or BaseClass(BaseView)
- local FortuneCatMainView = FortuneCatMainView
- local cos = math.cos
- local sin = math.sin
- local rad = math.rad
- local deg = math.deg
- local Quaternion = Quaternion
- local TweenFunc = TweenFunc
- local ClampAngleType2 = ClampAngleType2
-
- function FortuneCatMainView:__init()
- self.base_file = "fortuneCat"
- self.layout_file = "FortuneCatMainView"
- self.layer_name = "UI"
- self.destroy_imm = true
- self.use_background = true --全屏界面默认使用这个参数,非全屏界面自行设置
- self.blur_activity_bg = false
- self.use_show_anim = true
- self.use_hide_anim = true
- self.hide_maincancas = false
- self:AddPreLoadList("fortuneCat", {"FortuneCatRecordItem"})
- self.need_refresh_roll_item = false -- 是否需要等待33219协议刷新
- self.can_roll = false -- 是否可以抽奖
- self.recharge_cost = nil -- 本次抽奖的扣除多少彩钻
- self.recharge_condi = nil -- 本次抽奖的累充需求
- self.item_pos_radius = 190 -- 抽奖节点分布在容器内的分布半径
- self.roll_item_list = {} -- 抽奖节点列表
- self.record_item_list = {} -- 抽奖记录节点列表
- self.in_rolling_anim = false -- 是否正在抽奖动画中
- self.roll_btn_has_effect = false -- 抽奖按钮是否已经有特效了
- self.temp_target_id = nil -- 用于在抽取过程中关闭界面直接弹出获奖信息
- self.temp_roll_cost = nil -- 缓存本次抽奖的花费
- self.tab_index = 1 -- 默认显示全服记录
- self.has_update_record = false -- 是否已经更新了一次招财记录
- self.model = FortuneCatModel:getInstance()
- self.model._is_fc_view_open = true
- self.skip_anim = self.model._skip_anim_cache -- 是否跳过动画缓存
- self.ca_model = CustomActivityModel:getInstance()
- self.open_guide_close = true
- self.load_callback = function ()
- self:LoadSuccess()
- self:AddEvent()
- self.model:ShutDownFcLoginRed(self.sub_type)
- self.model:Fire(FortuneCatModel.REQUEST_CCMD_EVENT, 33220, self.base_type, self.sub_type)
- self.model:Fire(FortuneCatModel.REQUEST_CCMD_EVENT, 33222, self.base_type, self.sub_type)
- end
- self.open_callback = function ( )
- self:UpdateView()
- self:StartLightAnim()
- end
- self.destroy_callback = function ( )
- self:DestroySuccess()
- -- 抽奖过程中关闭界面直接弹出结果
- if self.in_rolling_anim then
- self.model:ShowDrawRewardEffect(self.fc_cfg, self.temp_target_id, self.temp_roll_cost)
- end
- self.model._skip_anim_cache = self.skip_anim
- self.model._is_fc_view_open = false
- end
- end
-
- -- 定制活动子类型
- function FortuneCatMainView:Open(sub_type)
- self.base_type = CustomActivityModel.CustomActBaseType.FORTUNE_CAT
- self.sub_type = sub_type
- BaseView.Open(self)
- end
-
- function FortuneCatMainView:LoadSuccess()
- local nodes = {
- "bg:raw", "close_btn:obj", "money_node", "bg/spin_selected:obj",
- "skip_anim_tog:obj:tog", -- 跳过动画tog
- "ad_img2:obj", -- 广告词2,需要根据条件拉伸
- "ad_img3:obj",
- "ad_img4:obj", "ad_img4/ad_tip4:tmp",
- "light_con_r", "light_con_y", -- 闪光容器
- -- 抽奖记录容器
- "record_scroll",
- "record_scroll/Viewport/record_con",
- "no_record:tmp",
- -- 招财按钮相关
- "roll_btn:obj:img",
- "roll_btn/roll_btn_effect",
- "roll_btn/roll_spin",
- "roll_btn/cost_icon:obj:img",
- "roll_btn/btn_lb1:tmp",
- "roll_btn/roll_cost:tmp",
- "roll_btn/roll_finished:tmp",
- -- 奖品节点
- "item_con",
- -- 招财记录tab
- "record_tab1:obj:img",
- "record_tab2:obj:img",
- "record_tab1/record_tab1_lb:tmp",
- "record_tab2/record_tab2_lb:tmp",
- -- 招财剩余次数
- "roll_left_time:tmp",
- -- 活动剩余时间
- "left_time:tmp",
- -- 招财条件
- "buy_condition:tmp",
- }
- self:GetChildren(nodes)
- self.roll_spin.localRotation = Quaternion.Euler(0, 0, -22.5)
- self.spin_selected_obj:SetActive(false)
- -- 特殊背景节点
- self.special_bg_list = {}
- -- for i = 1, 8 do
- -- self.special_bg_list[i] = {}
- -- self.special_bg_list[i].obj = self:GetChild("bg/special_bg" .. i).gameObject
- -- end
- self.skip_anim_tog_tog.isOn = self.skip_anim
- -- 货币栏
- self.ui_money_view = UIMoneyView.New(self.money_node)
- self.ui_money_view:SetPosition(0,0)
- self.ui_money_view:SetData()
- self.ui_money_view:ChangeShowFlag("smallWindow2")
- self.ui_money_view:ShowMoneyEffect(false)
-
- -- 修改页签文本
- self.record_tab1_lb_tmp.text = "全服记录"
- self.record_tab2_lb_tmp.text = "个人记录"
- self.ad_tip4_tmp.text = "限定次数<color=#fdffc2>彩钻翻倍</color>,财运滚滚来!"
- lua_resM:setOutsideRawImage(self, self.bg_raw, GameResPath.GetViewBigBg("fc_main_bg"), false)
- end
-
- function FortuneCatMainView:AddEvent()
- local function click_event(target)
- if target == self.close_btn_obj then
- self:Close()
- elseif target == self.roll_btn_obj then
- self:OnRollBtnClicked()
- elseif target == self.record_tab1_obj then
- self:OnRecordTabClick(1)
- elseif target == self.record_tab2_obj then
- self:OnRecordTabClick(2)
- elseif target == self.skip_anim_tog_obj then
- self.skip_anim = self.skip_anim_tog_tog.isOn
- end
- end
- AddClickEvent(self.close_btn_obj, click_event, LuaSoundManager.SOUND_UI.NONE)
- AddClickEvent(self.roll_btn_obj, click_event)
- AddClickEvent(self.record_tab1_obj, click_event, LuaSoundManager.SOUND_UI.SWITCH)
- AddClickEvent(self.record_tab2_obj, click_event, LuaSoundManager.SOUND_UI.SWITCH)
- AddClickEvent(self.skip_anim_tog_obj, click_event, LuaSoundManager.SOUND_UI.SWITCH)
-
- -- 活动配置更新之后要马上刷新整个界面
- local function update_after_config_updated()
- self:UpdateView()
- end
- self:BindEvent(self.model, FortuneCatModel.UPDATE_FORTUNE_CAT_CONFIG, update_after_config_updated)
-
- local function update_roll_event_data(sub_type)
- if sub_type == self.sub_type then
- self:UpdateFcRollInfo()
- end
- end
- self:BindEvent(self.model, FortuneCatModel.UPDATE_FORTUNE_CAT_ROLL_TIME, update_roll_event_data)
-
- local function roll_succeed_func(vo)
- if vo and vo.sub_type == self.sub_type then
- self.in_rolling_anim = true
- self:ClearUIEffect(self.roll_btn_effect)
- self.roll_btn_has_effect = false
- self.temp_target_id = vo.sort
- self.temp_roll_cost = self.recharge_cost
- self:StartRollItemAnim(vo.sort)
- end
- -- debug
- -- self:StartRollItemAnim(math.floor(math.random(1, 8)))
- end
- self:BindEvent(self.model, FortuneCatModel.UPDATE_FORTUNE_CAT_RESULT, roll_succeed_func)
-
- local function update_fc_record(sub_type)
- -- if sub_type == self.sub_type and not self.has_update_record then
- -- self.has_update_record = true
- if sub_type == self.sub_type then
- self:UpdateFcRecord()
- end
- end
- self:BindEvent(self.model, FortuneCatModel.UPDATE_FORTUNE_CAT_ROLL_RECORD, update_fc_record)
- end
-
- function FortuneCatMainView:UpdateView()
- self:UpdateFcEventData()
- self:CreateRollItems()
- self:OnRecordTabClick()
- end
-
- -- 播放闪光动画
- function FortuneCatMainView:StartLightAnim( )
- if not self.light_anim_action then
- cc.ActionManager:getInstance():removeAllActionsFromTarget(self.light_con_r)
- local target_scale_x = 1
- local function scale_action()
- SetLocalScale(self.light_con_r, target_scale_x, 1, 1)
- SetLocalScale(self.light_con_y, target_scale_x * -1, 1, 1)
- target_scale_x = target_scale_x * -1
- end
- local delay_action = cc.DelayTime.New(1)
- local anim_action = cc.Sequence.New(delay_action, cc.CallFunc.New(scale_action))
- self.light_anim_action = cc.RepeatForever.New(anim_action)
- cc.ActionManager:getInstance():addAction(self.light_anim_action, self.light_con_r)
- end
- end
-
- -- 点击记录页签回调 tab_index:1全服记录 2个人纪录
- function FortuneCatMainView:OnRecordTabClick(tab_index)
- self.tab_index = tab_index or self.tab_index
- -- 调整按钮表现
- lua_resM:setImageSprite(self, self.record_tab1_img, "fortuneCat_asset", self.tab_index == 1 and "fc_rank_tab2" or "fc_rank_tab1", true)
- lua_resM:setImageSprite(self, self.record_tab2_img, "fortuneCat_asset", self.tab_index == 2 and "fc_rank_tab2" or "fc_rank_tab1", true)
- self.record_tab1_lb_tmp.color = ColorUtil:ConvertHexToRGBColor(self.tab_index == 1 and "ffffff" or "dadafe")
- self.record_tab2_lb_tmp.color = ColorUtil:ConvertHexToRGBColor(self.tab_index == 2 and "ffffff" or "dadafe")
- -- 更新排行数据
- self:UpdateFcRecord()
- end
-
- -- 更新招财猫活动主要信息
- function FortuneCatMainView:UpdateFcEventData( )
- self.event_data = self.ca_model:getActList(self.base_type, self.sub_type)
- self:ClearEventLeftTimeId()
- if not self.event_data then return end
- local function left_time_func()
- local left_time = self.event_data.etime - TimeUtil:getServerTime()
- if left_time > 0 then
- self.left_time_tmp.text = string.format("活动剩余:<color=%s>%s</color>",
- ColorUtil.GREEN_DARK, TimeUtil:qianggouTimeLeft2(left_time))
- else
- self.left_time_tmp.text = string.format("活动剩余:<color=%s>已结束</color>", ColorUtil.RED_DARK)
- self:ClearEventLeftTimeId()
- end
- end
- self.event_left_time_id = GlobalTimerQuest:AddPeriodQuest(left_time_func, 0.5, -1)
- left_time_func()
- -- 更新招财猫抽奖相关信息
- self:UpdateFcRollInfo()
- end
-
- -- 更新招财猫抽奖相关信息
- function FortuneCatMainView:UpdateFcRollInfo( )
- self.roll_time_data = self.model:GetFortuneCatRollTimes(self.base_type, self.sub_type)
- self.fc_cfg = self.model:GetFortuneCatConfig(self.base_type, self.sub_type)
- -- print("Saber:FortuneCatMainView [start:216] self.fc_cfg ------------------------------------------")
- -- PrintTable(self.fc_cfg)
- -- 确保这两个数据都有了才加载
- if self.roll_time_data and self.fc_cfg then
- -- 先判断是否已经抽完了
- local is_finished = self.fc_cfg.max_times <= self.roll_time_data.times
- -- 这个次数是已抽次数,前端获取配置时要+1
- local roll_time = is_finished and self.roll_time_data.times or self.roll_time_data.times + 1
- local time_cfg = self.fc_cfg.confs[roll_time]
- -- 获取目前充值额度下,还能转盘几次
- local left_roll_time = 0
- -- 需要额外充值多少获得转盘次数
- local need_dia = nil
- if not is_finished then
- for i = roll_time, self.fc_cfg.max_times do
- if self.roll_time_data.recharge >= self.fc_cfg.confs[i].recharge then
- left_roll_time = left_roll_time + 1
- else
- need_dia = self.fc_cfg.confs[i].recharge - self.roll_time_data.recharge
- break
- end
- end
- end
- -- 抽奖按钮
- self.btn_lb1_tmp.text = is_finished and "" or "投入"
- self.roll_cost_tmp.text = is_finished and "" or time_cfg.cost
- self.roll_finished_tmp.text = is_finished and "已转完" or ""
- self.cost_icon_obj:SetActive(not is_finished)
- SetImageGray(self.roll_btn_img, is_finished)
- -- 居中对齐货币icon和花费
- local len1 = self.cost_icon.sizeDelta.x
- local len2 = self.roll_cost_tmp.preferredWidth
- local offset_x = (161 - len1 - len2 - 2) / 2
- SetAnchoredPositionX(self.cost_icon, offset_x)
- SetAnchoredPositionX(self.roll_cost, self.cost_icon.anchoredPosition.x + len1 + 2)
- -- 剩余次数
- self.roll_left_time_tmp.text = string.format("当前可转盘次数:<color=%s>%s次</color>",
- left_roll_time == 0 and ColorUtil.RED_DARK or ColorUtil.GREEN_DARK,
- left_roll_time)
- -- 是否已经获得了所有转盘次数
- local get_all_times = left_roll_time + self.roll_time_data.times >= self.fc_cfg.max_times
- self.ad_img2_obj:SetActive(not get_all_times)
- self.ad_img3_obj:SetActive(not get_all_times)
- self.ad_img4_obj:SetActive(get_all_times)
- -- 右下方条件文本
- self.buy_condition_tmp.text = get_all_times and ""
- or (need_dia and string.format("%s彩钻", need_dia > 0 and need_dia or 0) or "")
- -- SetSizeDeltaX(self.ad_img2, self.buy_condition_tmp.preferredWidth + 112)
- -- 做一个可抽奖的缓存,不可抽奖的时候不发协议
- self.can_roll = left_roll_time > 0
- self.recharge_cost = not is_finished and tonumber(time_cfg.cost) or nil
- self.recharge_condi = not is_finished and tonumber(time_cfg.recharge) or nil
- -- 添加特效
- if not self.in_rolling_anim and self.can_roll
- and self.recharge_cost and GoodsModel:getInstance():IsJinEnough(self.recharge_cost) then
- if not self.roll_btn_has_effect then
- self:AddUIEffect("ui_bianqiang", self.roll_btn_effect, self.layer_name, nil, {x=2.7,y=2.7}, true, nil, nil, nil, nil, nil)
- self.roll_btn_has_effect = true
- end
- else
- self:ClearUIEffect(self.roll_btn_effect)
- self.roll_btn_has_effect = false
- end
- end
- end
-
- function FortuneCatMainView:ClearEventLeftTimeId( )
- if self.event_left_time_id then
- GlobalTimerQuest:CancelQuest(self.event_left_time_id)
- self.event_left_time_id = nil
- end
- end
-
- -- 创建招财猫抽奖用节点
- function FortuneCatMainView:CreateRollItems( )
- self.fc_cfg = self.fc_cfg or self.model:GetFortuneCatConfig(self.base_type, self.sub_type)
- -- local function special_bg_callback(index, show)
- -- if self.special_bg_list[index] then
- -- self.special_bg_list[index].obj:SetActive(show)
- -- end
- -- end
- if self.fc_cfg then
- local item_data = self.fc_cfg.rebacks
- local item_num = TableSize(item_data)
- local angle_offset = 360 / item_num
- local start_angle = 90 - angle_offset / 2
- local rad_start_angle
- local item
- for k, v in ipairs(item_data) do
- item = self.roll_item_list[k]
- if not item then
- item = FortuneCatRollItem.New(self.item_con)
- self.roll_item_list[k] = item
- end
- rad_start_angle = rad(start_angle)
- -- 坐标设置:y正向为起点顺时针分布
- item:SetAnchoredPosition(self.item_pos_radius * cos(rad_start_angle), self.item_pos_radius * sin(rad_start_angle))
- -- item:SetData(v, k, special_bg_callback)
- item:SetData(v, k)
- item._angle = start_angle
- -- 变换角度
- start_angle = ClampAngleType2(start_angle - angle_offset)
- end
-
- self.need_refresh_roll_item = false
- else
- self.need_refresh_roll_item = true
- end
- end
-
- -- 创建招财猫服务器记录
- function FortuneCatMainView:UpdateFcRecord( )
- -- 创建的时候要暂停动画
- self:StopRecordItemAction()
- -- 追加字段,判断是否获取个人记录
- local record_list = self.model:GetFortuneCatRollRecord(self.base_type, self.sub_type, self.tab_index == 2)
- for k, v in pairs(self.record_item_list) do
- v:SetVisible(false)
- end
- -- 节点高度
- local max_item_num = 20 -- 最大节点数
- local node_height = self.record_scroll.sizeDelta.y
- local height = 0
- local item
- self.record_count = 0
- for k, v in ipairs(record_list) do
- if k > max_item_num then
- break
- end
- item = self.record_item_list[k]
- if not item then
- item = FortuneCatRecordItem.New(self.record_con)
- self.record_item_list[k] = item
- end
- item:SetAnchoredPosition(2, -height)
- item:SetVisible(true)
- height = height + item:SetData(v, self.sub_type)
- self.record_count = self.record_count + 1
- end
- self.no_record_tmp.text = self.record_count == 0 and "暂无记录" or ""
- SetSizeDeltaY(self.record_con, height)
- -- 记录一下当前的节点数
- -- 生成节点的高度超过了容器高度,就需要展示轮播
- if height > node_height then
- self:StartRecordItemAction()
- end
- end
-
- -- 招财记录动画相关
- -- 招财记录动画相关
- -- 招财记录动画相关
- -- 开始轮播招财记录动画
- function FortuneCatMainView:StartRecordItemAction()
- self:StopRecordItemAction()
- local time = FortuneCatModel.RecordAnimDuration
- local function func()
- self:UpdateRecordItemPos()
- self:MoveRecordItem()
- end
- self.auto_record_item_anim_id = GlobalTimerQuest:AddPeriodQuest(func, time, -1)
- end
-
- function FortuneCatMainView:StopRecordItemAction()
- if self.auto_record_item_anim_id then
- GlobalTimerQuest:CancelQuest(self.auto_record_item_anim_id)
- self.auto_record_item_anim_id = nil
- end
- self:StopRecordItemAnim()
- end
-
- -- 播放招财记录节点的动画
- function FortuneCatMainView:MoveRecordItem()
- local first_text = self.record_item_list[1]
- local move_height = first_text:GetAnchoredPosition().y
- move_height = move_height > 0 and 0 or move_height
- for k,text in pairs(self.record_item_list) do
- text:StartAction(move_height)
- end
- end
-
- -- 停止招财记录节点的动画
- function FortuneCatMainView:StopRecordItemAnim()
- for k,text in pairs(self.record_item_list) do
- text:StopAction()
- end
- end
-
- function FortuneCatMainView:UpdateRecordItemPos()
- local delete_index = {}
- local height = 0
- local count = 0
- for i = 1, self.record_count do
- local text = self.record_item_list[i]
- if text then
- local vis = text:GetVisible()
- local h = text:GetRecordHeight()
- local y = text:GetAnchoredPosition().y
- height = height + (vis and h or 0)
- if y + h > 0.1 and vis then -- 将超出屏幕并显示中的节点保存到移动临时队列 0.1 由于浮点误差有可能出现不该隐藏的节点也添加到队列中,做加大误差处理
- table.insert(delete_index, i)
- end
- end
- end
-
- local del_num = 0
- local t = {}
- for i,v in ipairs(delete_index) do
- local index = v - del_num
- local text = table.remove(self.record_item_list, index)
- t[#t+1] = text
- del_num = del_num + 1
- end
-
- -- 将临时队列的节点存回去
- for i = 1, #t do
- t[i]:SetAnchoredPosition(2, -height)
- table.insert(self.record_item_list, t[i])
- end
- end
-
- -- 玩家招财动画相关
- -- 玩家招财动画相关
- -- 玩家招财动画相关
- -- 开启抽奖随机闪烁动画
- function FortuneCatMainView:StartRollItemAnim(target_id)
- cc.ActionManager:getInstance():removeAllActionsFromTarget(self.roll_spin)
- -- print("Saber:FortuneCatMainView [391] target_id: ",target_id)
- local angel = self:AnimRotateAngle(target_id)
- local anim_end_fun = function()
- self.in_rolling_anim = false
-
- self.roll_spin.localRotation = Quaternion.Euler(0, 0, angel)
- local spin_angel = math.ceil(ClampAngleType2(angel) / 45) * 45
- self.spin_selected_obj:SetActive(true)
- self.spin_selected.localRotation = Quaternion.Euler(0, 0, spin_angel)
-
- self.model:ShowDrawRewardEffect(self.fc_cfg, target_id, self.temp_roll_cost)
- self.model:Fire(FortuneCatModel.REQUEST_CCMD_EVENT, 33220, self.base_type, self.sub_type)
- self.temp_target_id = nil
- self.temp_roll_cost = nil
- self:UpdateFcRollInfo()
- -- 恢复货币更新
- if self.ui_money_view then
- self.ui_money_view:ReBindValueUpdate()
- end
- end
- self.spin_selected_obj:SetActive(false)
- local start_angel = self.roll_spin.localEulerAngles.z
- start_angel = ClampAngleType2(start_angel)
- -- 跳过动画
- if self.skip_anim then
- anim_end_fun()
- else
- -- local spin_selected_angel = self.spin_selected.localEulerAngles.z
- -- 播放动画
- local spin_action_callback = function(percent)
- -- local ratio = TweenFunc.easeInOut(percent)
- local ratio = self:AnimPercentageAmount(percent)
- local temp_angle = angel * ratio
- local temp_angle2 = start_angel * (1-ratio)
- self.roll_spin.localRotation = Quaternion.Euler(0, 0, temp_angle2 + temp_angle)
- -- 更新选中节点的旋转角度
- -- local temp_spin_angel = ClampAngleType2(temp_angle2 + temp_angle)
- -- temp_spin_angel = math.ceil(temp_spin_angel / 45) * 45
- -- if temp_spin_angel ~= spin_selected_angel then
- -- spin_selected_angel = temp_spin_angel
- -- self.spin_selected.localRotation = Quaternion.Euler(0, 0, spin_selected_angel)
- -- end
- end
- local spin_action = cc.CustomUpdate.New(FortuneCatModel.AnimTime, spin_action_callback)
- spin_action = cc.Sequence.New(spin_action, cc.CallFunc.New(anim_end_fun))
- cc.ActionManager:getInstance():addAction(spin_action, self.roll_spin)
- end
- end
-
- function FortuneCatMainView:AnimPercentageAmount(ratio)
- local div = FortuneCatModel.AnimAmountDiv
- if ratio < div then
- return div * TweenFunc.easeInQuint(ratio/div)
- else
- return (1-div) * TweenFunc.easeOutQuint((ratio-div)/(1-div)) + div
- end
- end
-
- function FortuneCatMainView:ClearRollItemDelay( )
- if self.rollItem_anim_delay_id then
- GlobalTimerQuest:CancelQuest(self.rollItem_anim_delay_id)
- self.rollItem_anim_delay_id = nil
- end
- end
- -- 获取抽中道具所在的角度,并推算出一个n圈的终点角度
- function FortuneCatMainView:AnimRotateAngle(target_id)
- local target_angle
- for k, v in ipairs(self.roll_item_list) do
- if v.sort and v.sort == target_id then -- 获取抽中档位所在的节点的角度,并做一个减少90度的偏移,求得旋转指针最后的角度
- target_angle = v._angle - 90
- end
- end
- target_angle = target_angle + math.random(-15, 15) -- 在节点范围内进行一个合理的偏移
- -- 起始角度必须先将指针的角度归零
- -- 默认转10圈,然后停在目标角度范围内
- local angle = FortuneCatModel.AnimRollTime * -360 + target_angle
- return angle
- end
-
- -- 点击招财按钮
- function FortuneCatMainView:OnRollBtnClicked( )
- if self.in_rolling_anim then
- Message.show("正在转盘中...", "falut")
- return
- end
- if self.can_roll then -- 可抽,弹出tips界面
- local function ok_callback()
- self.model:Fire(FortuneCatModel.REQUEST_CCMD_EVENT, 33221, self.base_type, self.sub_type)
- self.has_update_record = false
- -- 停用货币更新
- if self.ui_money_view then
- self.ui_money_view:UnBindAllValueUpdate()
- end
- end
-
- if GoodsModel:getInstance():IsJinEnough(self.recharge_cost) then -- 这边需要特殊处理,彩钻够了就直接发协议
- ok_callback()
- else
- local function use_function( toggle_tip_data, call_fun_sum )
- if tab_cfg.price ~= 0 then
- GlobalEventSystem:Fire(EventName.OPEN_COM_TOGGLE_TIP_VIEW, toggle_tip_data)
- else
- call_fun_sum()
- end
- end
-
- local data = {
- gold_type = 1,
- cost_price = self.recharge_cost,
- ok_callback = ok_callback,
- togglePriceStr = string.format("<color=%s>%s</color> 彩钻进行一次彩钻星轮?", ColorUtil.ORANGE_DARK, self.recharge_cost),
- use_function = use_function,
- no_need_toggle = true,
- qc_type = 0,
- }
- CustomActivityModel:getInstance():BuyTips(data)
- end
- else
- if self.recharge_cost then -- 不可抽,但是存在抽奖充值条件,则代表还有次数需飘字提示
- -- local function ok( ... )
- -- OpenFun.Open(158, 0)
- -- -- self:Close()
- -- end
- -- local ask_str = string.format("还需充值 %s<color=%s>%s</color>,才能转动彩钻星轮哦~", WordManager:GetMoneyFaceStr(1),
- -- ColorUtil.ORANGE_DARK, self.recharge_condi - self.roll_time_data.recharge)
- -- Alert.show(ask_str,Alert.Type.Two,ok,nil,"前往充值","取消")
- local qc_data = {
- price = self.recharge_condi - self.roll_time_data.recharge,
- close_callback = ok,
- qc_type = 2,
- }
- GlobalEventSystem:Fire(EventName.OPEN_RECHARGE_TIP_VIEW, true, qc_data)
- else
- Message.show("已完成本期彩钻星轮", "fault")
- end
- end
- end
-
- function FortuneCatMainView:DestroySuccess( )
- self:ClearEventLeftTimeId()
- self:ClearRollItemDelay()
- self:StopRecordItemAction()
- self:ClearUIEffect(self.roll_btn_effect)
- cc.ActionManager:getInstance():removeAllActionsFromTarget(self.roll_spin)
- cc.ActionManager:getInstance():removeAllActionsFromTarget(self.light_con_r)
- if self.ui_money_view then
- self.ui_money_view:DeleteMe()
- self.ui_money_view = nil
- end
-
- for k, v in pairs(self.roll_item_list) do
- v:DeleteMe()
- v = nil
- end
- self.roll_item_list = nil
-
- for k, v in pairs(self.record_item_list) do
- v:DeleteMe()
- v = nil
- end
- self.record_item_list = nil
- end
|