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

227 rivejä
7.3 KiB

4 viikkoa sitten
  1. --贵族特权查看界面
  2. SupremeVipFindRightView = SupremeVipFindRightView or BaseClass(BaseView)
  3. local SupremeVipFindRightView = SupremeVipFindRightView
  4. function SupremeVipFindRightView:__init()
  5. self.base_file = "supremeVip"
  6. self.layout_file = "SupremeVipFindRightView"
  7. self.layer_name = "Activity"
  8. self.destroy_imm = true
  9. self.use_background = true
  10. self.change_scene_close = true
  11. self.hide_maincancas = false --是否隐藏主界面
  12. self.append_to_ctl_queue = false --是否要添加进界面堆栈
  13. self.need_show_money = false --是否要显示顶部的金钱栏
  14. self.is_set_zdepth = true
  15. self.choose_index = 1
  16. self.model = SupremeVipModel:getInstance()
  17. self.mainVo = RoleManager.Instance.mainRoleInfo
  18. self.load_callback = function ()
  19. self:LoadSuccess()
  20. self:AddEvent()
  21. end
  22. self.open_callback = function ( )
  23. self:UpdateView()
  24. end
  25. self.destroy_callback = function ( )
  26. self:DestroySuccess()
  27. end
  28. end
  29. function SupremeVipFindRightView:Open( )
  30. --self.data = data
  31. BaseView.Open(self)
  32. end
  33. function SupremeVipFindRightView:LoadSuccess()
  34. local nodes = {
  35. "sloganImg:img", "bg:raw",
  36. "closeBtn:obj",
  37. "rightTitle:tmp", "rightdes:tmp",
  38. "rightBigIcon:img:obj",
  39. "ScrollView", "ScrollView/Viewport/Content",
  40. "tabCon/smallTab3:img", "tabCon/smallTab7:img", "tabCon/smallTab6:img", "tabCon/smallTab4:img", "tabCon/smallTab1:img", "tabCon/smallTab2:img", "tabCon/smallTab5:img",
  41. "extraEffect",
  42. "iconEffect",
  43. }
  44. self:GetChildren(nodes)
  45. -- local function bg_back_func( ... )
  46. -- if self.background_wnd and self.background_wnd:GetComponent("RawImageExtend") then
  47. -- self:MoveUIToBack(self.background_wnd:GetComponent("RawImageExtend"))
  48. -- end
  49. -- self:MoveUIToBack(self.bg_raw)
  50. -- end
  51. -- if self.background_wnd then
  52. -- bg_back_func()
  53. -- else
  54. -- self.bg_back_func = bg_back_func
  55. -- end
  56. -- self.icon_canvas = self.rightBigIcon:GetComponent(typeof(UnityEngine.Canvas))
  57. -- self.icon_canvas.sortingOrder = self:GetCurrLayerDepth("Activity") + 40
  58. -- -- self:AddUIEffect("ui_guizutequan", self.rightBigIcon, "Activity", Vector3(-4,-30.5,0), 1, false,nil,nil,nil,nil,nil,UIPartical.RenderingOther_List.UIBackward)
  59. -- self:AddUIEffect("ui_guizutequan", self.iconEffect, "Activity", Vector3(-4,-30.5,0), 1, true)
  60. lua_resM:setOutsideRawImage(self, self.bg_raw, GameResPath.GetViewBigBg("supremeVip_activate_view"))
  61. lua_resM:setOutsideImageSprite(self, self.sloganImg_img, GameResPath.GetSupremeVipIcon("supremeVip_des_2_pointfilter"), true)
  62. self.sup_vip_type = RoleManager.Instance.mainRoleInfo.sup_vip_type
  63. SetAnchoredPositionY(self.rightBigIcon,30)
  64. SetAnchoredPositionY(self.iconEffect,30)
  65. if self.tween_id then
  66. TweenLite.Stop(self.tween_id)
  67. self.tween_id = nil
  68. end
  69. -- self.tween_id =TweenLite.to(self, self.rightBigIcon,TweenLite.UiAnimationType.ANCHORED_POSY,37, 1.8, nil,TweenFunc.PINGPONG,true)
  70. end
  71. function SupremeVipFindRightView:AddEvent()
  72. local on_click = function ( click_obj )
  73. if self.closeBtn_obj == click_obj then
  74. self:Close()
  75. end
  76. end
  77. AddClickEvent(self.closeBtn_obj, on_click,1)
  78. end
  79. function SupremeVipFindRightView:ChangeShowSupremeRight(index)
  80. self.choose_index = index
  81. self.rightTitle_tmp.text = string.format("特权%s:%s",index,SupremeVipConst.SupremeVipRight[index].name)
  82. self.rightdes_tmp.text = SupremeVipConst.SupremeVipRight[index].des
  83. -- if index == 1 then
  84. -- lua_resM:setOutsideImageSprite(self, self.rightBigIcon_img, GameResPath.GetSkillIcon("109101"), true)
  85. -- else
  86. -- lua_resM:setOutsideImageSprite(self, self.rightBigIcon_img, GameResPath.GetSupremeVipIcon("supremeVip_right_big_icon_"..index), true)
  87. -- end
  88. if self.choose_index == 3 then
  89. self:AddUIEffect("ui_guizutequan_godstone", self.extraEffect, "Activity", Vector3(-4,-30.5,0), 1, false,-1,nil,nil,nil,nil)
  90. lua_resM:setImageSprite(self, self.rightBigIcon_img, "uiComponent_asset","com_empty")
  91. elseif self.choose_index == 4 then
  92. self:AddUIEffect("ui_guizutequan_nojump", self.extraEffect, "Activity", Vector3(-4,-30.5,0), 1, false,-1,nil,nil,nil,nil)
  93. lua_resM:setImageSprite(self, self.rightBigIcon_img, "uiComponent_asset","com_empty")
  94. else
  95. self:ClearUIEffect(self.extraEffect)
  96. lua_resM:setOutsideImageSprite(self, self.rightBigIcon_img, GameResPath.GetSupremeVipIcon("supremeVip_right_big_icon_"..index), true)
  97. end
  98. end
  99. function SupremeVipFindRightView:UpdateView()
  100. local click_callback = function(index)
  101. self:ChangeShowSupremeRight(index)
  102. self:UpdateRightItemPos(index)
  103. self:AutoChangeIndex()
  104. self:UpdateSmallTab()
  105. end
  106. if not self.item_list_com then
  107. self.item_list_com = self:AddUIComponent(UI.ItemListCreator)
  108. end
  109. local info = {
  110. data_list = {{},{},{},{},{},{},{}},
  111. item_con = self.Content,
  112. item_class = SupremeVipRightItem,
  113. item_width = 162,
  114. item_height = 46,
  115. -- space_x = 0,
  116. space_y = 8,
  117. start_x = 116,
  118. start_y = -33-8,
  119. scroll_view = self.ScrollView,
  120. -- create_frequency = 0.01,
  121. reuse_item_num = 7,
  122. on_update_item = function(item, i, v)
  123. item:SetData(i,click_callback)
  124. self.item_list_com:IterateItems(function( item, i )
  125. item:OnClick(1)
  126. end)
  127. end,
  128. final_callback = function()
  129. self.item_list_com:IterateItems(function( item, i )
  130. item:OnClick(1)
  131. end)
  132. end,
  133. }
  134. self.item_list_com:UpdateItems(info)
  135. self.icon_canvas = self.rightBigIcon:GetComponent(typeof(UnityEngine.Canvas))
  136. self.icon_canvas.sortingOrder = self:GetCurrLayerDepth("Activity") + 40
  137. -- self:AddUIEffect("ui_guizutequan", self.rightBigIcon, "Activity", Vector3(-4,-30.5,0), 1, false,nil,nil,nil,nil,nil,UIPartical.RenderingOther_List.UIBackward)
  138. self:AddUIEffect("ui_guizutequan", self.iconEffect, "Activity", Vector3(-4,-30.5,0), 1, true)
  139. end
  140. function SupremeVipFindRightView:UpdateRightItemPos(index)
  141. if self.item_list_com then
  142. self.item_list_com:IterateItems(function( item, i )
  143. local pos_y = -33
  144. if i < index then
  145. pos_y = pos_y - (i-1)*(46+8)
  146. elseif i == index then
  147. pos_y = pos_y - (i-1)*(46+8) -8
  148. elseif i > index then
  149. pos_y = pos_y - (i-2)*(46+8) -8-8 -53
  150. end
  151. item:SetAnchoredPosition(116,pos_y)
  152. end)
  153. end
  154. SetSizeDeltaY(self.Content,(46+5)*7+33-8+30)
  155. -- SetAnchoredPositionY(self.Content,33+(index-1)*(46+22)+10)
  156. end
  157. function SupremeVipFindRightView:AutoChangeIndex()
  158. if self.delay_handler then
  159. TimerQuest.CancelQuest(GlobalTimerQuest, self.delay_handler)
  160. self.delay_handler = nil
  161. end
  162. local function delay_method( )
  163. local next_index = self.choose_index < 7 and self.choose_index+1 or 1
  164. self.item_list_com:IterateItems(function( item, i )
  165. item:OnClick(next_index)
  166. end)
  167. local pos_y = 0
  168. if next_index == 6 then
  169. pos_y = 32
  170. elseif next_index == 7 then
  171. pos_y = 32
  172. end
  173. SetAnchoredPositionY(self.Content,pos_y)
  174. end
  175. self.delay_handler = setTimeout(delay_method, 6)
  176. end
  177. function SupremeVipFindRightView:UpdateSmallTab( )
  178. for i=1,7 do
  179. if i == self.choose_index then
  180. lua_resM:setImageSprite(self, self["smallTab"..i.."_img"], "supremeVip_asset","supremeVip_small_tab_2")
  181. else
  182. lua_resM:setImageSprite(self, self["smallTab"..i.."_img"], "supremeVip_asset","supremeVip_small_tab_1")
  183. end
  184. end
  185. end
  186. function SupremeVipFindRightView:DestroySuccess( )
  187. if self.tween_id then
  188. TweenLite.Stop(self.tween_id)
  189. self.tween_id = nil
  190. end
  191. if self.delay_handler then
  192. TimerQuest.CancelQuest(GlobalTimerQuest, self.delay_handler)
  193. self.delay_handler = nil
  194. end
  195. self:ClearUIEffect(self.iconEffect)
  196. self:ClearUIEffect(self.extraEffect)
  197. end