World can be imported from JSON

At least for assets.
This commit is contained in:
2018-12-05 19:13:19 +01:00
parent 53bc93a15c
commit e516770fca
6 changed files with 23 additions and 9 deletions

View File

@ -218,12 +218,12 @@ public class AssetEditorPanel extends javax.swing.JPanel {
);
}// </editor-fold>//GEN-END:initComponents
@Export
public String getDeecimals() {
@Export("decimals")
public String getDecimals() {
return decimalsField.getValue().toString();
}
@Import
@Import("decimals")
public void setDecimals(String d) {
decimalsField.setValue(Integer.parseInt(d));
}
@ -277,6 +277,8 @@ public class AssetEditorPanel extends javax.swing.JPanel {
public boolean save(WorldAdm worldadm ){
JSONObject jo = Json.get(this);
System.out.printf("ASSETGETTER: %s\n",jo.toString(5));
if (jo.getString(World.JKEYS.ASSET_SYMBOL).length()==0){
javax.swing.JOptionPane.showMessageDialog(this, "Symbol must not be empty.",
"Error",

View File

@ -178,10 +178,15 @@ public class AssetListDialog extends EscDialog {
AssetEditorDialog.runDialog(this, worldadm, o, null);
assetListPanel.reload();
}//GEN-LAST:event_newButtonActionPerformed
private void doneButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_doneButtonActionPerformed
dispose();
JSONObject o = worldadm.world.getJson();
Globals.prefs.put("world", o.toString());
}//GEN-LAST:event_doneButtonActionPerformed
private void doEdit() {

View File

@ -91,8 +91,9 @@ public class SeSimApplication extends javax.swing.JFrame {
// Globals.setLookAndFeel("Metal");
initComponents();
worldadm = new WorldAdm();
JSONObject cfg;
cfg = new JSONObject(Globals.prefs.get("world","{}"));
worldadm = new WorldAdm(cfg);