Skip to content

Commit 4ab85f5

Browse files
committed
World properties can also be set in BladeEngine.properties. Added PLATFORM property.
1 parent 75259b1 commit 4ab85f5

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

blade-engine/src/com/bladecoder/engine/actions/IfPropertyAction.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
import com.bladecoder.engine.model.VerbRunner;
1919
import com.bladecoder.engine.model.World;
2020
import com.bladecoder.engine.util.ActionUtils;
21+
import com.bladecoder.engine.util.Config;
2122

22-
@ActionDescription("Execute the actions inside the If/EndIf if the game property has the specified value. Properties are created by the user but the next always exists: SAVED_GAME_VERSION, PREVIOUS_SCENE, CURRENT_CHAPTER")
23+
@ActionDescription("Execute actions inside the If/EndIf if the game property has the specified value. Properties are created with the 'Property' action or set in the 'BladeEngine.properties' file. The next always exists: SAVED_GAME_VERSION, PREVIOUS_SCENE, CURRENT_CHAPTER, PLATFORM")
2324
public class IfPropertyAction extends AbstractIfAction {
2425
@ActionProperty(required = true)
2526
@ActionPropertyDescription("The property name")
@@ -31,7 +32,10 @@ public class IfPropertyAction extends AbstractIfAction {
3132

3233
@Override
3334
public boolean run(VerbRunner cb) {
34-
String valDest = World.getInstance().getCustomProperty(name);
35+
String valDest = World.getInstance().getCustomProperty(name);
36+
37+
if(valDest == null)
38+
valDest = Config.getProperty(name, null);
3539

3640
if (!ActionUtils.compareNullStr(value, valDest)) {
3741
gotoElse((VerbRunner) cb);

blade-engine/src/com/bladecoder/engine/actions/PropertyAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import com.bladecoder.engine.model.VerbRunner;
1919
import com.bladecoder.engine.model.World;
2020

21-
@ActionDescription("Sets a global game property. Properties are created by the user but the next ones always exists: SAVED_GAME_VERSION, PREVIOUS_SCENE, CURRENT_CHAPTER")
21+
@ActionDescription("Sets a global game property. Properties are created by the user but the next ones always exists: SAVED_GAME_VERSION, PREVIOUS_SCENE, CURRENT_CHAPTER, PLATFORM")
2222
public class PropertyAction implements Action {
2323
@ActionProperty(required = true)
2424
@ActionPropertyDescription("Property name")

blade-engine/src/com/bladecoder/engine/model/World.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static enum AssetState {
7979
};
8080

8181
public static enum WorldProperties {
82-
SAVED_GAME_VERSION, PREVIOUS_SCENE, CURRENT_CHAPTER
82+
SAVED_GAME_VERSION, PREVIOUS_SCENE, CURRENT_CHAPTER, PLATFORM
8383
};
8484

8585
private static final boolean CACHE_ENABLED = true;
@@ -852,6 +852,7 @@ public void loadChapter(String chapterName) throws IOException {
852852
I18N.loadChapter(EngineAssetManager.MODEL_DIR + chapterName);
853853

854854
customProperties.put(WorldProperties.CURRENT_CHAPTER.toString(), chapterName);
855+
customProperties.put(WorldProperties.PLATFORM.toString(), Gdx.app.getType().toString());
855856
} else {
856857
EngineLogger.error(
857858
"ERROR LOADING CHAPTER: " + chapterName + EngineAssetManager.CHAPTER_EXT + " doesn't exists.");

0 commit comments

Comments
 (0)