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:
@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user