Package com.drakulo.games.ais.core.delayed

Examples of com.drakulo.games.ais.core.delayed.ResearchAction


  /**
   * This method handle research steps
   */
  private static void researchProcess(Colony c) {
    ResearchAction research = c.getResearch();
    // If the research is null, that's because the player didn't started a
    // research. In that case, there is nothing to do.
    if (research != null) {
      research.step();
      if (research.isDone()) {
        // The research is done.
        research.getTechnology().setOwned(true);
        c.setResearch(null);
      }
    }
  }
View Full Code Here


    y += 20;
    smallFont.drawString(x + 12, y + 2, this.colony.getPlanetName());

    UIHelper.drawDarkBox(g, x, y + 35, 175, 40);

    ResearchAction research = this.colony.getResearch();
    if (research != null) {
      // The colony's current research name
      smallFont.drawString(x + 4, y + 45, research.getTechnology()
          .getName());

      // The colony's current research progress
      this.researchPB.setMaxValue(BigDecimal.valueOf(research
          .getDuration()));
      this.researchPB.setValue(BigDecimal.valueOf(research
          .getCurrentValue()));
      this.researchPB.setOX(x + 4);
      this.researchPB.setOY(this.getOY() + 2 + HEIGHT - dpadding - 10
          - dpadding);
      researchPB.render(g);
View Full Code Here

              cost.get(r).negate());
        }
        ResearchState.this.startResearchButton.disable();
        ResearchState.this.cancelResearchButton.enable();
        // TODO externalize research duration in technologies file
        ResearchAction action = new ResearchAction(
            ResearchState.this.uiTechnology.getTechnology(), 5);
        GameData.getSelectedColony().setResearch(action);
      }
    });
    add(startResearchButton);
View Full Code Here

      ProgressBar pb = this.resourceBars.get(r);
      pb.update(input);
    }

    // Handling research buttons
    ResearchAction action = GameData.getSelectedColony().getResearch();
    if (action == null) {
      // No research for now : authorize start research is research is
      // possible
      if (this.uiTechnology != null
          && this.uiTechnology.getTechnology().isResearchable()) {
        // The technology is researchable
        this.startResearchButton.enable();
      } else {
        // Action not possible
        this.startResearchButton.disable();
      }
      this.cancelResearchButton.disable();
      this.researchProgress.setValue(BigDecimal.ZERO);
    } else {
      // Research in progress
      Technology t = action.getTechnology();
      if (this.uiTechnology == null) {
        // The player is showing the root : disable all
        this.startResearchButton.disable();
        this.cancelResearchButton.disable();
      } else if (t.equals(this.uiTechnology.getTechnology())) {
        // The player is showing the research in pregress : authorize
        // stop button
        this.startResearchButton.disable();
        this.cancelResearchButton.enable();
      } else {
        // The player is showing a random technology : block research
        // actions
        this.startResearchButton.disable();
        this.cancelResearchButton.disable();
      }

      this.researchProgress.setValue(BigDecimal.valueOf(action
          .getProgression()));
    }

    // buttons
    this.startResearchButton.update(input);
View Full Code Here

    this.homeButton.render(g);

    Font font = FontHelper.getDefaultFont();
    String label;
    // If a technology is currently beeing researched, progress is rendered
    ResearchAction action = GameData.getSelectedColony().getResearch();
    if (action == null) {
      label = I18n.getFirstToUpper("research.no_research");
    } else {
      label = action.getTechnology().getName();
      this.researchProgress.setMaxValue(BigDecimal.valueOf(100));
      this.researchProgress.setValue(BigDecimal.valueOf(action
          .getProgression()));
      this.researchProgress.render(g);
    }
    font.drawString(10, 60, label);
View Full Code Here

    researchProgress.setOX(x + 10);
    researchProgress.setOY(41);
    researchProgress.setWidth(BUTTON_WIDTH * 2 + 5);

    String label = "";
    ResearchAction action = GameData.getSelectedColony().getResearch();
    if (action == null) {
      label = I18n.getFirstToUpper("research.no_research");
    } else {
      label = action.getTechnology().getName();
      this.researchProgress.setMaxValue(BigDecimal.valueOf(100));
      this.researchProgress.setValue(BigDecimal.valueOf(action
          .getProgression()));
    }
    researchProgress.render(g);

    font.drawString(x + 10, 60, label);
View Full Code Here

TOP

Related Classes of com.drakulo.games.ais.core.delayed.ResearchAction

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.