File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -14,19 +14,23 @@ class Resource extends hxd.res.Resource {
1414 }
1515 super .watch (function () {
1616 if ( lib != null ) {
17- var data = try haxe. Json . parse ( entry . getText () ) catch ( e : Dynamic ) return ; // parsing error (conflict ?)
17+ var data = try loadData ( ) catch ( e : Dynamic ) return ; // parsing error (conflict ?)
1818 lib .reload (data );
1919 onPrefabLoaded (lib );
2020 }
2121 onChanged ();
2222 });
2323 }
2424
25+ function loadData () {
26+ var isBSON = entry .fetchBytes (0 ,1 ).get (0 ) == ' H' .code ;
27+ return isBSON ? new hxd.fmt.hbson. Reader (entry .getBytes (),false ).read () : haxe. Json .parse (entry .getText ());
28+ }
29+
2530 public function load () : Prefab {
2631 if ( lib != null && cacheVersion == CACHE_VERSION )
2732 return lib ;
28- var isBSON = entry .fetchBytes (0 ,1 ).get (0 ) == ' H' .code ;
29- var data = isBSON ? new hxd.fmt.hbson. Reader (entry .getBytes (),false ).read () : haxe. Json .parse (entry .getText ());
33+ var data = loadData ();
3034 lib = Library .create (entry .extension );
3135 lib .loadData (data );
3236 cacheVersion = CACHE_VERSION ;
You can’t perform that action at this time.
0 commit comments