源战役客户端
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

604 řádky
20 KiB

před 4 týdny
  1. MarketBuyHallView = MarketBuyHallView or BaseClass(BaseItem)
  2. local MarketBuyHallView = MarketBuyHallView
  3. local table_insert = table.insert
  4. function MarketBuyHallView:__init()
  5. self.base_file = "market"
  6. self.layout_file = "MarketBuyHallView"
  7. self.model = MarketModel:GetInstance()
  8. self.sell_type = 0
  9. self.series_limit = 0
  10. self.color = 99
  11. self.career_limit = 0
  12. self.page_size = 8
  13. self.sort_id = 1--1:时间排序 2:当前竞拍价排序 3:一口价排序
  14. self.sort_order = 0--0:表示顺序(从大到小) 1:表示倒序(从小到大)
  15. self.sort_data = {
  16. 1,0,0
  17. }
  18. self.is_first = true--是否第一次进入
  19. self.tab_item_list = {}
  20. self.cur_hor_tab_index = 1 --水平tab选择
  21. self:Load()
  22. end
  23. function MarketBuyHallView:Load_callback()
  24. self.nodes = {
  25. "title/auction_con/auction_arrow","title/price_con/price_arrow","title/time_con/time_arrow",
  26. "right_scroll/Viewport/right_con","left_scroll","left_scroll/Viewport/left_con","empty/empty_talk_image:raw",
  27. "right_scroll:obj","series_con:obj","color_con:obj","series_con/series_drop","color_con/color_drop",
  28. "title/auction_con:obj","title/price_con:obj","title/time_con:obj","career_con/career_text:tmp",
  29. "empty/girl:raw","empty/empty_text:tmp","empty:obj","tab_con","career_con:obj", "career_con/career_drop",
  30. }
  31. self:GetChildren(self.nodes)
  32. lua_resM:setOutsideRawImage(self, self.empty_talk_image_raw, GameResPath.GetViewBigBg("com_empty_bg1"), false)
  33. lua_resM:setOutsideRawImage(self, self.girl_raw, GameResPath.GetRoleBg("team_empty_bg_267_589"), false)
  34. self:InitDropDown()
  35. self:AddEvents()
  36. if self.need_refreshData then
  37. self:UpdateView()
  38. end
  39. for index=1,3 do
  40. if index == 1 then
  41. self.time_arrow.localRotation = self.sort_data[index] == 1 and Quaternion.Euler(0,0,0) or Quaternion.Euler(0,0,180)
  42. elseif index == 2 then
  43. self.auction_arrow.localRotation = self.sort_data[index] == 1 and Quaternion.Euler(0,0,0) or Quaternion.Euler(0,0,180)
  44. elseif index == 3 then
  45. self.price_arrow.localRotation = self.sort_data[index] == 1 and Quaternion.Euler(0,0,0) or Quaternion.Euler(0,0,180)
  46. end
  47. end
  48. end
  49. function MarketBuyHallView:AddEvents( )
  50. local function on_update_goods( )
  51. self:UpdateGoodsList()
  52. end
  53. self.on_update_goods_id = self.model:BindOne("market_goods_list", on_update_goods)
  54. self.on_update_guild_goods_id = self.model:BindOne("market_guild_goods_list", on_update_goods)
  55. local function touch_end(target,pos_x, pos_y)
  56. self:OnTouchEnd(pos_x, pos_y)
  57. end
  58. AddDragEndEvent(self.right_scroll_obj,touch_end)
  59. function on_click_sort( target )
  60. if target == self.auction_con_obj then--拍卖排序
  61. self:SelectSort(2)
  62. elseif target == self.price_con_obj then--一口价排序
  63. self:SelectSort(3)
  64. elseif target == self.time_con_obj then--时间排序
  65. self:SelectSort(1)
  66. end
  67. end
  68. AddClickEvent(self.auction_con_obj, on_click_sort)
  69. AddClickEvent(self.price_con_obj, on_click_sort)
  70. AddClickEvent(self.time_con_obj, on_click_sort)
  71. local function on_refresh_data( )
  72. if self.cur_hor_tab_index == 1 then
  73. self.model:CleanMarketGoodsInfo()
  74. else
  75. self.model:CleanMarketGuildGoodsInfo()
  76. end
  77. self.need_reset = true
  78. self:OnTouchEnd(0,0,true)
  79. end
  80. self.on_refresh_data_id = self.model:Bind(MarketModel.MARKET_BUY_SUCCESS, on_refresh_data)
  81. end
  82. function MarketBuyHallView:SelectSort( index )
  83. self.sort_id = index
  84. self.sort_order = self.sort_data[index] == 1 and 1 or 0
  85. self.sort_data[index] = self.sort_data[index] == 1 and 0 or 1
  86. if index == 1 then
  87. self.time_arrow.localRotation = self.sort_data[index] == 1 and Quaternion.Euler(0,0,0) or Quaternion.Euler(0,0,180)
  88. elseif index == 2 then
  89. self.auction_arrow.localRotation = self.sort_data[index] == 1 and Quaternion.Euler(0,0,0) or Quaternion.Euler(0,0,180)
  90. elseif index == 3 then
  91. self.price_arrow.localRotation = self.sort_data[index] == 1 and Quaternion.Euler(0,0,0) or Quaternion.Euler(0,0,180)
  92. end
  93. if self.cur_hor_tab_index == 1 then
  94. self.model:CleanMarketGoodsInfoByType(self.sell_type or self.last_sell_type, self.sell_sub_type)
  95. else
  96. self.model:CleanMarketGuildGoodsInfoByType(self.sell_type or self.last_sell_type, self.sell_sub_type)
  97. end
  98. self.need_reset = true
  99. self:OnTouchEnd(0,0,true)
  100. end
  101. function MarketBuyHallView:InitDropDown()
  102. local list = {}
  103. local cfg_color = Config.Marketgoodsselectbycolor
  104. table.insert(list,"所有品质")
  105. for i,v in ipairs(cfg_color) do
  106. table.insert(list, v.describe)
  107. end
  108. self.color_index = 1
  109. local function update_color_func(index)
  110. self.color_index = index
  111. if index == 1 then
  112. self.color = 99
  113. else
  114. self.color = index-1
  115. end
  116. if self.cur_hor_tab_index == 1 then
  117. self.model:CleanMarketGoodsInfoByType(self.sell_type or self.last_sell_type, self.sell_sub_type)
  118. else
  119. self.model:CleanMarketGuildGoodsInfoByType(self.sell_type or self.last_sell_type, self.sell_sub_type)
  120. end
  121. self.need_reset = true
  122. self:OnTouchEnd(0,0,true)
  123. end
  124. local prefab_data = {Combox = "Combox",ComboxView = "ComboxView", ComboxItem = "ComboxItem", offset_y = -#list*ComboxItem.Height-9, show_type = "down"}
  125. if not self.combox_color then
  126. self.combox_color = Combox.New(self.color_drop,list,update_color_func,122,38,nil,prefab_data)
  127. else
  128. self.combox_color:ResetData(list,self.color_index,update_color_func,122,38)
  129. end
  130. local list = {}
  131. local cfg_lv = Config.Marketgoodsselectbylev
  132. table.insert(list,"不限套装")
  133. for i,v in ipairs(cfg_lv) do
  134. table.insert(list, v.stage.."")
  135. end
  136. local function update_level_func(index)
  137. self.series_index = index
  138. if index == 1 then
  139. self.series_limit = 0
  140. else
  141. self.series_limit = cfg_lv[index-1].stage
  142. end
  143. if self.cur_hor_tab_index == 1 then
  144. self.model:CleanMarketGoodsInfoByType(self.sell_type or self.last_sell_type, self.sell_sub_type)
  145. else
  146. self.model:CleanMarketGuildGoodsInfoByType(self.sell_type or self.last_sell_type, self.sell_sub_type)
  147. end
  148. self.need_reset = true
  149. self:OnTouchEnd(0,0,true)
  150. end
  151. local prefab_data = {Combox = "Combox",ComboxView = "ComboxView", ComboxItem = "ComboxItem", offset_y = -#list*ComboxItem.Height-9, show_type = "down"}
  152. if not self.combox_series then
  153. self.combox_series = Combox.New(self.series_drop,list,update_level_func,122,38,nil,prefab_data)
  154. else
  155. self.combox_series:ResetData(list,self.series_index,update_level_func,122,38)
  156. end
  157. local list = {}
  158. local cfg_career = Config.Marketgoodsselectbycareer
  159. table.insert(list,"不限职业")
  160. for i,v in ipairs(cfg_career) do
  161. table.insert(list, v.describe)
  162. end
  163. local function update_career_func(index)
  164. self.career_index = index
  165. if index == 1 then
  166. self.career_limit = 0
  167. else
  168. self.career_limit = cfg_career[index-1].id
  169. end
  170. if not self.is_first then
  171. if self.cur_hor_tab_index == 1 then
  172. self.model:CleanMarketGoodsInfoByType(self.sell_type or self.last_sell_type, self.sell_sub_type)
  173. else
  174. self.model:CleanMarketGuildGoodsInfoByType(self.sell_type or self.last_sell_type, self.sell_sub_type)
  175. end
  176. self.need_reset = true
  177. self:OnTouchEnd(0,0,true)
  178. end
  179. end
  180. local prefab_data = {Combox = "Combox",ComboxView = "ComboxView", ComboxItem = "ComboxItem", offset_y = -#list*ComboxItem.Height-9, show_type = "down"}
  181. if not self.combox_career then
  182. self.combox_career = Combox.New(self.career_drop,list,update_career_func,122,38,nil,prefab_data)
  183. else
  184. self.combox_career:ResetData(list,self.career_index,update_career_func,122,38)
  185. end
  186. end
  187. --更新筛选栏状态
  188. function MarketBuyHallView:UpdateFliter( )
  189. local fliter_type = self.model:GetFliterType(self.sell_type,self.sell_sub_type)
  190. if fliter_type == MarketConst.FliterType.Armor then
  191. self.career_con_obj:SetActive(true)
  192. self.series_con_obj:SetActive(true)
  193. self.color_con_obj:SetActive(true)
  194. SetAnchoredPositionX(self.color_con, 144)
  195. self.career_text_tmp.text = "性别"
  196. local list = {}
  197. local cfg_career = MarketConst.Sex
  198. local career = RoleManager.Instance.mainRoleInfo.career
  199. self.career_index = self.model:GetMarketDefultSelectIndexByType(fliter_type, career)
  200. table.insert(list,"不限性别")
  201. for i,v in ipairs(cfg_career) do
  202. table.insert(list, v.name)
  203. end
  204. local function update_career_func(index)
  205. self.career_index = index
  206. if index == 1 then
  207. self.career_limit = 0
  208. else
  209. self.career_limit = self.model:GetMarketFliterCareerBySex(cfg_career[index-1].id)
  210. end
  211. if not self.is_first then
  212. if self.cur_hor_tab_index == 1 then
  213. self.model:CleanMarketGoodsInfoByType(self.sell_type or self.last_sell_type, self.sell_sub_type)
  214. else
  215. self.model:CleanMarketGuildGoodsInfoByType(self.sell_type or self.last_sell_type, self.sell_sub_type)
  216. end
  217. self.need_reset = true
  218. self:OnTouchEnd(0,0,true)
  219. end
  220. end
  221. local prefab_data = {Combox = "Combox",ComboxView = "ComboxView", ComboxItem = "ComboxItem", offset_y = -#list*ComboxItem.Height-9, show_type = "down"}
  222. if not self.combox_career then
  223. self.combox_career = Combox.New(self.career_drop,list,update_career_func,122,38,nil,prefab_data)
  224. else
  225. self.combox_career:ResetData(list,self.career_index,update_career_func,122,38,nil,true, prefab_data)
  226. end
  227. elseif fliter_type == MarketConst.FliterType.Weapon then
  228. self.career_con_obj:SetActive(true)
  229. self.series_con_obj:SetActive(true)
  230. self.color_con_obj:SetActive(true)
  231. SetAnchoredPositionX(self.color_con, 144)
  232. self.career_text_tmp.text = "职业"
  233. local list = {}
  234. local cfg_career = MarketConst.Career
  235. local career = RoleManager.Instance.mainRoleInfo.career
  236. self.career_index = self.model:GetMarketDefultSelectIndexByType(fliter_type, career)
  237. table.insert(list,"不限职业")
  238. for i,v in ipairs(cfg_career) do
  239. table.insert(list, v.name)
  240. end
  241. local function update_career_func(index)
  242. self.career_index = index
  243. if index == 1 then
  244. self.career_limit = 0
  245. else
  246. self.career_limit = cfg_career[index-1].id
  247. end
  248. if not self.is_first then
  249. if self.cur_hor_tab_index == 1 then
  250. self.model:CleanMarketGoodsInfoByType(self.sell_type or self.last_sell_type, self.sell_sub_type)
  251. else
  252. self.model:CleanMarketGuildGoodsInfoByType(self.sell_type or self.last_sell_type, self.sell_sub_type)
  253. end
  254. self.need_reset = true
  255. self:OnTouchEnd(0,0,true)
  256. end
  257. end
  258. local prefab_data = {Combox = "Combox",ComboxView = "ComboxView", ComboxItem = "ComboxItem", offset_y = -#list*ComboxItem.Height-9, show_type = "down"}
  259. if not self.combox_career then
  260. self.combox_career = Combox.New(self.career_drop,list,update_career_func,122,38,nil,prefab_data)
  261. else
  262. self.combox_career:ResetData(list,self.career_index,update_career_func,122,38,nil,true,prefab_data)
  263. end
  264. elseif fliter_type == MarketConst.FliterType.Other then
  265. self.career_con_obj:SetActive(false)
  266. self.series_con_obj:SetActive(false)
  267. self.color_con_obj:SetActive(true)
  268. SetAnchoredPositionX(self.color_con, 372)
  269. elseif fliter_type == MarketConst.FliterType.Hot then
  270. self.career_con_obj:SetActive(false)
  271. self.series_con_obj:SetActive(true)
  272. self.color_con_obj:SetActive(true)
  273. SetAnchoredPositionX(self.color_con, 144)
  274. end
  275. end
  276. function MarketBuyHallView:UpdateView( )
  277. self:SetHorTabCon()
  278. end
  279. function MarketBuyHallView:SetData(tab_id )
  280. self.cur_hor_tab_index = tab_id or self.cur_hor_tab_index
  281. if self.is_loaded then
  282. self.need_refreshData = false
  283. self:UpdateView()
  284. else
  285. self.need_refreshData = true
  286. end
  287. end
  288. function MarketBuyHallView:SetHorTabCon( )
  289. for i,v in ipairs(self.tab_item_list) do
  290. v:SetVisible(false)
  291. end
  292. local data = {"世界拍卖", "社团拍卖"}
  293. local function click_func( index )
  294. self:SwitchHorTab(index)
  295. end
  296. local count = 0
  297. for i,v in ipairs(data) do
  298. local item = self.tab_item_list[count+1]
  299. if not item then
  300. item = MarketHorTabItem.New(self.tab_con)
  301. item:SetPosition(count * 124, 0)
  302. self.tab_item_list[count+1] = item
  303. end
  304. item:SetClickFunc(click_func)
  305. count = count + 1
  306. item:SetData(count, v)
  307. item:SetVisible(true)
  308. end
  309. self:SwitchHorTab(self.cur_hor_tab_index)
  310. end
  311. function MarketBuyHallView:SwitchHorTab( index, sub_type )
  312. self.is_first = true--为了能刷新列表
  313. for i,v in pairs(self.tab_item_list) do
  314. v:SetSelect(i==index)
  315. end
  316. self.cur_hor_tab_index = index--当前选的tab
  317. if self.cur_hor_tab_index == 2 then
  318. self.model:SetHasGuildGoods(false)
  319. end
  320. if self.cur_hor_tab_index == 1 then
  321. self.sell_type = 0
  322. self.sell_sub_type = nil
  323. else
  324. self.sell_type = 0
  325. self.sell_sub_type = nil
  326. end
  327. self.need_reset = true
  328. self:UpdateVerTabBtns(true)
  329. end
  330. function MarketBuyHallView:UpdateVerTabBtns( need_refresh )
  331. if self.cur_hor_tab_index == 1 then
  332. self.tab_cfg = self.model:GetMarketCFG()
  333. else
  334. self.tab_cfg = self.model:GetMarketGuildCFG()
  335. end
  336. self.tab_creator = self.tab_creator or self:AddUIComponent(UI.ItemListCreator)
  337. -- 声明点击回调
  338. local data = {}
  339. if (self.sell_type and need_refresh) or self.tab_all_close then
  340. for i,v in pairsByKeys(self.tab_cfg) do
  341. if i == self.sell_type then--如果是当前选中的第一层
  342. table_insert(data, DeepCopy(v))
  343. data[#data].is_tab = true
  344. for ii,vv in pairsByKeys(v) do
  345. table_insert(data, DeepCopy(vv))
  346. end
  347. else
  348. table_insert(data, DeepCopy(v))
  349. data[#data].is_tab = true
  350. end
  351. end
  352. else
  353. data = self.tab_data
  354. end
  355. if not self.sell_sub_type then--没选中就默认选第一个
  356. if self.model:CheckMarketCanSelectZero(self.sell_type) then
  357. self.sell_sub_type = 0
  358. else
  359. self.sell_sub_type = 1
  360. end
  361. end
  362. self.tab_data = data
  363. local call_back = function(data, sell_type, sell_sub_type)
  364. local need_refresh = self.sell_type ~= sell_type
  365. self.need_reset = true
  366. if sell_type == 0 then
  367. self.career_limit = 0--热卖的话就不用筛职业
  368. elseif sell_type ~= 0 and sell_type ~= 1 and sell_type ~= 3 then --其他类别的 不筛选职业和套装
  369. self.career_limit = 0
  370. self.series_limit = 0
  371. elseif sell_type == 1 and need_refresh then --切页签了 要默认筛自己的防具
  372. local cfg_career = MarketConst.Sex
  373. local career = RoleManager.Instance.mainRoleInfo.career
  374. local career_index = self.model:GetMarketDefultSelectIndexByType(MarketConst.FliterType.Armor, career)
  375. self.career_limit = cfg_career[career_index-1].id
  376. elseif sell_type == 3 and need_refresh then --切页签了 要默认筛自己的武器
  377. local career = RoleManager.Instance.mainRoleInfo.career
  378. -- local cfg_career = MarketConst.Career
  379. -- local career_index = self.model:GetMarketDefultSelectIndexByType(MarketConst.FliterType.Armor, career)
  380. -- self.career_limit = self.model:GetMarketFliterCareerBySex(cfg_career[career_index-1].id)
  381. self.career_limit = career
  382. end
  383. if not need_refresh and not sell_sub_type then--如果不需要刷新 且点到了tab 意思就是要收起来tab
  384. self.need_reset = false
  385. self.tab_all_close = true
  386. self.last_sell_type = self.sell_type --先保存起来上一个选中的tab
  387. self.sell_type = nil
  388. else
  389. self.tab_all_close = false
  390. self.sell_type = sell_type
  391. end
  392. if sell_sub_type then
  393. self.sell_sub_type = sell_sub_type
  394. elseif need_refresh then
  395. self.sell_sub_type = sell_sub_type
  396. end
  397. local sell_sub_type_temp = nil
  398. if self.model:CheckMarketCanSelectZero(self.sell_type) then
  399. sell_sub_type_temp = 0
  400. else
  401. sell_sub_type_temp = 1
  402. end
  403. if self.cur_hor_tab_index == 1 then
  404. self.model:CleanMarketGoodsInfoByType(self.sell_type or self.last_sell_type, self.sell_sub_type or sell_sub_type_temp)
  405. else
  406. self.model:CleanMarketGuildGoodsInfoByType(self.sell_type or self.last_sell_type, self.sell_sub_type or sell_sub_type_temp)
  407. end
  408. self:UpdateVerTabBtns(need_refresh)
  409. self:UpdateSelectVer(need_refresh)
  410. end
  411. local tag_all_info = {
  412. data_list = data,
  413. item_con = self.left_con,
  414. item_class = MarketVerTabItem,
  415. item_width = 206,
  416. get_item_height = function(i)
  417. return data[i].is_tab and 56 or 48
  418. end,
  419. reuse_item_num = 12,
  420. start_x = 2,
  421. start_y = -10,
  422. space_y = 2,
  423. scroll_view = self.left_scroll,
  424. create_frequency = 0.01,
  425. on_update_item = function(item, i, v)
  426. if self.cur_hor_tab_index == 1 then
  427. item:SetData(v, i, self.sell_type, self.sell_sub_type)
  428. else
  429. item:SetData(v, i, self.sell_type, self.sell_sub_type, MarketModel.VER_TAB_TYPE.GUILD_TYPE)
  430. end
  431. item:SetCallBackFunc(call_back)
  432. end,
  433. }
  434. self.tab_creator:UpdateItems(tag_all_info)
  435. if self.is_first then
  436. self:UpdateSelectVer(true)
  437. self:UpdateGoodsList()
  438. -- self:OnTouchEnd(0,0,true)
  439. self.is_first = false
  440. end
  441. if need_refresh then
  442. self:UpdateFliter()
  443. end
  444. end
  445. --设置垂直tab选择
  446. function MarketBuyHallView:UpdateSelectVer( need_refresh )
  447. self.tab_creator:IterateItems(function(item, i, v)
  448. item:SetSelect(self.sell_type, self.sell_sub_type)
  449. end)
  450. self:OnTouchEnd(0,0,true)
  451. if need_refresh then
  452. self:ScrollToSelectItem()
  453. end
  454. end
  455. function MarketBuyHallView:ScrollToSelectItem( )
  456. if not self.sell_sub_type then--如果没有选中第二层的item就默认选第一个
  457. self.sell_sub_type = 1
  458. end
  459. for i,v in ipairs(self.tab_data) do
  460. if v.sell_type == self.sell_type and v.sell_sub_type == self.sell_sub_type then
  461. self.tab_creator:ScrollToItem(i-1)
  462. end
  463. end
  464. end
  465. function MarketBuyHallView:UpdateGoodsList( )
  466. local goods_list = self.model:GetMarketGoodsInfo(self.sell_type or self.last_sell_type, self.sell_sub_type)
  467. if self.cur_hor_tab_index == 2 then
  468. goods_list = self.model:GetMarketGuildGoodsInfo(self.sell_type or self.last_sell_type, self.sell_sub_type)
  469. end
  470. local data = {}
  471. local page = TableSize(goods_list)
  472. for i=1,page do
  473. if goods_list[page] then
  474. for i,v in ipairs(goods_list[i]) do
  475. data[#data+1] = v
  476. end
  477. end
  478. end
  479. if TableSize(data) == 0 then
  480. self.empty_obj:SetActive(true)
  481. self.empty_text_tmp.text = "还没有该类商品出售哦~"
  482. else
  483. self.empty_obj:SetActive(false)
  484. end
  485. if not self.goods_list_com then
  486. self.goods_list_com = self:AddUIComponent(UI.ItemListCreator)
  487. end
  488. if self.need_reset then
  489. self.goods_list_com:Reset()
  490. self.need_reset = false
  491. end
  492. local info = {
  493. data_list = data,
  494. item_con = self.right_con,
  495. scroll_view = self.right_scroll,
  496. item_class = MarketGoodsItem,
  497. start_y = 0, start_x = 8,
  498. create_frequency = 0.02,
  499. create_num_per_time = 3,
  500. item_height = 100,
  501. space_y = 0,
  502. on_update_item = function(item, i, v)
  503. item:SetData(i, v)
  504. end,
  505. }
  506. self.goods_list_com:UpdateItems(info)
  507. end
  508. function MarketBuyHallView:RequestGoodsListWithPage(page)
  509. --判断page是否合法
  510. if self.cur_hor_tab_index == 1 and not self.model:IsLastGoodsPage(self.sell_type or self.last_sell_type, self.sell_sub_type) then
  511. self.model:Fire(MarketModel.REQUEST_CCMD_EVENT, 15501, self.cur_hor_tab_index, self.sell_type or self.last_sell_type, self.sell_sub_type, self.series_limit,
  512. self.color, self.career_limit, self.page_size, page, self.sort_id, self.sort_order)
  513. elseif self.cur_hor_tab_index == 2 and not self.model:IsLastGuildGoodsPage(self.sell_type or self.last_sell_type, self.sell_sub_type) then
  514. self.model:Fire(MarketModel.REQUEST_CCMD_EVENT, 15501, self.cur_hor_tab_index, self.sell_type or self.last_sell_type, self.sell_sub_type, self.series_limit,
  515. self.color, self.career_limit, self.page_size, page, self.sort_id, self.sort_order)
  516. else
  517. -- Message.show("已经是最后一页了哦~")
  518. end
  519. end
  520. function MarketBuyHallView:OnTouchEnd(pos_x,pos_y, is_force)
  521. local tempPos = self.right_con.transform.localPosition --获取拖动的值
  522. local num = 0
  523. if self.cur_hor_tab_index == 2 then
  524. num = self.model:GetMarketGuildGoodsListNum(self.sell_type or self.last_sell_type, self.sell_sub_type)
  525. else
  526. num = self.model:GetMarketGoodsListNum(self.sell_type or self.last_sell_type, self.sell_sub_type)
  527. end
  528. local page = math.ceil(num / self.page_size)
  529. local total_height = MarketGoodsItem.HEIGHT * num
  530. if tempPos.y - MarketGoodsItem.HEIGHT * (num-self.page_size) >= 0 or is_force then
  531. self:RequestGoodsListWithPage(page + 1)
  532. end
  533. end
  534. --用来请求一下当前选中页签内容
  535. function MarketBuyHallView:RefreshData( )
  536. if self.cur_hor_tab_index == 1 then
  537. self.model:CleanMarketGoodsInfo()
  538. else
  539. self.model:CleanMarketGuildGoodsInfo()
  540. end
  541. self:UpdateView()
  542. end
  543. function MarketBuyHallView:__delete()
  544. self.model:CleanMarketGoodsInfo()
  545. self.model:CleanMarketGuildGoodsInfo()
  546. if self.on_update_goods_id then
  547. self.model:UnBind(self.on_update_goods_id)
  548. self.on_update_goods_id = nil
  549. end
  550. if self.on_update_guild_goods_id then
  551. self.model:UnBind(self.on_update_guild_goods_id)
  552. self.on_update_guild_goods_id = nil
  553. end
  554. for _, v in pairs(self.tab_item_list) do
  555. v:DeleteMe()
  556. v = nil
  557. end
  558. self.tab_item_list = {}
  559. if self.on_refresh_data_id then
  560. self.model:UnBind(self.on_refresh_data_id)
  561. self.on_refresh_data_id = nil
  562. end
  563. if self.combox_career then
  564. self.combox_career:DeleteMe()
  565. self.combox_career = nil
  566. end
  567. if self.combox_series then
  568. self.combox_series:DeleteMe()
  569. self.combox_series = nil
  570. end
  571. if self.combox_color then
  572. self.combox_color:DeleteMe()
  573. self.combox_color = nil
  574. end
  575. end