X.XXX.X (XXXX-XX-XX)
- ・JinParser 2.101.4 に対応。
・JDK9以降のWindows HiDPI環境に対応。
+ ・キャスト表Wiki出力の見栄えを改善。
+ ・JinParser 2.101.4 に対応。
・-nosplashオプションの廃止。
3.302.4 (2017-04-09)
package jp.sfjp.jindolf.dxchg;
+import java.awt.Color;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.ByteBuffer;
private static final String WOLFBBS_URL = "http://wolfbbs.jp/";
+ private static final Color COLOR_INNOCENT = new Color(0xb7bad3);
+ private static final Color COLOR_WOLF = new Color(0xe0b8b8);
+ private static final Color COLOR_HAMSTER = new Color(0xb9d0be);
+ private static final Color COLOR_DEAD = new Color(0xaaaaaa);
+ private static final Color COLOR_ALIVE = new Color(0xffffff);
+
private static final Logger LOGGER = Logger.getAnonymousLogger();
static{
}
/**
- * 陣営の色Wiki表記を返す。
+ * ColorのRGB各成分をWikiカラー表記に変換する。
+ *
+ * α成分は無視される。
+ *
+ * @param color 色
+ * @return Wikiカラー表記
+ */
+ public static String cnvWikiColor(Color color){
+ int packRGB = color.getRGB();
+
+ String txtRGB = Integer.toHexString(packRGB);
+ String leadRGB = "00000000" + txtRGB;
+ int chopLen = leadRGB.length() - 6;
+ String fixed = leadRGB.substring(chopLen);
+ String result = "#" + fixed;
+
+ return result;
+ }
+
+ /**
+ * 表の偶数行に色の変化を付ける。
+ *
+ * @param color 色
+ * @return 変化した色
+ */
+ public static Color evenColor(Color color){
+ int red = color.getRed();
+ int green = color.getGreen();
+ int blue = color.getBlue();
+
+ float[] hsb = Color.RGBtoHSB(red, green, blue, null);
+ float h = hsb[0];
+ float s = hsb[1];
+ float b = hsb[2];
+
+ if(b < 0.5){
+ b += 0.03;
+ }else{
+ b -= 0.03;
+ }
+
+ Color result = Color.getHSBColor(h, s, b);
+
+ return result;
+ }
+
+ /**
+ * 陣営の色を返す。
*
* @param role 役職
- * @return 色Wiki表記
+ * @return 色
*/
- public static String getTeamWikiColor(GameRole role){
- String result;
+ public static Color getTeamColor(GameRole role){
+ Color result;
switch(role){
case INNOCENT:
case SHAMAN:
case HUNTER:
case FRATER:
- result = "#b7bad3";
+ result = COLOR_INNOCENT;
break;
case WOLF:
case MADMAN:
- result = "#e0b8b8";
+ result = COLOR_WOLF;
break;
case HAMSTER:
- result = "#b9d0be";
+ result = COLOR_HAMSTER;
break;
default:
assert false;
}
/**
- * 運命に対応する色Wiki表記を返す。
+ * 運命に対応する色を返す。
*
* @param destiny 運命
- * @return 色Wiki表記
+ * @return 色
*/
- public static String getDestinyColorWiki(Destiny destiny){
- String result;
- if(destiny == Destiny.ALIVE) result = "#ffffff";
- else result = "#aaaaaa";
+ public static Color getDestinyColor(Destiny destiny){
+ Color result;
+ if(destiny == Destiny.ALIVE) result = COLOR_ALIVE;
+ else result = COLOR_DEAD;
return result;
}
package jp.sfjp.jindolf.summary;
+import java.awt.Color;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
public static final Comparator<Player> COMPARATOR_CASTING =
new CastingComparator();
+ private static final Color COLOR_PLAINTABLE = new Color(0xedf5fe);
+
private static final String GENERATOR =
VerInfo.TITLE + "\u0020Ver." + VerInfo.VERSION;
.append('\n');
wikiText.append(WolfBBS.COMMENTLINE);
+ boolean even = true;
+
for(Player player : getCastingPlayerList()){
Avatar avatar = player.getAvatar();
GameRole role = player.getRole();
.append("]");
wikiText.append(" ==========\n");
- String teamColor = "BGCOLOR("
- + WolfBBS.getTeamWikiColor(role)
+ Color teamColor = WolfBBS.getTeamColor(role);
+ Color destinyColor = WolfBBS.getDestinyColor(destiny);
+ Color plainColor = COLOR_PLAINTABLE;
+ if(even){
+ teamColor = WolfBBS.evenColor(teamColor);
+ destinyColor = WolfBBS.evenColor(destinyColor);
+ plainColor = WolfBBS.evenColor(plainColor);
+ }
+ even = ! even;
+
+ String teamWikiColor = "BGCOLOR("
+ + WolfBBS.cnvWikiColor(teamColor)
+ + "):";
+ String destinyWikiColor = "BGCOLOR("
+ + WolfBBS.cnvWikiColor(destinyColor)
+ + "):";
+ String plainWikiColor = "BGCOLOR("
+ + WolfBBS.cnvWikiColor(plainColor)
+ "):";
String avatarIcon = iconSet.getAvatarIconWiki(avatar);
- wikiText.append('|').append(teamColor);
+ wikiText.append('|').append(teamWikiColor);
wikiText.append(avatarIcon).append("&br;");
wikiText.append("[[").append(avatar.getName()).append("]]");
- wikiText.append('|').append(teamColor);
+ wikiText.append('|').append(teamWikiColor);
wikiText.append("[[").append(WolfBBS.escapeWikiBracket(name));
if(urlText != null && urlText.length() > 0){
wikiText.append('>').append(urlText);
}
wikiText.append("]]");
- wikiText.append('|').append(teamColor);
+ wikiText.append('|').append(teamWikiColor);
wikiText.append(WolfBBS.getRoleIconWiki(role));
wikiText.append("&br;");
wikiText.append("[[");
wikiText.append(role.getRoleName());
wikiText.append("]]");
- String destinyColor = WolfBBS.getDestinyColorWiki(destiny);
- wikiText.append('|');
- wikiText.append("BGCOLOR(").append(destinyColor).append("):");
+ wikiText.append('|').append(destinyWikiColor);
if(destiny == Destiny.ALIVE){
wikiText.append("最後まで&br;生存");
}else{
wikiText.append(destiny.getMessage());
}
- wikiText.append('|');
+ wikiText.append('|').append(plainWikiColor);
wikiText.append(avatar.getJobTitle()).append('。');
if(avatar == Avatar.AVATAR_GERD){
package jp.sfjp.jindolf.dxchg;
-import jp.sourceforge.jindolf.corelib.Destiny;
-import jp.sourceforge.jindolf.corelib.GameRole;
+import java.awt.Color;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
}
/**
- * Test of getTeamWikiColor method, of class WolfBBS.
+ * Test of cnvWikiColor method, of class WolfBBS.
*/
@Test
- public void testGetTeamWikiColor() {
- System.out.println("getTeamWikiColor");
+ public void testCnvWikiColor() {
+ System.out.println("cnvWikiColor");
String result;
- result = WolfBBS.getTeamWikiColor(GameRole.INNOCENT);
- assertEquals("#b7bad3", result);
+ result = WolfBBS.cnvWikiColor(new Color(0x00, 0x00, 0x00));
+ assertEquals("#000000", result);
- result = WolfBBS.getTeamWikiColor(GameRole.FRATER);
- assertEquals("#b7bad3", result);
+ result = WolfBBS.cnvWikiColor(new Color(0x12, 0x34, 0x56));
+ assertEquals("#123456", result);
- result = WolfBBS.getTeamWikiColor(GameRole.HUNTER);
- assertEquals("#b7bad3", result);
+ result = WolfBBS.cnvWikiColor(new Color(0x01, 0x00, 0x00));
+ assertEquals("#010000", result);
- result = WolfBBS.getTeamWikiColor(GameRole.SEER);
- assertEquals("#b7bad3", result);
+ result = WolfBBS.cnvWikiColor(new Color(0x00, 0x00, 0x01));
+ assertEquals("#000001", result);
- result = WolfBBS.getTeamWikiColor(GameRole.SHAMAN);
- assertEquals("#b7bad3", result);
-
- result = WolfBBS.getTeamWikiColor(GameRole.WOLF);
- assertEquals("#e0b8b8", result);
-
- result = WolfBBS.getTeamWikiColor(GameRole.MADMAN);
- assertEquals("#e0b8b8", result);
-
- result = WolfBBS.getTeamWikiColor(GameRole.HAMSTER);
- assertEquals("#b9d0be", result);
-
- return;
- }
-
- /**
- * Test of getDestinyColorWiki method, of class WolfBBS.
- */
- @Test
- public void testGetDestinyColorWiki() {
- System.out.println("getDestinyColorWiki");
-
- String result;
-
- result = WolfBBS.getDestinyColorWiki(Destiny.ALIVE);
+ result = WolfBBS.cnvWikiColor(new Color(0xff, 0xff, 0xff));
assertEquals("#ffffff", result);
- result = WolfBBS.getDestinyColorWiki(Destiny.DISSOLVE);
- assertEquals("#aaaaaa", result);
-
- result = WolfBBS.getDestinyColorWiki(Destiny.EATEN);
- assertEquals("#aaaaaa", result);
-
- result = WolfBBS.getDestinyColorWiki(Destiny.EXECUTED);
- assertEquals("#aaaaaa", result);
-
- result = WolfBBS.getDestinyColorWiki(Destiny.SUDDENDEATH);
- assertEquals("#aaaaaa", result);
+ result = WolfBBS.cnvWikiColor(new Color(0x12, 0x34, 0x56, 0x78));
+ assertEquals("#123456", result);
return;
}