Revision 4c0cd600
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/magic/RubikActivity.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
import org.distorted.dialog.RubikDialogAbout; |
29 | 29 |
import org.distorted.dialog.RubikDialogScores; |
30 |
import org.distorted.dialog.RubikDialogSettings;
|
|
30 |
import org.distorted.dialog.RubikDialogEffects;
|
|
31 | 31 |
import org.distorted.effect.BaseEffect; |
32 | 32 |
import org.distorted.library.main.DistortedLibrary; |
33 | 33 |
|
... | ... | |
91 | 91 |
RubikStatePlay play = (RubikStatePlay)RubikState.PLAY.getStateClass(); |
92 | 92 |
int object = play.getObject(); |
93 | 93 |
int size = play.getSize(); |
94 |
RubikObjectList obj = RubikObjectList.getObject(object); |
|
95 |
int objectSize = obj.getSizes()[size]; |
|
96 | 94 |
|
97 |
view.getRenderer().createObject( obj, objectSize ); |
|
95 |
if( object>=0 && object<RubikObjectList.NUM_OBJECTS ) |
|
96 |
{ |
|
97 |
RubikObjectList obj = RubikObjectList.getObject(object); |
|
98 |
int[] sizes = obj.getSizes(); |
|
99 |
|
|
100 |
if( size>=0 && size<sizes.length ) |
|
101 |
{ |
|
102 |
view.getRenderer().createObject( obj, sizes[size] ); |
|
103 |
} |
|
104 |
} |
|
98 | 105 |
} |
99 | 106 |
|
100 | 107 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
111 | 118 |
@Override |
112 | 119 |
public void onClick(View v) |
113 | 120 |
{ |
114 |
int id = v.getId(); |
|
115 |
|
|
116 |
if( id>=0 && id< RubikObjectList.getTotal() ) |
|
121 |
switch(v.getId()) |
|
117 | 122 |
{ |
118 |
int object = RubikObjectList.unpackObject(id); |
|
119 |
int size= RubikObjectList.unpackSize(id); |
|
123 |
case RubikStateAbstract.BUTTON_ID_OBJECT: RubikStatePlay play = (RubikStatePlay)RubikState.PLAY.getStateClass(); |
|
124 |
play.bringUpPopup(this,v); |
|
125 |
break; |
|
126 |
case RubikStateAbstract.BUTTON_ID_BACK: RubikState.goBack(this); |
|
127 |
break; |
|
128 |
} |
|
129 |
} |
|
120 | 130 |
|
121 |
RubikObjectList obj = RubikObjectList.getObject(object); |
|
122 |
int objectSize = obj.getSizes()[size]; |
|
131 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
123 | 132 |
|
124 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
|
125 |
boolean success = view.getRenderer().createObject(obj,objectSize); |
|
133 |
public void changeObject(int object, int size) |
|
134 |
{ |
|
135 |
RubikObjectList obj = RubikObjectList.getObject(object); |
|
136 |
int objectSize = obj.getSizes()[size]; |
|
126 | 137 |
|
127 |
if( success ) |
|
128 |
{ |
|
129 |
RubikStatePlay play = (RubikStatePlay)RubikState.PLAY.getStateClass(); |
|
130 |
play.markButton(this,object,size); |
|
131 |
} |
|
132 |
} |
|
138 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
|
139 |
view.getRenderer().createObject(obj,objectSize); |
|
140 |
} |
|
133 | 141 |
|
134 |
if( id == RubikStateAbstract.BUTTON_ID_BACK ) |
|
135 |
{ |
|
136 |
RubikState.goBack(this); |
|
137 |
} |
|
142 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
143 |
|
|
144 |
public boolean isVertical() |
|
145 |
{ |
|
146 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
|
147 |
return view.isVertical(); |
|
138 | 148 |
} |
139 | 149 |
|
140 | 150 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
196 | 206 |
|
197 | 207 |
public void Settings(View v) |
198 | 208 |
{ |
199 |
RubikDialogSettings settings = new RubikDialogSettings();
|
|
209 |
RubikDialogEffects settings = new RubikDialogEffects();
|
|
200 | 210 |
settings.show(getSupportFragmentManager(), null); |
201 | 211 |
} |
202 | 212 |
|
Also available in: Unified diff
Change the series of Object buttons in the Play state into a PopupWindow.