local MiniMap_Model = {} local private = {} local EventSystem = require('Event/EventSystem') --点击大地图时,特殊判断是否需要判断战区是否开启,会进入到不同的场景 MiniMap_Model.CrossServerScene = { [13] = 300005, --开启战区后的跨服主城 } --由于进关卡时序问题,小地图元素在打开界面前就加载出来了。 --未打开界面前,先将元素信息缓存,打开界面从该缓存取出 private.levelItemCache = {} function MiniMap_Model.OnStartup() EventSystem.Regist(EventID.UI_MiniMap_AddMapPoint, private.OnAddMapPoint) EventSystem.Regist(EventID.UI_MiniMap_DeleteMapPoint, private.OnDeleteMapPoint) end function MiniMap_Model.OnShutdown() table.clearArray(private.levelItemCache) EventSystem.UnRegist(EventID.UI_MiniMap_AddMapPoint, private.OnAddMapPoint) EventSystem.UnRegist(EventID.UI_MiniMap_DeleteMapPoint, private.OnDeleteMapPoint) end function private.OnAddMapPoint(item) if table.containValue(private.levelItemCache, item) then return end table.insert(private.levelItemCache, item) end function private.OnDeleteMapPoint(item) table.removebyvalue(private.levelItemCache, item) end function MiniMap_Model.GetLevelItemList() return private.levelItemCache end function MiniMap_Model.GetMapIndex(mapId) for k,v in pairs(MiniMap_Model.CrossServerScene) do if v == mapId then return k end end for i,v in DataSheetManager.WorldMap:GetEnumerator() do if v.CityID == mapId then return v.ID end if table.containValue(v.TownID, mapId) then return v.ID end end --无配置显示在第一个主城 return 1 end return MiniMap_Model