Fix NPE on create new 9 patch due to project reload
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2
-2
@@ -18,8 +18,8 @@
|
||||
|
||||
package games.rednblack.h2d.common.plugins;
|
||||
|
||||
import com.badlogic.ashley.core.Engine;
|
||||
import com.badlogic.ashley.core.Entity;
|
||||
import com.badlogic.ashley.core.PooledEngine;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
@@ -56,7 +56,7 @@ public interface PluginAPI {
|
||||
* Returns Ashley engine of main scene where all entities are located
|
||||
* @return Engine
|
||||
*/
|
||||
Engine getEngine();
|
||||
PooledEngine getEngine();
|
||||
|
||||
/**
|
||||
* Get simple libGDX Stage for UI part of editor, to add dialogs or other UI elements and widgets
|
||||
|
||||
+1
-2
@@ -53,7 +53,6 @@ public class MainPanelMediator extends SimpleMediator<MainPanel> {
|
||||
break;
|
||||
case NinePatchPlugin.CONVERT_TO_NINE_PATCH:
|
||||
convertImageToNinePatch();
|
||||
loadNinePatch();
|
||||
break;
|
||||
case MainPanel.SAVE_CLICKED:
|
||||
Entity entity = plugin.currEditingEntity;
|
||||
@@ -70,7 +69,7 @@ public class MainPanelMediator extends SimpleMediator<MainPanel> {
|
||||
mainItemComponent.entityType = EntityFactory.NINE_PATCH;
|
||||
TextureRegionComponent textureRegionComponent = ComponentRetriever.get(entity, TextureRegionComponent.class);
|
||||
String regionName = textureRegionComponent.regionName;
|
||||
NinePatchComponent ninePatchComponent = new NinePatchComponent();
|
||||
NinePatchComponent ninePatchComponent = plugin.getAPI().getEngine().createComponent(NinePatchComponent.class);
|
||||
ninePatchComponent.textureRegionName = regionName;
|
||||
TextureAtlas.AtlasRegion newRegion = (TextureAtlas.AtlasRegion) textureRegionComponent.region;
|
||||
int[] splits = {0, 0, 0, 0};
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
package games.rednblack.editor.proxy;
|
||||
|
||||
import com.badlogic.ashley.core.Engine;
|
||||
import com.badlogic.ashley.core.Entity;
|
||||
import com.badlogic.ashley.core.PooledEngine;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
@@ -210,7 +210,7 @@ public class PluginManager extends BaseProxy implements PluginAPI {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Engine getEngine() {
|
||||
public PooledEngine getEngine() {
|
||||
return getSceneLoader().getEngine();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user