源战役客户端
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.

599 rivejä
23 KiB

4 viikkoa sitten
  1. DailyRechargeSubView = DailyRechargeSubView or BaseClass(BaseItem)
  2. local DailyRechargeSubView = DailyRechargeSubView
  3. -- DailyRechargeSubView.Width = 200
  4. -- DailyRechargeSubView.Height = 90
  5. function DailyRechargeSubView:__init(parent_wnd,prefab_asset,layer_name,sub_type)
  6. self.base_file = "dailyRecharge"
  7. self.layout_file = "DailyRechargeSubView"
  8. self.layer_name = layer_name
  9. self.model = RechargeActivityModel:getInstance()
  10. self.base_type = CustomActivityModel.CustomActBaseType.DAILY_RECHARGE
  11. self.sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(CustomActivityModel.CustomActBaseType.DAILY_RECHARGE)
  12. self.model:SetDailyRechargeLoginCookie(self.sub_type)
  13. self.model:CheckDailyRechargeMainIconRedDot(self.sub_type)
  14. self.select_index = 4
  15. self.show_tab_extra = false
  16. self.light_pos_index = {
  17. [1] = 151,
  18. [2] = 77,
  19. [3] = 5,
  20. [4] = -67,
  21. [5] = -141,
  22. }
  23. self.first_open = true
  24. self:Load()
  25. end
  26. function DailyRechargeSubView:Load_callback()
  27. self.nodes = {
  28. "scroll_1", "scroll_1/Viewport/Content_1",
  29. "lb_des_1:tmp",
  30. "btn_1:img:obj","red_mid_1:obj", "pelletBtn/pelletBtnRed:obj",
  31. "btn_1/lb_btn_1:tmp","nameText:tmp", "closeBtn:obj", "pelletBtn:obj",
  32. --页签相关
  33. "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",
  34. "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",
  35. "tabScroll/Viewport/tabCon/di_tab_5:obj",
  36. "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",
  37. "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",
  38. "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",
  39. "bg:raw", "showBg:img", "tabScroll:scroll", "tabScroll/Viewport/tabCon",
  40. --气泡头像称号相关节点
  41. "dressCon:obj","dressCon/designationImg:img:obj", "dressCon/imgCon:img:obj","dressCon/bubbleCon",
  42. "dressCon/headCon","roleCon:obj","effect:obj",
  43. "awardEffect", "btn_1/goBtnEffect",
  44. }
  45. self:GetChildren(self.nodes)
  46. lua_resM:setOutsideRawImage(self, self.bg_raw, GameResPath.GetViewBigBg("dailyRecharge_bg2"), false)
  47. -- 称号起点位置
  48. self.ori_dsg_pos = self.dressCon.anchoredPosition.y + 70
  49. SetAnchoredPositionY(self.dressCon, self.ori_dsg_pos)
  50. self.up_dsg_pos = self.ori_dsg_pos + 15
  51. self.down_dsg_pos = self.ori_dsg_pos - 15
  52. self:ArrowAnimation(0)
  53. self:AddEvents()
  54. self:UpdateView()
  55. end
  56. function DailyRechargeSubView:AddEvents( )
  57. local function call_back( target )
  58. if target == self.di_tab_1_obj then
  59. self.wait_change_next_time = nil
  60. self.select_index = 1
  61. -- self.select_index = self.show_tab_extra and self.select_index or self.select_index - 1
  62. self:UpdateView()
  63. elseif target == self.di_tab_2_obj then
  64. self.wait_change_next_time = nil
  65. self.select_index = 2
  66. -- self.select_index = self.show_tab_extra and self.select_index or self.select_index - 1
  67. self:UpdateView()
  68. elseif target == self.di_tab_3_obj then
  69. self.wait_change_next_time = nil
  70. self.select_index = 3
  71. -- self.select_index = self.show_tab_extra and self.select_index or self.select_index - 1
  72. self:UpdateView()
  73. elseif target == self.di_tab_4_obj then
  74. self.wait_change_next_time = nil
  75. self.select_index = 4
  76. -- self.select_index = self.show_tab_extra and self.select_index or self.select_index - 1
  77. self:UpdateView()
  78. elseif target == self.di_tab_5_obj then
  79. self.wait_change_next_time = nil
  80. self.select_index = 5
  81. -- self.select_index = self.show_tab_extra and self.select_index or self.select_index - 1
  82. self:UpdateView()
  83. elseif target == self.btn_1_obj then
  84. if not self.act_list then return end
  85. local grade = self.tab_list[self.select_index].grade
  86. local status_1 = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 1, "status")--领取状态
  87. if status_1 == 1 then
  88. --可领取--已领取
  89. CustomActivityModel:getInstance():Fire(CustomActivityModel.PROTO_CCMD_EVENT,33105,self.base_type,self.sub_type,grade)
  90. self.wait_change_next_time = TimeUtil:getServerTime()--一定时间内返回的更新函数会自动切换标签
  91. elseif status_1 == 2 then
  92. Message.show("该档位奖励已领取!","fault")
  93. else
  94. OpenFun.Open(450,1)
  95. end
  96. elseif target == self.closeBtn_obj then
  97. if self.close_call_back then
  98. self.close_call_back()
  99. end
  100. elseif target == self.pelletBtn_obj then
  101. if self.pellet_call_back then
  102. self.pellet_call_back()
  103. end
  104. end
  105. end
  106. AddClickEvent(self.di_tab_1_obj,call_back,false)
  107. AddClickEvent(self.di_tab_2_obj,call_back,false)
  108. AddClickEvent(self.di_tab_3_obj,call_back,false)
  109. AddClickEvent(self.di_tab_4_obj,call_back,false)
  110. AddClickEvent(self.di_tab_5_obj,call_back,false)
  111. AddClickEvent(self.btn_1_obj,call_back,false)
  112. AddClickEvent(self.closeBtn_obj,call_back,false)
  113. AddClickEvent(self.pelletBtn_obj,call_back,false)
  114. local function UPDATE_TODAY_RECHARGE_INFO( )
  115. self:UpdateView()
  116. end
  117. self:BindEvent(self.model, RechargeActivityModel.UPDATE_TODAY_RECHARGE_INFO, UPDATE_TODAY_RECHARGE_INFO)
  118. local function UPDATE_ACTIVITY_INFO( base_type )
  119. if base_type == self.base_type then
  120. self:UpdateView()
  121. end
  122. end
  123. self:BindEvent(CustomActivityModel:getInstance(), CustomActivityModel.UPDATE_ACTIVITY_INFO, UPDATE_ACTIVITY_INFO)
  124. end
  125. function DailyRechargeSubView:CheckShowNum( )
  126. self.show_tab_extra = false
  127. self.act_list = CustomActivityModel:getInstance():getOneActRewardList(self.base_type,self.sub_type)
  128. self.tab_list = self.model:GetDailyRechargeTabList( self.sub_type )
  129. if (not self.tab_list) or (not self.act_list) then return end
  130. -------------------------
  131. local grade = self.tab_list[#self.tab_list].grade
  132. local condition_list_1 = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 1, "condition_list")--条件列表
  133. local need_add = self.model:GetConditionInfo(condition_list_1,"show_gold")--需要充值额
  134. local today_add = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 1, "progress")--今日已经充值
  135. self.show_tab_extra = tonumber(today_add) >= tonumber(need_add)
  136. if self.wait_change_next_time then
  137. if TimeUtil:getServerTime() - self.wait_change_next_time <= 2 then
  138. self.first_open = true
  139. end
  140. end
  141. if self.first_open then
  142. --(0未达成 1未领 2已领)
  143. --玩家打开界面时如果有可领取的档位,则默认焦距在最小的可领取档位,如无可领取档位,则聚焦在玩家未达成的最小档位
  144. local min_can_get = false
  145. local min_no_get = false
  146. for i,v in pairs(self.tab_list) do
  147. if i == 5 and (not self.show_tab_extra) then
  148. --消费够了,但是充值不够,隐藏页签不开
  149. else
  150. local status_1 = self.model:GetInfoFromActList(self.act_list.reward_list, v.grade, 1, "status")--领取状态
  151. local status_2 = self.model:GetInfoFromActList(self.act_list.reward_list, v.grade, 2, "status")--领取状态
  152. if not min_can_get then
  153. if (status_1 == 1) or (status_2 == 1) then
  154. min_can_get = i
  155. end
  156. end
  157. if (status_1 == 0) or (status_2 == 0) then
  158. min_no_get = i
  159. end
  160. end
  161. end
  162. -------------------------
  163. self.select_index = false
  164. self.select_index = min_can_get
  165. self.select_index = self.select_index or min_no_get
  166. self.select_index = self.select_index or 4
  167. -------------------------
  168. self.first_open = false
  169. end
  170. end
  171. function DailyRechargeSubView:UpdateView( )
  172. if not self.is_loaded then return end
  173. self:CheckShowNum()
  174. self:RefreshLeft()
  175. self:RefreshMid()
  176. self:RefreshRed()
  177. if self.swith_tab_index ~= self.select_index then
  178. self.swith_tab_index = self.select_index
  179. self:PlaySwithTabAnim()
  180. end
  181. end
  182. function DailyRechargeSubView:RefreshLeft( )
  183. --奖励配置
  184. local tab_len = self.show_tab_extra and 5 or 4
  185. for i=1,tab_len do
  186. local name_list = self.tab_list[i] and Split(self.tab_list[i].name,"@") or {"",""}
  187. if self.select_index == i then
  188. self["lb_" .. i .. "_tmp"].text = ""
  189. self["lb_" .. i .. "_cur_tmp"].text = name_list[1] or ""
  190. else
  191. self["lb_" .. i .. "_tmp"].text = name_list[1] or ""
  192. self["lb_" .. i .. "_cur_tmp"].text = ""
  193. end
  194. self["tab_name" .. i .. "_tmp"].text = name_list[2] or ""
  195. end
  196. self.di_select_obj:SetActive(true)
  197. local pos_x,pos_y = GetAnchoredPosition(self["di_tab_"..self.select_index])
  198. SetAnchoredPositionY(self.di_select.transform, pos_y+1)
  199. lua_resM:setImageSprite(self, self.di_select_img, "dailyRecharge_asset", self.select_index >= 4 and "dailyRecharge_di_66" or "dailyRecharge_di_6")
  200. local scroll_pos_x,scroll_pos_y = GetAnchoredPosition(self.tabCon)
  201. SetAnchoredPositionY(self.tabCon.transform, self.select_index==5 and 90 or scroll_pos_y)
  202. self.tabScroll_scroll.enabled = self.show_tab_extra
  203. self.lb_5_obj:SetActive(self.show_tab_extra)
  204. self.di_tab_5_obj:SetActive(self.show_tab_extra)
  205. self.tab_name5.gameObject:SetActive(self.show_tab_extra)
  206. if not self.show_tab_extra then
  207. self.lb_5_cur_tmp.text = ""
  208. end
  209. end
  210. function DailyRechargeSubView:RefreshMid( )
  211. if (not self.act_list) or (not self.tab_list) then return end
  212. local grade = self.tab_list[self.select_index].grade
  213. self.nameText_tmp.text = Trim(self.tab_list[self.select_index].desc)
  214. --(0未达成 1未领 2已领)
  215. local status_1 = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 1, "status")--领取状态
  216. local status_2 = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 2, "status")--领取状态
  217. local condition_list_1 = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 1, "condition_list")--条件列表
  218. local condition_list_2 = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 2, "condition_list")--条件列表
  219. local have_get_add = status_1 == 2--已领取1
  220. local today_add = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 1, "progress")--今日已经充值
  221. local need_add = self.model:GetConditionInfo(condition_list_1,"gold")--需要充值额
  222. self:ClearUIEffect(self.goBtnEffect)
  223. if tonumber(today_add) >= tonumber(need_add) then
  224. self.lb_des_1_tmp.text = "<color=#2cf89a>今日已达标</color>"
  225. SetImageGray( self.btn_1_img, have_get_add )
  226. self.lb_btn_1_tmp.text = have_get_add and "已领取" or "领取"
  227. SetTMPSharedMaterial(self.lb_btn_1_tmp, have_get_add and ShaderTools.TMPSharedMaterialType.FZZZOutlineDarkGrayBtn or ShaderTools.TMPSharedMaterialType.FZZZOutlineDarkOrangeBtn)
  228. else
  229. -- self.lb_des_1_tmp.text = string.format( "今日充值:%s %d / %s",
  230. -- WordManager:GetMoneyFaceStr( 1 ), today_add, HtmlColorTxt( need_add , '#fdffc2') )
  231. self.lb_des_1_tmp.text = string.format( "还需充值:%s <size=115%%>%s</size>",
  232. WordManager:GetMoneyFaceStr( 1 ), HtmlColorTxt(need_add - today_add, ColorUtil.GREEN_DARK))
  233. SetImageGray( self.btn_1_img, false )
  234. self.lb_btn_1_tmp.text = "充点小钱"
  235. SetTMPSharedMaterial(self.lb_btn_1_tmp, ShaderTools.TMPSharedMaterialType.FZZZOutlineDarkOrangeBtn)
  236. end
  237. if status_1 ~= 2 then
  238. self:AddUIEffect("ui_icon02", self.goBtnEffect, self.layer_name, Vector3(0, 0, 0), 1, true)
  239. end
  240. self.red_mid_1_obj:SetActive(status_1 == 1)
  241. self.pelletBtnRed_obj:SetActive(self.model:GetPelletRed())
  242. --这里展示聚焦特效逻辑
  243. self:ClearUIEffect(self.awardEffect)
  244. local need_show_jujiao_effect = true
  245. if status_1 == 2 or not self.model.need_show_daily_recharge_effect or self.select_index ~= 4 then
  246. need_show_jujiao_effect = false
  247. else
  248. local cookie_bool = self.model:GetDailyActCookie(self.model.need_show_daily_recharge_effect)
  249. if not cookie_bool then
  250. self.model:SetDailyActCookie(self.model.need_show_daily_recharge_effect)
  251. else
  252. need_show_jujiao_effect = false
  253. end
  254. self.model.need_show_daily_recharge_effect = false
  255. end
  256. if need_show_jujiao_effect then
  257. self:AddUIEffect("ui_jujiaodianji", self.awardEffect, "Activity", Vector3(39,-39,0), 1, true)
  258. end
  259. local function get_start_x( goods_num )
  260. local off_x = 7
  261. if goods_num <= 6 then
  262. off_x = off_x + (6-goods_num) * 51 + 5
  263. end
  264. return off_x
  265. end
  266. local show_list_1 = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 1, "reward_info")
  267. self.award_item_con_1 = self.award_item_con_1 or self:AddUIComponent(UI.ItemListCreator)
  268. -- data_list = sort_award(show_list_1),
  269. self.mode_goods = show_list_1[1]
  270. local tab_info_list = {
  271. data_list = show_list_1,
  272. item_con = self.Content_1,
  273. scroll_view = self.scroll_1,
  274. obj_pool_type = UIObjPool.UIType.AwardItem,
  275. item_width = 78,
  276. item_height = 78,
  277. start_x = 14,
  278. start_y = -17,
  279. space_x = 16,
  280. space_y = 15,
  281. create_frequency = 0.01,
  282. show_col = 4,
  283. alignment = UnityEngine.TextAnchor.UpperLeft,
  284. on_update_item = function(item, i, v)
  285. item:SetIsAct(true)
  286. item:SetDataWithMapId(v.goods_id, v.goods_count, v.goods_kind)
  287. item:SetItemSize(78, 78)
  288. if (self.select_index == 4 or self.select_index == 5) and i == 1 then
  289. item:SetNumLimitVisible(true,32)
  290. else
  291. item:SetNumLimitVisible(false)
  292. end
  293. if i == 1 and self.select_index == 4 and need_show_jujiao_effect then
  294. local function call_back( target,x,y )
  295. self:ClearUIEffect(self.awardEffect)
  296. UIToolTipMgr:getInstance():AppendGoodsTips(v.goods_id, x, y,nil,nil,nil,nil,true)
  297. end
  298. item:SetCallBack(call_back)
  299. end
  300. end,
  301. }
  302. self.award_item_con_1:UpdateItems(tab_info_list)
  303. -------------------------
  304. if self.tab_list[self.select_index] and self.tab_list[self.select_index].condition_list then
  305. local conditon = self.tab_list[self.select_index].condition_list
  306. local show_data = nil
  307. for i,v in ipairs(conditon) do
  308. if v[1] == "show" then
  309. show_data = v
  310. elseif v[1] == "show_bg_res" then
  311. lua_resM:setOutsideImageSprite(self, self.showBg_img, GameResPath.GetRechargeActivityImage(Trim(v[2])), true)
  312. end
  313. end
  314. if show_data then
  315. self:UpdateModelCon(show_data)
  316. else
  317. self:UpdateImage()
  318. end
  319. end
  320. end
  321. function DailyRechargeSubView:RefreshRed( )
  322. if (not self.act_list) or (not self.tab_list) then return end
  323. local tab_len = self.show_tab_extra and 5 or 4
  324. local index = false
  325. local grade = false
  326. local status_1 = false
  327. local status_2 = false
  328. for i=1,tab_len do
  329. grade = self.tab_list[i].grade
  330. status_1 = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 1, "status")--领取状态
  331. status_2 = self.model:GetInfoFromActList(self.act_list.reward_list, grade, 2, "status")--领取状态
  332. self["red_" .. i .. "_obj"]:SetActive(status_1 == 1 or status_2 == 1)
  333. end
  334. if not self.show_tab_extra then
  335. self.red_5_obj:SetActive(false)
  336. end
  337. end
  338. function DailyRechargeSubView:__delete( )
  339. self:ClearUIEffect(self.awardEffect)
  340. self:ClearUIEffect(self.goBtnEffect)
  341. self:StopSwithTabAnim()
  342. self:DeleteDressEffect()
  343. self:ClearUIEffect(self.effect)
  344. self:StopAnim()
  345. end
  346. function DailyRechargeSubView:UpdateImage( )
  347. self.roleCon_obj:SetActive(false)
  348. self.imgCon_obj:SetActive(true)
  349. self.dressCon_obj:SetActive(true)
  350. self.bubbleCon.gameObject:SetActive(false)
  351. self.designationImg.gameObject:SetActive(false)
  352. self.headCon.gameObject:SetActive(false)
  353. if self.mode_goods and self.mode_goods.goods_id then
  354. local goods_base_vo = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.mode_goods.goods_id)
  355. if goods_base_vo and goods_base_vo.goods_icon then
  356. if self.enlarge == 1 then--自动放大
  357. local is_design = false
  358. for k,v in pairs(Config.Dsgt) do
  359. if v.goods_id == goods_base_vo.goods_icon then
  360. is_design = true
  361. break
  362. end
  363. end
  364. if is_design then
  365. local designation_id = DesignationModel:GetInstance():GetDesignationIdByGoodsId(goods_base_vo.goods_icon)
  366. lua_resM:setOutsideImageSprite(self, self.imgCon_img, GameResPath.GetDesignImage(designation_id))
  367. SetSizeDelta(self.imgCon,256,105)
  368. else
  369. lua_resM:setOutsideImageSprite(self, self.imgCon_img, GameResPath.GetGoodsIcon(goods_base_vo.goods_icon))
  370. SetSizeDelta(self.imgCon,200,200)
  371. end
  372. else
  373. if LimitGiftConst.ResByGoodsId[self.mode_goods.goods_id] then
  374. local resname = LimitGiftConst.ResByGoodsId[self.mode_goods.goods_id]
  375. lua_resM:setOutsideImageSprite(self, self.imgCon_img, GameResPath.GetLimitGiftImage(resname),true)
  376. end
  377. end
  378. end
  379. end
  380. end
  381. --图片上下移动
  382. function DailyRechargeSubView:ArrowAnimation(time)
  383. self:StopAnim()
  384. local call_fun = function ()
  385. local function onCompleted()
  386. self:ArrowAnimation(time)
  387. end
  388. self.dsgcon_move_up_id = TweenLite.to(self, self.dressCon, TweenLite.UiAnimationType.POSY, self.up_dsg_pos, 1.2, onCompleted)
  389. end
  390. local onDelay = function( )
  391. self.dsg_con_move_down_id = TweenLite.to(self, self.dressCon, TweenLite.UiAnimationType.POSY, self.down_dsg_pos, 1.2, call_fun)
  392. end
  393. self.dsg_move_delay_id = setTimeout(onDelay, time)
  394. end
  395. function DailyRechargeSubView:StopAnim()
  396. if self.dsg_con_move_down_id then
  397. TweenLite.Stop(self.dsg_con_move_down_id)
  398. self.dsg_con_move_down_id = nil
  399. end
  400. if self.dsgcon_move_up_id then
  401. TweenLite.Stop(self.dsgcon_move_up_id)
  402. self.dsgcon_move_up_id = nil
  403. end
  404. if self.dsg_move_delay_id then
  405. GlobalTimerQuest:CancelQuest(self.dsg_move_delay_id)
  406. self.dsg_move_delay_id = nil
  407. end
  408. end
  409. --更新模型
  410. function DailyRechargeSubView:UpdateModelCon( figure_data )
  411. if figure_data then
  412. local show_type = tonumber(figure_data[2])
  413. self.imgCon_obj:SetActive(show_type == 1)
  414. self.roleCon_obj:SetActive(show_type == 2)
  415. self.dressCon_obj:SetActive(show_type == 3 or show_type == 1)
  416. if show_type == 1 then -- 展示图片
  417. self.bubbleCon.gameObject:SetActive(false)
  418. self.designationImg.gameObject:SetActive(false)
  419. self.headCon.gameObject:SetActive(false)
  420. elseif show_type == 2 then -- 展示模型
  421. local model_cfg = CustomActivityModel:getInstance():GetActModelConShowCfg(self.base_type,tonumber(figure_data[3]),tonumber(figure_data[4]))
  422. local scale = model_cfg and model_cfg.scale or 200
  423. local position = model_cfg and model_cfg.position or Vector3(0,0,-300)
  424. local career = RoleManager.Instance.mainRoleInfo.career
  425. if tonumber(figure_data[3]) == FuncOpenModel.TypeId.FWeapon then--武器位置调高一点
  426. if career == 3 or career == 4 then
  427. scale = scale*1.7
  428. position = Vector3(0,0,-300)
  429. end
  430. end
  431. if figure_data[1] == "show" then
  432. local res_data = {
  433. father_node = self,
  434. transform = self.roleCon,
  435. fashion_type = tonumber(figure_data[3]),
  436. raycast_size = Vector2(0,0),
  437. scale = scale,
  438. figure_id = tonumber(figure_data[4]),
  439. position = position,
  440. layer_name = self.layer_name,
  441. ui_model_type = UIModelCommon.ModelType.Model,
  442. show_shadow = false,
  443. use_bloom = false,
  444. }
  445. FuncOpenModel:getInstance():SetModelRes(res_data)
  446. else
  447. end
  448. elseif show_type == 3 then -- 展示称号/气泡/头像
  449. local dress_type = tonumber(figure_data[3])
  450. self.bubbleCon.gameObject:SetActive(dress_type == FuncOpenModel.DressTypeId.Pupple)
  451. self.designationImg.gameObject:SetActive(dress_type == FuncOpenModel.DressTypeId.Design)
  452. self.headCon.gameObject:SetActive(dress_type == FuncOpenModel.DressTypeId.RoleHead or dress_type == FuncOpenModel.DressTypeId.Head)
  453. if dress_type == FuncOpenModel.DressTypeId.Design then--称号
  454. self:UpdateDesignShow(figure_data)
  455. elseif dress_type == FuncOpenModel.DressTypeId.Head then--头像框
  456. self:UpdateHead(figure_data)
  457. elseif dress_type == FuncOpenModel.DressTypeId.RoleHead then--头像
  458. self:UpdateRoleHead(figure_data)
  459. elseif dress_type == FuncOpenModel.DressTypeId.Pupple then--气泡
  460. self:UpdatePupple(figure_data)
  461. end
  462. end
  463. else
  464. -- 什么都不展示的话,就可以发现问题
  465. self.imgCon_obj:SetActive(false)
  466. self.roleCon_obj:SetActive(false)
  467. self.dressCon_obj:SetActive(false)
  468. end
  469. end
  470. -- 更新称号效果
  471. function DailyRechargeSubView:UpdateDesignShow(dsg_data)
  472. local data = {
  473. parent = self,
  474. dress_id = dsg_data[4],
  475. designationImg = self.designationImg,
  476. }
  477. FuncOpenModel:getInstance():ShowDesign(data)
  478. end
  479. --更新头像框
  480. function DailyRechargeSubView:UpdateHead( dsg_data )
  481. if not self.mainRoleHeadItem then
  482. self.mainRoleHeadItem = HeadRoleItem.New(self.headCon)
  483. self.mainRoleHeadItem:SetItemSize(180,180)
  484. end
  485. local data = {
  486. parent = self,
  487. dress_id = dsg_data[4],
  488. mainRoleHeadItem = self.mainRoleHeadItem,
  489. }
  490. FuncOpenModel:getInstance():ShowHead(data)
  491. end
  492. --更新头像
  493. function DailyRechargeSubView:UpdateRoleHead( dsg_data )
  494. if not self.mainRoleHeadItem then
  495. self.mainRoleHeadItem = HeadRoleItem.New(self.headCon)
  496. self.mainRoleHeadItem:SetItemSize(180,180)
  497. end
  498. local data = {
  499. parent = self,
  500. dress_id = dsg_data[4],
  501. mainRoleHeadItem = self.mainRoleHeadItem,
  502. }
  503. FuncOpenModel:getInstance():ShowRoleHead(data)
  504. end
  505. --更新气泡
  506. function DailyRechargeSubView:UpdatePupple( dsg_data )
  507. SetSizeDelta(self.bubbleCon, 250, 70)
  508. local data = {
  509. parent = self,
  510. dress_id = dsg_data[4],
  511. bubbleCon = self.bubbleCon,
  512. }
  513. FuncOpenModel:getInstance():ShowBubble(data)
  514. end
  515. function DailyRechargeSubView:DeleteDressEffect( )
  516. if self.designationImg then
  517. cc.ActionManager:getInstance():removeAllActionsFromTarget(self.designationImg.transform)
  518. end
  519. if self.mainRoleHeadItem ~= nil then
  520. self.mainRoleHeadItem:DeleteMe()
  521. self.mainRoleHeadItem = nil
  522. end
  523. end
  524. --设置方法回调
  525. function DailyRechargeSubView:SetFuncCallBack( pellet_call_back,close_call_back )
  526. self.pellet_call_back = pellet_call_back
  527. self.close_call_back = close_call_back
  528. end
  529. -- 播放切换页签动画
  530. function DailyRechargeSubView:PlaySwithTabAnim( )
  531. self:StopSwithTabAnim()
  532. -- 隐藏并调整目标节点
  533. self.showBg_img.color = Color(1,1,1,0)
  534. local offer_x = KfActivityConst.LimitShopOfferX + 50
  535. SetAnchoredPositionX(self.showBg, -78 - offer_x)
  536. -- 进度百分比回调
  537. local function cg_callback(percent)
  538. self.showBg_img.color = Color(1,1,1,percent)
  539. SetAnchoredPositionX(self.showBg, -78 + offer_x * (percent - 1))
  540. end
  541. local pec_action = cc.CustomUpdate.New(KfActivityConst.LimitShopTime+0.1, cg_callback)
  542. cc.ActionManager:getInstance():addAction(pec_action, self.showBg)
  543. end
  544. function DailyRechargeSubView:StopSwithTabAnim( )
  545. if self.is_loaded then
  546. cc.ActionManager:getInstance():removeAllActionsFromTarget(self.showBg)
  547. end
  548. end