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 Window currencyScreen() {
   Window win = new Window("Information", skin);
   win.setWidth(200);
   win.setHeight(40);
   win.setMovable(true);
   win.setPosition(0, 0);
   win.defaults().space(5);
   win.row().fill().expandX();
   win.add(f);
   return win;
 }
Esempio n. 4
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;
  }