All upgrades are used in calculations -> bomb still has to be balanced

added firework on goal and different goal screen (with button to toolshop), but not happy with second one
Have to change it in layout file

TopBarData has been removed -> All data (DataStorageHandler, TutorialManager, LevelManager, SoundManager, Typeface, User) is stored in the GameActivity and can be recieved by getters

Toolshop-tutorial can now be reset and works instantaniously
This commit is contained in:
=
2017-07-18 15:57:21 +02:00
parent 4b4d81d8c7
commit b8322c9f05
28 changed files with 7590 additions and 2572 deletions

View File

@ -0,0 +1,53 @@
package de.frajul.endlessroll.entities.particles;
import java.util.Random;
import de.frajul.endlessroll.data.Vector;
import de.frajul.endlessroll.entities.particles.Particle;
import de.frajul.endlessroll.entities.particles.ParticleEffect;
import de.frajul.endlessroll.entities.particles.ParticleSource;
import de.frajul.endlessroll.main.game.Camera;
/**
* Created by Julian on 15.07.2017.
*/
public class Firework {
private ParticleEffect effect;
private Camera camera;
private Random random;
public Firework(ParticleEffect effect, Camera camera){
this.effect = effect;
this.camera = camera;
this.random = new Random();
}
public void start(){
randomExplosion(500);
randomExplosion(1000);
randomExplosion(2000);
randomExplosion(3500);
randomExplosion(3590);
randomExplosion(4800);
randomExplosion(5600);
randomExplosion(6900);
randomExplosion(7000);
}
private void randomExplosion(float delay){
ParticleSource explosion = new ParticleSource(randomPosition(), effect);
explosion.setDelayMS(delay);
explosion.start();
}
private Vector randomPosition(){
float x = camera.getX() + (random.nextFloat() - 0.5f) * 2.5f;
float y = camera.getY() + (random.nextFloat() * 0.5f) - 1f;
return new Vector(x, y);
}
}

View File

@ -0,0 +1,27 @@
package de.frajul.endlessroll.main.screens;
import android.widget.RelativeLayout;
import de.frajul.endlessroll.R;
import de.frajul.endlessroll.main.GameActivity;
/**
* Created by Julian on 15.07.2017.
*/
public class PreStartScreen extends Screen<RelativeLayout> {
public PreStartScreen(GameActivity gameActivity) {
super(ScreenType.PRE_START, gameActivity, R.layout.pre_start_screen);
}
@Override
public void prepareToBeShown() {
}
@Override
public void onBackKeyDown() {
}
}

View File

@ -0,0 +1,61 @@
package de.frajul.endlessroll.main.tutorial;
import java.util.ArrayList;
import java.util.List;
import de.frajul.endlessroll.R;
import de.frajul.endlessroll.entities.tools.ToolType;
/**
* Created by Julian on 10.06.2017.
*/
public class ToolShopTutorial extends Tutorial {
private List<BreakPoint> atStartBreakPoints = new ArrayList<>();
private List<BreakPoint> afterSpringBoughtBreakPoints = new ArrayList<>();
private boolean firstPartShown;
public ToolShopTutorial() {
super(-1, -1, new BreakPoint(0, R.id.tutorial_toolshop_welcome),
new BreakPoint(0, R.id.tutorial_toolshop_all_tools_and_inspector),
new BreakPoint(0, R.id.tutorial_toolshop_buy_spring),
new BreakPoint(1, R.id.tutorial_toolshop_equip_spring));
for (BreakPoint breakPoint : super.getBreakPoints()) {
if (breakPoint.getX() == 0)
atStartBreakPoints.add(breakPoint);
else
afterSpringBoughtBreakPoints.add(breakPoint);
}
}
@Override
public void reset() {
currentBreakPoints.clear();
firstPartShown = false;
}
public void onToolShopPrepare(boolean isSpringUnlocked) {
currentBreakPoints.clear();
if (isSpringUnlocked && !firstPartShown) {
currentBreakPoints.addAll(atStartBreakPoints);
firstPartShown = true;
}
}
public void onToolBought(ToolType type) {
currentBreakPoints.clear();
if (type == ToolType.SPRING) {
currentBreakPoints = afterSpringBoughtBreakPoints;
}
}
public boolean isFirstPartShown() {
return firstPartShown;
}
public void setFirstPartShown(boolean firstPartShown) {
this.firstPartShown = firstPartShown;
}
}

View File

@ -1,6 +1,5 @@
package de.frajul.endlessroll.views;
import android.content.Context;
import android.graphics.Typeface;
import android.view.View;
import android.widget.ImageView;
@ -8,8 +7,8 @@ import android.widget.TextView;
import de.frajul.endlessroll.R;
import de.frajul.endlessroll.entities.tools.ToolType;
import de.frajul.endlessroll.main.GameActivity;
import de.frajul.endlessroll.main.screens.ToolShopScreen;
import de.frajul.endlessroll.user.User;
/**
* Created by Julian on 03.06.2017.
@ -17,9 +16,8 @@ import de.frajul.endlessroll.user.User;
public class ToolInspector implements View.OnClickListener {
private GameActivity gameActivity;
private ToolShopScreen toolShopScreen;
private User user;
private Context context;
private TextView title;
private ImageView imageView;
@ -31,18 +29,18 @@ public class ToolInspector implements View.OnClickListener {
private ToolType toolType;
private boolean locked;
public ToolInspector(ToolShopScreen toolShopScreen, User user, Context context, Typeface typeface, View layout) {
public ToolInspector(ToolShopScreen toolShopScreen, GameActivity gameActivity, View layout) {
this.toolShopScreen = toolShopScreen;
this.user = user;
this.context = context;
this.gameActivity = gameActivity;
Typeface typeface = gameActivity.getTypeface();
title = (TextView) layout.findViewById(R.id.tool_inspector_title);
title.setTypeface(typeface);
imageView = (ImageView) layout.findViewById(R.id.tool_inspector_imageview);
priceButton = new PriceButton(context, typeface,
priceButton = new PriceButton(gameActivity, typeface,
layout.findViewById(R.id.tool_inspector_pricebutton), this);
toolUpgradeView0 = new ToolUpgradeView(this, context, typeface,
toolUpgradeView0 = new ToolUpgradeView(this, gameActivity, typeface,
layout.findViewById(R.id.tool_inspector_toolupgrade0));
toolUpgradeView1 = new ToolUpgradeView(this, context, typeface,
toolUpgradeView1 = new ToolUpgradeView(this, gameActivity, typeface,
layout.findViewById(R.id.tool_inspector_toolupgrade1));
}
@ -50,22 +48,22 @@ public class ToolInspector implements View.OnClickListener {
this.toolType = toolType;
this.locked = locked;
this.title.setText(locked ? "???" : toolType.getName());
this.imageView.setImageDrawable(context.getResources().getDrawable(
this.imageView.setImageDrawable(gameActivity.getResources().getDrawable(
locked ? R.drawable.tools_lockedbutton : toolType.getButtonDrawable()));
priceButton.init("Buy", toolType.getPrice(), R.drawable.currency_star);
priceButton.setLayoutVisible(toolType.isBought() || locked ? View.GONE : View.VISIBLE);
priceButton.setLayoutEnabled(toolType.getPrice() <= user.getStarCount());
priceButton.setLayoutEnabled(toolType.getPrice() <= gameActivity.getUser().getStarCount());
toolUpgradeView0
.update(toolType.getUpgrades()[0], toolType.isBought(), user.getEnergyCount());
toolUpgradeView0.update(toolType.getUpgrades()[0], toolType.isBought(),
gameActivity.getUser().getEnergyCount());
toolUpgradeView0.setLayoutVisiblity(locked ? View.GONE : View.VISIBLE);
if (toolType.getUpgrades().length <= 1 || locked)
toolUpgradeView1.setLayoutVisiblity(View.GONE);
else {
toolUpgradeView1.setLayoutVisiblity(View.VISIBLE);
toolUpgradeView1
.update(toolType.getUpgrades()[1], toolType.isBought(), user.getEnergyCount());
toolUpgradeView1.update(toolType.getUpgrades()[1], toolType.isBought(),
gameActivity.getUser().getEnergyCount());
}
}
@ -78,6 +76,6 @@ public class ToolInspector implements View.OnClickListener {
public void onClick(View v) {
toolType.setBought(true);
update(toolType, locked);
toolShopScreen.onToolBought(toolType.getPrice());
toolShopScreen.onToolBought(toolType.getPrice(), toolType);
}
}