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.battlescreen; /*from ww w .j a v a 2 s .co m*/ import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.scenes.scene2d.Touchable; public class UnitButton extends MyButton implements IUpdateable{ private int cost; private boolean canChange; public UnitButton(Texture t,int c){ super(t); cost=c; canChange=true; } @Override public void setTouchable(com.badlogic.gdx.scenes.scene2d.Touchable touchable) { super.setTouchable(touchable); if(touchable==Touchable.disabled) pressed=true; else if(touchable==Touchable.enabled) pressed=false; }; @Override public void update(HumanPlayer player){ if(canChange){ if(cost<=player.getCurrMana() && this.getTouchable()==Touchable.disabled) this.setTouchable(Touchable.enabled); else if(cost>player.getCurrMana() && this.getTouchable()==Touchable.enabled) this.setTouchable(Touchable.disabled); } } public boolean isCanChange() { return canChange; } public void setCanChange(boolean canChange) { this.canChange = canChange; } }