Lazy load bitmap map
This commit is contained in:
		
							parent
							
								
									f75a1e6866
								
							
						
					
					
						commit
						61e8b248f6
					
				
					 2 changed files with 7 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -37,7 +37,6 @@ window.loadFileAsync = function(fullPath, bitmap, callback) {
 | 
			
		|||
 | 
			
		||||
    // Check if already loaded
 | 
			
		||||
    if (window.fileAsyncCache.hasOwnProperty(mappingKey)) return callback();
 | 
			
		||||
    console.log('load', mappingKey);
 | 
			
		||||
 | 
			
		||||
    // Show spinner
 | 
			
		||||
    if (!bitmap && window.setBusy) window.setBusy();
 | 
			
		||||
| 
						 | 
				
			
			@ -183,7 +182,6 @@ function preloadList(jsonArray) {
 | 
			
		|||
        // Preload the asset
 | 
			
		||||
        FS.createPreloadedFile(path, filename, "gameasync/" + mappingValue, true, true, function() {
 | 
			
		||||
            window.fileAsyncCache[mappingKey] = 1;
 | 
			
		||||
            console.log('preload', mappingKey);
 | 
			
		||||
        }, console.error, false, false, () => {
 | 
			
		||||
            try { FS.unlink(path + "/" + filename); } catch (err) {}
 | 
			
		||||
        });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,6 @@
 | 
			
		|||
    <script src="js/drive.js"></script>
 | 
			
		||||
    <script src="js/dpad.js"></script>
 | 
			
		||||
    <script src="gameasync/mapping.js"></script>
 | 
			
		||||
    <script src="gameasync/bitmap-map.js"></script>
 | 
			
		||||
 | 
			
		||||
    <title>MKXP</title>
 | 
			
		||||
    <style>
 | 
			
		||||
| 
						 | 
				
			
			@ -238,8 +237,15 @@
 | 
			
		|||
                const s = document.createElement('script');
 | 
			
		||||
                s.setAttribute('src', 'mkxp.js');
 | 
			
		||||
                document.body.appendChild(s);
 | 
			
		||||
 | 
			
		||||
                getLazyAsset('gameasync/bitmap-map.js', 'Primary assets', () => {
 | 
			
		||||
                        const s = document.createElement('script');
 | 
			
		||||
                        s.setAttribute('src', 'gameasync/bitmap-map.js');
 | 
			
		||||
                        document.body.appendChild(s);
 | 
			
		||||
                });
 | 
			
		||||
            });
 | 
			
		||||
        }, 200);
 | 
			
		||||
        var bitmapSizeMapping = {};
 | 
			
		||||
 | 
			
		||||
        if (!is_touch_device()) {
 | 
			
		||||
            document.getElementById('dpad').style.display = 'none';
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue