Package com.drakulo.games.ais.ui.component.button

Examples of com.drakulo.games.ais.ui.component.button.Button


    add(gameMenuButton);

    // Load button
    y += vPadding;
    label = FontHelper.firstToUpper(I18n.get("global.load"));
    Button loadButton = new TextButton(label, x, y);
    loadButton.setSize(buttonWidth, buttonHeight);
    loadButton.disable();
    loadButton.hide();
    loadButton.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
        // TODO
      }
    });
    gameMenuButtons.add(loadButton);
    add(loadButton);

    // Save button
    y += vPadding;
    label = FontHelper.firstToUpper(I18n.get("global.save"));
    Button saveButton = new TextButton(label, x, y);
    saveButton.hide();
    saveButton.setSize(buttonWidth, buttonHeight);
    saveButton.disable();
    saveButton.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
        // TODO
      }
    });
    gameMenuButtons.add(saveButton);
    add(saveButton);

    // Settings button
    y += vPadding;
    label = FontHelper.firstToUpper(I18n.get("global.settings"));
    Button settingsButton = new TextButton(label, x, y);
    settingsButton.setSize(buttonWidth, buttonHeight);
    settingsButton.disable();
    settingsButton.hide();
    settingsButton.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
        // TODO
      }
    });
    gameMenuButtons.add(settingsButton);
    add(settingsButton);

    // Main menu button
    y += vPadding;
    label = FontHelper.firstToUpper(I18n.get("global.main_menu"));
    Button mainMenu = new TextButton(label, x, y);
    mainMenu.setSize(buttonWidth, buttonHeight);
    mainMenu.hide();
    mainMenu.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
        GameData.getGame().enterState(AloneInSpace.MAIN_MENU_STATE);
      }
    });
    gameMenuButtons.add(mainMenu);
    add(mainMenu);
   
    // Exit button
    y += vPadding;
    label = FontHelper.firstToUpper(I18n.get("global.exit"));
    Button exitButton = new TextButton(label, x, y);
    exitButton.setSize(buttonWidth, buttonHeight);
    exitButton.hide();
    exitButton.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
        GameData.getGameContainer().exit();
      }
View Full Code Here


    int y = initialY;

    // Robots actions
    // Terrabot (terrain preparation)

    Button terrabotButton = new ImageButton("TERRABOT", x, y);
    terrabotButton.disable();
    // TODO why the terrabutton size is fucked?
    terrabotButton.setSize(ImageButton.IB_DEFAULT_SIZE,
        ImageButton.IB_DEFAULT_SIZE);
    terrabotButton.setActionHandler(new ActionHandler() {

      @Override
      public void run() {
        PreparationAction pa = BuildingHelper.create(GameData.getSelectedColony());
        BuildWindowOld.this.parent.setSelectedAction(pa);
        hide();
      }
    });
    terrabotButton.setHoverHandler(new ActionHandler() {

      @Override
      public void run() {
        initMaps();
        BuildWindowOld.this.name = "terrabot";
        BuildWindowOld.this.cost.put(Resource.ENERGY,
            BigDecimal.valueOf(25));
      }
    });
    this.buttons.add(terrabotButton);

    // Landscape buildings, following the robots with a little margin
    x += pitch * 2; // The margin
    List<BuildingType> types = BuildingType
        .values(BuildingCategory.LANDSCAPE);
    for (BuildingType type : types) {
      Button button = createBuildingButton(type.toString()
          .substring(0, 1), type);
      button.setPosition(x, y);
      this.buttons.add(button);
      x += pitch;
    }

    // Industrial buildings
    x = initialX;
    y += pitch;
    types = BuildingType.values(BuildingCategory.INDUSTRIAL);
    for (BuildingType type : types) {
      Button button = createBuildingButton(type.toString()
          .substring(0, 1), type);
      button.setPosition(x, y);
      this.buttons.add(button);
      x += pitch;
    }

    // Civil buildings
    x = initialX;
    y += pitch;
    types = BuildingType.values(BuildingCategory.CIVIL);
    for (BuildingType type : types) {
      Button button = createBuildingButton(type.toString()
          .substring(0, 1), type);
      button.setPosition(x, y);
      if (BuildingType.COMMAND_CENTER.equals(type)) {
        this.cmButton = button;
        this.cmButton.enable();
        if (GameData.getSelectedColony().isCommandCenterBuilt()) {
          // Only 1 command center
          button.disable();
        }
      } else if (BuildingType.RESEARCH_CENTER.equals(type)
          && GameData.getSelectedColony().isResearchCenterBuilt()) {
        // Only 1 research center
        button.disable();
      }
      this.buttons.add(button);
      x += pitch;
    }

View Full Code Here

    // Industrial buildings
    x = initialX;
    List<BuildingType> types = BuildingType
        .values(BuildingCategory.INDUSTRIAL);
    for (BuildingType type : types) {
      Button button = createBuildingButton(type);
      button.setPosition(x, y);
      buttons.add(button);
      x += pitch;
    }

    // Civil buildings
    x = initialX;
    y += ImageButton.IB_DEFAULT_SIZE + 15;
    types = BuildingType.values(BuildingCategory.CIVIL);
    for (BuildingType type : types) {
      Button button = createBuildingButton(type);
      button.setPosition(x, y);
      if (BuildingType.COMMAND_CENTER.equals(type)) {
        cmButton = button;
        cmButton.enable();
        if (GameData.getSelectedColony().isCommandCenterBuilt()) {
          // Only 1 command center
          button.disable();
        }
      } else if (BuildingType.RESEARCH_CENTER.equals(type)
          && GameData.getSelectedColony().isResearchCenterBuilt()) {
        // Only 1 research center
        button.disable();
      }
      buttons.add(button);
      x += pitch;
    }
View Full Code Here

TOP

Related Classes of com.drakulo.games.ais.ui.component.button.Button

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.