Back to project page diploma-assignment.
The source code is released under:
MIT License
If you think the Android project diploma-assignment listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.me.openingscreen; /* w w w .j a v a 2s .c o m*/ import com.badlogic.gdx.graphics.Texture; import com.me.battlescreen.MyButton; import com.me.battlescreen.MyLabel; public class UpgradeButton extends MyButton{ OpeningScreen screen; int index; Texture texture2; MyLabel label; public UpgradeButton(OpeningScreen s,Texture t1,Texture t2,int index,MyLabel l) { super(t1); screen=s; this.index=index; texture2=t2; label=l; update(); } public void update(){ if(screen.game.getPlayer().getUnlockedList()[index]==0){ this.setTexture(texture); label.setText(Constants.unlockedPrice[index]+""); return; } this.setTexture(texture2); if(screen.game.getPlayer().getUpList()[index]==0){ label.setText(Constants.upPrice[index]+""); return; } label.setText("Bought"); } public void check(){ boolean notUnlocked=false; if(screen.game.getPlayer().getUnlockedList()[index]==0){ notUnlocked=true; } else if(screen.game.getPlayer().getUpList()[index]==1){ return; } if(notUnlocked){ screen.game.getPlayer().unlock(index); } else { screen.game.getPlayer().upgrade(index); } } }