Esempio 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;
  }
Esempio 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;
  }
Esempio n. 3
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)));
  }
Esempio n. 4
0
 public void resetColor(TextButton button) {
   if (button != null) button.setColor(Color.WHITE);
 }
Esempio n. 5
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;
  }