v0.9.0: initial interface work for talents
This commit is contained in:
parent
bd480e25cd
commit
24c4ae4185
Binary file not shown.
Before Width: | Height: | Size: 501 B After Width: | Height: | Size: 496 B |
BIN
core/src/main/assets/interfaces/talent_button.png
Normal file
BIN
core/src/main/assets/interfaces/talent_button.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
BIN
core/src/main/assets/interfaces/talent_icons.png
Normal file
BIN
core/src/main/assets/interfaces/talent_icons.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 586 B |
|
@ -332,7 +332,9 @@ actors.hero.talent.test_huntress_4.desc=TODO
|
||||||
actors.hero.hero.name=you
|
actors.hero.hero.name=you
|
||||||
actors.hero.hero.leave=You can't leave yet!
|
actors.hero.hero.leave=You can't leave yet!
|
||||||
actors.hero.hero.level_up=Level up!
|
actors.hero.hero.level_up=Level up!
|
||||||
actors.hero.hero.new_level=Level up!\nYou are more accurate, evasive, & healthy!
|
actors.hero.hero.new_level=Level up! +Accuracy, +Evasion, +5 HP!
|
||||||
|
actors.hero.hero.new_talent=+1 Talent Point!
|
||||||
|
actors.hero.hero.unspent=You have unspent talent points!
|
||||||
actors.hero.hero.level_cap=You cannot grow stronger, but your experiences do give you a surge of power!
|
actors.hero.hero.level_cap=You cannot grow stronger, but your experiences do give you a surge of power!
|
||||||
actors.hero.hero.you_now_have=You picked up: %s.
|
actors.hero.hero.you_now_have=You picked up: %s.
|
||||||
actors.hero.hero.you_cant_have=You can't carry: %s.
|
actors.hero.hero.you_cant_have=You can't carry: %s.
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
ui.quickslotbutton.select_item=Quickslot an item
|
ui.quickslotbutton.select_item=Quickslot an item
|
||||||
|
|
||||||
|
ui.talentspane.tier=tier %d
|
||||||
|
ui.talentspane.coming_soon=More talents coming soon!
|
||||||
|
|
||||||
ui.toolbar.examine_prompt=Press again to search\nPress a tile to examine
|
ui.toolbar.examine_prompt=Press again to search\nPress a tile to examine
|
||||||
|
|
||||||
ui.updatenotification.title=Update
|
ui.updatenotification.title=Update
|
||||||
|
|
|
@ -37,6 +37,7 @@ windows.wndgameinprogress.erase_warn_yes=Yes, delete this save
|
||||||
windows.wndgameinprogress.erase_warn_no=No, I want to continue
|
windows.wndgameinprogress.erase_warn_no=No, I want to continue
|
||||||
|
|
||||||
windows.wndhero.stats=Stats
|
windows.wndhero.stats=Stats
|
||||||
|
windows.wndhero.talents=Talents
|
||||||
windows.wndhero.buffs=Buffs
|
windows.wndhero.buffs=Buffs
|
||||||
windows.wndhero$statstab.title=Level %1$d %2$s
|
windows.wndhero$statstab.title=Level %1$d %2$s
|
||||||
windows.wndhero$statstab.exp=Experience
|
windows.wndhero$statstab.exp=Experience
|
||||||
|
@ -50,6 +51,8 @@ windows.wndimp.reward=Take the ring
|
||||||
|
|
||||||
windows.wndinfocell.nothing=Nothing interesting here.
|
windows.wndinfocell.nothing=Nothing interesting here.
|
||||||
|
|
||||||
|
windows.wndinfotalent.upgrade=Upgrade Talent.
|
||||||
|
|
||||||
windows.wndinfotrap.inactive=This trap is inactive, and can no longer be triggered.
|
windows.wndinfotrap.inactive=This trap is inactive, and can no longer be triggered.
|
||||||
|
|
||||||
windows.wndjournal.guide=Guide
|
windows.wndjournal.guide=Guide
|
||||||
|
@ -109,6 +112,7 @@ windows.wndranking.stats=Stats
|
||||||
windows.wndranking.items=Items
|
windows.wndranking.items=Items
|
||||||
windows.wndranking.badges=Badges
|
windows.wndranking.badges=Badges
|
||||||
windows.wndranking$statstab.title=Level %1$d %2$s
|
windows.wndranking$statstab.title=Level %1$d %2$s
|
||||||
|
windows.wndranking$statstab.talents=Talents
|
||||||
windows.wndranking$statstab.challenges=Challenges
|
windows.wndranking$statstab.challenges=Challenges
|
||||||
windows.wndranking$statstab.health=Health
|
windows.wndranking$statstab.health=Health
|
||||||
windows.wndranking$statstab.str=Strength
|
windows.wndranking$statstab.str=Strength
|
||||||
|
|
|
@ -92,7 +92,9 @@ public class Assets {
|
||||||
|
|
||||||
public static final String BUFFS_SMALL = "interfaces/buffs.png";
|
public static final String BUFFS_SMALL = "interfaces/buffs.png";
|
||||||
public static final String BUFFS_LARGE = "interfaces/large_buffs.png";
|
public static final String BUFFS_LARGE = "interfaces/large_buffs.png";
|
||||||
public static final String CONS_ICONS = "interfaces/consumable_icons.png";
|
|
||||||
|
public static final String TALENT_ICONS = "interfaces/talent_icons.png";
|
||||||
|
public static final String TALENT_BUTTON = "interfaces/talent_button.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
//these points to resource bundles, not raw asset files
|
//these points to resource bundles, not raw asset files
|
||||||
|
|
|
@ -116,7 +116,9 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.AttackIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.AttackIndicator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.StatusPane;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndHero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndMessage;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndMessage;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndResurrect;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndResurrect;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndTradeItem;
|
||||||
|
@ -306,6 +308,7 @@ public class Hero extends Char {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO account for tiers
|
||||||
public int talentPointsSpent(){
|
public int talentPointsSpent(){
|
||||||
int total = 0;
|
int total = 0;
|
||||||
for (LinkedHashMap<Talent, Integer> tier : talents){
|
for (LinkedHashMap<Talent, Integer> tier : talents){
|
||||||
|
@ -316,6 +319,7 @@ public class Hero extends Char {
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO account for tiers
|
||||||
public int talentPointsAvailable(){
|
public int talentPointsAvailable(){
|
||||||
//hero currently only gains points up to level 6
|
//hero currently only gains points up to level 6
|
||||||
return Math.min(lvl, 6) - 1 - talentPointsSpent();
|
return Math.min(lvl, 6) - 1 - talentPointsSpent();
|
||||||
|
@ -1431,9 +1435,15 @@ public class Hero extends Char {
|
||||||
|
|
||||||
if (sprite != null) {
|
if (sprite != null) {
|
||||||
GLog.newLine();
|
GLog.newLine();
|
||||||
GLog.p( Messages.get(this, "new_level"), lvl );
|
GLog.p( Messages.get(this, "new_level") );
|
||||||
sprite.showStatus( CharSprite.POSITIVE, Messages.get(Hero.class, "level_up") );
|
sprite.showStatus( CharSprite.POSITIVE, Messages.get(Hero.class, "level_up") );
|
||||||
Sample.INSTANCE.play( Assets.Sounds.LEVELUP );
|
Sample.INSTANCE.play( Assets.Sounds.LEVELUP );
|
||||||
|
if (talentPointsAvailable() > 0){
|
||||||
|
GLog.newLine();
|
||||||
|
GLog.p( Messages.get(this, "new_talent") );
|
||||||
|
StatusPane.talentBlink = 10f;
|
||||||
|
WndHero.lastIdx = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item.updateQuickslot();
|
Item.updateQuickslot();
|
||||||
|
|
|
@ -90,6 +90,22 @@ public class Speck extends Image {
|
||||||
origin.set( SIZE / 2f );
|
origin.set( SIZE / 2f );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Speck image( int type ){
|
||||||
|
reset(0, 0, 0, type);
|
||||||
|
|
||||||
|
left = lifespan = Float.POSITIVE_INFINITY;
|
||||||
|
this.type = -1;
|
||||||
|
|
||||||
|
resetColor();
|
||||||
|
scale.set( 1 );
|
||||||
|
speed.set( 0 );
|
||||||
|
acc.set( 0 );
|
||||||
|
angle = 0;
|
||||||
|
angularSpeed = 0;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public void reset( int index, float x, float y, int type ) {
|
public void reset( int index, float x, float y, int type ) {
|
||||||
revive();
|
revive();
|
||||||
|
|
||||||
|
|
|
@ -469,6 +469,13 @@ public class GameScene extends PixelScene {
|
||||||
GLog.h(Messages.get(this, "return"), Dungeon.depth);
|
GLog.h(Messages.get(this, "return"), Dungeon.depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Dungeon.hero.talentPointsAvailable() > 0){
|
||||||
|
GLog.newLine();
|
||||||
|
GLog.w( Messages.get(Dungeon.hero, "unspent") );
|
||||||
|
StatusPane.talentBlink = 10f;
|
||||||
|
WndHero.lastIdx = 1;
|
||||||
|
}
|
||||||
|
|
||||||
switch (Dungeon.level.feeling) {
|
switch (Dungeon.level.feeling) {
|
||||||
case CHASM:
|
case CHASM:
|
||||||
GLog.w(Messages.get(this, "chasm"));
|
GLog.w(Messages.get(this, "chasm"));
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class StatusPane extends Component {
|
||||||
|
|
||||||
private NinePatch bg;
|
private NinePatch bg;
|
||||||
private Image avatar;
|
private Image avatar;
|
||||||
|
public static float talentBlink;
|
||||||
private float warning;
|
private float warning;
|
||||||
|
|
||||||
private int lastTier = 0;
|
private int lastTier = 0;
|
||||||
|
@ -104,6 +105,8 @@ public class StatusPane extends Component {
|
||||||
avatar = HeroSprite.avatar( Dungeon.hero.heroClass, lastTier );
|
avatar = HeroSprite.avatar( Dungeon.hero.heroClass, lastTier );
|
||||||
add( avatar );
|
add( avatar );
|
||||||
|
|
||||||
|
talentBlink = 0;
|
||||||
|
|
||||||
compass = new Compass( Statistics.amuletObtained ? Dungeon.level.entrance : Dungeon.level.exit );
|
compass = new Compass( Statistics.amuletObtained ? Dungeon.level.entrance : Dungeon.level.exit );
|
||||||
add( compass );
|
add( compass );
|
||||||
|
|
||||||
|
@ -124,7 +127,7 @@ public class StatusPane extends Component {
|
||||||
add( bossHP );
|
add( bossHP );
|
||||||
|
|
||||||
level = new BitmapText( PixelScene.pixelFont);
|
level = new BitmapText( PixelScene.pixelFont);
|
||||||
level.hardlight( 0xFFEBA4 );
|
level.hardlight( 0xFFFFAA );
|
||||||
add( level );
|
add( level );
|
||||||
|
|
||||||
depth = new BitmapText( Integer.toString( Dungeon.depth ), PixelScene.pixelFont);
|
depth = new BitmapText( Integer.toString( Dungeon.depth ), PixelScene.pixelFont);
|
||||||
|
@ -200,6 +203,9 @@ public class StatusPane extends Component {
|
||||||
warning += Game.elapsed * 5f *(0.4f - (health/max));
|
warning += Game.elapsed * 5f *(0.4f - (health/max));
|
||||||
warning %= 1f;
|
warning %= 1f;
|
||||||
avatar.tint(ColorMath.interpolate(warning, warningColors), 0.5f );
|
avatar.tint(ColorMath.interpolate(warning, warningColors), 0.5f );
|
||||||
|
} else if (talentBlink > 0){
|
||||||
|
talentBlink -= Game.elapsed;
|
||||||
|
avatar.tint(1, 1, 0, (float)Math.abs(Math.sin(2*talentBlink)/2f));
|
||||||
} else {
|
} else {
|
||||||
avatar.resetColor();
|
avatar.resetColor();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,151 @@
|
||||||
|
/*
|
||||||
|
* Pixel Dungeon
|
||||||
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
|
*
|
||||||
|
* Shattered Pixel Dungeon
|
||||||
|
* Copyright (C) 2014-2020 Evan Debenham
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoTalent;
|
||||||
|
import com.watabou.gltextures.SmartTexture;
|
||||||
|
import com.watabou.gltextures.TextureCache;
|
||||||
|
import com.watabou.noosa.ColorBlock;
|
||||||
|
import com.watabou.noosa.Image;
|
||||||
|
import com.watabou.noosa.TextureFilm;
|
||||||
|
import com.watabou.noosa.audio.Sample;
|
||||||
|
import com.watabou.noosa.particles.Emitter;
|
||||||
|
import com.watabou.noosa.ui.Button;
|
||||||
|
import com.watabou.utils.Callback;
|
||||||
|
|
||||||
|
public class TalentButton extends Button {
|
||||||
|
|
||||||
|
public static final int WIDTH = 20;
|
||||||
|
public static final int HEIGHT = 26;
|
||||||
|
|
||||||
|
private SmartTexture icons;
|
||||||
|
private TextureFilm film;
|
||||||
|
|
||||||
|
Talent talent;
|
||||||
|
boolean upgradeEnabled;
|
||||||
|
|
||||||
|
Image icon;
|
||||||
|
Image bg;
|
||||||
|
|
||||||
|
ColorBlock fill;
|
||||||
|
|
||||||
|
public TalentButton(Talent talent, boolean upgradeEnabled){
|
||||||
|
super();
|
||||||
|
this.talent = talent;
|
||||||
|
this.upgradeEnabled = upgradeEnabled;
|
||||||
|
|
||||||
|
icon.frame( film.get( talent.icon() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void createChildren() {
|
||||||
|
super.createChildren();
|
||||||
|
|
||||||
|
icons = TextureCache.get( Assets.Interfaces.TALENT_ICONS );
|
||||||
|
film = new TextureFilm( icons, 16, 16 );
|
||||||
|
|
||||||
|
fill = new ColorBlock(0, 4, 0xFFFFFF44);
|
||||||
|
add(fill);
|
||||||
|
|
||||||
|
bg = new Image(Assets.Interfaces.TALENT_BUTTON, 20, 0, WIDTH, HEIGHT);
|
||||||
|
add(bg);
|
||||||
|
|
||||||
|
icon = new Image( icons );
|
||||||
|
add(icon);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void layout() {
|
||||||
|
width = WIDTH;
|
||||||
|
height = HEIGHT;
|
||||||
|
|
||||||
|
super.layout();
|
||||||
|
|
||||||
|
fill.x = x;
|
||||||
|
fill.y = y + WIDTH - 1;
|
||||||
|
fill.size( Dungeon.hero.pointsInTalent(talent)/2f * WIDTH, 5);
|
||||||
|
|
||||||
|
bg.x = x;
|
||||||
|
bg.y = y;
|
||||||
|
|
||||||
|
icon.x = x + 2;
|
||||||
|
icon.y = y + 2;
|
||||||
|
PixelScene.align(icon);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onClick() {
|
||||||
|
super.onClick();
|
||||||
|
|
||||||
|
if (upgradeEnabled
|
||||||
|
&& Dungeon.hero != null
|
||||||
|
&& Dungeon.hero.talentPointsAvailable() > 0
|
||||||
|
&& Dungeon.hero.pointsInTalent(talent) < talent.maxPoints()){
|
||||||
|
ShatteredPixelDungeon.scene().addToFront(new WndInfoTalent(talent, new Callback() {
|
||||||
|
@Override
|
||||||
|
public void call() {
|
||||||
|
upgradeTalent();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
ShatteredPixelDungeon.scene().addToFront(new WndInfoTalent(talent, null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPointerDown() {
|
||||||
|
icon.brightness( 1.5f );
|
||||||
|
bg.brightness( 1.5f );
|
||||||
|
Sample.INSTANCE.play( Assets.Sounds.CLICK );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPointerUp() {
|
||||||
|
icon.resetColor();
|
||||||
|
bg.resetColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enable( boolean value ) {
|
||||||
|
active = value;
|
||||||
|
icon.alpha( value ? 1.0f : 0.3f );
|
||||||
|
bg.alpha( value ? 1.0f : 0.3f );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void upgradeTalent(){
|
||||||
|
if (Dungeon.hero.talentPointsAvailable() > 0) {
|
||||||
|
Dungeon.hero.upgradeTalent(talent);
|
||||||
|
float oldWidth = fill.width();
|
||||||
|
layout();
|
||||||
|
Sample.INSTANCE.play(Assets.Sounds.LEVELUP, 0.7f, 1.2f);
|
||||||
|
Emitter emitter = (Emitter) parent.recycle(Emitter.class);
|
||||||
|
emitter.revive();
|
||||||
|
emitter.pos(fill.x + (fill.width() + oldWidth) / 2f, fill.y + fill.height() / 2f);
|
||||||
|
emitter.burst(Speck.factory(Speck.STAR), 12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,139 @@
|
||||||
|
/*
|
||||||
|
* Pixel Dungeon
|
||||||
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
|
*
|
||||||
|
* Shattered Pixel Dungeon
|
||||||
|
* Copyright (C) 2014-2020 Evan Debenham
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
|
import com.watabou.noosa.ColorBlock;
|
||||||
|
import com.watabou.noosa.Image;
|
||||||
|
import com.watabou.noosa.ui.Component;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
//TODO some stuff here is currently coded without accounting for tiers
|
||||||
|
public class TalentsPane extends ScrollPane {
|
||||||
|
|
||||||
|
RenderedTextBlock title;
|
||||||
|
ArrayList<TalentButton> buttons;
|
||||||
|
|
||||||
|
ArrayList<Image> stars;
|
||||||
|
|
||||||
|
ColorBlock sep;
|
||||||
|
ColorBlock blocker;
|
||||||
|
RenderedTextBlock blockText;
|
||||||
|
|
||||||
|
public TalentsPane( boolean canUpgrade ) {
|
||||||
|
super(new Component());
|
||||||
|
|
||||||
|
title = PixelScene.renderTextBlock(Messages.titleCase(Messages.get(this, "tier", 1)), 9);
|
||||||
|
title.hardlight(Window.TITLE_COLOR);
|
||||||
|
content.add(title);
|
||||||
|
|
||||||
|
setupStars();
|
||||||
|
|
||||||
|
buttons = new ArrayList<>();
|
||||||
|
for (Talent talent : Dungeon.hero.talents.get(0).keySet()){
|
||||||
|
TalentButton btn = new TalentButton(talent, canUpgrade){
|
||||||
|
@Override
|
||||||
|
public void upgradeTalent() {
|
||||||
|
super.upgradeTalent();
|
||||||
|
setupStars();
|
||||||
|
TalentsPane.this.layout();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
buttons.add(btn);
|
||||||
|
content.add(btn);
|
||||||
|
}
|
||||||
|
|
||||||
|
sep = new ColorBlock(0, 1, 0xFF000000);
|
||||||
|
content.add(sep);
|
||||||
|
|
||||||
|
blocker = new ColorBlock(0, 0, 0xFF222222);
|
||||||
|
content.add(blocker);
|
||||||
|
|
||||||
|
blockText = PixelScene.renderTextBlock(Messages.get(this, "coming_soon"), 6);
|
||||||
|
content.add(blockText);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupStars(){
|
||||||
|
if (stars != null){
|
||||||
|
for (Image im : stars){
|
||||||
|
im.killAndErase();
|
||||||
|
}
|
||||||
|
stars.clear();
|
||||||
|
} else {
|
||||||
|
stars = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
int totStars = 5;
|
||||||
|
int openStars = Dungeon.hero.talentPointsAvailable();
|
||||||
|
int usedStars = Dungeon.hero.talentPointsSpent();
|
||||||
|
for (int i = 0; i < totStars; i++){
|
||||||
|
Image im = new Speck().image(Speck.STAR);
|
||||||
|
stars.add(im);
|
||||||
|
add(im);
|
||||||
|
if (i >= openStars && i < (openStars + usedStars)){
|
||||||
|
im.tint(0.75f, 0.75f, 0.75f, 0.9f);
|
||||||
|
} else if (i >= (openStars + usedStars)){
|
||||||
|
im.tint(0f, 0f, 0f, 0.9f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void layout() {
|
||||||
|
super.layout();
|
||||||
|
|
||||||
|
float titleWidth = title.width();
|
||||||
|
titleWidth += 2 + stars.size()*6;
|
||||||
|
title.setPos(x + (width - titleWidth)/2f, y+2);
|
||||||
|
|
||||||
|
float left = title.right() + 2;
|
||||||
|
for (Image star : stars){
|
||||||
|
star.x = left;
|
||||||
|
star.y = title.top();
|
||||||
|
PixelScene.align(star);
|
||||||
|
left += 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
float gap = (width - buttons.size()*TalentButton.WIDTH)/(buttons.size()+1);
|
||||||
|
left = x + gap;
|
||||||
|
for (TalentButton btn : buttons){
|
||||||
|
btn.setPos(left, title.bottom() + 4);
|
||||||
|
PixelScene.align(btn);
|
||||||
|
left += btn.width() + gap;
|
||||||
|
}
|
||||||
|
|
||||||
|
sep.x = x;
|
||||||
|
sep.y = buttons.get(0).bottom() + 2;
|
||||||
|
sep.size(width, 1);
|
||||||
|
|
||||||
|
blocker.x = x;
|
||||||
|
blocker.y = sep.y + 1;
|
||||||
|
blocker.size(width, height - sep.y - 1);
|
||||||
|
|
||||||
|
blockText.setPos(x + (width - blockText.width())/2f, blocker.y + 10);
|
||||||
|
}
|
||||||
|
}
|
|
@ -66,7 +66,7 @@ public class WndGameInProgress extends Window {
|
||||||
IconTitle title = new IconTitle();
|
IconTitle title = new IconTitle();
|
||||||
title.icon( HeroSprite.avatar(info.heroClass, info.armorTier) );
|
title.icon( HeroSprite.avatar(info.heroClass, info.armorTier) );
|
||||||
title.label((Messages.get(this, "title", info.level, className)).toUpperCase(Locale.ENGLISH));
|
title.label((Messages.get(this, "title", info.level, className)).toUpperCase(Locale.ENGLISH));
|
||||||
title.color(Window.SHPX_COLOR);
|
title.color(Window.TITLE_COLOR);
|
||||||
title.setRect( 0, 0, WIDTH, 0 );
|
title.setRect( 0, 0, WIDTH, 0 );
|
||||||
add(title);
|
add(title);
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollPane;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollPane;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.StatusPane;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.TalentsPane;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||||
import com.watabou.gltextures.SmartTexture;
|
import com.watabou.gltextures.SmartTexture;
|
||||||
import com.watabou.gltextures.TextureCache;
|
import com.watabou.gltextures.TextureCache;
|
||||||
|
@ -46,14 +48,14 @@ import java.util.Locale;
|
||||||
|
|
||||||
public class WndHero extends WndTabbed {
|
public class WndHero extends WndTabbed {
|
||||||
|
|
||||||
private static final int WIDTH = 115;
|
private static final int WIDTH = 120;
|
||||||
private static final int HEIGHT = 100;
|
private static final int HEIGHT = 100;
|
||||||
|
|
||||||
private StatsTab stats;
|
private StatsTab stats;
|
||||||
|
private TalentsTab talents;
|
||||||
private BuffsTab buffs;
|
private BuffsTab buffs;
|
||||||
|
|
||||||
private SmartTexture icons;
|
public static int lastIdx = 0;
|
||||||
private TextureFilm film;
|
|
||||||
|
|
||||||
public WndHero() {
|
public WndHero() {
|
||||||
|
|
||||||
|
@ -61,12 +63,13 @@ public class WndHero extends WndTabbed {
|
||||||
|
|
||||||
resize( WIDTH, HEIGHT );
|
resize( WIDTH, HEIGHT );
|
||||||
|
|
||||||
icons = TextureCache.get( Assets.Interfaces.BUFFS_LARGE );
|
|
||||||
film = new TextureFilm( icons, 16, 16 );
|
|
||||||
|
|
||||||
stats = new StatsTab();
|
stats = new StatsTab();
|
||||||
add( stats );
|
add( stats );
|
||||||
|
|
||||||
|
talents = new TalentsTab();
|
||||||
|
add(talents);
|
||||||
|
talents.setRect(0, 0, WIDTH, HEIGHT);
|
||||||
|
|
||||||
buffs = new BuffsTab();
|
buffs = new BuffsTab();
|
||||||
add( buffs );
|
add( buffs );
|
||||||
buffs.setRect(0, 0, WIDTH, HEIGHT);
|
buffs.setRect(0, 0, WIDTH, HEIGHT);
|
||||||
|
@ -75,19 +78,29 @@ public class WndHero extends WndTabbed {
|
||||||
add( new LabeledTab( Messages.get(this, "stats") ) {
|
add( new LabeledTab( Messages.get(this, "stats") ) {
|
||||||
protected void select( boolean value ) {
|
protected void select( boolean value ) {
|
||||||
super.select( value );
|
super.select( value );
|
||||||
|
if (selected) lastIdx = 0;
|
||||||
stats.visible = stats.active = selected;
|
stats.visible = stats.active = selected;
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
add( new LabeledTab( Messages.get(this, "talents") ) {
|
||||||
|
protected void select( boolean value ) {
|
||||||
|
super.select( value );
|
||||||
|
if (selected) lastIdx = 1;
|
||||||
|
if (selected) StatusPane.talentBlink = 0;
|
||||||
|
talents.visible = talents.active = selected;
|
||||||
|
}
|
||||||
|
} );
|
||||||
add( new LabeledTab( Messages.get(this, "buffs") ) {
|
add( new LabeledTab( Messages.get(this, "buffs") ) {
|
||||||
protected void select( boolean value ) {
|
protected void select( boolean value ) {
|
||||||
super.select( value );
|
super.select( value );
|
||||||
|
if (selected) lastIdx = 2;
|
||||||
buffs.visible = buffs.active = selected;
|
buffs.visible = buffs.active = selected;
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
layoutTabs();
|
layoutTabs();
|
||||||
|
|
||||||
select( 0 );
|
select( lastIdx );
|
||||||
}
|
}
|
||||||
|
|
||||||
private class StatsTab extends Group {
|
private class StatsTab extends Group {
|
||||||
|
@ -106,7 +119,7 @@ public class WndHero extends WndTabbed {
|
||||||
title.label( Messages.get(this, "title", hero.lvl, hero.className() ).toUpperCase( Locale.ENGLISH ) );
|
title.label( Messages.get(this, "title", hero.lvl, hero.className() ).toUpperCase( Locale.ENGLISH ) );
|
||||||
else
|
else
|
||||||
title.label((hero.name() + "\n" + Messages.get(this, "title", hero.lvl, hero.className())).toUpperCase(Locale.ENGLISH));
|
title.label((hero.name() + "\n" + Messages.get(this, "title", hero.lvl, hero.className())).toUpperCase(Locale.ENGLISH));
|
||||||
title.color(Window.SHPX_COLOR);
|
title.color(Window.TITLE_COLOR);
|
||||||
title.setRect( 0, 0, WIDTH, 0 );
|
title.setRect( 0, 0, WIDTH, 0 );
|
||||||
add(title);
|
add(title);
|
||||||
|
|
||||||
|
@ -148,15 +161,43 @@ public class WndHero extends WndTabbed {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class TalentsTab extends Component {
|
||||||
|
|
||||||
|
TalentsPane pane;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void createChildren() {
|
||||||
|
super.createChildren();
|
||||||
|
pane = new TalentsPane(true);
|
||||||
|
add(pane);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void layout() {
|
||||||
|
super.layout();
|
||||||
|
pane.setRect(x, y, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private class BuffsTab extends Component {
|
private class BuffsTab extends Component {
|
||||||
|
|
||||||
private static final int GAP = 2;
|
private static final int GAP = 2;
|
||||||
|
|
||||||
|
private SmartTexture icons;
|
||||||
|
private TextureFilm film;
|
||||||
|
|
||||||
private float pos;
|
private float pos;
|
||||||
private ScrollPane buffList;
|
private ScrollPane buffList;
|
||||||
private ArrayList<BuffSlot> slots = new ArrayList<>();
|
private ArrayList<BuffSlot> slots = new ArrayList<>();
|
||||||
|
|
||||||
public BuffsTab() {
|
@Override
|
||||||
|
protected void createChildren() {
|
||||||
|
icons = TextureCache.get( Assets.Interfaces.BUFFS_LARGE );
|
||||||
|
film = new TextureFilm( icons, 16, 16 );
|
||||||
|
|
||||||
|
super.createChildren();
|
||||||
|
|
||||||
buffList = new ScrollPane( new Component() ){
|
buffList = new ScrollPane( new Component() ){
|
||||||
@Override
|
@Override
|
||||||
public void onClick( float x, float y ) {
|
public void onClick( float x, float y ) {
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* Pixel Dungeon
|
||||||
|
* Copyright (C) 2012-2015 Oleg Dolya
|
||||||
|
*
|
||||||
|
* Shattered Pixel Dungeon
|
||||||
|
* Copyright (C) 2014-2020 Evan Debenham
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||||
|
import com.watabou.gltextures.SmartTexture;
|
||||||
|
import com.watabou.gltextures.TextureCache;
|
||||||
|
import com.watabou.noosa.Image;
|
||||||
|
import com.watabou.noosa.TextureFilm;
|
||||||
|
import com.watabou.utils.Callback;
|
||||||
|
|
||||||
|
public class WndInfoTalent extends Window {
|
||||||
|
|
||||||
|
private static final float GAP = 2;
|
||||||
|
|
||||||
|
private static final int WIDTH = 120;
|
||||||
|
|
||||||
|
private SmartTexture icons;
|
||||||
|
private TextureFilm film;
|
||||||
|
|
||||||
|
public WndInfoTalent(Talent talent, Callback onUpgradeButton){
|
||||||
|
super();
|
||||||
|
|
||||||
|
IconTitle titlebar = new IconTitle();
|
||||||
|
|
||||||
|
icons = TextureCache.get( Assets.Interfaces.TALENT_ICONS );
|
||||||
|
film = new TextureFilm( icons, 16, 16 );
|
||||||
|
|
||||||
|
Image buffIcon = new Image( icons );
|
||||||
|
buffIcon.frame( film.get(talent.icon()) );
|
||||||
|
|
||||||
|
titlebar.icon( buffIcon );
|
||||||
|
String title = Messages.titleCase(talent.title());
|
||||||
|
if (Dungeon.hero != null && Dungeon.hero.pointsInTalent(talent) > 0){
|
||||||
|
title += " +" + Dungeon.hero.pointsInTalent(talent);
|
||||||
|
}
|
||||||
|
titlebar.label( title, Window.TITLE_COLOR );
|
||||||
|
titlebar.setRect( 0, 0, WIDTH, 0 );
|
||||||
|
add( titlebar );
|
||||||
|
|
||||||
|
RenderedTextBlock txtInfo = PixelScene.renderTextBlock(talent.desc(), 6);
|
||||||
|
txtInfo.maxWidth(WIDTH);
|
||||||
|
txtInfo.setPos(titlebar.left(), titlebar.bottom() + 2*GAP);
|
||||||
|
add( txtInfo );
|
||||||
|
|
||||||
|
resize( WIDTH, (int)(txtInfo.bottom() + GAP) );
|
||||||
|
|
||||||
|
if (onUpgradeButton != null) {
|
||||||
|
RedButton upgrade = new RedButton( Messages.get(this, "upgrade") ) {
|
||||||
|
@Override
|
||||||
|
protected void onClick() {
|
||||||
|
super.onClick();
|
||||||
|
hide();
|
||||||
|
onUpgradeButton.call();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
upgrade.setRect(0, txtInfo.bottom() + 2*GAP, WIDTH, 16);
|
||||||
|
add(upgrade);
|
||||||
|
resize( WIDTH, (int)upgrade.bottom()+1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -37,6 +37,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.ItemSlot;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollPane;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollPane;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.TalentsPane;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||||
import com.watabou.noosa.ColorBlock;
|
import com.watabou.noosa.ColorBlock;
|
||||||
import com.watabou.noosa.Game;
|
import com.watabou.noosa.Game;
|
||||||
|
@ -155,24 +156,40 @@ public class WndRanking extends WndTabbed {
|
||||||
|
|
||||||
private class StatsTab extends Group {
|
private class StatsTab extends Group {
|
||||||
|
|
||||||
private int GAP = 5;
|
private int GAP = 4;
|
||||||
|
|
||||||
public StatsTab() {
|
public StatsTab() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
if (Dungeon.challenges > 0) GAP--;
|
|
||||||
|
|
||||||
String heroClass = Dungeon.hero.className();
|
String heroClass = Dungeon.hero.className();
|
||||||
|
|
||||||
IconTitle title = new IconTitle();
|
IconTitle title = new IconTitle();
|
||||||
title.icon( HeroSprite.avatar( Dungeon.hero.heroClass, Dungeon.hero.tier() ) );
|
title.icon( HeroSprite.avatar( Dungeon.hero.heroClass, Dungeon.hero.tier() ) );
|
||||||
title.label( Messages.get(this, "title", Dungeon.hero.lvl, heroClass ).toUpperCase( Locale.ENGLISH ) );
|
title.label( Messages.get(this, "title", Dungeon.hero.lvl, heroClass ).toUpperCase( Locale.ENGLISH ) );
|
||||||
title.color(Window.SHPX_COLOR);
|
title.color(Window.TITLE_COLOR);
|
||||||
title.setRect( 0, 0, WIDTH, 0 );
|
title.setRect( 0, 0, WIDTH, 0 );
|
||||||
add( title );
|
add( title );
|
||||||
|
|
||||||
float pos = title.bottom() + GAP;
|
float pos = title.bottom() + GAP;
|
||||||
|
|
||||||
|
RedButton btnTalents = new RedButton( Messages.get(this, "talents") ){
|
||||||
|
@Override
|
||||||
|
protected void onClick() {
|
||||||
|
Game.scene().addToFront( new Window(){
|
||||||
|
{
|
||||||
|
resize(120, 144);
|
||||||
|
TalentsPane p = new TalentsPane(false);
|
||||||
|
add(p);
|
||||||
|
p.setRect(0, 0, width, height);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
btnTalents.setRect( (WIDTH - btnTalents.reqWidth()+2)/2, pos, btnTalents.reqWidth()+2 , 16 );
|
||||||
|
add(btnTalents);
|
||||||
|
|
||||||
|
pos = btnTalents.bottom();
|
||||||
|
|
||||||
if (Dungeon.challenges > 0) {
|
if (Dungeon.challenges > 0) {
|
||||||
RedButton btnChallenges = new RedButton( Messages.get(this, "challenges") ) {
|
RedButton btnChallenges = new RedButton( Messages.get(this, "challenges") ) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -180,11 +197,14 @@ public class WndRanking extends WndTabbed {
|
||||||
Game.scene().add( new WndChallenges( Dungeon.challenges, false ) );
|
Game.scene().add( new WndChallenges( Dungeon.challenges, false ) );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
float btnW = btnChallenges.reqWidth() + 2;
|
|
||||||
btnChallenges.setRect( (WIDTH - btnW)/2, pos, btnW , btnChallenges.reqHeight() + 2 );
|
btnChallenges.setSize( btnChallenges.reqWidth()+2, 16 );
|
||||||
add( btnChallenges );
|
add( btnChallenges );
|
||||||
|
|
||||||
pos = btnChallenges.bottom();
|
float left = (WIDTH - btnTalents.width() - btnChallenges.width())/3f;
|
||||||
|
|
||||||
|
btnTalents.setPos(left, btnTalents.top());
|
||||||
|
btnChallenges.setPos(btnTalents.right() + left, btnTalents.top());
|
||||||
}
|
}
|
||||||
|
|
||||||
pos += GAP;
|
pos += GAP;
|
||||||
|
|
|
@ -832,7 +832,7 @@ public class WndSettings extends WndTabbed {
|
||||||
|
|
||||||
RenderedTextBlock title = PixelScene.renderTextBlock(6);
|
RenderedTextBlock title = PixelScene.renderTextBlock(6);
|
||||||
title.text(Messages.titleCase(Messages.get(LangsTab.this, "credits")), w);
|
title.text(Messages.titleCase(Messages.get(LangsTab.this, "credits")), w);
|
||||||
title.hardlight(SHPX_COLOR);
|
title.hardlight(TITLE_COLOR);
|
||||||
title.setPos((w - title.width()) / 2, 0);
|
title.setPos((w - title.width()) / 2, 0);
|
||||||
credits.add(title);
|
credits.add(title);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user