Source code: org/dma/ihm/game/calendar/events/GameCalendarYearStartEvent.java
1 package org.dma.ihm.game.calendar.events;
2
3 import java.util.*;
4 import org.dma.ihm.controller.*;
5 import org.dma.ihm.controller.data.*;
6 import org.dma.ihm.game.*;
7 import org.dma.ihm.game.calendar.*;
8
9 import org.dma.ihm.game.league.*;
10
11 /**
12 * GameCalendarYearEndEvent Special event that resets the game and places
13 * already a endYear event in the calendar.
14 *
15 * @author Bernhard von Gunten / Arik Dasen
16 * @created December 29, 2001
17 */
18 public class GameCalendarYearStartEvent extends GameCalendarEvent {
19 /**
20 * Creates the event
21 *
22 * @param source The source of this event
23 * @param day The day of this event
24 */
25 public GameCalendarYearStartEvent(Object source, Calendar day) {
26 super(source, day, "GameCalendarYearStartEvent");
27 }
28
29 /** Reset scenario and add an endYear event to the GameCalendar */
30 public void play() {
31 super.play();
32 Controller.getScenario().newSeason();
33 // Add a displayGui for each user that the season is finished
34 User[] users = Controller.getScenario().getUsers();
35 for (int i = 0; i < users.length; i++) {
36 GameCalendarDisplayGuiEvent tmp = new GameCalendarDisplayGuiEvent(this, Controller.getScenario().getGameCalendar().getLastDay(), users[i], Controller.getTranslation("event.endOfSeason"));
37 Controller.getScenario().getGameCalendar().addEvent(tmp);
38 }
39 // Add the end of the year
40 Controller.getScenario().getGameCalendar().addEvent(new GameCalendarYearEndEvent(this, Controller.getScenario().getGameCalendar().getLastDay()));
41 }
42
43 }