local Interact_Model = {} local private = {recordOpenInfos = {}} local EventSystem = require('Event/EventSystem') function Interact_Model.OnStartup() EventSystem.Regist(EventID.UI_Interact_Show , private.ShowInteractUI) end function private.ShowInteractUI(isShow , interactData ,triggerEntity ,interactEntity, interactIndex) if triggerEntity ~= BattleDataGetter.GetCurEntity() then return end if BattleDataGetter.IsInReconnectFastPlay() then -- 这里存在个bug:当界面开这个A的交互时,断线后远离了A,则界面未关闭A的交互。若此时交互B,则B的交互被界面拦截了。 if isShow then -- 修复方法:界面那边以最后打开的交互功能为准 ,关闭的话在追帧时可尝试让界面关闭。 table.insert(private.recordOpenInfos, { isShow ,interactData ,triggerEntity, interactEntity, interactIndex }) else for i = #private.recordOpenInfos, 1, -1 do local info = private.recordOpenInfos[i] if info[2] == interactData and info[4] == interactEntity and info[5] == interactIndex then table.remove(private.recordOpenInfos,i) end end EventSystem.Dispatch(EventID.UI_Interact_ShowUI, isShow ,interactData ,triggerEntity, interactEntity, interactIndex) end return end if isShow and ( not UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UIInteractView) ) then UIManager.OpenView(Const_UI_Lua.UIEnum.UIInteractView , { isShow ,interactData ,triggerEntity, interactEntity, interactIndex }) else EventSystem.Dispatch(EventID.UI_Interact_ShowUI, isShow ,interactData ,triggerEntity, interactEntity, interactIndex) end end function Interact_Model.OnFastPlayOver() local count = #private.recordOpenInfos if count > 0 then for _,info in ipairs(private.recordOpenInfos) do if info[1] == true and ( not UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UIInteractView) ) then UIManager.OpenView(Const_UI_Lua.UIEnum.UIInteractView , info) else EventSystem.Dispatch(EventID.UI_Interact_ShowUI, info[1] ,info[2] ,info[3], info[4], info[5]) end end table.clearArray(private.recordOpenInfos) end end return Interact_Model