File tree 1 file changed +7
-3
lines changed
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 {
14
14
}
15
15
super .watch (function () {
16
16
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 ?)
18
18
lib .reload (data );
19
19
onPrefabLoaded (lib );
20
20
}
21
21
onChanged ();
22
22
});
23
23
}
24
24
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
+
25
30
public function load () : Prefab {
26
31
if ( lib != null && cacheVersion == CACHE_VERSION )
27
32
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 ();
30
34
lib = Library .create (entry .extension );
31
35
lib .loadData (data );
32
36
cacheVersion = CACHE_VERSION ;
You can’t perform that action at this time.
0 commit comments