properly persist medal icons across states
This commit is contained in:
@@ -48,7 +48,9 @@ class Medals
|
||||
#if html5
|
||||
// Web builds support parsing the bitmap data from the URL directly.
|
||||
BitmapData.loadFromFile("https:" + medalData.icon).onComplete(function(bmp:BitmapData) {
|
||||
NewgroundsMedalPlugin.play(medalData.value, medalData.name, FlxGraphic.fromBitmapData(bmp));
|
||||
var medalGraphic = FlxGraphic.fromBitmapData(bmp);
|
||||
medalGraphic.persist = true;
|
||||
NewgroundsMedalPlugin.play(medalData.value, medalData.name, medalGraphic);
|
||||
});
|
||||
#else
|
||||
if (medalJSON == null) loadMedalJSON();
|
||||
@@ -59,6 +61,7 @@ class Medals
|
||||
str = str.replace("data:image/png;base64,", "").trim();
|
||||
var bitmapData = BitmapData.fromBase64(str, "image/png");
|
||||
if (str != null) g = FlxGraphic.fromBitmapData(bitmapData);
|
||||
g.persist = true;
|
||||
|
||||
NewgroundsMedalPlugin.play(medalData.value, medalData.name, g);
|
||||
#end
|
||||
|
||||
@@ -37,7 +37,6 @@ class NewgroundsMedalPlugin extends FlxTypedContainer<FlxBasic>
|
||||
var why = FlxG.height - 100;
|
||||
FlxGraphic.defaultPersist = true;
|
||||
medal = new FlxAtlasSprite(ecs, why, Paths.animateAtlas("ui/medal"));
|
||||
FlxGraphic.defaultPersist = false;
|
||||
|
||||
points = new FlxText(171 + ecs, 10 + why, 50, 12, false);
|
||||
points.fieldHeight = 18;
|
||||
@@ -95,6 +94,7 @@ class NewgroundsMedalPlugin extends FlxTypedContainer<FlxBasic>
|
||||
add(medal);
|
||||
add(points);
|
||||
add(name);
|
||||
FlxGraphic.defaultPersist = false;
|
||||
}
|
||||
|
||||
override public function update(elapsed:Float)
|
||||
|
||||
Reference in New Issue
Block a user