gps房创建拦截

master
罗家炜 2025-08-23 17:00:09 +08:00
parent 7e9802346c
commit 94b7b5e517
24 changed files with 25 additions and 18 deletions

View File

@ -136,18 +136,23 @@ function M:PublicJoinRoom(cmd, roomid, tem, callback, group_id, pid)
--获得玩法配置定位信息,如果开启了配置则必须强制有定位才能进入房间 --获得玩法配置定位信息,如果开启了配置则必须强制有定位才能进入房间
local play = DataManager.groups:get(group_id):getPlay(pid) local play = DataManager.groups:get(group_id):getPlay(pid)
local pos = "" local pos = ""
if play and play.config and play.config.GPSDetection and play.config.GPSDetection > 0 then if play and play.config then
if not DataManager.SelfUser.location then local config = json.decode(play.config)
get_gps(function(cmd, roomid, tem, callback, group_id, pid) if config.GPSDetection and config.GPSDetection > 0 then
if not DataManager.SelfUser.location then if not DataManager.SelfUser.location then
ViewUtil.ErrorMsg(nil, 55, "未开启gps定位不能创建gps定位房") get_gps(nil, {
return _callback_lad = function(flag)
end if flag then
self:PublicJoinRoom(cmd, roomid, tem, callback, group_id, pid) self:PublicJoinRoom(cmd, roomid, tem, callback, group_id, pid)
end) return
return end
ViewUtil.ErrorMsg(nil, 55, "未开启gps定位不能创建gps定位房")
end
})
return
end
pos = DataManager.SelfUser.location:Location2String()
end end
pos = DataManager.SelfUser.location:Location2String()
end end
_data["pos"] = pos _data["pos"] = pos
elseif cmd == Protocol.WEB_FG_QUEUE_ROOM then elseif cmd == Protocol.WEB_FG_QUEUE_ROOM then

View File

@ -227,10 +227,12 @@ function ad2d(decimal)
end end
-- 获取gps -- 获取gps
function get_gps(callback) function get_gps(callback, data)
local _localAddress = data and data._callback_lad or nil
if Application.platform == RuntimePlatform.IPhonePlayer or Application.platform == RuntimePlatform.Android then if Application.platform == RuntimePlatform.IPhonePlayer or Application.platform == RuntimePlatform.Android then
local s, e = pcall(function() local s, e = pcall(function()
Utils.LocalAddress(function(result, latitude, longitude) Utils.LocalAddress(function(result, latitude, longitude)
if _localAddress then _localAddress(result, latitude, longitude) end
if not result or (latitude == 0 and longitude == 0) then return end if not result or (latitude == 0 and longitude == 0) then return end
DataManager.SelfUser.location = Location.new(tostring(longitude) .. "," .. tostring(latitude)) DataManager.SelfUser.location = Location.new(tostring(longitude) .. "," .. tostring(latitude))
if callback then callback() end if callback then callback() end

View File

@ -32,10 +32,10 @@
"bundle": "extend/majiang/nancheng" "bundle": "extend/majiang/nancheng"
}, },
{ {
"ver": "1.0.33", "ver": "1.0.34",
"name": "黎川麻将", "name": "黎川麻将",
"check": true, "check": true,
"version": "1.0.33", "version": "1.0.34",
"game_id": "87", "game_id": "87",
"bundle": "extend/majiang/lichuan" "bundle": "extend/majiang/lichuan"
}, },

View File

@ -1,11 +1,11 @@
[ [
{ {
"lua_path": "/tolua_project,/base_project,/main_project", "lua_path": "/tolua_project,/base_project,/main_project",
"ver": "1.0.8", "ver": "1.0.6",
"name": "base_script", "name": "base_script",
"check": true, "check": true,
"bundle": "base/base_script", "bundle": "base/base_script",
"version": "1.0.8" "version": "1.0.6"
}, },
{ {
"ver": "1.0.8", "ver": "1.0.8",
@ -29,11 +29,11 @@
"version": "1.0.8" "version": "1.0.8"
}, },
{ {
"ver": "1.0.8", "ver": "1.0.9",
"name": "Family", "name": "Family",
"check": true, "check": true,
"bundle": "base/Family", "bundle": "base/Family",
"version": "1.0.8" "version": "1.0.9"
}, },
{ {
"ver": "1.0.8", "ver": "1.0.8",