Flag for Particle Effects auto start
This commit is contained in:
Submodule hyperlap2d-runtime-libgdx updated: cec3ea25a6...758c37a179
+2
@@ -25,6 +25,7 @@ public class UpdateParticleDataCommand extends EntityModifyRevertibleCommand {
|
||||
|
||||
ParticleComponent particleComponent = SandboxComponentRetriever.get(entity, ParticleComponent.class);
|
||||
particleComponent.transform = vo.transform;
|
||||
particleComponent.autoStart = vo.autoStart;
|
||||
|
||||
particleComponent.particleEffect.setPosition(0, 0);
|
||||
|
||||
@@ -37,6 +38,7 @@ public class UpdateParticleDataCommand extends EntityModifyRevertibleCommand {
|
||||
|
||||
ParticleComponent particleComponent = SandboxComponentRetriever.get(entity, ParticleComponent.class);
|
||||
particleComponent.transform = backup.transform;
|
||||
particleComponent.autoStart = backup.autoStart;
|
||||
|
||||
HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity);
|
||||
}
|
||||
|
||||
+15
-6
@@ -1,21 +1,21 @@
|
||||
package games.rednblack.editor.view.ui.properties.panels;
|
||||
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.kotcrab.vis.ui.widget.VisCheckBox;
|
||||
import games.rednblack.editor.event.CheckBoxChangeListener;
|
||||
import games.rednblack.editor.view.ui.properties.UIItemCollapsibleProperties;
|
||||
import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory;
|
||||
|
||||
public class UIParticleProperties extends UIItemCollapsibleProperties {
|
||||
private VisCheckBox matrixTransformCheckBox;
|
||||
private VisCheckBox matrixTransformCheckBox, autoStartCheckBox;
|
||||
|
||||
public UIParticleProperties() {
|
||||
super("Particle Effect");
|
||||
|
||||
matrixTransformCheckBox = StandardWidgetsFactory.createCheckBox();
|
||||
matrixTransformCheckBox = StandardWidgetsFactory.createCheckBox("Matrix Transform");
|
||||
autoStartCheckBox = StandardWidgetsFactory.createCheckBox("Auto Start");
|
||||
|
||||
mainTable.add(StandardWidgetsFactory.createLabel("Matrix Transform", Align.right)).padRight(5).width(120).right();
|
||||
mainTable.add(matrixTransformCheckBox).left().row();
|
||||
mainTable.add(autoStartCheckBox).left().row();
|
||||
|
||||
setListeners();
|
||||
}
|
||||
@@ -29,11 +29,20 @@ public class UIParticleProperties extends UIItemCollapsibleProperties {
|
||||
return matrixTransformCheckBox.isChecked();
|
||||
}
|
||||
|
||||
public void setMatrixTransformEnabled(boolean scissorsEnabled) {
|
||||
matrixTransformCheckBox.setChecked(scissorsEnabled);
|
||||
public boolean isAutoStartEnabled() {
|
||||
return autoStartCheckBox.isChecked();
|
||||
}
|
||||
|
||||
public void setMatrixTransformEnabled(boolean matrixTransform) {
|
||||
matrixTransformCheckBox.setChecked(matrixTransform);
|
||||
}
|
||||
|
||||
public void setAutoStartEnabled(boolean autoStart) {
|
||||
autoStartCheckBox.setChecked(autoStart);
|
||||
}
|
||||
|
||||
private void setListeners() {
|
||||
matrixTransformCheckBox.addListener(new CheckBoxChangeListener(getUpdateEventName()));
|
||||
autoStartCheckBox.addListener(new CheckBoxChangeListener(getUpdateEventName()));
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -18,13 +18,16 @@ public class UIParticlePropertiesMediator extends UIItemPropertiesMediator<UIPar
|
||||
|
||||
@Override
|
||||
protected void translateObservableDataToView(int item) {
|
||||
viewComponent.setMatrixTransformEnabled(SandboxComponentRetriever.get(item, ParticleComponent.class).transform);
|
||||
ParticleComponent particleComponent = SandboxComponentRetriever.get(item, ParticleComponent.class);
|
||||
viewComponent.setMatrixTransformEnabled(particleComponent.transform);
|
||||
viewComponent.setAutoStartEnabled(particleComponent.autoStart);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void translateViewToItemData() {
|
||||
ParticleEffectVO payloadVo = new ParticleEffectVO();
|
||||
payloadVo.transform = viewComponent.isMatrixTransformEnabled();
|
||||
payloadVo.autoStart = viewComponent.isAutoStartEnabled();
|
||||
|
||||
Object payload = UpdateParticleDataCommand.payload(observableReference, payloadVo);
|
||||
facade.sendNotification(MsgAPI.ACTION_UPDATE_PARTICLE_DATA, payload);
|
||||
|
||||
Reference in New Issue
Block a user