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 pos = ""
if play and play.config and play.config.GPSDetection and play.config.GPSDetection > 0 then
if not DataManager.SelfUser.location then
get_gps(function(cmd, roomid, tem, callback, group_id, pid)
if not DataManager.SelfUser.location then
ViewUtil.ErrorMsg(nil, 55, "未开启gps定位不能创建gps定位房")
return
end
self:PublicJoinRoom(cmd, roomid, tem, callback, group_id, pid)
end)
return
if play and play.config then
local config = json.decode(play.config)
if config.GPSDetection and config.GPSDetection > 0 then
if not DataManager.SelfUser.location then
get_gps(nil, {
_callback_lad = function(flag)
if flag then
self:PublicJoinRoom(cmd, roomid, tem, callback, group_id, pid)
return
end
ViewUtil.ErrorMsg(nil, 55, "未开启gps定位不能创建gps定位房")
end
})
return
end
pos = DataManager.SelfUser.location:Location2String()
end
pos = DataManager.SelfUser.location:Location2String()
end
_data["pos"] = pos
elseif cmd == Protocol.WEB_FG_QUEUE_ROOM then

View File

@ -227,10 +227,12 @@ function ad2d(decimal)
end
-- 获取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
local s, e = pcall(function()
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
DataManager.SelfUser.location = Location.new(tostring(longitude) .. "," .. tostring(latitude))
if callback then callback() end

View File

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

View File

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