Hi,
We are testing the above feature now.
Below is the code implementation:
Jesse
//------------------------------------------------------------------------------------------------------------
function LoadOptionsAndHighScores ( )
if (Platform <> Web)
index as integer
if GetFileExists( DataVersion ) = 0
else
OpenToRead(1, DataVersion)
MusicVolume = readInteger( 1 )
EffectsVolume = readInteger( 1 )
GameMode = readInteger( 1 )
SelectedBackground = readInteger( 1 )
for index = 0 to 2
LevelSkip[index] = ReadInteger( 1 )
next index
for index = 0 to 3
SecretCode[index] = readInteger( 1 )
next index
mode as integer
rank as integer
for mode = 0 to 2
for rank = 0 to 9
HighScoreName [ mode, rank ] = readString( 1 )
HighScoreLevel [ mode, rank ] = ReadInteger( 1 )
HighScoreScore [ mode, rank ] = ReadInteger( 1 )
next rank
next mode
CloseFile ( 1 )
endif
else
cookieValue as string
cookieValue = LoadSharedVariable(HTML5DataVersion+"MusicVolume", "No Value")
if (cookieValue <> "No Value") then MusicVolume = Val(cookieValue)
cookieValue = LoadSharedVariable(HTML5DataVersion+"EffectsVolume", "No Value")
if (cookieValue <> "No Value") then EffectsVolume = Val(cookieValue)
cookieValue = LoadSharedVariable(HTML5DataVersion+"GameMode", "No Value")
if (cookieValue <> "No Value") then GameMode = Val(cookieValue)
cookieValue = LoadSharedVariable(HTML5DataVersion+"SelectedBackground", "No Value")
if (cookieValue <> "No Value") then SelectedBackground = Val(cookieValue)
for index = 0 to 2
cookieValue = LoadSharedVariable( HTML5DataVersion+"LevelSkip"+str(index), "No Value" )
if (cookieValue <> "No Value") then LevelSkip[index]= Val(cookieValue)
next index
for index = 0 to 3
cookieValue = LoadSharedVariable( HTML5DataVersion+"SecretCode"+str(index), "No Value" )
if (cookieValue <> "No Value") then SecretCode[index]= Val(cookieValue)
next index
for mode = 0 to 2
for rank = 0 to 9
cookieValue = LoadSharedVariable( HTML5DataVersion+"HighscoreName"+str(mode)+str(rank), "No Value" )
if (cookieValue <> "No Value") then HighScoreName [ mode, rank ] = cookieValue
cookieValue = LoadSharedVariable( HTML5DataVersion+"HighScoreLevel"+str(mode)+str(rank), "No Value" )
if (cookieValue <> "No Value") then HighScoreLevel [ mode, rank ] = Val(cookieValue)
cookieValue = LoadSharedVariable( HTML5DataVersion+"HighScoreScore"+str(mode)+str(rank), "No Value" )
if (cookieValue <> "No Value") then HighScoreScore [ mode, rank ] = Val(cookieValue)
next rank
next mode
endif
endfunction
//------------------------------------------------------------------------------------------------------------
function SaveOptionsAndHighScores ( )
if (Platform <> Web)
index as integer
OpenToWrite( 1 , DataVersion )
WriteInteger ( 1, MusicVolume )
WriteInteger ( 1, EffectsVolume )
WriteInteger ( 1, GameMode )
WriteInteger ( 1, SelectedBackground )
for index = 0 to 2
WriteInteger ( 1, LevelSkip[index] )
next index
for index = 0 to 3
WriteInteger ( 1, SecretCode[index] )
next index
mode as integer
rank as integer
for mode = 0 to 2
for rank = 0 to 9
WriteString ( 1, HighScoreName [ mode, rank ] )
WriteInteger ( 1, HighScoreLevel [ mode, rank ] )
WriteInteger ( 1, HighScoreScore [ mode, rank ] )
next rank
next mode
CloseFile ( 1 )
else
SaveSharedVariable( HTML5DataVersion+"MusicVolume", str(MusicVolume) )
SaveSharedVariable( HTML5DataVersion+"EffectsVolume", str(EffectsVolume) )
SaveSharedVariable( HTML5DataVersion+"GameMode", str(GameMode) )
SaveSharedVariable( HTML5DataVersion+"SelectedBackground", str(SelectedBackground) )
for index = 0 to 2
SaveSharedVariable( HTML5DataVersion+"LevelSkip"+str(index), str(LevelSkip[index]) )
next index
for index = 0 to 3
SaveSharedVariable( HTML5DataVersion+"SecretCode"+str(index), str(SecretCode[index]) )
next index
for mode = 0 to 2
for rank = 0 to 9
SaveSharedVariable( HTML5DataVersion+"HighscoreName"+str(mode)+str(rank), HighScoreName [ mode, rank ] )
SaveSharedVariable( HTML5DataVersion+"HighScoreLevel"+str(mode)+str(rank), str(HighScoreLevel [ mode, rank ]) )
SaveSharedVariable( HTML5DataVersion+"HighScoreScore"+str(mode)+str(rank), str(HighScoreScore [ mode, rank ]) )
next rank
next mode
endif
endfunction