[jetrix-cvs] jetrix/src/java/net/jetrix/filter LogoFilter.java,1.4,1.5
Brought to you by:
smanux
From: Emmanuel B. <sm...@us...> - 2005-05-10 02:23:01
|
Update of /cvsroot/jetrix/jetrix/src/java/net/jetrix/filter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1133 Modified Files: LogoFilter.java Log Message: Updated to load the field from an external file Index: LogoFilter.java =================================================================== RCS file: /cvsroot/jetrix/jetrix/src/java/net/jetrix/filter/LogoFilter.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LogoFilter.java 4 Apr 2005 09:36:17 -0000 1.4 --- LogoFilter.java 10 May 2005 02:22:52 -0000 1.5 *************** *** 21,24 **** --- 21,25 ---- import java.util.*; + import java.io.*; import net.jetrix.*; *************** *** 26,30 **** /** ! * Display a logo on the field of players loosing the game. * * @author Emmanuel Bourg --- 27,31 ---- /** ! * Display a logo on the field of players losing the game. * * @author Emmanuel Bourg *************** *** 33,71 **** public class LogoFilter extends GenericFilter { ! private short jetrixLogo[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, ! 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, ! 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, ! 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, ! 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0}; ! public void onMessage(PlayerLostMessage m, List<Message> out) { ! // send closing screen ! StringBuilder screenLayout = new StringBuilder(); ! for (int i = 0; i < 12 * 22; i++) { ! screenLayout.append(((int) (Math.random() * 5 + 1)) * (1 - jetrixLogo[i])); } FieldMessage endingScreen = new FieldMessage(); endingScreen.setSlot(m.getSlot()); ! endingScreen.setField(screenLayout.toString()); out.add(m); --- 34,61 ---- public class LogoFilter extends GenericFilter { + private static final String DEFAULT_FIELD = "data/jetrix.field"; ! private Field field; ! public void init() { ! // load the field ! field = new Field(); ! try { ! field.load(DEFAULT_FIELD); ! } ! catch (IOException e) ! { ! e.printStackTrace(); } + } + + public void onMessage(PlayerLostMessage m, List<Message> out) + { + // send closing screen FieldMessage endingScreen = new FieldMessage(); endingScreen.setSlot(m.getSlot()); ! endingScreen.setField(field.getFieldString()); out.add(m); |