Fixed bundle settings, edited basic guns, removed weapon display
This commit is contained in:
@@ -1,77 +1,11 @@
|
||||
package io.anuke.mindustry.ui.fragments;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.GameState;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.resource.Weapon;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Inputs;
|
||||
import io.anuke.ucore.scene.ui.ButtonGroup;
|
||||
import io.anuke.ucore.scene.ui.ImageButton;
|
||||
import io.anuke.ucore.scene.ui.Tooltip;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class WeaponFragment implements Fragment{
|
||||
Table weapontable;
|
||||
|
||||
public void build(){
|
||||
weapontable = Core.scene.table();
|
||||
weapontable.bottom().left();
|
||||
weapontable.setVisible(()-> !GameState.is(State.menu));
|
||||
|
||||
if(android){
|
||||
weapontable.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public void update(){
|
||||
weapontable.clearChildren();
|
||||
|
||||
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
||||
group.setMaxCheckCount(2);
|
||||
|
||||
weapontable.defaults().size(58, 62);
|
||||
|
||||
for(Weapon weapon : control.getWeapons()){
|
||||
ImageButton button = new ImageButton(Draw.region(weapon.name), "toggle");
|
||||
button.getImageCell().size(8*5);
|
||||
|
||||
group.add(button);
|
||||
|
||||
button.clicked(()->{
|
||||
//if(weapon == player.weapon) return;
|
||||
if(Inputs.keyDown("weapon_alt_select")){
|
||||
player.weaponRight = weapon;
|
||||
}else {
|
||||
player.weaponLeft = weapon;
|
||||
}
|
||||
button.setChecked(true);
|
||||
Vars.netClient.handleWeaponSwitch();
|
||||
});
|
||||
|
||||
button.update(() -> button.setChecked(weapon == player.weaponLeft || weapon == player.weaponRight)); //TODO
|
||||
|
||||
weapontable.add(button);
|
||||
|
||||
Table tiptable = new Table();
|
||||
String description = weapon.description;
|
||||
|
||||
tiptable.background("button");
|
||||
tiptable.add(weapon.localized(), 0.5f).left().padBottom(3f);
|
||||
|
||||
tiptable.row();
|
||||
tiptable.row();
|
||||
tiptable.add("[GRAY]" + description).left();
|
||||
tiptable.margin(14f);
|
||||
|
||||
Tooltip<Table> tip = new Tooltip<>(tiptable);
|
||||
|
||||
tip.setInstant(true);
|
||||
|
||||
button.addListener(tip);
|
||||
}
|
||||
@Override
|
||||
public void build(){
|
||||
|
||||
}
|
||||
|
||||
public void update(){}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user