UIActivityGoddessView.lua 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. local UIActivityGoddessView = require("UIActivity/UIActivityGoddessView_Generate")
  2. function UIActivityGoddessView:OnAwake(data)
  3. LogError("========================"..Inspect(data))
  4. self.controller = require("UIActivity/UIActivityGoddessCtr"):new()
  5. self.controller:Init(self)
  6. self.controller:SetData(data)
  7. end
  8. function UIActivityGoddessView:AddEventListener()
  9. ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.EID_Activity_Data_Change,self,self.OnActivityDataChanged)
  10. end
  11. function UIActivityGoddessView:FillContent(data, uiBase)
  12. self.uiBase = uiBase
  13. local gameObject = self.uiBase:GetRoot()
  14. if gameObject ~= nil then
  15. self.gameObject = gameObject
  16. self.transform = gameObject.transform
  17. end
  18. self:InitGenerate(self.transform, data)
  19. self:Init()
  20. end
  21. function UIActivityGoddessView:Init()
  22. self.controller:InitData()
  23. self:RefreshBg()
  24. self.lastLoveLv = nil
  25. self.lastLoveVal = nil
  26. self:RefreshTimer()
  27. self:RefreshLoveGifts()
  28. self:RefreshOwnerGifts()
  29. self:OpenGiveGift(nil)
  30. end
  31. function UIActivityGoddessView:RemoveEventListener()
  32. ManagerContainer.LuaEventMgr:Unregister(self.uiData.name)
  33. end
  34. function UIActivityGoddessView:AddUIEventListener()
  35. self.uiBase:AddButtonUniqueEventListener(self.btnInfo.button, self, self.OnClickInfoBtn)
  36. self.uiBase:AddButtonUniqueEventListener(self.backBtn.button, self, self.OnClickBackBtn)
  37. self.uiBase:AddButtonUniqueEventListener(self.giveTipsClickRect.button, self, self.OnClickGiveTipsClickRect)
  38. end
  39. function UIActivityGoddessView:OnHide()
  40. end
  41. function UIActivityGoddessView:OnShow(data)
  42. self.controller:SetData(data)
  43. end
  44. function UIActivityGoddessView:OnClose()
  45. end
  46. function UIActivityGoddessView:OnDispose()
  47. self.curGiveGiftIdx = nil
  48. if self.endTimer then
  49. if self.endTimer.running then
  50. self.endTimer:Stop()
  51. end
  52. self.endTimer = nil
  53. end
  54. self.lastLoveLv = nil
  55. self.lastLoveVal = nil
  56. self:DisposeLoveGiftItems()
  57. self:DisposeOwnerGiftItems()
  58. self:DisposeGiveGiftItems()
  59. self.controller:OnDispose()
  60. end
  61. function UIActivityGoddessView:OnActivityDataChanged(activityId)
  62. local actItem = self.controller:GetActivityData()
  63. --LogError("11111"..Inspect(actItem));
  64. if actItem == nil or actItem.actId ~= activityId then
  65. return
  66. end
  67. --LogError("22222");
  68. self:RefreshTimer()
  69. self:RefreshLoveGifts()
  70. self:RefreshOwnerGifts()
  71. self:RefreshGiveGifts()
  72. end
  73. function UIActivityGoddessView:OnClickBackBtn()
  74. self:UIClose()
  75. if self.uiBase.MSourceUIID > 0 then
  76. ManagerContainer.LuaUIMgr:Open(self.uiBase.MSourceUIID)
  77. end
  78. end
  79. function UIActivityGoddessView:OnClickInfoBtn()
  80. local actItem = self.controller:GetActivityData()
  81. if not actItem then return end
  82. if not actItem.infoLangKey or actItem.infoLangKey == '' then return end
  83. ManagerContainer.LuaUIMgr:Open(Enum.UIPageName.UIPlayRule, {'PlayExplainTitle', actItem.infoLangKey})
  84. end
  85. function UIActivityGoddessView:OnClickItemBtn(_, params)
  86. local data = params[0]
  87. ManagerContainer.LuaUIMgr:OpenTips(data)
  88. end
  89. function UIActivityGoddessView:OnClickOwnerGiftItem(_, params)
  90. local idx = params[2]
  91. self:OpenGiveGift(idx)
  92. end
  93. function UIActivityGoddessView:OnClickGiveTipsClickRect()
  94. self:OpenGiveGift(nil)
  95. end
  96. function UIActivityGoddessView:OnClickGiveGiftItem(_, params)
  97. local data = params[0]
  98. local idx = params[2]
  99. local errorCode = self.controller:SendGiveLikabilityReq(self.curGiveGiftIdx, data.cfgId, idx)
  100. if errorCode and errorCode ~= 0 then
  101. ManagerContainer.LuaUIMgr:ErrorNoticeDisplay(errorCode)
  102. end
  103. end
  104. function UIActivityGoddessView:RefreshBg()
  105. self.banner.image.enabled = false
  106. self.banner.image.sprite = nil
  107. CommonUtil.LoadIcon(self, self.controller:GetBg(), function(sprite)
  108. if sprite then
  109. self.banner.image.sprite = sprite
  110. self.banner.image.enabled = true
  111. end
  112. end)
  113. end
  114. function UIActivityGoddessView:RefreshTimer()
  115. local actItem = self.controller:GetActivityData()
  116. local remainTime = 0
  117. if actItem and actItem:IsLimited() then
  118. remainTime = actItem:LeftTime()
  119. if remainTime < 0 then
  120. remainTime = 0
  121. end
  122. end
  123. if remainTime < 60 then
  124. self.timeTxt.text.text = I18N.SetLanguageValue('ActCloseTime', I18N.T('LessOneMinu'))
  125. if self.endTimer and self.endTimer.running then
  126. self.endTimer:Stop()
  127. end
  128. return
  129. else
  130. self.timeTxt.text.text = I18N.SetLanguageValue('ActCloseTime', DateTimeUtil.convertSeconds2TimeStr1(remainTime, true, false, false))
  131. end
  132. local validTime = nil
  133. if remainTime >= 86400 then
  134. validTime = remainTime % 3600
  135. if validTime == 0 then validTime = 3600 end
  136. elseif remainTime >= 3600 then
  137. validTime = remainTime % 60
  138. if validTime == 0 then validTime = 60 end
  139. else
  140. validTime = 1
  141. end
  142. if not self.endTimer then
  143. self.endTimer = Timer.New(slot(self.RefreshTimer, self), validTime, -1)
  144. else
  145. self.endTimer.duration = validTime
  146. end
  147. if not self.endTimer.running then
  148. self.endTimer:Start()
  149. end
  150. end
  151. function UIActivityGoddessView:RefreshLoveGifts()
  152. local actItem = self.controller:GetActivityData()
  153. if not actItem then
  154. self.favoring:SetActive(false)
  155. return
  156. end
  157. self.favoring:SetActive(true)
  158. local curLoveLv = actItem:GetCurLoveLv()
  159. local curLoveVal = actItem:GetCurLoveVal()
  160. local actId = self.controller:GetActId()
  161. local cfgData = ManagerContainer.CfgMgr:GetActivityGoddessLoveCfgByLv(actId, curLoveLv)
  162. self.favoring.lv.text.text = tostring(curLoveLv)
  163. if not cfgData or not cfgData.LikeMax or cfgData.LikeMax <= 0 then
  164. self.favoring.lv.text.text = string.formatbykey('LikeLevelMax')
  165. self.favoring.slider.num.text.text = '0'
  166. self.favoring.slider.slider.value = 1
  167. elseif cfgData.LikeMax <= curLoveVal then
  168. self.favoring.lv.text.text = string.formatbykey('LikeLevelMax')
  169. self.favoring.slider.num.text.text = tostring(cfgData.LikeMax)
  170. self.favoring.slider.slider.value = 1
  171. else
  172. self.favoring.lv.text.text = tostring(curLoveLv)
  173. self.favoring.slider.num.text.text = tostring(curLoveVal)
  174. self.favoring.slider.slider.value = curLoveVal / cfgData.LikeMax
  175. end
  176. if self.lastLoveLv and self.lastLoveVal then
  177. local upVal = 0
  178. if self.lastLoveLv == curLoveLv then
  179. if self.lastLoveVal < curLoveVal then
  180. upVal = (curLoveVal - self.lastLoveVal)
  181. end
  182. elseif self.lastLoveLv < curLoveLv then
  183. upVal = curLoveVal
  184. local tempCfgData = ManagerContainer.CfgMgr:GetActivityGoddessLoveCfgByLv(actId, self.lastLoveLv)
  185. if tempCfgData then
  186. upVal = upVal + (tempCfgData.LikeMax - self.lastLoveVal)
  187. end
  188. for i = self.lastLoveLv + 1, curLoveLv - 1 do
  189. tempCfgData = ManagerContainer.CfgMgr:GetActivityGoddessLoveCfgByLv(actId, i)
  190. if tempCfgData then
  191. upVal = upVal + tempCfgData.LikeMax
  192. end
  193. end
  194. end
  195. if upVal > 0 then
  196. ManagerContainer.LuaUIMgr:ErrorNoticeDisplayWithParam('LikeUpNum', tostring(upVal))
  197. end
  198. end
  199. self.lastLoveLv = curLoveLv
  200. self.lastLoveVal = curLoveVal
  201. local loveGiftItems = self.loveGiftItems
  202. if not loveGiftItems then
  203. loveGiftItems = {self.favoring.item}
  204. self.loveGiftItems = loveGiftItems
  205. end
  206. local len1 = #loveGiftItems
  207. local len2 = 0
  208. if cfgData and cfgData.Conditionrewards then
  209. local rectW = self.favoring.slider.slider.handleRect.parent.rect.width
  210. local defPos = self.favoring.item.transform.anchoredPosition3D
  211. len2 = #cfgData.Conditionrewards
  212. for i = 1, len2 do
  213. local loveGiftItem = nil
  214. local trans = nil
  215. if i <= len1 then
  216. loveGiftItem = loveGiftItems[i]
  217. trans = loveGiftItem.transform
  218. else
  219. loveGiftItem = UnityEngine.GameObject.Instantiate(self.favoring.item.gameObject)
  220. trans = loveGiftItem.transform
  221. trans:SetParent(self.favoring.item.transform.parent)
  222. trans.localRotation = Quaternion.identity
  223. trans.localScale = Vector3.one
  224. if tolua.getpeer(loveGiftItem) == nil then
  225. tolua.setpeer(loveGiftItem, {})
  226. end
  227. local tmp = trans:Find('text/num').gameObject
  228. if tolua.getpeer(tmp) == nil then
  229. tolua.setpeer(tmp, {})
  230. end
  231. loveGiftItem.num = tmp
  232. tmp.text = tmp:GetComponent(Enum.TypeInfo.Text)
  233. tmp = trans:Find('IconSmallItem').gameObject
  234. if tolua.getpeer(tmp) == nil then
  235. tolua.setpeer(tmp, {})
  236. end
  237. loveGiftItem.iconSmallItem = CommonUtil.BindGridViewItem2LuaStatic("IconItem", tmp)
  238. loveGiftItem.iconSmallItem.prefabName = "IconItem"
  239. tmp.rectTransform = tmp:GetComponent(Enum.TypeInfo.RectTransform)
  240. tmp.layoutElement = tmp:GetComponent(Enum.TypeInfo.LayoutElement)
  241. loveGiftItems[i] = loveGiftItem
  242. end
  243. loveGiftItem:SetActive(true)
  244. local reward = cfgData.Conditionrewards[i]
  245. local loveVal = reward[1]
  246. local posX = rectW
  247. if cfgData.LikeMax and cfgData.LikeMax > 0 then
  248. posX = posX * ((loveVal / cfgData.LikeMax) - 0.5)
  249. end
  250. trans.anchoredPosition3D = Vector3(posX, defPos.y, defPos.z)
  251. loveGiftItem.num.text.text = tostring(loveVal)
  252. if curLoveVal >= loveVal then
  253. CommonUtil.UpdateItemPrefab(self, loveGiftItem.iconSmallItem, {cfgId = reward[2], num = reward[3]}, Enum.ItemIEnterType.Bag)
  254. CommonUtil.SetTotalChildrenGray(loveGiftItem.iconSmallItem.gameObject, true)
  255. else
  256. CommonUtil.SetTotalChildrenGray(loveGiftItem.iconSmallItem.gameObject, false)
  257. CommonUtil.UpdateItemPrefab(self, loveGiftItem.iconSmallItem, {cfgId = reward[2], num = reward[3]}, Enum.ItemIEnterType.Bag, self, self.OnClickItemBtn)
  258. end
  259. end
  260. end
  261. for i = len2 + 1, len1 do
  262. if loveGiftItems[i] then
  263. loveGiftItems[i]:SetActive(false)
  264. end
  265. end
  266. end
  267. function UIActivityGoddessView:DisposeLoveGiftItems()
  268. local loveGiftItems = self.loveGiftItems
  269. if not loveGiftItems then
  270. return
  271. end
  272. for _, loveGiftItem in pairs(loveGiftItems) do
  273. if loveGiftItem and loveGiftItem ~= self.favoring.item then
  274. local go = loveGiftItem.gameObject
  275. if loveGiftItem.iconSmallItem.GenerateDestroy ~= nil then
  276. loveGiftItem.iconSmallItem:GenerateDestroy()
  277. end
  278. if tolua.getpeer(loveGiftItem.iconSmallItem) ~= nil then
  279. tolua.setpeer(loveGiftItem.iconSmallItem, nil)
  280. end
  281. if tolua.getpeer(loveGiftItem.num) ~= nil then
  282. tolua.setpeer(loveGiftItem.num, nil)
  283. end
  284. if tolua.getpeer(loveGiftItem) ~= nil then
  285. tolua.setpeer(loveGiftItem, nil)
  286. end
  287. CommonUtil.DestroyGO(go)
  288. end
  289. end
  290. self.loveGiftItems = nil
  291. end
  292. function UIActivityGoddessView:RefreshOwnerGifts()
  293. local actItem = self.controller:GetActivityData()
  294. if not actItem then
  295. self.owenGift:SetActive(false)
  296. return
  297. end
  298. self.owenGift:SetActive(true)
  299. local ownerGiftItems = self.ownerGiftItems
  300. if not ownerGiftItems then
  301. ownerGiftItems = {self.owenGift.item}
  302. self.ownerGiftItems = ownerGiftItems
  303. end
  304. local actId = self.controller:GetActId()
  305. local cfgDatas = ManagerContainer.CfgMgr:GetActivityGoddessGiftCfgByActId(actId)
  306. local len1 = #ownerGiftItems
  307. local len2 = 0
  308. if cfgDatas then
  309. len2 = #cfgDatas
  310. for i = 1, len2 do
  311. local ownerGiftItem = nil
  312. local trans = nil
  313. if i <= len1 then
  314. ownerGiftItem = ownerGiftItems[i]
  315. trans = ownerGiftItem.transform
  316. else
  317. ownerGiftItem = UnityEngine.GameObject.Instantiate(self.owenGift.item.gameObject)
  318. trans = ownerGiftItem.transform
  319. trans:SetParent(self.owenGift.transform)
  320. trans.localPosition = Vector3.zero
  321. trans.localRotation = Quaternion.identity
  322. trans.localScale = Vector3.one
  323. if tolua.getpeer(ownerGiftItem) == nil then
  324. tolua.setpeer(ownerGiftItem, {})
  325. end
  326. local tmp = trans:Find('Num/num').gameObject
  327. if tolua.getpeer(tmp) == nil then
  328. tolua.setpeer(tmp, {})
  329. end
  330. ownerGiftItem.num = tmp
  331. tmp.text = tmp:GetComponent(Enum.TypeInfo.Text)
  332. tmp = trans:Find('IconItem').gameObject
  333. if tolua.getpeer(tmp) == nil then
  334. tolua.setpeer(tmp, {})
  335. end
  336. ownerGiftItem.iconItem = CommonUtil.BindGridViewItem2LuaStatic("IconItem", tmp)
  337. ownerGiftItem.iconItem.prefabName = "IconItem"
  338. tmp.rectTransform = tmp:GetComponent(Enum.TypeInfo.RectTransform)
  339. tmp.layoutElement = tmp:GetComponent(Enum.TypeInfo.LayoutElement)
  340. ownerGiftItems[i] = ownerGiftItem
  341. end
  342. ownerGiftItem:SetActive(true)
  343. local cfgData = cfgDatas[i]
  344. ownerGiftItem.num.text.text = CommonUtil.FormatNumber(CommonUtil.GetOwnResCountByItemId(cfgData.Classitemid))
  345. CommonUtil.UpdateItemPrefab(self, ownerGiftItem.iconItem, {cfgId = cfgData.Classitemid}, Enum.ItemIEnterType.Bag, self, self.OnClickOwnerGiftItem, i)
  346. end
  347. end
  348. for i = len2 + 1, len1 do
  349. if ownerGiftItems[i] then
  350. ownerGiftItems[i]:SetActive(false)
  351. end
  352. end
  353. end
  354. function UIActivityGoddessView:DisposeOwnerGiftItems()
  355. local ownerGiftItems = self.ownerGiftItems
  356. if not ownerGiftItems then
  357. return
  358. end
  359. for _, ownerGiftItem in pairs(ownerGiftItems) do
  360. if ownerGiftItem and ownerGiftItem ~= self.owenGift.item then
  361. local go = ownerGiftItem.gameObject
  362. if ownerGiftItem.iconItem.GenerateDestroy ~= nil then
  363. ownerGiftItem.iconItem:GenerateDestroy()
  364. end
  365. if tolua.getpeer(ownerGiftItem.iconItem) ~= nil then
  366. tolua.setpeer(ownerGiftItem.iconItem, nil)
  367. end
  368. if tolua.getpeer(ownerGiftItem.num) ~= nil then
  369. tolua.setpeer(ownerGiftItem.num, nil)
  370. end
  371. if tolua.getpeer(ownerGiftItem) ~= nil then
  372. tolua.setpeer(ownerGiftItem, nil)
  373. end
  374. CommonUtil.DestroyGO(go)
  375. end
  376. end
  377. self.ownerGiftItems = nil
  378. end
  379. function UIActivityGoddessView:OpenGiveGift(idx)
  380. local actItem = self.controller:GetActivityData()
  381. if not actItem then
  382. return
  383. end
  384. if self.curGiveGiftIdx == idx then
  385. return
  386. end
  387. self.curGiveGiftIdx = idx
  388. if not idx then
  389. self.giveTipsClickRect:SetActive(false)
  390. self.giveTips:SetActive(false)
  391. return
  392. end
  393. self.giveTipsClickRect:SetActive(true)
  394. self.giveTips:SetActive(true)
  395. self:RefreshGiveGifts()
  396. end
  397. function UIActivityGoddessView:RefreshGiveGifts()
  398. if not self.curGiveGiftIdx then
  399. return
  400. end
  401. local actId = self.controller:GetActId()
  402. local cfgDatas = ManagerContainer.CfgMgr:GetActivityGoddessGiftCfgByActId(actId)
  403. if not cfgDatas then
  404. self:OpenGiveGift(nil)
  405. return
  406. end
  407. local cfgData = cfgDatas[self.curGiveGiftIdx]
  408. if not cfgDatas then
  409. self:OpenGiveGift(nil)
  410. return
  411. end
  412. local giveGiftItems = self.giveGiftItems
  413. if not giveGiftItems then
  414. giveGiftItems = {self.giveTips.item}
  415. self.giveGiftItems = giveGiftItems
  416. end
  417. local len1 = #giveGiftItems
  418. local len2 = 0
  419. local giveGifts = cfgData.Classcostaddlike
  420. if giveGifts then
  421. local cfgId = cfgData.Classitemid
  422. local ownerNum = CommonUtil.GetOwnResCountByItemId(cfgId)
  423. local data = {cfgId = cfgId}
  424. len2 = #giveGifts
  425. for i = 1, len2 do
  426. local giveGiftItem = nil
  427. local trans = nil
  428. if i <= len1 then
  429. giveGiftItem = giveGiftItems[i]
  430. trans = giveGiftItem.transform
  431. else
  432. giveGiftItem = UnityEngine.GameObject.Instantiate(self.giveTips.item.gameObject)
  433. trans = giveGiftItem.transform
  434. trans:SetParent(self.giveTips.transform)
  435. trans.localPosition = Vector3.zero
  436. trans.localRotation = Quaternion.identity
  437. trans.localScale = Vector3.one
  438. if tolua.getpeer(giveGiftItem) == nil then
  439. tolua.setpeer(giveGiftItem, {})
  440. end
  441. local tmp = trans:Find('text/num').gameObject
  442. if tolua.getpeer(tmp) == nil then
  443. tolua.setpeer(tmp, {})
  444. end
  445. giveGiftItem.num = tmp
  446. tmp.text = tmp:GetComponent(Enum.TypeInfo.Text)
  447. tmp = trans:Find('IconSmallItem').gameObject
  448. if tolua.getpeer(tmp) == nil then
  449. tolua.setpeer(tmp, {})
  450. end
  451. giveGiftItem.iconSmallItem = CommonUtil.BindGridViewItem2LuaStatic("IconItem", tmp)
  452. giveGiftItem.iconSmallItem.prefabName = "IconItem"
  453. tmp.rectTransform = tmp:GetComponent(Enum.TypeInfo.RectTransform)
  454. tmp.layoutElement = tmp:GetComponent(Enum.TypeInfo.LayoutElement)
  455. giveGiftItems[i] = giveGiftItem
  456. end
  457. giveGiftItem:SetActive(true)
  458. local giveGift = giveGifts[i]
  459. if ownerNum < giveGift[1] then
  460. giveGiftItem.num.text.text = string.format(Constant.RedColorText, '+' .. tostring(giveGift[2]))
  461. CommonUtil.UpdateItemPrefab(self, giveGiftItem.iconSmallItem, {cfgId = cfgId, num = giveGift[1]}, Enum.ItemIEnterType.Bag)
  462. CommonUtil.SetTotalChildrenGray(giveGiftItem.iconSmallItem.gameObject, true)
  463. else
  464. giveGiftItem.num.text.text = '+' .. tostring(giveGift[2])
  465. CommonUtil.SetTotalChildrenGray(giveGiftItem.iconSmallItem.gameObject, false)
  466. CommonUtil.UpdateItemPrefab(self, giveGiftItem.iconSmallItem, {cfgId = cfgId, num = giveGift[1]}, Enum.ItemIEnterType.Bag, self, self.OnClickGiveGiftItem, i)
  467. end
  468. end
  469. end
  470. for i = len2 + 1, len1 do
  471. if giveGiftItems[i] then
  472. giveGiftItems[i]:SetActive(false)
  473. end
  474. end
  475. local transform = self.giveTips.transform
  476. ManagerContainer.LuaUIMgr:ForceRebuildLayoutImmediate(transform)
  477. local posX = 0
  478. local arrowPos = nil
  479. local item = self.ownerGiftItems[self.curGiveGiftIdx]
  480. if item then
  481. arrowPos = item.transform.position
  482. posX = self.giveTipsOffsetRect.transform.parent:InverseTransformPoint(arrowPos).x
  483. local halfW = transform.rect.width * 0.5
  484. local rect = self.giveTipsOffsetRect.transform.rect
  485. if rect.xMin > (posX - halfW) then
  486. posX = (rect.xMin + halfW)
  487. end
  488. if rect.xMax < (posX + halfW) then
  489. posX = (rect.xMax - halfW)
  490. end
  491. else
  492. arrowPos = Vector3.zero
  493. end
  494. local pos = transform.anchoredPosition3D
  495. transform.anchoredPosition3D = Vector3(posX, pos.y, pos.z)
  496. transform = self.giveTips.arrow.transform
  497. local oldPos = transform.position
  498. oldPos.x = arrowPos.x
  499. transform.position = oldPos
  500. end
  501. function UIActivityGoddessView:DisposeGiveGiftItems()
  502. local giveGiftItems = self.giveGiftItems
  503. if not giveGiftItems then
  504. return
  505. end
  506. for _, giveGiftItem in pairs(giveGiftItems) do
  507. if giveGiftItem and giveGiftItem ~= self.giveTips.item then
  508. local go = giveGiftItem.gameObject
  509. if giveGiftItem.iconSmallItem.GenerateDestroy ~= nil then
  510. giveGiftItem.iconSmallItem:GenerateDestroy()
  511. end
  512. if tolua.getpeer(giveGiftItem.iconSmallItem) ~= nil then
  513. tolua.setpeer(giveGiftItem.iconSmallItem, nil)
  514. end
  515. if tolua.getpeer(giveGiftItem.num) ~= nil then
  516. tolua.setpeer(giveGiftItem.num, nil)
  517. end
  518. if tolua.getpeer(giveGiftItem) ~= nil then
  519. tolua.setpeer(giveGiftItem, nil)
  520. end
  521. CommonUtil.DestroyGO(go)
  522. end
  523. end
  524. self.giveGiftItems = nil
  525. end
  526. return UIActivityGoddessView