local PlayerInteract_Controller = {} local EventSystem = require('Event/EventSystem') local private = {} private.ClickPlayers = {} function PlayerInteract_Controller.OpenFriendInteractView(acid, occasionType, extraParameter) if BattleDataGetter.GetAcID() ~= acid then if CTL.ChannelChat.SelfIsDead() then CTL.Tips.AddTipsMsg(Const_IDS.IDS_DeadNote) else MDL.PlayerInteract.GetPlayerInteractiveInfoReq(acid, occasionType, extraParameter) end else logging.log(LTAG.LOG," OpenFriendInteractView ",acid, BattleDataGetter.GetAcID()) end end --视野内玩家消失 function PlayerInteract_Controller.OnPlayerRemove(entityID) if LevelManager.IsNoBattleLevel() and #private.ClickPlayers > 0 then if private.ClickEntity ~= nil and private.ClickEntity.EntityID == entityID then private.CloseAllInteract() else for i, v in ipairs(private.ClickPlayers) do if v.EntityID == entityID then table.remove(private.ClickPlayers, i) break end end if #private.ClickPlayers == 0 then private.CloseAllInteract() else EventSystem.Dispatch(EventID.UI_Refresh_MultiInteract) end end else private.CloseAllInteract() end end function PlayerInteract_Controller.OnClickPlayer(entityList) table.clearArray(private.ClickPlayers) if entityList then local num = entityList.Count for i = 0, num - 1 do local entityID = entityList[i] local entity = BattleDataGetter.GetEntityByEntityID(entityID) if entity and entity._logicInitData.IsPlayerSelf == false and entity._logicInitData.CharacterType == LuaConst.CharacterType.Hero and entity._logicInitData.Name ~= "" then table.insert(private.ClickPlayers, entity) end end local clickNum = #private.ClickPlayers if clickNum > 0 then if clickNum == 1 then PlayerInteract_Controller.ClickSinglePlayer(private.ClickPlayers[1]) else private.ClickMultiPlayer() end else private.CloseAllInteract() end else private.CloseAllInteract() end end function private.ClickMultiPlayer() PlayerInteract_Controller.CloseSingleInteract() if UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UITownHomeInteractionNameListView) then EventSystem.Dispatch(EventID.UI_Refresh_MultiInteract) else UIManager.OpenView(Const_UI_Lua.UIEnum.UITownHomeInteractionNameListView, private.ClickPlayers) end end function PlayerInteract_Controller.ClickSinglePlayer(entity) private.CloseMultiInteract() --选中特效 private.CancelClickEffect() private.ClickEntity = entity SystemManager.OnShowEffect(private.ClickEntity,LuaConst.EffectType.BeingSelected,true) local townRoleInfo = SyncMoveManager.GetTownRoleInfo(entity.EntityID) if townRoleInfo then if UIManager.IsViewOpened(Const_UI_Lua.UIEnum.UITownHomePlayerHeadInteractionView) then EventSystem.Dispatch(EventID.UI_Refresh_SingleInteract, townRoleInfo) else UIManager.OpenView(Const_UI_Lua.UIEnum.UITownHomePlayerHeadInteractionView, townRoleInfo) end else UIManager.CloseView(Const_UI_Lua.UIEnum.UITownHomePlayerHeadInteractionView) end end function private.CloseAllInteract() private.CloseMultiInteract() PlayerInteract_Controller.CloseSingleInteract() end function private.CloseMultiInteract() UIManager.CloseView(Const_UI_Lua.UIEnum.UITownHomeInteractionNameListView) end function PlayerInteract_Controller.CloseSingleInteract() UIManager.CloseView(Const_UI_Lua.UIEnum.UITownHomePlayerHeadInteractionView) private.CancelClickEffect() end function private.CancelClickEffect() if private.ClickEntity ~= nil then SystemManager.OnShowEffect(private.ClickEntity,LuaConst.EffectType.BeingSelected,false) private.ClickEntity = nil end end return PlayerInteract_Controller