1 package erland.game.tileadventure;
2
3 import erland.util.*;
4 import erland.game.GameEnvironmentInterface;
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 public class LevelManagerHelper {
26 public static StorageInterface load(ParameterValueStorageExInterface mainStorage, String parent, String group, String id) {
27 StorageInterface parentStorage = mainStorage.getParameterAsStorage(parent);
28 ParameterValueStorageExInterface parameters = new ParameterStorageGroupWithId(parentStorage, null, parent, group);
29 return parameters.getParameterAsStorage(group + "." + id);
30 }
31 public static void store(ParameterValueStorageExInterface storage, String parent, String group, String id, String value) {
32 StorageInterface parameterStorage = storage.getParameterAsStorage(parent);
33 ParameterStorageGroupWithId parameters = null;
34 StorageInterface updatedStorage = null;
35 if(parameterStorage==null) {
36 updatedStorage = new StringStorage();
37 parameters = new ParameterStorageGroupWithId(updatedStorage,null,null,group);
38 }else {
39 updatedStorage = parameterStorage;
40 parameters = new ParameterStorageGroupWithId(updatedStorage,null,parent,group);
41 }
42 parameters.setParameter(group+"."+id,value);
43
44 if(parameterStorage!=null) {
45 storage.setParameterAsStorage(parent,updatedStorage);
46 }else {
47 storage.setParameter(parent,updatedStorage.load());
48 }
49 }
50 }