コード例 #1
0
  @Override
  protected void paintComponent(Graphics grphcs) {
    super.paintComponent(grphcs);

    int width = this.getWidth();
    int height = this.getHeight();

    googleMap.setWidth(width);
    googleMap.setHeight(height);

    Image image = googleMap.getImage();
    grphcs.drawImage(image, 0, 0, this);

    Graphics2D g2 = (Graphics2D) grphcs;

    String toDisplay = "Normal";
    if (crit) {
      g2.setColor(Color.red);
      toDisplay = "ALARM";
    } else if (warn) {
      g2.setColor(Color.orange);
      toDisplay = "WARNING";
    } else {
      g2.setColor(Color.green.darker());
      toDisplay = "Normal";
    }

    g2.setFont(new Font("Calibri", Font.BOLD, 60));
    g2.drawString(toDisplay, 10, 60);
  }
コード例 #2
0
ファイル: GameModel.java プロジェクト: tiksa/Jorma-s-Revenge
 public void newTurn() {
   turn++;
   updateTime();
   currentMap.update(timeLeap);
   if (previousMapTimer > 0) {
     previousMap.update(timeLeap);
     previousMapTimer -= timeLeap;
   }
   player.update();
   for (Event e : events.getAddBuffer()) {
     addMessage(e.getMessage());
   }
   events.update(); // TODO: optimize double looping
 }
コード例 #3
0
  public void setSCADASites(ArrayList<SCADASite> sites) {
    // remove all previous markers
    Marker[] markers = googleMap.getMarkers();
    for (Marker marker : markers) {
      googleMap.removeMarker(marker);
    }

    // then add the new ones
    markers = new Marker[sites.size()];
    for (int i = 0; i < markers.length; i++) {
      SCADASite site = sites.get(i);

      String color;

      crit = false;
      warn = false;

      if (site.getAlarm()) {
        color = "red";
        crit = true;
        playSound();
        firstAlarm = false;
      } else if (site.getWarning()) {
        color = "orange";
        warn = true;
        firstAlarm = true;
      } else {
        color = "green";
        firstAlarm = true;
      }

      Marker marker = new Marker(googleMap, site.getLat(), site.getLon(), color);
      googleMap.addMarker(marker);
    }

    repaint();
  }
コード例 #4
0
ファイル: GameModel.java プロジェクト: tiksa/Jorma-s-Revenge
 public void waitTenTurns() {
   for (int i = 0; i < 10; i++) {
     boolean hostileNPCNear = false;
     for (Char c : currentMap.getChars()) {
       if (c.isNextTo(player) && c.isHostile()) {
         hostileNPCNear = true;
       }
     }
     if (!hostileNPCNear) {
       addEvent(new MiscEvent(100, "", Event.OTHER_EVENT));
       newTurn();
     } else {
       i = 10;
     }
   }
   clearOutput();
   updateVisibleOutput();
 }
コード例 #5
0
ファイル: GameModel.java プロジェクト: tiksa/Jorma-s-Revenge
 public GameModel(Window window) {
   super(window);
   this.view = new GameView(this);
   this.controller = new GameController(this);
   maps = new MapList(this);
   currentMap = maps.get(FIRST_MAP_NAME);
   setCurrentMap(currentMap);
   previousMap = null;
   previousMapTimer = 0;
   player = new Player(PLAYER_NAME, currentMap.getCells()[8][8]); // luodaan se playeri oikein
   turn = 0;
   timeLeap = 0;
   time = 16955; // Util.randInt(DAY_LENGTH / 5, DAY_LENGTH / 2);
   day = 1;
   hours = generateHourNames();
   events = new BufferedList<Event>();
   initQuests();
   updateVisibleOutput();
 }