Re-made all weapon sprites and finalized weapon layout

This commit is contained in:
Anuken
2017-09-24 13:03:20 -04:00
parent 2f092604a3
commit c0505338f2
13 changed files with 188 additions and 182 deletions

View File

@@ -534,26 +534,36 @@ public class UI extends SceneModule{
public void updateWeapons(){
weapontable.clearChildren();
ButtonGroup group = new ButtonGroup();
weapontable.defaults().size(58, 62);
for(Weapon weapon : control.getWeapons()){
ImageButton button = new ImageButton(Draw.region(weapon.name()), "static");
button.getImageCell().size(14*3);
button.setDisabled(true);
ImageButton button = new ImageButton(Draw.region(weapon.name()), "toggle");
button.getImageCell().size(8*5);
if(weapon != player.weapon)
button.setColor(Color.GRAY);
group.add(button);
weapontable.add(button).size(52, 56);
button.clicked(()->{
if(weapon == player.weapon) return;
player.weapon = weapon;
button.setChecked(true);
});
button.setChecked(weapon == player.weapon);
weapontable.add(button);
Table tiptable = new Table();
String description = weapon.description;
tiptable.background("button");
tiptable.add("[PURPLE]" + weapon.name(), 0.75f).left().padBottom(2f);
tiptable.add("" + weapon.name(), 0.5f).left().padBottom(3f);
tiptable.row();
tiptable.row();
tiptable.add("[ORANGE]" + description).left();
tiptable.pad(10f);
tiptable.add("[GRAY]" + description).left();
tiptable.pad(14f);
Tooltip tip = new Tooltip(tiptable);
@@ -563,9 +573,9 @@ public class UI extends SceneModule{
}
weapontable.addIButton("icon-menu", 8*3, ()->{
weapontable.addIButton("icon-menu", 8*4, ()->{
upgrades.show();
}).size(52, 56);
});
}
public void showLoading(){

View File

@@ -82,7 +82,7 @@ import io.anuke.ucore.entities.Entity;
*/
public class SaveIO{
/**Save file version ID. Should be incremented every breaking release.*/
private static final int fileVersionID = 5;
private static final int fileVersionID = 6;
private static FormatProvider provider = null;

View File

@@ -50,7 +50,7 @@ public enum Weapon{
Effects.effect("shoot2", p.x + vector.x, p.y+vector.y);
}
},
flamethrower(5, BulletType.flame, "Shoots a stream of fire.", stack(Item.steel, 60), stack(Item.coal, 60)){
flamer(5, BulletType.flame, "Shoots a stream of fire.", stack(Item.steel, 60), stack(Item.coal, 60)){
{
shootsound = "flame2";
@@ -65,12 +65,7 @@ public enum Weapon{
bullet(p, p.x, p.y, ang + Mathf.range(12));
}
},
//TODO
railgun(40, BulletType.sniper, "Shoots a stream of fire.", stack(Item.steel, 60), stack(Item.coal, 60)){
{
shootsound = "flame2";
}
railgun(40, BulletType.sniper, "Shoots one long-range bullet.", stack(Item.steel, 60), stack(Item.iron, 60)){
@Override
public void shoot(Player p){
@@ -79,12 +74,7 @@ public enum Weapon{
bullet(p, p.x, p.y, ang);
}
},
//TODO
mortar(20, BulletType.shell, "Shoots a stream of fire.", stack(Item.steel, 60), stack(Item.coal, 60)){
{
shootsound = "flame2";
}
mortar(100, BulletType.shell, "Shoots a slow, but damaging shell.", stack(Item.titanium, 40), stack(Item.steel, 60)){
@Override
public void shoot(Player p){

View File

@@ -12,7 +12,6 @@ import io.anuke.mindustry.resource.Weapon;
import io.anuke.ucore.core.Draw;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.function.Listenable;
import io.anuke.ucore.scene.event.Touchable;
import io.anuke.ucore.scene.ui.*;
import io.anuke.ucore.scene.ui.layout.Table;
@@ -35,10 +34,10 @@ public class UpgradeDialog extends Dialog{
getButtonTable().addButton("Ok", ()->{
hide();
}).size(84, 48).pad(4);
}).size(96, 50).pad(5);
Table weptab = new Table();
weptab.background("button");
//weptab.background("button");
weptab.pad(20);
int i = 0;
@@ -46,23 +45,22 @@ public class UpgradeDialog extends Dialog{
TextButton button = new TextButton(weapon.name());
Image img = new Image(Draw.region(weapon.name()));
button.add(img).size(14*4);
button.add(img).size(8*5);
button.getCells().reverse();
button.row();
button.pad(14);
button.getLabelCell().left();
button.pack();
button.update(()->{
if(control.hasWeapon(weapon)){
button.setDisabled(true);
button.setColor(Color.GRAY);
button.setTouchable(Touchable.disabled);
}else{
button.setColor(Color.WHITE);
button.setDisabled(false);
}else if(!Inventory.hasItems(weapon.requirements)){
button.setDisabled(true);
}
button.setDisabled(!Inventory.hasItems(weapon.requirements));
});
if(i > 0 && (i)%2==0)
@@ -70,7 +68,7 @@ public class UpgradeDialog extends Dialog{
i++;
weptab.add(button).width(210);
weptab.add(button).width(250);
Table tiptable = new Table();
@@ -79,28 +77,36 @@ public class UpgradeDialog extends Dialog{
String description = weapon.description;
tiptable.background("button");
tiptable.add("[PURPLE]" + weapon.name(), 0.75f).left().padBottom(2f);
tiptable.background("pane");
tiptable.add("[orange]" + weapon.name(), 0.5f).left().padBottom(4f);
Table reqtable = new Table();
tiptable.row();
tiptable.add(reqtable).left();
if(!control.hasWeapon(weapon)){
ItemStack[] req = weapon.requirements;
for(ItemStack s : req){
tiptable.row();
int amount = Math.min(Inventory.getAmount(s.item), s.amount);
tiptable.add(
(amount >= s.amount ? "[YELLOW]" : "[RED]")
+s.item + ": " + amount + " / " +s.amount, 0.5f).left();
reqtable.addImage(Draw.region("icon-" + s.item.name())).padRight(3).size(8*2);
reqtable.add(
(amount >= s.amount ? "" : "[RED]")
+ amount + " / " +s.amount, 0.5f).left();
reqtable.row();
}
}
tiptable.row();
tiptable.add().size(10);
tiptable.row();
tiptable.add("[ORANGE]" + description).left();
tiptable.add("[gray]" + description).left();
tiptable.row();
if(control.hasWeapon(weapon))
tiptable.add("[LIME]Purchased!").left();
tiptable.pad(10f);
if(control.hasWeapon(weapon)){
tiptable.add("[LIME]Purchased!").padTop(6).left();
}
tiptable.pad(14f);
};
run.listen();