[virtualcommons-svn] commit/foraging: alllee: adding chat duration to chat instructions template
Status: Beta
Brought to you by:
alllee
From: Bitbucket <com...@bi...> - 2011-12-06 08:10:23
|
1 new commit in foraging: https://bitbucket.org/virtualcommons/foraging/changeset/7065b38e2c9c/ changeset: 7065b38e2c9c user: alllee date: 2011-12-06 01:45:52 summary: adding chat duration to chat instructions template affected #: 4 files diff -r a5f45da2f0b4f37c7ea8baeb8bb29736f6094d13 -r 7065b38e2c9c054b0517b14b6f571fdaa3bf7f3b src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java --- a/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java +++ b/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; +import java.util.concurrent.TimeUnit; import org.stringtemplate.v4.ST; @@ -303,14 +304,19 @@ } public String getChatInstructions() { - return getProperty("chat-instructions"); + ST template = createStringTemplate(getProperty("chat-instructions")); + template.add("chatDuration", inMinutes(getChatDuration()) + " minutes"); + return template.render(); + } + + public long inMinutes(long seconds) { + return TimeUnit.MINUTES.convert(seconds, TimeUnit.SECONDS); } public String getRegulationInstructions() { return getProperty("regulation-instructions"); } - public String getLastRoundDebriefing() { return getProperty("last-round-debriefing"); } diff -r a5f45da2f0b4f37c7ea8baeb8bb29736f6094d13 -r 7065b38e2c9c054b0517b14b6f571fdaa3bf7f3b src/main/java/edu/asu/commons/foraging/ui/GridView.java --- a/src/main/java/edu/asu/commons/foraging/ui/GridView.java +++ b/src/main/java/edu/asu/commons/foraging/ui/GridView.java @@ -18,10 +18,10 @@ import edu.asu.commons.util.ResourceLoader; /** - * $Id: GridView.java 475 2010-02-24 00:39:44Z alllee $ + * $Id$ * * @author Allen Lee - * @version $Revision: 475 $ + * @version $Revision$ * * Superclass for experimenter and subject views of the simulation world. */ @@ -38,7 +38,7 @@ scaledSelfExplicitCollectionModeImage, scaledBeingSanctionedImage, scaledSanctioningImage, scaledMonitorImage; /** - * Use these for the dimensions when drawing. + * Represents the width and height of a grid cell, respectively. */ protected double dw, dh; diff -r a5f45da2f0b4f37c7ea8baeb8bb29736f6094d13 -r 7065b38e2c9c054b0517b14b6f571fdaa3bf7f3b src/main/java/edu/asu/commons/foraging/ui/SubjectView.java --- a/src/main/java/edu/asu/commons/foraging/ui/SubjectView.java +++ b/src/main/java/edu/asu/commons/foraging/ui/SubjectView.java @@ -21,7 +21,7 @@ /** - * $Id: SubjectView.java 484 2010-03-09 00:42:46Z dbarge $ + * $Id$ * <p> * This class encapsulates the client's view of the game board. Used by the * ForagerGameWindow to render the current state of the game. @@ -32,7 +32,7 @@ * * * @author Allen Lee - * @version $Revision: 484 $ + * @version $Revision$ * */ public class SubjectView extends GridView { @@ -86,6 +86,7 @@ if (subjectFieldOfVision) { viewSubjectsRadius = configuration.getViewSubjectsRadius(); viewSubjectsField = new Circle(dataModel.getCurrentPosition(), viewSubjectsRadius); + // FIXME: get rid of these magic numbers and figure out how to adjust it properly. fieldOfVisionXOffset = (dw / 3.0d); fieldOfVisionYOffset = (dh / 3.0d); } @@ -159,8 +160,8 @@ viewSubjectsField.setCenter(currentPosition); Point topLeftCorner = new Point(currentPosition.x - radius, currentPosition.y - radius); // for some reason - double x = Math.ceil(scaleXDouble(topLeftCorner.x) + fieldOfVisionXOffset); - double y = Math.ceil(scaleYDouble(topLeftCorner.y) + fieldOfVisionYOffset); + double x = scaleXDouble(topLeftCorner.x) + fieldOfVisionXOffset; + double y = scaleYDouble(topLeftCorner.y) + fieldOfVisionYOffset; double diameter = radius * 2.0d; diameter = Math.min(scaleXDouble(diameter), scaleYDouble(diameter)) + (dw * 0.85); Ellipse2D.Double circle = new Ellipse2D.Double(x, y, diameter, diameter); diff -r a5f45da2f0b4f37c7ea8baeb8bb29736f6094d13 -r 7065b38e2c9c054b0517b14b6f571fdaa3bf7f3b src/main/resources/configuration/stockholm/censored-chat/round4.xml --- a/src/main/resources/configuration/stockholm/censored-chat/round4.xml +++ b/src/main/resources/configuration/stockholm/censored-chat/round4.xml @@ -16,8 +16,6 @@ <entry key='max-cell-occupancy'>1</entry><!-- before this round begins, we have a chat session --> -<entry key="chat-enabled">true</entry> - <entry key='censored-chat-enabled'>true</entry><entry key='chat-enabled'>true</entry> Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |