diff options
| author | ozh <ozh@ozh.org> | 2014-02-14 10:13:58 +0100 |
|---|---|---|
| committer | ozh <ozh@ozh.org> | 2014-02-14 10:13:58 +0100 |
| commit | 8bbc037eb8bcd6e36baa025b3252f9ba676e5ce6 (patch) | |
| tree | 160aa03408b780447f59982bf63d4793912eb51a /mobile.js | |
| parent | baa0a68dcc965833b2c9f0eb31dda045fa3d17c7 (diff) | |
1.0411
Diffstat (limited to 'mobile.js')
| -rw-r--r-- | mobile.js | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/mobile.js b/mobile.js deleted file mode 100644 index 3d0f5d6..0000000 --- a/mobile.js +++ /dev/null @@ -1,82 +0,0 @@ -var LaunchMobile=function() -{ - Game.m={fileSystem:{}};//handle for every thing mobile - - //docs for this stuff : http://docs.phonegap.com/en/3.0.0/cordova_file_file.md.html - - Game.m.readSaveRequest=function() - { - Debug('Load save request'); - Game.m.fileSystem.root.getFile(Game.SaveTo+'.txt',{create:true,exclusive: false},Game.m.readFileEntry,Game.m.fail); - } - Game.m.readSaveResponse=function(response) - { - Debug('Load save response'); - Game.LoadSave(unescape(response)); - } - Game.m.writeSaveRequest=function() - { - Debug('Write save request'); - Game.m.fileSystem.root.getFile(Game.SaveTo+'.txt',{create:true,exclusive: false},Game.m.writeFileEntry,Game.m.fail); - } - - - Game.m.onDeviceReady=function() - { - Debug('Ready'); - window.requestFileSystem(LocalFileSystem.PERSISTENT,0,Game.m.gotFileSystem,Game.m.fail);//ask for the file system - } - - Game.m.gotFileSystem=function(fileSystem) - { - Debug('Got file system'); - Game.m.fileSystem=fileSystem;//did we get the file system? Good, save it - Game.LoadSave();//load the save for good measure - } - - Game.m.readFileEntry=function(fileEntry) - { - Debug('Read file entry'); - fileEntry.file(Game.m.readFile,Game.m.fail);//did we get the requested file entry? That's just super, get ready to read it - } - Game.m.readFile=function(file) - { - Debug('Read file'); - var reader=new FileReader();//we got the file we wanted? Radical. Let's read it now - reader.onloadend=function(evt) - { - Game.m.readSaveResponse(evt.target.result); - //console.log(evt.target.result); - }; - reader.readAsText(file); - } - - - - Game.m.writeFileEntry=function(fileEntry) - { - Debug('Write file entry'); - fileEntry.createWriter(Game.m.writeFile,Game.m.fail);//did we get the requested file entry? Joy and butterflies, now we can write to it - } - Game.m.writeFile=function(writer) - { - Debug('Write file'); - writer.onwriteend=function(evt)//why this plugin isn't using unquestionably superior camel-case is beyond me - { - }; - writer.write(Game.saveData);//well oh my goodness I think we're done here - } - - - - Game.m.fail=function(evt)//well I guess something went wrong - { - Debug('Failed'); - console.log(evt.target.error.code); - Game.Popup(evt.target.error.code); - } - - //Wait for device API libraries to load - Debug('Readying mobile'); - document.addEventListener('deviceready',Game.m.onDeviceReady,false); -}
\ No newline at end of file |