37
37
import com .bladecoder .engineeditor .Ctx ;
38
38
import com .bladecoder .engineeditor .common .EditorLogger ;
39
39
import com .bladecoder .engineeditor .common .ElementUtils ;
40
- import com .bladecoder .engineeditor .common .Message ;
41
40
import com .bladecoder .engineeditor .model .Project ;
42
41
import com .bladecoder .engineeditor .ui .panels .EditModelDialog ;
43
42
import com .bladecoder .engineeditor .ui .panels .FilteredSelectBox ;
@@ -74,25 +73,25 @@ public EditSceneDialog(Skin skin, World parent, Scene e) {
74
73
75
74
super (skin );
76
75
77
- id = InputPanelFactory .createInputPanel (skin , "Scene ID" ,
78
- "The ID is mandatory for scenes." , true );
76
+ id = InputPanelFactory .createInputPanel (skin , "Scene ID" , "The ID is mandatory for scenes." , true );
79
77
backgroundAtlas = InputPanelFactory .createInputPanel (skin , "Background Atlas" ,
80
78
"The atlas where the background for the scene is located" , Type .ATLAS_ASSET , false );
81
79
backgroundRegion = InputPanelFactory .createInputPanel (skin , "Background Region Id" ,
82
80
"The region id for the background." , new String [0 ], false );
83
81
// depthVector = InputPanelFactory.createInputPanel(skin, "Depth Vector",
84
82
// "X: the actor 'y' position for a 0.0 scale, Y: the actor 'y' position for a 1.0 scale.",
85
83
// Param.Type.VECTOR2, false);
86
-
87
- depthVector = InputPanelFactory .createInputPanel (skin , "Fake depth" , "Change actor scale based in the 'y' axis position." , Param . Type . BOOLEAN , true ,
88
- "false" );
89
-
84
+
85
+ depthVector = InputPanelFactory .createInputPanel (skin , "Fake depth" ,
86
+ "Change actor scale based in the 'y' axis position." , Param . Type . BOOLEAN , true , " false" );
87
+
90
88
state = InputPanelFactory .createInputPanel (skin , "State" , "The initial state for the scene." , false );
91
- music = InputPanelFactory .createInputPanel (skin , "Music Filename" , "The music for the scene" , Type .MUSIC_ASSET , false );
89
+ music = InputPanelFactory .createInputPanel (skin , "Music Filename" , "The music for the scene" , Type .MUSIC_ASSET ,
90
+ false );
92
91
loopMusic = InputPanelFactory .createInputPanel (skin , "Loop Music" , "If the music is playing in looping" ,
93
92
Param .Type .BOOLEAN , true , "true" );
94
- volumeMusic = InputPanelFactory .createInputPanel (skin , "Music Volume" , "The volume of the music. Value is between 0 and 1." ,
95
- Param .Type .FLOAT , true , "1" );
93
+ volumeMusic = InputPanelFactory .createInputPanel (skin , "Music Volume" ,
94
+ "The volume of the music. Value is between 0 and 1." , Param .Type .FLOAT , true , "1" );
96
95
initialMusicDelay = InputPanelFactory .createInputPanel (skin , "Initial music delay" ,
97
96
"The time to wait before playing" , Param .Type .FLOAT , true , "0" );
98
97
repeatMusicDelay = InputPanelFactory .createInputPanel (skin , "Repeat music delay" ,
@@ -103,8 +102,9 @@ public EditSceneDialog(Skin skin, World parent, Scene e) {
103
102
sceneSize = InputPanelFactory .createInputPanel (skin , "Scene Dimension" ,
104
103
"Sets the size of the scene. If empty, the background image size is used as the scene dimension." ,
105
104
Param .Type .DIMENSION , false );
106
-
107
- walkzone = InputPanelFactory .createInputPanel (skin , "Walkzone" , "The initial walkzone." , Type .WALKZONE_ACTOR , false );
105
+
106
+ walkzone = InputPanelFactory .createInputPanel (skin , "Walkzone" , "The initial walkzone." , Type .WALKZONE_ACTOR ,
107
+ false );
108
108
109
109
bgImage = new Image ();
110
110
bgImage .setScaling (Scaling .fit );
@@ -118,7 +118,8 @@ public void changed(ChangeEvent event, Actor actor) {
118
118
try {
119
119
fillBGRegions (backgroundAtlas , backgroundRegion );
120
120
} catch (Exception e ) {
121
- Message .showMsg (getStage (), "Error loading regions from selected atlas" , 4 );
121
+ EditorLogger .error ("Error loading regions from selected atlas: " + backgroundAtlas .getText () + "."
122
+ + backgroundRegion .getText ());
122
123
}
123
124
}
124
125
});
@@ -133,7 +134,8 @@ public void changed(ChangeEvent event, Actor actor) {
133
134
try {
134
135
fillBGRegions (backgroundAtlas , backgroundRegion );
135
136
} catch (Exception e2 ) {
136
- EditorLogger .error ("Error loading regions from selected atlas" );
137
+ EditorLogger .error ("Error loading regions from selected atlas: " + backgroundAtlas .getText () + "."
138
+ + backgroundRegion .getText ());
137
139
}
138
140
139
141
init (parent , e , new InputPanel [] { id , backgroundAtlas , backgroundRegion , depthVector , state , sceneSize , music ,
@@ -214,19 +216,20 @@ protected void inputsToModel(boolean create) {
214
216
parent .getScenes ().remove (e .getId ());
215
217
}
216
218
217
- e .setId (ElementUtils .getCheckedId (id .getText (), Ctx .project .getWorld ().getScenes ().keySet ().toArray (new String [0 ])));
219
+ e .setId (ElementUtils .getCheckedId (id .getText (),
220
+ Ctx .project .getWorld ().getScenes ().keySet ().toArray (new String [0 ])));
218
221
219
222
e .setBackgroundAtlas (backgroundAtlas .getText ());
220
223
e .setBackgroundRegionId (backgroundRegion .getText ());
221
-
224
+
222
225
boolean dv = Boolean .parseBoolean (depthVector .getText ());
223
-
224
- if (dv == true && e .getDepthVector () == null ) { // create depth vector
226
+
227
+ if (dv == true && e .getDepthVector () == null ) { // create depth vector
225
228
e .setDepthVector (new Vector2 (Ctx .project .getWorld ().getHeight (), 0 ));
226
- } else if (dv == false && e .getDepthVector () != null ) { // Remove depth vector
229
+ } else if (dv == false && e .getDepthVector () != null ) { // Remove depth vector
227
230
e .setDepthVector (null );
228
231
}
229
-
232
+
230
233
e .setState (state .getText ());
231
234
232
235
MusicDesc md = null ;
@@ -245,7 +248,7 @@ protected void inputsToModel(boolean create) {
245
248
e .setMusicDesc (md );
246
249
247
250
e .setSceneSize (Param .parseVector2 (sceneSize .getText ()));
248
-
251
+
249
252
e .setWalkZone (walkzone .getText ());
250
253
251
254
parent .addScene (e );
@@ -269,12 +272,12 @@ protected void modelToInputs() {
269
272
id .setText (e .getId ());
270
273
backgroundAtlas .setText (e .getBackgroundAtlas ());
271
274
backgroundRegion .setText (e .getBackgroundRegionId ());
272
-
275
+
273
276
if (e .getDepthVector () != null )
274
277
depthVector .setText ("true" );
275
278
else
276
279
depthVector .setText ("false" );
277
-
280
+
278
281
state .setText (e .getState ());
279
282
280
283
MusicDesc md = e .getMusicDesc ();
@@ -290,7 +293,7 @@ protected void modelToInputs() {
290
293
291
294
if (e .getSceneSize () != null )
292
295
sceneSize .setText (Param .toStringParam (e .getSceneSize ()));
293
-
296
+
294
297
walkzone .setText (e .getWalkZone ());
295
298
}
296
299
0 commit comments