Commit 1d082d99 authored by Luboš Horáček's avatar Luboš Horáček

Merge branch 'devel' of gitlab.labs.nic.cz:labs/tablexia into devel

parents 9a684c69 4bb826dd
...@@ -936,7 +936,7 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener ...@@ -936,7 +936,7 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
public PotmeDifficulty getPotmeDifficulty() { public PotmeDifficulty getPotmeDifficulty() {
if (potmeDifficulty == null) { if (potmeDifficulty == null) {
boolean firstPlay = currentFirstPlay && (getTablexiaContext().getSelectedUser() != null) && (GameManager.getGamePlayCountForUser(getTablexiaContext().getSelectedUser(), getGameDefinition()) == 0); boolean firstPlay = currentFirstPlay && (getTablexiaContext().getSelectedUser() != null) && (GameManager.getLastGameManagerRegardlessFinishing(getTablexiaContext().getSelectedUser(), getGameDefinition()) == null);
potmeDifficulty = PotmeDifficulty.getPotmeDifficultyForGameDifficulty(getDifficulty(), firstPlay); potmeDifficulty = PotmeDifficulty.getPotmeDifficultyForGameDifficulty(getDifficulty(), firstPlay);
} }
return potmeDifficulty; return potmeDifficulty;
......
...@@ -28,6 +28,7 @@ import java.util.Map.Entry; ...@@ -28,6 +28,7 @@ import java.util.Map.Entry;
import java.util.Random; import java.util.Random;
import org.andengine.engine.options.EngineOptions; import org.andengine.engine.options.EngineOptions;
import org.andengine.entity.IEntity;
import org.andengine.entity.modifier.MoveModifier; import org.andengine.entity.modifier.MoveModifier;
import org.andengine.entity.modifier.RotationModifier; import org.andengine.entity.modifier.RotationModifier;
import org.andengine.entity.primitive.Rectangle; import org.andengine.entity.primitive.Rectangle;
...@@ -41,6 +42,8 @@ import org.andengine.opengl.texture.ITexture; ...@@ -41,6 +42,8 @@ import org.andengine.opengl.texture.ITexture;
import org.andengine.opengl.texture.region.ITextureRegion; import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.opengl.texture.region.TextureRegion; import org.andengine.opengl.texture.region.TextureRegion;
import org.andengine.opengl.texture.region.TextureRegionFactory; import org.andengine.opengl.texture.region.TextureRegionFactory;
import org.andengine.util.modifier.IModifier;
import org.andengine.util.modifier.IModifier.IModifierListener;
import org.andengine.util.modifier.ease.EaseLinear; import org.andengine.util.modifier.ease.EaseLinear;
import android.graphics.Bitmap; import android.graphics.Bitmap;
...@@ -626,6 +629,20 @@ public class PronasledovaniActivity extends GameActivity implements IOnSceneTouc ...@@ -626,6 +629,20 @@ public class PronasledovaniActivity extends GameActivity implements IOnSceneTouc
shadowSprite.unregisterEntityModifier(moveModifier); shadowSprite.unregisterEntityModifier(moveModifier);
} }
moveModifier = new MoveModifier(0.2f, originalX, originalY, futureX, futureY, EaseLinear.getInstance()); moveModifier = new MoveModifier(0.2f, originalX, originalY, futureX, futureY, EaseLinear.getInstance());
moveModifier.addModifierListener(new IModifierListener<IEntity>() {
@Override
public void onModifierStarted(IModifier<IEntity> pModifier, IEntity pItem) {
// nothing
}
@Override
public void onModifierFinished(IModifier<IEntity> pModifier, IEntity pItem) {
if (gameRunning && checkWhetherDone()) {
onVictory();
}
}
});
scene.getChildByTag(pieceID).registerEntityModifier(moveModifier); scene.getChildByTag(pieceID).registerEntityModifier(moveModifier);
shadowSprite.registerEntityModifier(moveModifier); shadowSprite.registerEntityModifier(moveModifier);
} }
...@@ -641,6 +658,21 @@ public class PronasledovaniActivity extends GameActivity implements IOnSceneTouc ...@@ -641,6 +658,21 @@ public class PronasledovaniActivity extends GameActivity implements IOnSceneTouc
shadowSprite.unregisterEntityModifier(rotationModifier); shadowSprite.unregisterEntityModifier(rotationModifier);
} }
rotationModifier = new RotationModifier(0.4f, initialRotation, endRotation, EaseLinear.getInstance()); rotationModifier = new RotationModifier(0.4f, initialRotation, endRotation, EaseLinear.getInstance());
rotationModifier.addModifierListener(new IModifierListener<IEntity>() {
@Override
public void onModifierStarted(IModifier<IEntity> pModifier, IEntity pItem) {
// nothing
}
@Override
public void onModifierFinished(IModifier<IEntity> pModifier, IEntity pItem) {
if (gameRunning && checkWhetherDone()) {
onVictory();
}
}
});
scene.getChildByTag(pieceID).registerEntityModifier(rotationModifier); scene.getChildByTag(pieceID).registerEntityModifier(rotationModifier);
shadowSprite.registerEntityModifier(rotationModifier); shadowSprite.registerEntityModifier(rotationModifier);
} }
...@@ -824,7 +856,7 @@ public class PronasledovaniActivity extends GameActivity implements IOnSceneTouc ...@@ -824,7 +856,7 @@ public class PronasledovaniActivity extends GameActivity implements IOnSceneTouc
getGameManager().setExtraInt2AndSave(++movesCounter); getGameManager().setExtraInt2AndSave(++movesCounter);
} }
if (checkWhetherDone()) { if (gameRunning && checkWhetherDone()) {
onVictory(); onVictory();
} }
animationCanceled = false; animationCanceled = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment