Revision f12e4de9
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objects/RubikObjectList.java | ||
---|---|---|
28 | 28 |
import org.distorted.screens.ScreenList; |
29 | 29 |
|
30 | 30 |
import java.util.ArrayList; |
31 |
|
|
32 |
import static org.distorted.config.ConfigScreenPane.MESH_NICE; |
|
31 | 33 |
import static org.distorted.objectlib.main.ObjectType.NUM_OBJECTS; |
32 | 34 |
|
33 | 35 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
107 | 109 |
return type.getNumScramble(); |
108 | 110 |
} |
109 | 111 |
|
112 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
113 |
|
|
114 |
public static void setMeshState(int ordinal, int state) |
|
115 |
{ |
|
116 |
if( ordinal>=0 && ordinal<mNumObjects ) mObjects.get(ordinal).setMeshState(state); |
|
117 |
} |
|
118 |
|
|
119 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
120 |
|
|
121 |
public static int getMeshState(int ordinal) |
|
122 |
{ |
|
123 |
return (ordinal>=0 && ordinal<mNumObjects) ? mObjects.get(ordinal).getMeshState() : MESH_NICE; |
|
124 |
} |
|
125 |
|
|
110 | 126 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
111 | 127 |
|
112 | 128 |
public static void savePreferences(SharedPreferences.Editor editor) |
113 | 129 |
{ |
114 |
RubikObject object = getObject(mObject); |
|
130 |
RubikObject obj = getObject(mObject); |
|
131 |
if( obj!=null ) editor.putString("rol_objName", obj.getName() ); |
|
132 |
} |
|
115 | 133 |
|
116 |
if( object!=null ) |
|
134 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
135 |
|
|
136 |
public static void saveMeshState(SharedPreferences.Editor editor) |
|
137 |
{ |
|
138 |
for(int i=0; i<mNumObjects; i++) |
|
117 | 139 |
{ |
118 |
editor.putString("statePlay_objName", object.getName() ); |
|
140 |
RubikObject obj = getObject(i); |
|
141 |
|
|
142 |
if( obj!=null ) |
|
143 |
{ |
|
144 |
String name = obj.getName(); |
|
145 |
editor.putInt("rol_"+name, obj.getMeshState() ); |
|
146 |
} |
|
119 | 147 |
} |
120 | 148 |
} |
121 | 149 |
|
... | ... | |
125 | 153 |
{ |
126 | 154 |
RubikObject object = getObject(DEF_OBJECT); |
127 | 155 |
String defName = object==null ? "CUBE_3" : object.getName(); |
128 |
String objName= preferences.getString("statePlay_objName",defName);
|
|
156 |
String objName= preferences.getString("rol_objName",defName);
|
|
129 | 157 |
mObject = getOrdinal(objName); |
130 | 158 |
|
131 | 159 |
if( mObject<0 || mObject>=mNumObjects ) mObject = DEF_OBJECT; |
132 | 160 |
} |
133 | 161 |
|
162 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
163 |
|
|
164 |
public static void restoreMeshState(SharedPreferences preferences) |
|
165 |
{ |
|
166 |
for(int i=0; i<mNumObjects; i++) |
|
167 |
{ |
|
168 |
RubikObject obj = getObject(i); |
|
169 |
|
|
170 |
if( obj!=null ) |
|
171 |
{ |
|
172 |
String name = obj.getName(); |
|
173 |
int meshState= preferences.getInt("rol_"+name,MESH_NICE); |
|
174 |
obj.setMeshState(meshState); |
|
175 |
} |
|
176 |
} |
|
177 |
} |
|
178 |
|
|
134 | 179 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
135 | 180 |
|
136 | 181 |
public static boolean setCurrObject(RubikActivity act, int ordinal) |
Also available in: Unified diff
Progress with Config UI.