LuaUIMgr.lua 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. local LuaUIMgr = class("LuaUIMgr", function()
  2. return UIMgr.Instance
  3. end)
  4. local oldSlot
  5. local UIOpenStatusList = {}
  6. function LuaUIMgr:ctor()
  7. ManagerContainer.LuaEventMgr:RegisterEvent(UIEventNames.LIMIT_RECHARGE_OPEN_UI_NTF, self, self.OpenLimitRechargeUI)
  8. self.isAcrossRole = false
  9. self.UIViewMap = {}
  10. self.ShowUIPageList = {}
  11. self:SetClickLuaFun(self.OnClickScreen)
  12. end
  13. function LuaUIMgr:Destroy()
  14. ManagerContainer.LuaEventMgr:UnregisterEvent(UIEventNames.LIMIT_RECHARGE_OPEN_UI_NTF, self, self.OpenLimitRechargeUI)
  15. self.uiBattleDropRoot = nil
  16. if tolua.getpeer(self) ~= nil then
  17. tolua.setpeer(self, nil)
  18. end
  19. end
  20. local isRoleUI = false
  21. function LuaUIMgr:OnClickScreen()
  22. ManagerContainer.LuaUIMgr:Hide(Enum.UIPageName.UIMinTips)
  23. end
  24. function LuaUIMgr:Open(id, param, sourceUI, needOutAnim, skipCloseAll, sortingOrder)
  25. local page = self:GetPage(id)
  26. local view, uiData
  27. if page ~= nil and page.MLuaTable then
  28. view = page.MLuaTable
  29. uiData = view.uiData
  30. else
  31. uiData = ManagerContainer.CfgMgr:GetUIData(id)
  32. if uiData == nil then
  33. LogError( CommonUtil.StringConcat(id, " ui isnt exist") )
  34. return
  35. end
  36. local luaPath = nil
  37. if uiData.lua_path and uiData.lua_path ~= '' then
  38. luaPath = CommonUtil.StringConcat(uiData.lua_path, "View")
  39. else
  40. luaPath = CommonUtil.StringConcat(uiData.res_path, "View")
  41. end
  42. view = require(luaPath):new()
  43. if view == nil then
  44. LogError( CommonUtil.StringConcat(id, " view isnt exist") )
  45. return
  46. end
  47. view.uiData = uiData
  48. self:AddUIView(uiData.id, view)
  49. end
  50. if not Constant.OpenPay then
  51. if uiData and uiData.NoPay then
  52. return
  53. end
  54. end
  55. if uiData.type == Enum.UIType.Total then
  56. if uiData.id ~= Enum.UIPageName.UIBattle then
  57. ManagerContainer.LuaUIMgr:Hide(Enum.UIPageName.UIBattle)
  58. ManagerContainer.LuaUIMgr:SetBattleDropRootVisible(false)
  59. end
  60. if not skipCloseAll then
  61. ManagerContainer.LuaUIMgr:CloseAllPagesExceptIdAndPersistentWnd(uiData.id)
  62. end
  63. end
  64. self:LuaOpenUI(uiData, view, sortingOrder or Enum.UISibling[uiData.type + 1], param, sourceUI or 0, needOutAnim)
  65. -- if uiData.id == Enum.UIPageName.UIBattle or uiData.id == Enum.UIPageName.UIMainCity then
  66. if uiData.id == Enum.UIPageName.UIBattle then
  67. elseif uiData.type == Enum.UIType.Total then
  68. if uiData.id == Enum.UIPageName.UIRoleMain1 then
  69. isRoleUI = true;
  70. end
  71. end
  72. end
  73. function LuaUIMgr:CloseRoleUI()
  74. isRoleUI = false
  75. end
  76. function LuaUIMgr:GetBattleUIDropRoot()
  77. if self.UIBattleRootTrans == nil then
  78. return
  79. end
  80. local drop = self.UIBattleRootTrans:Find("DropRoot")
  81. if tolua.isnull(drop) then
  82. return
  83. end
  84. self.uiBattleDropRoot = drop
  85. if self.uiBattleDropRoot == nil then
  86. return
  87. end
  88. return self.uiBattleDropRoot
  89. end
  90. function LuaUIMgr:SetBattleDropRootVisible(state)
  91. local dropRoot = self:GetBattleUIDropRoot()
  92. if dropRoot == nil then return end
  93. dropRoot.gameObject:SetActive(state)
  94. end
  95. function LuaUIMgr:IsInRoleUI()
  96. return isRoleUI
  97. end
  98. function LuaUIMgr:ClosePage(id, needOutAnim)
  99. local uiData = ManagerContainer.CfgMgr:GetUIData(id);
  100. if uiData == nil then
  101. return;
  102. end
  103. local ignoreCheckCam = id == Enum.UIPageName.UILoading or id == Enum.UIPageName.UIStartLoading
  104. self:Close(uiData.id,ignoreCheckCam, (needOutAnim == false and false or true));
  105. end
  106. function LuaUIMgr:ErrorNoticeDisplay(error)
  107. if not error or error == "" then return end
  108. --网络重连状态,不显示errortips
  109. if self:HasOpenPage(Enum.UIPageName.UIWaiting) then
  110. return
  111. end
  112. local uiData = ManagerContainer.CfgMgr:GetUIData(Enum.UIPageName.UIErrorTips)
  113. if not ManagerContainer.LuaUIMgr:GetPage(uiData.id) then
  114. ManagerContainer.LuaUIMgr:Open(Enum.UIPageName.UIErrorTips, {errorId=error})
  115. else
  116. ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.ERROR_DESC_DISPLAY, {errorId=error})
  117. end
  118. end
  119. function LuaUIMgr:ErrorNoticeDisplayWithParam(error,...)
  120. if not error or error == "" then return end
  121. local uiData = ManagerContainer.CfgMgr:GetUIData(Enum.UIPageName.UIErrorTips)
  122. if not ManagerContainer.LuaUIMgr:GetPage(uiData.id) then
  123. ManagerContainer.LuaUIMgr:Open(Enum.UIPageName.UIErrorTips, {errorId=error,params = {...}})
  124. else
  125. ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.ERROR_DESC_DISPLAY, {errorId=error,params = {...}})
  126. end
  127. end
  128. function LuaUIMgr:AttrNoticeDisplay1(data)
  129. local uiData = ManagerContainer.CfgMgr:GetUIData(Enum.UIPageName.UIAttrAddTips)
  130. if not ManagerContainer.LuaUIMgr:GetPage(uiData.id) then
  131. ManagerContainer.LuaUIMgr:Open(Enum.UIPageName.UIAttrAddTips, data)
  132. else
  133. ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.ADD_ATTR_DISPLAY, data)
  134. end
  135. end
  136. function LuaUIMgr:POPGotAnimNotice(data)
  137. local uiData = ManagerContainer.CfgMgr:GetUIData(Enum.UIPageName.UIPOPGotAnims)
  138. if not ManagerContainer.LuaUIMgr:GetPage(uiData.id) then
  139. ManagerContainer.LuaUIMgr:Open(Enum.UIPageName.UIPOPGotAnims, data)
  140. else
  141. ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.GOT_ITEM_ANIM, data)
  142. end
  143. end
  144. function LuaUIMgr:SetOldSlot(slot)
  145. oldSlot = slot
  146. end
  147. function LuaUIMgr:GetOldSlot()
  148. return oldSlot
  149. end
  150. function LuaUIMgr:AttrNoticeDisplay(slotIndex)
  151. if oldSlot == nil then return end
  152. CommonUtil.AttrNoticeDisplay(slotIndex)
  153. oldSlot = nil
  154. end
  155. --- 打开道具Tips
  156. ---@param cfgId integer 道具配置id
  157. ---@param enterType Enum.ItemIEnterType 进入类型,在不同的调用地方,tips显示不一样,根据需要给值
  158. ---@param extData table 扩展参数,根据需要给值
  159. function LuaUIMgr:OpenItemTips(cfgId, enterType, extData)
  160. local itemCfgData = ManagerContainer.CfgMgr:GetItemById(cfgId)
  161. if not itemCfgData then
  162. return false
  163. end
  164. local data = {cfgId = cfgId, enterType = enterType, extData = extData}
  165. if itemCfgData.ResType == Enum.ItemType.FashionPaper then
  166. self:Open(Enum.UIPageName.UIFashionPaperTips, data)
  167. else
  168. self:Open(Enum.UIPageName.UIItemTips, data)
  169. end
  170. return true
  171. end
  172. --- 打开通用Tips
  173. ---@param data table 传入数据 data = {tipsType = Enum.UITipsType.Item, cfgId = 100001, num = 100, state = CommonUtil.Get2Powers(Enum.TipsEnterType.BaseAttr, Enum.TipsEnterType.Cost)}
  174. ---@param extData table 扩展参数,根据需要给值
  175. function LuaUIMgr:OpenTips(data, extData)
  176. local tipsType, cfgId, num, state, displayBtn, id, timeStamp
  177. if type(data) == "number" then
  178. cfgId = data
  179. num = 0
  180. state = 0
  181. displayBtn = false
  182. tipsType = Enum.UITipsType.Item
  183. elseif type(data) == "table" then
  184. cfgId = data.cfgId
  185. num = data.num
  186. state = data.state or 0
  187. id = data.id
  188. displayBtn = data.displayBtn == nil and false or data.displayBtn
  189. tipsType = data.tipsType or Enum.UITipsType.Item
  190. timeStamp = data.timeStamp
  191. if tipsType == Enum.UITipsType.Skill then
  192. local data1 = {tipsType = tipsType, cfgId = cfgId, num = num, state = state, extData = extData, displayBtn = displayBtn}
  193. self:Open(Enum.UIPageName.UITips, data1)
  194. return
  195. end
  196. end
  197. if cfgId == nil then return false end
  198. local itemCfgData = ManagerContainer.CfgMgr:GetItemById(cfgId)
  199. if not itemCfgData then
  200. return false
  201. end
  202. local data1 = {tipsType = tipsType, id = id, cfgId = cfgId, num = num, state = state, extData = extData, displayBtn = displayBtn, isPreview = data.isPreview, starLv = data.starLv}
  203. --if data1.state <= 0 then
  204. if itemCfgData.ResType == Enum.ItemType.Equip then
  205. data1.state = Bit.bor(data1.state, Bit.lshift(1, Enum.TipsEnterType.BaseAttr), Bit.lshift(1, Enum.TipsEnterType.BtnEquip)) --data1.state + CommonUtil.Get2Powers(Enum.TipsEnterType.BaseAttr, Enum.TipsEnterType.BtnEquip)
  206. if data.source == Enum.UIPageName.UIBag then
  207. local equipData = ManagerContainer.CfgMgr:GetEquipById(cfgId)
  208. if equipData.Forge == 0 then
  209. data1.state = Bit.bxor(data1.state, Bit.lshift(1, Enum.TipsEnterType.BtnEquip))
  210. end
  211. end
  212. elseif itemCfgData.ResType == Enum.ItemType.Card then
  213. data1.state = Bit.bor(data1.state, Bit.lshift(1, Enum.TipsEnterType.BaseAttr), Bit.lshift(1, Enum.TipsEnterType.BtnInsertCard)) --data1.state + CommonUtil.Get2Powers(Enum.TipsEnterType.BaseAttr, Enum.TipsEnterType.BtnInsertCard)
  214. elseif itemCfgData.ResType == Enum.ItemType.PetStamp then
  215. data1.state = Bit.bor(data1.state, Bit.lshift(1, Enum.TipsEnterType.BaseAttr)) --data1.state + CommonUtil.Get2Powers(Enum.TipsEnterType.BaseAttr, Enum.TipsEnterType.BtnInsertCard)
  216. elseif itemCfgData.ResType == Enum.ItemType.FashionPaper then
  217. data1.state = Bit.bor(data1.state, Bit.lshift(1, Enum.TipsEnterType.Cost)) --data1.state + CommonUtil.Get2Powers(Enum.TipsEnterType.Cost)
  218. local fashionPaperData = ManagerContainer.CfgMgr:GetFashionPaperById(data.cfgId)
  219. local owned = ManagerContainer.DataMgr.FashionData:Contains(fashionPaperData.FashionId)
  220. data1.state = Bit.bor(data1.state, (owned and Bit.lshift(1, Enum.TipsEnterType.BtnDecompose) or Bit.lshift(1, Enum.TipsEnterType.BtnCompose))) --data1.state + (owned and CommonUtil.Get2Powers(Enum.TipsEnterType.BtnDecompose) or CommonUtil.Get2Powers(Enum.TipsEnterType.BtnCompose))
  221. elseif itemCfgData.ResType == Enum.ItemType.Gift then --宝箱,这是宝箱
  222. local isGoto = nil
  223. if itemCfgData.SkipInterface > 0 then
  224. local isActItem, iActing = ManagerContainer.DataMgr.ActsDataMgr:IsActivityItemAndUnderway(cfgId)
  225. local isSeason = (not ManagerContainer.DataMgr.CompetitionData:IsOveerCurSeason())and ManagerContainer.DataMgr.CompetitionData:IsCurCompetitionItem(cfgId)
  226. if (isActItem and iActing) or isSeason then
  227. data1.state = Bit.bor(data1.state, Bit.lshift(1, Enum.TipsEnterType.BtnGoto))--data1.state + CommonUtil.Get2Powers(Enum.TipsEnterType.BtnGoto)
  228. isGoto = true
  229. end
  230. end
  231. if not isGoto then
  232. local _hasCondition = itemCfgData and itemCfgData.Costitem ~= nil;
  233. if _hasCondition then --开启宝箱需要条件,需要道具才能开启
  234. data1.state = Bit.bor(data1.state, Bit.lshift(1, Enum.TipsEnterType.SliderBoxCondition), Bit.lshift(1, Enum.TipsEnterType.SliderComs)) --data1.state + CommonUtil.Get2Powers(Enum.TipsEnterType.SliderBoxCondition, Enum.TipsEnterType.SliderComs)
  235. else
  236. data1.state = Bit.bor(data1.state, Bit.lshift(1, Enum.TipsEnterType.SliderBox), Bit.lshift(1, Enum.TipsEnterType.SliderComs)) --data1.state + CommonUtil.Get2Powers(Enum.TipsEnterType.SliderBox, Enum.TipsEnterType.SliderComs)
  237. end
  238. end
  239. elseif itemCfgData.ResType == Enum.ItemType.HeadFrame then
  240. data1.state = Bit.bor(data1.state, Bit.lshift(1, Enum.TipsEnterType.BaseAttr), Bit.lshift(1, Enum.TipsEnterType.SliderBox), Bit.lshift(1, Enum.TipsEnterType.SliderComs)) --data1.state + CommonUtil.Get2Powers(Enum.TipsEnterType.BaseAttr, Enum.TipsEnterType.SliderBox, Enum.TipsEnterType.SliderComs)
  241. elseif itemCfgData.ResType == Enum.ItemType.Compose then
  242. data1.state = Bit.bor(data1.state, Bit.lshift(1, Enum.TipsEnterType.SliderBox), Bit.lshift(1, Enum.TipsEnterType.SliderComs), Bit.lshift(1, Enum.TipsEnterType.BtnBoxCompose)) --data1.state + CommonUtil.Get2Powers(Enum.TipsEnterType.SliderBox, Enum.TipsEnterType.SliderComs, Enum.TipsEnterType.BtnBoxCompose)
  243. elseif itemCfgData.ResType == Enum.ItemType.Item then
  244. elseif itemCfgData.ResType == Enum.ItemType.Income then
  245. local _hasCondition = itemCfgData and itemCfgData.Costitem ~= nil
  246. local _hasCompose = itemCfgData and itemCfgData.ComposeItem ~= nil
  247. if _hasCondition and _hasCompose then --开启需要条件,需要道具才能开启
  248. data1.state = Bit.bor(data1.state, Bit.lshift(1, Enum.TipsEnterType.SliderBoxCondition), Bit.lshift(1, Enum.TipsEnterType.SliderComs), Bit.lshift(1, Enum.TipsEnterType.ItemNumber)) --data1.state + CommonUtil.Get2Powers(Enum.TipsEnterType.SliderBoxCondition, Enum.TipsEnterType.SliderComs, Enum.TipsEnterType.ItemNumber)
  249. elseif _hasCondition then
  250. data1.state = Bit.bor(data1.state, Bit.lshift(1, Enum.TipsEnterType.SliderBoxCondition), Bit.lshift(1, Enum.TipsEnterType.SliderComs)) --data1.state + CommonUtil.Get2Powers(Enum.TipsEnterType.SliderBoxCondition, Enum.TipsEnterType.SliderComs)
  251. elseif _hasCompose then
  252. data1.state = Bit.bor(data1.state, Bit.lshift(1, Enum.TipsEnterType.SliderBox), Bit.lshift(1, Enum.TipsEnterType.SliderComs), Bit.lshift(1, Enum.TipsEnterType.ItemNumber)) --data1.state + CommonUtil.Get2Powers(Enum.TipsEnterType.SliderBox, Enum.TipsEnterType.SliderComs, Enum.TipsEnterType.ItemNumber)
  253. else
  254. data1.state = Bit.bor(data1.state, Bit.lshift(1, Enum.TipsEnterType.SliderBox), Bit.lshift(1, Enum.TipsEnterType.SliderComs)) --data1.state + CommonUtil.Get2Powers(Enum.TipsEnterType.SliderBox, Enum.TipsEnterType.SliderComs)
  255. end
  256. elseif itemCfgData.ResType == Enum.ItemType.OptionalGift or itemCfgData.ResType == Enum.ItemType.VipProof or itemCfgData.ResType == Enum.ItemType.RuneShopExploreUnlock or itemCfgData.ResType == Enum.ItemType.WishBox or itemCfgData.ResType == Enum.ItemType.OptionalWishBox then
  257. data1.state = Bit.bor(data1.state, Bit.lshift(1, Enum.TipsEnterType.BtnOpen)) --data1.state + CommonUtil.Get2Powers(Enum.TipsEnterType.BtnOpen)
  258. end
  259. if itemCfgData.ItemTime > 0 then
  260. local logicData = ManagerContainer.DataMgr.BagData:GetItemById(id)
  261. if not logicData then
  262. logicData = ManagerContainer.DataMgr.BagData:GetItemDataByCfgId(cfgId)
  263. end
  264. if logicData then
  265. data1.timeStamp = logicData.timeStamp
  266. end
  267. end
  268. --end
  269. self:Open(Enum.UIPageName.UITips, data1)
  270. return true
  271. end
  272. function LuaUIMgr:OpenTipsSkill(data)
  273. self:Open(Enum.UIPageName.UITipsSkill, data)
  274. end
  275. function LuaUIMgr:FightPowerAddNotice(data)
  276. local uiData = ManagerContainer.CfgMgr:GetUIData(Enum.UIPageName.UIFightPowerTips)
  277. if not ManagerContainer.LuaUIMgr:GetPage(uiData.id) then
  278. ManagerContainer.LuaUIMgr:Open(Enum.UIPageName.UIFightPowerTips, data)
  279. else
  280. ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.FIGHTPOWER_REFRESH_TIPS, data)
  281. end
  282. end
  283. --只能用于根界面
  284. function LuaUIMgr:OpenSourceUI(owner, data)
  285. if owner == nil then return end
  286. --owner:UIClose()
  287. ManagerContainer.LuaUIMgr:ClosePage(owner.uiData.id)
  288. if owner.uiBase.MSourceUIID > 0 then
  289. local sourceId = owner.uiBase.MSourceUIID
  290. if sourceId == Enum.UIPageName.UIMainCity1 then
  291. ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.UIMAINVIEW_CHANGE_NOTICE, Enum.MainViewPageType.Town)
  292. elseif sourceId == Enum.UIPageName.UIBag then
  293. ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.UIMAINVIEW_CHANGE_NOTICE, Enum.MainViewPageType.Pub)
  294. elseif sourceId == Enum.UIPageName.UIBattle then
  295. ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.UIMAINVIEW_CHANGE_NOTICE, Enum.MainViewPageType.Adventure)
  296. elseif sourceId == Enum.UIPageName.UIRoleMain1 then
  297. ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.UIMAINVIEW_CHANGE_NOTICE, Enum.MainViewPageType.Role)
  298. elseif sourceId == Enum.UIPageName.UIPetRoot then
  299. ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.UIMAINVIEW_CHANGE_NOTICE, Enum.MainViewPageType.Battle)
  300. else
  301. ManagerContainer.LuaUIMgr:Open(owner.uiBase.MSourceUIID, data, nil, false)
  302. end
  303. end
  304. if not self:HasOpenPage(Enum.UIPageName.UIMain) then
  305. ManagerContainer.LuaUIMgr:Back2NormalBattleMain(Enum.MainViewPageType.Town)
  306. end
  307. end
  308. function LuaUIMgr:StoryHideUIStatus(status)
  309. if not status then
  310. UIOpenStatusList = {}
  311. local array = self:GetCurUIStack()
  312. for i = 0, array.Length - 1 do
  313. local luaUIBase = array[i]
  314. local uiView = luaUIBase.MLuaTable
  315. if uiView.gameObject.activeSelf then
  316. UIOpenStatusList[#UIOpenStatusList + 1] = uiView
  317. end
  318. end
  319. end
  320. for i = 1,#UIOpenStatusList do
  321. UIOpenStatusList[i].gameObject:SetActive(status)
  322. end
  323. end
  324. function LuaUIMgr:GetCurUIId()
  325. local array = self:GetCurUIStack()
  326. if array.Length > 0 then
  327. for i = 0, array.Length - 1 do
  328. local luaUIBase = array[i]
  329. local uiView = luaUIBase.MLuaTable
  330. local uiData = uiView.uiData
  331. if uiData.type <= Enum.UIType.Tips then
  332. return uiView.uiData.id
  333. end
  334. end
  335. end
  336. return nil
  337. end
  338. function LuaUIMgr:IsUIPageIsOpenning(pageId)
  339. local uiData = ManagerContainer.CfgMgr:GetUIData(pageId)
  340. return ManagerContainer.LuaUIMgr:GetPage(uiData.id)
  341. end
  342. function LuaUIMgr:NeedMainHideTop()
  343. local array = self:GetCurUIStack()
  344. for i = 0, array.Length - 1 do
  345. local luaUIBase = array[i]
  346. local uiView = luaUIBase.MLuaTable
  347. if uiView.gameObject.activeSelf then
  348. if (uiView.uiData.type == Enum.UIType.Total or uiView.uiData.type == Enum.UIType.TotalWin) and uiView.uiData.hide_main_top then
  349. return true
  350. end
  351. end
  352. end
  353. return false
  354. end
  355. function LuaUIMgr:NeedMainHideBottom()
  356. local array = self:GetCurUIStack()
  357. for i = 0, array.Length - 1 do
  358. local luaUIBase = array[i]
  359. local uiView = luaUIBase.MLuaTable
  360. if uiView.gameObject.activeSelf then
  361. if (uiView.uiData.type == Enum.UIType.Total or uiView.uiData.type == Enum.UIType.TotalWin) and uiView.uiData.hide_main_bottom then
  362. return true
  363. end
  364. end
  365. end
  366. return false
  367. end
  368. function LuaUIMgr:ShowNetWaiting()
  369. if self:HasOpenPage(Enum.UIPageName.UIWaiting) then
  370. return
  371. end
  372. self:Open(Enum.UIPageName.UIWaiting)
  373. end
  374. function LuaUIMgr:CloseNetWaiting()
  375. self:ClosePage(Enum.UIPageName.UIWaiting)
  376. end
  377. function LuaUIMgr:ShowNetWaiting_New(data)
  378. if self:HasOpenPage(Enum.UIPageName.UIWaiting) then
  379. return
  380. end
  381. self:Open(Enum.UIPageName.UIWaiting,data)
  382. end
  383. --显示单按钮mesbox
  384. function LuaUIMgr:ShowOkMessageBox(tipsKey,OkCb)
  385. ManagerContainer.LuaUIMgr:Open(Enum.UIPageName.UIAntiCheatMsgWnd, {tipsKey,OkCb})
  386. end
  387. --关闭单按钮mesbox
  388. function LuaUIMgr:CloseOkMessageBox(strTipName)
  389. local page = self:GetPage(Enum.UIPageName.UIAntiCheatMsgWnd)
  390. if nil ~= page then
  391. if nil ~= page.Data and nil ~= page.Data[1] then
  392. if strTipName ==page.Data[1] then
  393. self:ClosePage(Enum.UIPageName.UIAntiCheatMsgWnd)
  394. end
  395. end
  396. end
  397. end
  398. -- 显示messagebox
  399. function LuaUIMgr:ShowMessageBox(tipsKey,keyParams,data,owner,confirmCb,cancelCb)
  400. ManagerContainer.LuaUIMgr:Open(Enum.UIPageName.UINoticeTips, {tipsKey,keyParams, data, owner, confirmCb,cancelCb})
  401. end
  402. --关闭strTipName的 UINoticeTips
  403. function LuaUIMgr:CloseMessageBox(strTipName)
  404. local page = self:GetPage(Enum.UIPageName.UINoticeTips)
  405. if nil ~= page then
  406. if nil ~= page.Data and nil ~= page.Data[1] then
  407. if strTipName ==page.Data[1] then
  408. self:ClosePage(Enum.UIPageName.UINoticeTips)
  409. end
  410. end
  411. end
  412. end
  413. function LuaUIMgr:SetBattleRootVisible(vis)
  414. if self.UIBattleRootTrans == nil then
  415. return
  416. end
  417. -- self.UIBattleRootTrans.gameObject:SetActive(vis)
  418. end
  419. function LuaUIMgr:BackToMainCity()
  420. self:Open(Enum.UIPageName.UIMainCity1)
  421. end
  422. --- 私聊接口
  423. ---@param uid integer 唯一ID
  424. ---@param nickname string 名字
  425. ---@param headId integer 头像
  426. function LuaUIMgr:PrivateChatOtherPlayer(uid, nickname, headIcon, jobId, level,gender)
  427. local fromData = {uid = tostring(uid), nickname = nickname or "NickName", imgId = headIcon, jobId = jobId, level = level, sex = gender}
  428. local idx = ManagerContainer.DataMgr.ChatData:GetTargetIdxInSortedDatas(fromData)
  429. ManagerContainer.LuaUIMgr:Open(Enum.UIPageName.UIChatPrivate, idx)
  430. end
  431. --打开玩家头像交互界面,t_uid是想要查看的好友的uid的字符串
  432. function LuaUIMgr:OpenRoleMessagePanel(_uid, isAcrossRole)
  433. local t_uid_int64 = _uid;
  434. if "string" == type(_uid) then
  435. t_uid_int64 = int64.new(_uid);
  436. end
  437. local _userUid = ManagerContainer.DataMgr.UserData:GetUserId();
  438. if int64.equals(t_uid_int64, _userUid) then
  439. ManagerContainer.LuaUIMgr:ErrorNoticeDisplay("ChatError1")
  440. else
  441. if not isAcrossRole then isAcrossRole = false end
  442. self.isAcrossRole = isAcrossRole
  443. ManagerContainer.NetManager:SendMessage(ProtoMsgId.CS_GET_OTHER_PLAYER_DETAIL_INFO_REQ, {t_uid = t_uid_int64});
  444. end
  445. end
  446. function LuaUIMgr:GetIsAcrossRole()
  447. return self.isAcrossRole
  448. end
  449. function LuaUIMgr:ClearIsAcrossRoleState()
  450. self.isAcrossRole = false
  451. end
  452. --建立 返回正常巡游战斗主界面 执行队列
  453. function LuaUIMgr:Back2NormalBattleMain(mainViewPageType)
  454. local data = require('ExecuteSequenceData'):new();
  455. data:AppendFunc(false, ManagerContainer.LuaUIMgr, ManagerContainer.LuaUIMgr.Open, Enum.UIPageName.UIMain);
  456. data:AppendUIListener(Enum.UIPageName.UIMain, UIEventNames.UI_FILLCONTENT_COMPELETED, 5);
  457. data:AppendUIViewFunc(false, Enum.UIPageName.UIMain, 'ChangePageMsg', mainViewPageType);
  458. ManagerContainer.ExecuteSequenceMgr:Execute(data);
  459. return data
  460. end
  461. function LuaUIMgr:AddUIView(id, view)
  462. if id == nil then return end
  463. if self.UIViewMap[id] == nil then
  464. self.UIViewMap[id] = {}
  465. end
  466. self.UIViewMap[id][#self.UIViewMap[id] + 1] = view
  467. end
  468. function LuaUIMgr:RemoveUIView(id, view)
  469. if id == nil then return end
  470. for i = 1, #self.UIViewMap[id] do
  471. if self.UIViewMap[id][i] == view then
  472. self.UIViewMap[id][i] = nil
  473. end
  474. end
  475. end
  476. function LuaUIMgr:DestroyUIView(id)
  477. if id == nil then return end
  478. if #self.UIViewMap[id] == 0 then
  479. CommonUtil.SetUITableNilInPackage(id)
  480. end
  481. end
  482. function LuaUIMgr:GetViewCtrById(id)
  483. if id == nil then return end
  484. if self.UIViewMap[id] == nil then return end
  485. if self.UIViewMap[id][#self.UIViewMap[id]] == nil then return end
  486. return self.UIViewMap[id][#self.UIViewMap[id]].controller
  487. end
  488. function LuaUIMgr:ShowMinTips(contentKey,params)
  489. local tipsData = {self.ClickMousePos,1,contentKey,params}
  490. if self:HasOpenPage(Enum.UIPageName.UIMinTips) then
  491. ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.EID_REFRESH_MINTIPS,tipsData)
  492. else
  493. self:Open(Enum.UIPageName.UIMinTips, tipsData)
  494. end
  495. end
  496. function LuaUIMgr:ShowMinRewardTips(rewards)
  497. local tipsData = {self.ClickMousePos,2,nil,nil,rewards}
  498. if self:HasOpenPage(Enum.UIPageName.UIMinTips) then
  499. ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.EID_REFRESH_MINTIPS,tipsData)
  500. else
  501. self:Open(Enum.UIPageName.UIMinTips, tipsData)
  502. end
  503. end
  504. function LuaUIMgr:OnShowPage(uiData)
  505. if uiData.id == Enum.UIPageName.UIPrivateChatBtn then
  506. return
  507. end
  508. if uiData.type >= Enum.UIType.Tips then
  509. return
  510. end
  511. self.ShowUIPageList[#self.ShowUIPageList+1] = {pageId = uiData.id, topBtnState = uiData.top_btn_display_state}
  512. self:MainChangeBtnStateNotify(uiData.top_btn_display_state)
  513. end
  514. function LuaUIMgr:OnRemovePage(uiData)
  515. if self.ShowUIPageList == nil then
  516. return
  517. end
  518. if uiData.id == Enum.UIPageName.UIPrivateChatBtn then
  519. return
  520. end
  521. if uiData.type >= Enum.UIType.Tips then
  522. return
  523. end
  524. for i = 1, #self.ShowUIPageList do
  525. if self.ShowUIPageList[i].pageId == uiData.id then
  526. table.remove(self.ShowUIPageList, i)
  527. break
  528. end
  529. end
  530. if #self.ShowUIPageList > 0 then
  531. local topPage = self.ShowUIPageList[#self.ShowUIPageList]
  532. self:MainChangeBtnStateNotify(topPage.topBtnState)
  533. end
  534. end
  535. function LuaUIMgr:MainChangeBtnStateNotify(state)
  536. ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.MAIN_CHANGE_BUTTONS_STATE,state)
  537. end
  538. function LuaUIMgr:OpenLimitRechargeUI()
  539. local limitRecharge = ManagerContainer.DataMgr.ActsDataMgr:GetLimitRechargeItem()
  540. if not limitRecharge or not limitRecharge:IsLimitRechargeExist() then
  541. return
  542. end
  543. if not limitRecharge.needOpen then
  544. return
  545. end
  546. if ManagerContainer.FSMMgr:IsLoadingState() then
  547. return
  548. end
  549. local battlePage = self:GetCurrentBattlePageId()
  550. if battlePage > 0 then
  551. if battlePage ~= Enum.UIPageName.UIBattle then
  552. return
  553. else
  554. if ManagerContainer.LuaBattleMgr:GetBossFightState() then
  555. return
  556. end
  557. end
  558. end
  559. if not self:HasOpenPage(Enum.UIPageName.UIActivityLimitedGift) then
  560. self:Open(Enum.UIPageName.UIActivityLimitedGift, true)
  561. end
  562. end
  563. function LuaUIMgr:IsBatting()
  564. if ManagerContainer.FSMMgr:IsLoadingState() then
  565. return true
  566. end
  567. local battlePage = self:GetCurrentBattlePageId()
  568. if battlePage then
  569. if battlePage ~= Enum.UIPageName.UIBattle then
  570. return
  571. else
  572. if ManagerContainer.LuaBattleMgr:GetBossFightState() then
  573. return true
  574. end
  575. end
  576. end
  577. return false
  578. end
  579. return LuaUIMgr