Start of work on portrait mode / Made fragments abstract classes
This commit is contained in:
@@ -10,7 +10,7 @@ import io.anuke.ucore.scene.ui.layout.Unit;
|
||||
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
|
||||
public class BackgroundFragment implements Fragment {
|
||||
public class BackgroundFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public void build(Group parent) {
|
||||
|
||||
@@ -18,7 +18,7 @@ import io.anuke.ucore.scene.ui.layout.Table;
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
|
||||
public class BlockConfigFragment implements Fragment {
|
||||
public class BlockConfigFragment extends Fragment {
|
||||
private Table table = new Table();
|
||||
private InputHandler input;
|
||||
private Tile configTile;
|
||||
|
||||
@@ -33,7 +33,7 @@ import static io.anuke.mindustry.Vars.mobile;
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
|
||||
public class BlockInventoryFragment implements Fragment {
|
||||
public class BlockInventoryFragment extends Fragment {
|
||||
private final static float holdWithdraw = 40f;
|
||||
|
||||
private Table table;
|
||||
|
||||
@@ -28,7 +28,7 @@ import io.anuke.ucore.util.Strings;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class BlocksFragment implements Fragment{
|
||||
public class BlocksFragment extends Fragment{
|
||||
/**Table containing description that is shown on top.*/
|
||||
private Table descTable;
|
||||
/**Main table containing the whole menu.*/
|
||||
|
||||
@@ -27,7 +27,7 @@ import static io.anuke.mindustry.Vars.state;
|
||||
import static io.anuke.ucore.core.Core.scene;
|
||||
import static io.anuke.ucore.core.Core.skin;
|
||||
|
||||
public class ChatFragment extends Table implements Fragment{
|
||||
public class ChatFragment extends Table{
|
||||
private final static int messagesShown = 10;
|
||||
private Array<ChatMessage> messages = new Array<>();
|
||||
private float fadetime;
|
||||
@@ -43,6 +43,12 @@ public class ChatFragment extends Table implements Fragment{
|
||||
private Array<String> history = new Array<>();
|
||||
private int historyPos = 0;
|
||||
private int scrollPos = 0;
|
||||
private Fragment container = new Fragment() {
|
||||
@Override
|
||||
public void build(Group parent) {
|
||||
scene.add(ChatFragment.this);
|
||||
}
|
||||
};
|
||||
|
||||
public ChatFragment(){
|
||||
super();
|
||||
@@ -79,9 +85,8 @@ public class ChatFragment extends Table implements Fragment{
|
||||
setup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(Group parent) {
|
||||
scene.add(this);
|
||||
public Fragment container() {
|
||||
return container;
|
||||
}
|
||||
|
||||
public void clearMessages(){
|
||||
|
||||
@@ -27,7 +27,7 @@ import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class DebugFragment implements Fragment {
|
||||
public class DebugFragment extends Fragment {
|
||||
private static StringBuilder log = new StringBuilder();
|
||||
|
||||
static{
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
package io.anuke.mindustry.ui.fragments;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.ucore.scene.Group;
|
||||
|
||||
public interface Fragment{
|
||||
void build(Group parent);
|
||||
public abstract class Fragment{
|
||||
|
||||
public Fragment(){
|
||||
Gdx.app.postRunnable(() -> Vars.ui.addFragment(this));
|
||||
}
|
||||
|
||||
public abstract void build(Group parent);
|
||||
|
||||
public void onResize(){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import io.anuke.ucore.util.Bundles;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class HudFragment implements Fragment{
|
||||
public class HudFragment extends Fragment{
|
||||
public final BlocksFragment blockfrag = new BlocksFragment();
|
||||
|
||||
private ImageButton menu, flip;
|
||||
|
||||
@@ -10,7 +10,7 @@ import io.anuke.ucore.scene.ui.Label;
|
||||
import io.anuke.ucore.scene.ui.TextButton;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
public class LoadingFragment implements Fragment {
|
||||
public class LoadingFragment extends Fragment {
|
||||
private Table table;
|
||||
private TextButton button;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import io.anuke.ucore.scene.builders.table;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class MenuFragment implements Fragment{
|
||||
public class MenuFragment extends Fragment{
|
||||
|
||||
public void build(Group parent){
|
||||
new table(){{
|
||||
|
||||
@@ -4,7 +4,7 @@ import io.anuke.mindustry.input.InputHandler;
|
||||
import io.anuke.ucore.scene.Group;
|
||||
|
||||
/**Fragment for displaying overlays such as block inventories. One is created for each input handler.*/
|
||||
public class OverlayFragment implements Fragment{
|
||||
public class OverlayFragment extends Fragment{
|
||||
public final BlockInventoryFragment inv;
|
||||
public final BlockConfigFragment config;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import io.anuke.ucore.util.Bundles;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class PlayerListFragment implements Fragment{
|
||||
public class PlayerListFragment extends Fragment{
|
||||
private boolean visible = false;
|
||||
private Table content = new Table();
|
||||
private ObjectMap<Player, Boolean> checkmap = new ObjectMap<>();
|
||||
|
||||
Reference in New Issue
Block a user