//判断用户是否完成拼图
checkSuccess();
isAniming=false;
}
});
}
//判断用户是否完成拼图
private void checkSuccess() {
boolean isSuccess=true;
for (int i = 0; i < mGamePintuItems.length; i++) {
ImageView imageView=mGamePintuItems;
if (getImageIndexByTag((String)imageView.getTag())!=i) {
isSuccess=false;
}
}
if (isSuccess) {
Log.e("TAG","SUCCESS");
Toast.makeText(getContext(), "Success,Level up!!!",
Toast.LENGTH_LONG).show();
}
}
private int getImageIndexByTag(String tag) {
// TODO Auto-generated method stub
return 0;
}
/*
*
* 根据Tag获开ID
*/
public int getImageIdByTag(String tag) {
String[] split=tag.split("_");
return Integer.parseInt(split[0]);
}
public int getImageIndex(String tag){
String[] split=tag.split("_");
return Integer.parseInt(split[1]);
}
/*
* 构造我们的动画层
*/
private void setUpAnimLayout() {
if (mAnimLayout==null) {
mAnimLayout=new RelativeLayout(getContext());
addView(mAnimLayout);
}
}
} |