| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- export default {
- _caller: null, // 调用方指针
-
- map: null,
- map_layer: null,
-
- players: [], // 玩家信息
- players_position: [], // 玩家当前位置信息
- players_trail: [], // 玩家轨迹信息
-
- focusPlayerId: 0, // 当前选中的玩家ID
- checkPoints: [], // 检查点列表
- routes: [], // 路线列表
-
- setCaller(data) {
- this._caller = data // 指针复制,是同一个对象
- },
- setPlayers(data) {
- this.players = data // 指针复制,是同一个对象
- },
- setPlayersPosition(data) {
- this.players_position = data // 指针复制,是同一个对象
- },
- setPlayersTrail(data) {
- this.players_trail = data // 指针复制,是同一个对象
- },
- setCheckPoints(data) {
- this.checkPoints = data // 指针复制,是同一个对象
- },
- setRoutes(data) {
- this.routes = data // 指针复制,是同一个对象
- },
- getPlayerById(playerId) {
- if (!(playerId > 0)) return
-
- var player = null
- if (this.players != null && this.players.length > 0) {
- player = this.players.find(o => o.id === playerId)
- }
- // console.log("[getPlayerById]", playerId, player)
- return player
- },
- getPlayerPositionById(playerId) {
- if (!(playerId > 0)) return
-
- var player_position = null
- if (this.players_position != null && this.players_position.length > 0) {
- player_position = this.players_position.find(o => o.id === playerId)
- }
- // console.log("[getPlayerPositionById]", playerId, player_position)
- return player_position
- },
- getPlayerTrailById(playerId) {
- if (!(playerId > 0)) return
-
- var player_trail = null
- if (this.players_trail != null && this.players_trail.length > 0) {
- player_trail = this.players_trail.find(o => o.id === playerId)
- }
- // console.log("[getPlayerTrailById]", playerId, player_trail)
- return player_trail
- },
- getCheckPointById(cpId) {
- if (!(cpId > 0)) return
-
- var checkPoint = null
- if (this.checkPoints != null && this.checkPoints.length > 0) {
- checkPoint = this.checkPoints.find(o => o.cp_id === cpId)
- }
- // console.log("[getCheckPointById]", cpId, checkPoint)
- return checkPoint
- },
- getRouteById(rtId) {
- if (!(rtId > 0)) return
-
- var route = null
- if (this.routes != null && this.routes.length > 0) {
- route = this.routes.find(o => o.id === rtId)
- }
- // console.log("[getCheckPointById]", rtId, route)
- return route
- },
- }
|