Brought up to date with Narya changes.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1474 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -5,6 +5,7 @@ package com.samskivert.atlanti.client;
|
|||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import com.samskivert.util.ListUtil;
|
import com.samskivert.util.ListUtil;
|
||||||
|
import com.threerings.util.Name;
|
||||||
|
|
||||||
import com.threerings.presents.dobj.AttributeChangedEvent;
|
import com.threerings.presents.dobj.AttributeChangedEvent;
|
||||||
import com.threerings.presents.dobj.DSet;
|
import com.threerings.presents.dobj.DSet;
|
||||||
@@ -90,7 +91,7 @@ public class AtlantiController extends GameController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
public void turnDidChange (String turnHolder)
|
public void turnDidChange (Name turnHolder)
|
||||||
{
|
{
|
||||||
// if it's our turn, set the tile to be placed
|
// if it's our turn, set the tile to be placed
|
||||||
if (turnHolder.equals(_self.username)) {
|
if (turnHolder.equals(_self.username)) {
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import java.awt.GridBagConstraints;
|
|||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
import com.threerings.util.Name;
|
||||||
|
|
||||||
import com.threerings.presents.dobj.AttributeChangeListener;
|
import com.threerings.presents.dobj.AttributeChangeListener;
|
||||||
import com.threerings.presents.dobj.AttributeChangedEvent;
|
import com.threerings.presents.dobj.AttributeChangedEvent;
|
||||||
import com.threerings.presents.dobj.SetListener;
|
import com.threerings.presents.dobj.SetListener;
|
||||||
@@ -74,14 +76,14 @@ public class PlayerInfoView
|
|||||||
/**
|
/**
|
||||||
* Adds a player to the display.
|
* Adds a player to the display.
|
||||||
*/
|
*/
|
||||||
protected void addPlayer (int idx, String username)
|
protected void addPlayer (int idx, Name username)
|
||||||
{
|
{
|
||||||
GridBagConstraints c = new GridBagConstraints();
|
GridBagConstraints c = new GridBagConstraints();
|
||||||
|
|
||||||
// create a label for their username
|
// create a label for their username
|
||||||
c.fill = GridBagConstraints.HORIZONTAL;
|
c.fill = GridBagConstraints.HORIZONTAL;
|
||||||
c.weightx = 1.0; // use up extra space on this label
|
c.weightx = 1.0; // use up extra space on this label
|
||||||
JLabel unlabel = new JLabel(username);
|
JLabel unlabel = new JLabel(username.toString());
|
||||||
unlabel.setForeground(Feature.PIECEN_COLOR_MAP[idx]);
|
unlabel.setForeground(Feature.PIECEN_COLOR_MAP[idx]);
|
||||||
add(unlabel, c);
|
add(unlabel, c);
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public class TurnIndicatorView extends JPanel
|
|||||||
protected void updateTurnHolder ()
|
protected void updateTurnHolder ()
|
||||||
{
|
{
|
||||||
if (_atlobj.state == AtlantiObject.IN_PLAY) {
|
if (_atlobj.state == AtlantiObject.IN_PLAY) {
|
||||||
_whoLabel.setText(_atlobj.turnHolder);
|
_whoLabel.setText(_atlobj.turnHolder.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
package com.samskivert.atlanti.data;
|
package com.samskivert.atlanti.data;
|
||||||
|
|
||||||
import com.threerings.presents.dobj.DSet;
|
import com.threerings.presents.dobj.DSet;
|
||||||
|
import com.threerings.util.Name;
|
||||||
|
|
||||||
import com.threerings.parlor.game.GameObject;
|
import com.threerings.parlor.game.GameObject;
|
||||||
import com.threerings.parlor.turn.TurnGameObject;
|
import com.threerings.parlor.turn.TurnGameObject;
|
||||||
@@ -15,7 +16,7 @@ public class AtlantiObject extends GameObject
|
|||||||
implements TurnGameObject
|
implements TurnGameObject
|
||||||
{
|
{
|
||||||
/** The username of the current turn holder. */
|
/** The username of the current turn holder. */
|
||||||
public String turnHolder;
|
public Name turnHolder;
|
||||||
|
|
||||||
/** A set containing all of the tiles that are in play in this
|
/** A set containing all of the tiles that are in play in this
|
||||||
* game. */
|
* game. */
|
||||||
@@ -33,7 +34,7 @@ public class AtlantiObject extends GameObject
|
|||||||
public int[] scores;
|
public int[] scores;
|
||||||
|
|
||||||
// documentation inherited from interface
|
// documentation inherited from interface
|
||||||
public String[] getPlayers ()
|
public Name[] getPlayers ()
|
||||||
{
|
{
|
||||||
return players;
|
return players;
|
||||||
}
|
}
|
||||||
@@ -45,7 +46,7 @@ public class AtlantiObject extends GameObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited from interface
|
// documentation inherited from interface
|
||||||
public String getTurnHolder ()
|
public Name getTurnHolder ()
|
||||||
{
|
{
|
||||||
return turnHolder;
|
return turnHolder;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
package com.samskivert.atlanti.data;
|
package com.samskivert.atlanti.data;
|
||||||
|
|
||||||
import com.threerings.presents.dobj.DSet;
|
import com.threerings.presents.dobj.DSet;
|
||||||
|
import com.threerings.util.Name;
|
||||||
|
|
||||||
import com.threerings.parlor.game.GameObject;
|
import com.threerings.parlor.game.GameObject;
|
||||||
import com.threerings.parlor.turn.TurnGameObject;
|
import com.threerings.parlor.turn.TurnGameObject;
|
||||||
@@ -30,7 +31,7 @@ public class AtlantiObject extends GameObject
|
|||||||
public static final String SCORES = "scores";
|
public static final String SCORES = "scores";
|
||||||
|
|
||||||
/** The username of the current turn holder. */
|
/** The username of the current turn holder. */
|
||||||
public String turnHolder;
|
public Name turnHolder;
|
||||||
|
|
||||||
/** A set containing all of the tiles that are in play in this
|
/** A set containing all of the tiles that are in play in this
|
||||||
* game. */
|
* game. */
|
||||||
@@ -48,7 +49,7 @@ public class AtlantiObject extends GameObject
|
|||||||
public int[] scores;
|
public int[] scores;
|
||||||
|
|
||||||
// documentation inherited from interface
|
// documentation inherited from interface
|
||||||
public String[] getPlayers ()
|
public Name[] getPlayers ()
|
||||||
{
|
{
|
||||||
return players;
|
return players;
|
||||||
}
|
}
|
||||||
@@ -60,7 +61,7 @@ public class AtlantiObject extends GameObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited from interface
|
// documentation inherited from interface
|
||||||
public String getTurnHolder ()
|
public Name getTurnHolder ()
|
||||||
{
|
{
|
||||||
return turnHolder;
|
return turnHolder;
|
||||||
}
|
}
|
||||||
@@ -73,10 +74,10 @@ public class AtlantiObject extends GameObject
|
|||||||
* clients) will apply the value change when they received the
|
* clients) will apply the value change when they received the
|
||||||
* attribute changed notification.
|
* attribute changed notification.
|
||||||
*/
|
*/
|
||||||
public void setTurnHolder (String turnHolder)
|
public void setTurnHolder (Name turnHolder)
|
||||||
{
|
{
|
||||||
this.turnHolder = turnHolder;
|
|
||||||
requestAttributeChange(TURN_HOLDER, turnHolder);
|
requestAttributeChange(TURN_HOLDER, turnHolder);
|
||||||
|
this.turnHolder = turnHolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,8 +122,8 @@ public class AtlantiObject extends GameObject
|
|||||||
*/
|
*/
|
||||||
public void setTiles (DSet tiles)
|
public void setTiles (DSet tiles)
|
||||||
{
|
{
|
||||||
this.tiles = tiles;
|
|
||||||
requestAttributeChange(TILES, tiles);
|
requestAttributeChange(TILES, tiles);
|
||||||
|
this.tiles = tiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -135,8 +136,8 @@ public class AtlantiObject extends GameObject
|
|||||||
*/
|
*/
|
||||||
public void setCurrentTile (AtlantiTile currentTile)
|
public void setCurrentTile (AtlantiTile currentTile)
|
||||||
{
|
{
|
||||||
this.currentTile = currentTile;
|
|
||||||
requestAttributeChange(CURRENT_TILE, currentTile);
|
requestAttributeChange(CURRENT_TILE, currentTile);
|
||||||
|
this.currentTile = currentTile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -181,8 +182,8 @@ public class AtlantiObject extends GameObject
|
|||||||
*/
|
*/
|
||||||
public void setPiecens (DSet piecens)
|
public void setPiecens (DSet piecens)
|
||||||
{
|
{
|
||||||
this.piecens = piecens;
|
|
||||||
requestAttributeChange(PIECENS, piecens);
|
requestAttributeChange(PIECENS, piecens);
|
||||||
|
this.piecens = piecens;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -195,8 +196,8 @@ public class AtlantiObject extends GameObject
|
|||||||
*/
|
*/
|
||||||
public void setScores (int[] scores)
|
public void setScores (int[] scores)
|
||||||
{
|
{
|
||||||
this.scores = scores;
|
|
||||||
requestAttributeChange(SCORES, scores);
|
requestAttributeChange(SCORES, scores);
|
||||||
|
this.scores = scores;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,7 +210,7 @@ public class AtlantiObject extends GameObject
|
|||||||
*/
|
*/
|
||||||
public void setScoresAt (int value, int index)
|
public void setScoresAt (int value, int index)
|
||||||
{
|
{
|
||||||
this.scores[index] = value;
|
|
||||||
requestElementUpdate(SCORES, new Integer(value), index);
|
requestElementUpdate(SCORES, new Integer(value), index);
|
||||||
|
this.scores[index] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -464,12 +464,12 @@ public class AtlantiTile
|
|||||||
{
|
{
|
||||||
// load up the tile set if we haven't already
|
// load up the tile set if we haven't already
|
||||||
if (_tset == null) {
|
if (_tset == null) {
|
||||||
_tset = _tmgr.loadTileSet(TILES_IMG_PATH, TILE_TYPES,
|
_tset = _tmgr.loadTileSet(TILES_IMG_PATH,
|
||||||
TILE_WIDTH, TILE_HEIGHT);
|
TILE_WIDTH, TILE_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// fetch the tile
|
// fetch the tile
|
||||||
return _tset.getTileImage(type-1);
|
return _tset.getRawTileImage(type-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -479,12 +479,12 @@ public class AtlantiTile
|
|||||||
{
|
{
|
||||||
// load up the tile set if we haven't already
|
// load up the tile set if we haven't already
|
||||||
if (_stset == null) {
|
if (_stset == null) {
|
||||||
_stset = _tmgr.loadTileSet(SHIELD_IMG_PATH, 1,
|
_stset = _tmgr.loadTileSet(SHIELD_IMG_PATH,
|
||||||
SHIELD_SIZE, SHIELD_SIZE);
|
SHIELD_SIZE, SHIELD_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// fetch the tile
|
// fetch the tile
|
||||||
return _stset.getTileImage(0);
|
return _stset.getRawTileImage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The tile image that we use to render this tile. */
|
/** The tile image that we use to render this tile. */
|
||||||
|
|||||||
@@ -21,10 +21,9 @@ import com.threerings.presents.dobj.MessageEvent;
|
|||||||
|
|
||||||
import com.threerings.presents.dobj.MessageEvent;
|
import com.threerings.presents.dobj.MessageEvent;
|
||||||
|
|
||||||
import com.threerings.crowd.chat.ChatProvider;
|
import com.threerings.crowd.chat.server.ChatProvider;
|
||||||
import com.threerings.crowd.chat.SpeakProvider;
|
import com.threerings.crowd.chat.server.SpeakProvider;
|
||||||
import com.threerings.crowd.data.PlaceObject;
|
import com.threerings.crowd.data.PlaceObject;
|
||||||
|
|
||||||
import com.threerings.crowd.data.PlaceConfig;
|
import com.threerings.crowd.data.PlaceConfig;
|
||||||
import com.threerings.crowd.server.PlaceManager;
|
import com.threerings.crowd.server.PlaceManager;
|
||||||
|
|
||||||
@@ -248,7 +247,7 @@ public class AtlantiManager extends GameManager
|
|||||||
|
|
||||||
String message = qual + " " + TileCodes.FEATURE_NAMES[f.type] +
|
String message = qual + " " + TileCodes.FEATURE_NAMES[f.type] +
|
||||||
" scored " + score + " points for " + names + ".";
|
" scored " + score + " points for " + names + ".";
|
||||||
SpeakProvider.sendSystemSpeak(
|
SpeakProvider.sendInfo(
|
||||||
_atlobj, ATLANTI_MESSAGE_BUNDLE, message);
|
_atlobj, ATLANTI_MESSAGE_BUNDLE, message);
|
||||||
|
|
||||||
Log.info("New scores: " + StringUtil.toString(_atlobj.scores));
|
Log.info("New scores: " + StringUtil.toString(_atlobj.scores));
|
||||||
@@ -321,7 +320,7 @@ public class AtlantiManager extends GameManager
|
|||||||
// players about the score
|
// players about the score
|
||||||
String message = getPlayerName(p.owner) + " scored " +
|
String message = getPlayerName(p.owner) + " scored " +
|
||||||
score + " points for " + qual + " temple.";
|
score + " points for " + qual + " temple.";
|
||||||
SpeakProvider.sendSystemSpeak(
|
SpeakProvider.sendInfo(
|
||||||
_atlobj, ATLANTI_MESSAGE_BUNDLE, message);
|
_atlobj, ATLANTI_MESSAGE_BUNDLE, message);
|
||||||
|
|
||||||
// add the score to the owning player
|
// add the score to the owning player
|
||||||
@@ -469,7 +468,7 @@ public class AtlantiManager extends GameManager
|
|||||||
_atlobj.scores[i] += cityScores[i];
|
_atlobj.scores[i] += cityScores[i];
|
||||||
String message = getPlayerName(i) + " scores " +
|
String message = getPlayerName(i) + " scores " +
|
||||||
cityScores[i] + " points for fisheries.";
|
cityScores[i] + " points for fisheries.";
|
||||||
SpeakProvider.sendSystemSpeak(
|
SpeakProvider.sendInfo(
|
||||||
_atlobj, ATLANTI_MESSAGE_BUNDLE, message);
|
_atlobj, ATLANTI_MESSAGE_BUNDLE, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ public class PiecenUtil
|
|||||||
public static void init (TileManager tmgr)
|
public static void init (TileManager tmgr)
|
||||||
{
|
{
|
||||||
UniformTileSet piecenSet = tmgr.loadTileSet(
|
UniformTileSet piecenSet = tmgr.loadTileSet(
|
||||||
PIECEN_IMG_PATH, PIECEN_TYPES, PIECEN_WIDTH, PIECEN_HEIGHT);
|
PIECEN_IMG_PATH, PIECEN_WIDTH, PIECEN_HEIGHT);
|
||||||
_images = new Image[PIECEN_TYPES];
|
_images = new Image[PIECEN_TYPES];
|
||||||
for (int i = 0; i < PIECEN_TYPES; i++) {
|
for (int i = 0; i < PIECEN_TYPES; i++) {
|
||||||
_images[i] = piecenSet.getTileImage(i);
|
_images[i] = piecenSet.getRawTileImage(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user