Message appears when playershape is unlocked
Superpower-countdown now calculated with timer.frametime -> superpower-countdown is now paused when the game is paused
This commit is contained in:
@ -15,10 +15,10 @@ public enum PlayerShape {
|
||||
BALL(R.string.playershape_name_ball, R.string.playershape_description_ball,
|
||||
R.drawable.playershapes_ball, new EmptyTask()),
|
||||
CLOCK(R.string.playershape_name_clock, R.string.playershape_description_clock,
|
||||
R.drawable.playershapes_clock, new CollectStarTask(15)),
|
||||
R.drawable.playershapes_clock, new CollectStarTask(1)),//15
|
||||
HYPNO_SPIRAL(R.string.playershape_name_hypno_spiral,
|
||||
R.string.playershape_description_hypno_spiral, R.drawable.playershapes_hypno_spiral,
|
||||
new CollectEnergyTask(3)),
|
||||
new CollectEnergyTask(1)),//3
|
||||
PACMAN(R.string.playershape_name_pacman, R.string.playershape_description_pacman,
|
||||
R.drawable.playershapes_pacman, new CompleteWorldTask(1)),
|
||||
SMILEY(R.string.playershape_name_smiley, R.string.playershape_description_smiley,
|
||||
|
@ -19,8 +19,7 @@ public class PowerMushroom extends Tool {
|
||||
|
||||
@Override
|
||||
public void onPlayerCollision(Player player, Timer timer) {
|
||||
player.startSuperPower(timer.getCurrentTime(),
|
||||
(long) ToolType.POWER_MUSHROOM.getCurrentUpgradeValue(ToolUpgradeType.DURATION));
|
||||
player.startSuperPower((long) ToolType.POWER_MUSHROOM.getCurrentUpgradeValue(ToolUpgradeType.DURATION));
|
||||
super.destroy(DestroyEffect.ENERGY_COLLECT);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,98 @@
|
||||
package de.frajul.endlessroll.views;
|
||||
|
||||
import android.graphics.Typeface;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import de.frajul.endlessroll.R;
|
||||
import de.frajul.endlessroll.entities.Player;
|
||||
import de.frajul.endlessroll.entities.shapes.PlayerShape;
|
||||
import de.frajul.endlessroll.main.GameActivity;
|
||||
import de.frajul.endlessroll.main.GameLog;
|
||||
import de.frajul.endlessroll.main.game.Game;
|
||||
import de.frajul.endlessroll.main.screens.Screen;
|
||||
|
||||
/**
|
||||
* Created by Julian on 15.07.2016.
|
||||
*/
|
||||
public class TaskCompletedMessage implements View.OnClickListener, BountyMessage.ScreenSwitchCaller {
|
||||
|
||||
private GameActivity gameActivity;
|
||||
private FrameLayout layout;
|
||||
|
||||
private TextView textView;
|
||||
private LinearLayout messagesLayout;
|
||||
|
||||
private List<PlayerShape> unlockedShapes = new ArrayList<>();
|
||||
|
||||
public TaskCompletedMessage(GameActivity gameActivity) {
|
||||
this.gameActivity = gameActivity;
|
||||
|
||||
Typeface typeface = gameActivity.getTypeface();
|
||||
LayoutInflater inflater = LayoutInflater.from(gameActivity);
|
||||
layout = (FrameLayout) inflater.inflate(R.layout.task_completed_message, null);
|
||||
layout.setOnClickListener(this);
|
||||
layout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
layout.setVisibility(View.GONE);
|
||||
textView = (TextView) layout.findViewById(R.id.task_completed_text);
|
||||
textView.setTypeface(typeface);
|
||||
messagesLayout = (LinearLayout) layout.findViewById(R.id.task_completed_unlock_list);
|
||||
}
|
||||
|
||||
public void show(List<PlayerShape> shapes) {
|
||||
unlockedShapes.clear();
|
||||
unlockedShapes.addAll(shapes);
|
||||
showNextShape();
|
||||
}
|
||||
|
||||
private void showNextShape() {
|
||||
messagesLayout.removeAllViews();
|
||||
PlayerShape shape = unlockedShapes.remove(0);
|
||||
|
||||
textView.setText(
|
||||
shape.getUnlockTask().toString(gameActivity, gameActivity.getLevelManager()));
|
||||
BountyMessage message = createBountyMessage(shape);
|
||||
messagesLayout.addView(message.getLayout());
|
||||
|
||||
layout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private BountyMessage createBountyMessage(PlayerShape shape) {
|
||||
return new BountyMessage(gameActivity, BountyMessage.MessageType.SHAPE_UNLOCKED, null, this,
|
||||
shape.getDrawableId());
|
||||
}
|
||||
|
||||
private void hide() {
|
||||
layout.setVisibility(View.GONE);
|
||||
messagesLayout.removeAllViews();
|
||||
}
|
||||
|
||||
public FrameLayout getLayout() {
|
||||
return layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (unlockedShapes.isEmpty())
|
||||
hide();
|
||||
else
|
||||
showNextShape();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void switchScreen(Screen.ScreenType screenType) {
|
||||
gameActivity.flipToScreen(screenType);
|
||||
hide();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user