| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- export default {
- _caller: null, // 调用方指针
-
- // *** 非指针复制 ***
- storePlayers: [{
- id: 0, // 玩家ID
- marker: null, // 玩家标识
- trail: null, // 玩家轨迹
- trailData: [], // 玩家轨迹信息(数据会追加并定时清理过期数据)
- interval_creatCircleMarker: null,
- interval_showTrail: null,
- }],
-
- map: null,
- map_layer: null,
-
- players: [], // 玩家信息(指针复制 每次grpc获取数据后之前旧数据会丢弃)
- players_position: [], // 玩家当前位置信息(指针复制 每次grpc获取数据后之前旧数据会丢弃)
-
- focusPlayerId: 0, // 当前选中的玩家ID
- checkPoints: [], // 检查点列表(指针复制 每次grpc获取数据后之前旧数据会丢弃)
- routes: [], // 路线列表(指针复制 每次grpc获取数据后之前旧数据会丢弃)
-
- setCaller(data) {
- this._caller = data // 指针复制,是同一个对象
- },
- setPlayers(data) {
- this.players = data // 指针复制,是同一个对象
- },
- setPlayersPosition(data) {
- this.players_position = data // 指针复制,是同一个对象
- },
- // *** 非指针复制 ***
- // storePlayersTrail(data) {
- // this.storePlayers.trail.push(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
- },
- getStorePlayersById(playerId) {
- if (!(playerId > 0)) return
-
- var storePlayer = null
- if (this.storePlayers != null && this.storePlayers.length > 0) {
- storePlayer = this.storePlayers.find(o => o.id === playerId)
- }
- // console.log("[getStorePlayersById]", playerId, storePlayer)
- return storePlayer
- },
- 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
- },
- }
|