use of net.drewke.tdme.tools.shared.model.PropertyModelClass in project tdme by andreasdr.
the class LevelEditorScreenController method onMapPropertiesSelectionChanged.
/**
* Event callback for map properties selection
* @param id
* @param event
*/
public void onMapPropertiesSelectionChanged() {
mapPropertyName.getController().setDisabled(true);
mapPropertyName.getController().setValue(TEXT_EMPTY);
mapPropertyValue.getController().setDisabled(true);
mapPropertyValue.getController().setValue(TEXT_EMPTY);
mapPropertySave.getController().setDisabled(true);
mapPropertyRemove.getController().setDisabled(true);
PropertyModelClass mapProperty = view.getLevel().getProperty(mapPropertiesListBox.getController().getValue().toString());
if (mapProperty != null) {
mapPropertyName.getController().setValue(value.set(mapProperty.getName()));
mapPropertyValue.getController().setValue(value.set(mapProperty.getValue()));
mapPropertyName.getController().setDisabled(false);
mapPropertyValue.getController().setDisabled(false);
mapPropertySave.getController().setDisabled(false);
mapPropertyRemove.getController().setDisabled(false);
}
}
use of net.drewke.tdme.tools.shared.model.PropertyModelClass in project tdme by andreasdr.
the class LevelEditorScreenController method setMapProperties.
/**
* Set up map properties
* @param map properties
*/
public void setMapProperties(Iterable<PropertyModelClass> mapProperties, String selectedName) {
//
mapPropertyName.getController().setDisabled(true);
mapPropertyValue.getController().setDisabled(true);
mapPropertySave.getController().setDisabled(true);
// map properties list box inner
GUIParentNode mapPropertiesListBoxInnerNode = (GUIParentNode) (mapPropertiesListBox.getScreenNode().getNodeById(mapPropertiesListBox.getId() + "_inner"));
// construct XML for sub nodes
int idx = 1;
String mapPropertiesListBoxSubNodesXML = "";
mapPropertiesListBoxSubNodesXML += "<scrollarea-vertical id=\"" + mapPropertiesListBox.getId() + "_inner_scrollarea\" width=\"100%\" height=\"100%\">\n";
for (PropertyModelClass mapProperty : mapProperties) {
mapPropertiesListBoxSubNodesXML += "<selectbox-option text=\"" + GUIParser.escapeQuotes(mapProperty.getName()) + ": " + GUIParser.escapeQuotes(mapProperty.getValue()) + "\" value=\"" + GUIParser.escapeQuotes(mapProperty.getName()) + "\" " + (selectedName != null && mapProperty.getName().equals(selectedName) ? "selected=\"true\" " : "") + "/>\n";
}
mapPropertiesListBoxSubNodesXML += "</scrollarea-vertical>\n";
// inject sub nodes
try {
mapPropertiesListBoxInnerNode.replaceSubNodes(mapPropertiesListBoxSubNodesXML, false);
} catch (Exception e) {
e.printStackTrace();
}
//
onMapPropertiesSelectionChanged();
}
use of net.drewke.tdme.tools.shared.model.PropertyModelClass in project tdme by andreasdr.
the class LevelEditorView method setStandardObjectColorEffect.
/**
* Set standard object color effect
* @param object
*/
private void setStandardObjectColorEffect(Entity object) {
ObjectColor color = objectColors.get("none");
object.getEffectColorAdd().set(color.colorAddR, color.colorAddG, color.colorAddB, 0.0f);
object.getEffectColorMul().set(color.colorMulR, color.colorMulG, color.colorMulB, 1.0f);
// color object
LevelEditorObject levelEditorObject = level.getObjectById(object.getId());
if (levelEditorObject == null)
return;
// try to get object color from object properties
PropertyModelClass colorProperty = levelEditorObject.getProperty("object.color");
// try to get object color from model properties
if (colorProperty == null)
colorProperty = levelEditorObject.getEntity().getProperty("object.color");
// handle object color if we have any
ObjectColor objectColor = colorProperty != null ? objectColors.get(colorProperty.getValue()) : null;
if (objectColor != null) {
object.getEffectColorAdd().set(object.getEffectColorAdd().getRed() + objectColor.colorAddR, object.getEffectColorAdd().getGreen() + objectColor.colorAddG, object.getEffectColorAdd().getBlue() + objectColor.colorAddB, 0.0f);
object.getEffectColorMul().set(object.getEffectColorMul().getRed() * objectColor.colorMulR, object.getEffectColorMul().getGreen() * objectColor.colorMulG, object.getEffectColorMul().getBlue() * objectColor.colorMulB, 1.0f);
}
}
Aggregations