UGH! My apologies, the copy/paste looks terrible even though I am using the lua tags. Is there a way to fix that? Hope you all can read it. SORRY!
I told my programmer that the game cannot (maybe) be played in certain states - I gave him a list and told him to make sure it won’t work there.
He provided the following code.
[lua]
local M = {}
local function getCityTbl( userCity )
cityTbl = {“Arizona”, “Arkansas”, “Connecticut”, “Delaware”,
“Florida”, “Illinois”, “Iowa”, “Louisiana”, “Maine”, “Maryland”,
“North Dakota”, “Tennessee”, “Vermont”, “Puerto Rico”, “Colorado”,
“Minnesota”, “Indiana”, “Montana”, “South Carolina”}
for i = 1,#cityTbl do
if (cityTbl[i] == userCity) then
return true
end
end
return false
end
M.getCityTbl = getCityTbl
return M
[/lua]
and
[lua]
local function onClickSubmit( event )
local phase = event.phase
if (event.phase == “ended”) then
if (radioButton[1].isOn == true) then
composer.gotoScene(“SoundSelection”)
elseif(radioButton[2].isOn == true) then
local loadData = {}
loadData = loadSave.loadTable(“userlocation.json”)
if (loadData ~= nil) then
local cityFlag = cityTbl.getCityTbl( tostring(loadData.city) )
if (cityFlag) then
local alert = native.showAlert( “Alert”, “Your city can’t play competition”, { “OK” } )
else
composer.gotoScene(“tournamentMenu”)
end
else
composer.gotoScene(“tournamentMenu”)
end
elseif(radioButton[3].isOn == true) then
composer.gotoScene(“HowToPlay”)
end
end
end
[/lua]
I also took a look inside the Main file and saw this…
[lua]
– A function to handle the “mapAddress” event (also known as “reverse geocoding”, ie: coordinates -> string).
local mapAddressHandler = function( event )
if event.isError then
– Failed to receive location information.
print(“errorcode”)
else
– Location information received. Display it.
local locationText =
"Latitude: " … currentLatitude …
", Longitude: " … currentLongitude …
", Address: " … ( event.streetDetail or “” ) …
" " … ( event.street or “” ) …
", " … ( event.city or “” ) …
", " … ( event.region or “” ) …
", " … ( event.country or “” ) …
", " … ( event.postalCode or “” )
– local alert = native.showAlert( “Alert”,event.city , { “OK” } )
userLocationTbl.city = event.region
userLocationTbl.country = event.country
loadSave.saveTable(userLocationTbl,“userlocation.json”)
end
end
[/lua]
It just doesn’t look like GPS gets state. Am I right? Is there a method to get it? or do I need to do the simple way I suggested, just post the GPS coordinates (latitude and longitude) and let other users decide if it is in illegal state or not?
Thanks for your help!
I told him these are states/provices not cities. He said it works. I have a hard time believing him.
I told him, one easy way is to just get the GEO Location (Lat/Long) and put those on website and if they played from in the state then another user could flag it as illegal.
But, he insists this works.
Can anyone verify? Sorry, I do not live in the states and have no easy way to see if it really works or not.
Thanks!