Ejemplo n.º 1
0
  public Window returnScreen() {
    final TextButton ts = new TextButton("Return to Title Screen", skin, "default");
    ts.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            game.setScreen(new SplashScreen(game));
          }
        });

    final TextButton qd = new TextButton("Quit to Desktop", skin, "default");
    qd.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            Gdx.app.exit();
          }
        });

    final Window win = new Window("Return Menu", skin);
    win.setWidth(200);
    win.setHeight(90);
    win.setMovable(true);
    win.setPosition(
        Gdx.graphics.getWidth() / 2 - 100, Gdx.graphics.getHeight() / 2 - win.getHeight() / 2);
    win.defaults().space(5);
    win.row().fill().expandX();
    win.add(ts);
    win.row().fill();
    win.add(qd);
    return win;
  }
Ejemplo n.º 2
0
  public Window ghostPanel() {
    if (HW4.stop) return null;

    float offset = 100;

    final TextButton atk = new TextButton("Action", skin, "default");
    final TextButton pat = new TextButton("Patrol", skin, "default");
    final TextButton def = new TextButton("Defend", skin, "default");
    final TextButton upg = new TextButton("Flee", skin, "default");

    atk.addListener(
        new InputListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            atk.setColor(Color.DARK_GRAY); // set to white to get color back
            pat.setColor(Color.WHITE);
            SelectionManager._instance.setCurrCommand(commandType.Action, atk);
            // waitForLeftMouse(atk);
            return true;
          }
        });

    def.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            SelectionManager._instance.issueDefendCommand();
          }
        });

    pat.addListener(
        new InputListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            pat.setColor(Color.DARK_GRAY); // set to white to get color back
            atk.setColor(Color.WHITE);
            SelectionManager._instance.setCurrCommand(commandType.Patrol, pat);
            return true;
          }
        });

    upg.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            SelectionManager._instance.issueFleeCommand();
          }
        });

    final Window win = new Window("Ghost Unit Actions", skin);
    win.setWidth(230);
    win.setHeight(90);
    win.setMovable(false);
    win.setPosition(Gdx.graphics.getWidth() / 2 - 115, 0);
    win.defaults().space(5);
    win.row().fill().expandX();
    win.add(atk, def);
    win.row().fill();
    win.add(pat, upg);

    return win;
  }
Ejemplo n.º 3
0
  @Override
  public void setUpInterface(Table table) {
    // TODO: Move this to the skin.
    ScrollPane.ScrollPaneStyle style = new ScrollPane.ScrollPaneStyle();

    table.pad(20);

    Label header = new Label(game.getLocale().get("main.about"), game.getSkin(), "bold");
    table.add(header).expandX().align(Align.center).height(80).row();

    innerContainer = new Table();
    ScrollPane scroll = new ScrollPane(innerContainer, style);
    table.add(scroll).expand().fill().align(Align.top).row();
    innerContainer.defaults().fill().expand();

    screen = SCREEN_CREDITS;
    updateScrollPane();

    final TextButton changeButton =
        new TextButton(game.getLocale().get("about.license"), game.getSkin());
    changeButton.addListener(
        new ChangeListener() {
          @Override
          public void changed(ChangeEvent event, Actor actor) {
            if (screen == SCREEN_CREDITS) {
              screen = SCREEN_LICENSE;
              changeButton.setText(game.getLocale().get("about.credits"));
              updateScrollPane();
            } else {
              screen = SCREEN_CREDITS;
              changeButton.setText(game.getLocale().get("about.license"));
              updateScrollPane();
            }
            game.player.playSound(SoundPlayer.SoundCode.SELECT);
            event.cancel();
          }
        });

    Table buttonRow = new Table();
    buttonRow.defaults().fill().expand().width(Value.maxWidth).space(10);
    buttonRow.add(changeButton);

    TextButton backButton = new TextButton(game.getLocale().get("core.back"), game.getSkin());
    buttonRow.add(backButton).row();
    backButton.addListener(new ScreenPopper(game));

    table.add(buttonRow).expandX().fillX().height(60).padTop(20).align(Align.bottom).row();
  }
Ejemplo n.º 4
0
  public void show() {

    stage = new Stage();

    Gdx.input.setInputProcessor(stage);

    atlas = new TextureAtlas("ui/atlas.pack");
    skin = new Skin(Gdx.files.internal("ui/menuSkin.json"), atlas);

    Texture chipBg = new Texture(Gdx.files.internal("img/chips.png"));
    stage.addActor(new Image(chipBg));

    table = new Table(skin);
    table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    table.bottom().right();

    backButton = new TextButton("BACK", skin);
    backButton.addListener(
        new ClickListener() {
          public void clicked(InputEvent event, float x, float y) {
            ((Game) Gdx.app.getApplicationListener()).setScreen(new PotatoMenu());
          }
        });
    backButton.pad(10);

    table.add(backButton).bottom().right();
    ;

    stage.addActor(table);

    tweenManager = new TweenManager();
    Tween.registerAccessor(Actor.class, new ActorAccessor());

    tweenManager.update(Gdx.graphics.getDeltaTime());

    stage.addAction(sequence(moveTo(0, stage.getHeight()), moveTo(0, 0, .5f)));
  }
Ejemplo n.º 5
0
  public MainMenuScreen(LD33 game) {
    this.game = game;
    bgCam = new OrthographicCamera(1, 1);
    stage = new Stage(new FitViewport(400, 300));

    Skin skin = game.assetMngr.get("skin.json", Skin.class);

    Table table = new Table();
    table.setFillParent(true);
    stage.addActor(table);

    Label title = new Label("Where-Wolf", skin);
    title.setFontScale(4);
    table.add(title).pad(50);
    table.row();

    TextButton startB = new TextButton("Start", skin);
    startB.setDisabled(true);
    startB.addListener(
        new ClickListener() {
          @Override
          public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) {
            MainMenuScreen.this.game.setScreen(new PlayScreen(MainMenuScreen.this.game, 1));
            dispose();
            return true;
          }
        });
    table.add(startB).pad(1f).width(96);
    table.row();

    TextButton levelB = new TextButton("Select level", skin);
    levelB.addListener(
        new ClickListener() {
          @Override
          public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) {
            MainMenuScreen.this.game.setScreen(
                new LevelsScreen(MainMenuScreen.this.game, MainMenuScreen.this));
            return true;
          }
        });
    levelB.setDisabled(true);
    table.add(levelB).pad(1f).width(96);
    table.row();

    TextButton controlB = new TextButton("Controls", skin);
    controlB.addListener(
        new ClickListener() {
          @Override
          public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) {
            MainMenuScreen.this.game.setScreen(
                new ControlsScreen(MainMenuScreen.this.game, MainMenuScreen.this));
            return true;
          }
        });
    controlB.setDisabled(true);
    table.add(controlB).pad(1f).width(96);
    table.row();

    TextButton exitB = new TextButton("Exit", skin);
    exitB.setDisabled(true);
    exitB.addListener(
        new ClickListener() {
          @Override
          public boolean touchDown(InputEvent e, float x, float y, int pointer, int button) {
            Gdx.app.exit();
            return true;
          }
        });
    if (Gdx.app.getType() != Application.ApplicationType.WebGL) table.add(exitB).pad(1f).width(96);
  }
Ejemplo n.º 6
0
  public Window structurePanel() {
    if (HW4.stop) return null;

    float offset = 100;

    final TextButton ral = new TextButton("Set Rally", skin, "default");
    final Color c = ral.getColor();
    ral.addListener(
        new InputListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            ral.setColor(Color.DARK_GRAY); // set to white to get color back
            SelectionManager._instance.setCurrCommand(commandType.Rally, ral);
            return true;
          }
        });

    ral.setChecked(true);

    final TextButton train = new TextButton("Upgrade Units", skin, "default");
    train.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            ral.setColor(Color.WHITE);
            EntityManager._instance
                .alliedBase
                .getComponent(BuildingComponent.class)
                .increaseUpgradeLevel();
          }
        });

    final TextButton melee = new TextButton("Manifest Melee Unit", skin, "default");
    melee.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            EntityManager._instance
                .alliedBase
                .getComponent(BuildingComponent.class)
                .trainMeleeUnit();
          }
        });
    final TextButton ranged = new TextButton("Manifest Ranged Unit", skin, "default");
    ranged.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            EntityManager._instance
                .alliedBase
                .getComponent(BuildingComponent.class)
                .trainRangedUnit();
          }
        });
    final TextButton worker = new TextButton("Manifest Worker Unit", skin, "default");
    worker.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            EntityManager._instance
                .alliedBase
                .getComponent(BuildingComponent.class)
                .trainWorkerUnit();
          }
        });

    final Window win = new Window("Home Base Actions", skin);
    win.setWidth(500);
    win.setHeight(90);
    win.setMovable(false);
    win.setPosition(Gdx.graphics.getWidth() / 2 - 250, 0);
    win.defaults().space(5);
    win.row().fill().expandX();
    win.add(ral);
    win.add(melee);
    win.add(ranged);
    win.row().fill();
    win.add(train);
    win.add(worker);

    return win;
  }