Squashed commit of the following:

commit ba361b5f0b
Merge: e8ad4d5 dbfd26b
Author: Nico <ainililia@163.com>
Date:   Wed Nov 14 16:44:54 2018 +0800

    Merge pull request #9 from abbychau/master

    Fix english grammatical errors

commit dbfd26b91e
Author: Abby <abbychau@gmail.com>
Date:   Wed Nov 14 17:24:19 2018 +0900

    add space

commit 1ea32fe93d
Author: Abby <abbychau@gmail.com>
Date:   Wed Nov 14 17:16:18 2018 +0900

    fix words and formats

commit a5cc4e1a08
Author: Abby <abbychau@gmail.com>
Date:   Wed Nov 14 17:02:15 2018 +0900

    fix 's

commit 42dcd95b07
Author: Abby <abbychau@gmail.com>
Date:   Wed Nov 14 16:57:54 2018 +0900

    Fix english grammatical errors

# Conflicts:
#	landlords-client/src/main/java/org/nico/ratel/landlords/client/event/ClientEventListener_CODE_SHOW_OPTIONS.java
This commit is contained in:
nico
2018-11-14 17:23:59 +08:00
parent 39badab555
commit d428f0ac35
22 changed files with 38 additions and 28 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ If you want to choose **Link**
```
You can enter ``7890j`` or ``789tj``
If you want to choose **The king of Fried**
If you want to choose **The Joker Bomb**
```
┌──┐──┐
│S |X |
@@ -9,7 +9,7 @@ public class ClientEventListener_CODE_CLIENT_CONNECT extends ClientEventListener
@Override
public void call(Channel channel, String data) {
SimplePrinter.printNotice("Connection to server successful, welcome to ratel !!");
SimplePrinter.printNotice("Connection to server is successful. Welcome to ratel!!");
SimpleClient.id = Integer.parseInt(data);
}
@@ -23,7 +23,7 @@ public class ClientEventListener_CODE_CLIENT_EXIT extends ClientEventListener{
}else {
role = String.valueOf(map.get("exitClientNickname"));
}
SimplePrinter.printNotice(role + " withdrew from the room, room dissolve!!");
SimplePrinter.printNotice(role + " withdrew from the room. Room disbanded!!");
get(ClientEventCode.CODE_SHOW_OPTIONS).call(channel, data);
}
@@ -21,7 +21,7 @@ public class ClientEventListener_CODE_GAME_LANDLORD_CONFIRM extends ClientEventL
String landlordNickname = String.valueOf(map.get("landlordNickname"));
SimplePrinter.printNotice(landlordNickname + " grabbed the landlord and got an extra three poker shots");
SimplePrinter.printNotice(landlordNickname + " grabbed the landlord and got extra three poker shots");
List<Poker> additionalPokers = Noson.convert(map.get("additionalPokers"), new NoType<List<Poker>>() {});
SimplePrinter.printPokers(additionalPokers);
@@ -8,7 +8,7 @@ public class ClientEventListener_CODE_GAME_LANDLORD_CYCLE extends ClientEventLis
@Override
public void call(Channel channel, String data) {
SimplePrinter.printNotice("No player takes the landowner, resend poker");
SimplePrinter.printNotice("No player takes the landlord, so redealing cards.");
}
@@ -18,7 +18,7 @@ public class ClientEventListener_CODE_GAME_LANDLORD_ELECT extends ClientEventLis
int turnClientId = (int) map.get("nextClientId");
if(turnClientId == SimpleClient.id) {
SimplePrinter.printNotice("It's your turn to rob the landlord[Y/N] (enter [EXIT] to exit current room)");
SimplePrinter.printNotice("It's your turn. Do you want to rob the landlord? [Y/N] (enter [EXIT] to exit current room)");
String line = SimpleWriter.write("Y/N");
if(line.equalsIgnoreCase("EXIT")) {
pushToServer(channel, ServerEventCode.CODE_CLIENT_EXIT);
@@ -31,7 +31,7 @@ public class ClientEventListener_CODE_GAME_LANDLORD_ELECT extends ClientEventLis
call(channel, data);
}
}else {
SimplePrinter.printNotice("It's turn " + map.get("nextClientNickname") + " to confirm, please wait patiently !");
SimplePrinter.printNotice("It's " + map.get("nextClientNickname") + "'s turn. Please wait patiently for his/her confirmation !");
}
}
@@ -13,7 +13,7 @@ public class ClientEventListener_CODE_GAME_OVER extends ClientEventListener{
@Override
public void call(Channel channel, String data) {
Map<String, Object> map = MapHelper.parser(data);
SimplePrinter.printNotice(map.get("winnerNickname") + " win");
SimplePrinter.printNotice(map.get("winnerNickname") + " wins");
SimplePrinter.printNotice("Game over");
pushToServer(channel, ServerEventCode.CODE_CLIENT_EXIT);
}
@@ -21,12 +21,12 @@ public class ClientEventListener_CODE_GAME_POKER_PLAY extends ClientEventListene
public void call(Channel channel, String data) {
Map<String, Object> map = MapHelper.parser(data);
SimplePrinter.printNotice("It's your turn to play, your pokers are as follows");
SimplePrinter.printNotice("It's your turn to play, your pokers are as follows: ");
List<Poker> pokers = Noson.convert(map.get("pokers"), new NoType<List<Poker>>() {});
SimplePrinter.printPokers(pokers);
SimplePrinter.printNotice("Please enter the card you came up (enter [EXIT] to exit current room, enter [PASS] jump current round)");
SimplePrinter.printNotice("Please enter the card you came up with (enter [EXIT] to exit current room, enter [PASS] to jump current round)");
String line = SimpleWriter.write("card");
if(line == null){
@@ -9,7 +9,7 @@ public class ClientEventListener_CODE_GAME_POKER_PLAY_CANT_PASS extends ClientEv
@Override
public void call(Channel channel, String data) {
SimplePrinter.printNotice("The last time you play the card, you can't pass");
SimplePrinter.printNotice("You played the previous card, so you can't pass.");
pushToServer(channel, ServerEventCode.CODE_GAME_POKER_PLAY_REDIRECT);
}
@@ -10,7 +10,7 @@ public class ClientEventListener_CODE_GAME_POKER_PLAY_INVALID extends ClientEven
@Override
public void call(Channel channel, String data) {
SimplePrinter.printNotice("Out pokers format is invalid");
SimplePrinter.printNotice("Out pokers' format is invalid");
pushToServer(channel, ServerEventCode.CODE_GAME_POKER_PLAY_REDIRECT);
}
@@ -9,7 +9,7 @@ public class ClientEventListener_CODE_GAME_POKER_PLAY_LESS extends ClientEventLi
@Override
public void call(Channel channel, String data) {
SimplePrinter.printNotice("Your pokers type is less than pre pokers, could not beat !!");
SimplePrinter.printNotice("Your pokers' type has lower rank than the previous. You could not play this combination !!");
pushToServer(channel, ServerEventCode.CODE_GAME_POKER_PLAY_REDIRECT);
}
@@ -14,7 +14,7 @@ public class ClientEventListener_CODE_GAME_POKER_PLAY_MISMATCH extends ClientEve
public void call(Channel channel, String data) {
Map<String, Object> map = MapHelper.parser(data);
SimplePrinter.printNotice("Your pokers type is " + map.get("playType") + " (" + map.get("playCount") + ") but pre pokers type is " + map.get("preType") + " (" + map.get("preCount") + "), mismatch !!");
SimplePrinter.printNotice("Your pokers' type is " + map.get("playType") + " (" + map.get("playCount") + ") but previous pokers' type is " + map.get("preType") + " (" + map.get("preCount") + "), mismatch !!");
pushToServer(channel, ServerEventCode.CODE_GAME_POKER_PLAY_REDIRECT);
}
@@ -15,7 +15,7 @@ public class ClientEventListener_CODE_GAME_POKER_PLAY_PASS extends ClientEventLi
public void call(Channel channel, String data) {
Map<String, Object> map = MapHelper.parser(data);
SimplePrinter.printNotice(map.get("clientNickname") + " dont out, turn next player " + map.get("nextClientNickname") + " out pokers");
SimplePrinter.printNotice(map.get("clientNickname") + " passed. It is now " + map.get("nextClientNickname") + "'s turn.");
int turnClientId = (int) map.get("nextClientId");
if(SimpleClient.id == turnClientId) {
@@ -19,19 +19,17 @@ public class ClientEventListener_CODE_GAME_POKER_PLAY_REDIRECT extends ClientEve
int sellClientId = (int) map.get("sellClientId");
SimplePrinter.printNotice("");
SimplePrinter.printNotice("Everyone's current situation: ");
SimplePrinter.printNotice("");
SimplePrinter.printNotice("\nEveryone's number of cards:\n");
List<Map<String, Object>> clientInfos = (List<Map<String, Object>>) map.get("clientInfos");
for(Map<String, Object> clientInfo: clientInfos) {
SimplePrinter.printNotice(clientInfo.get("clientNickname") + "\t[" + clientInfo.get("type") + "] surplus " + clientInfo.get("surplus") + " piece of poker");
SimplePrinter.printNotice(clientInfo.get("clientNickname") + "\t(" + clientInfo.get("type") + "): \t " + clientInfo.get("surplus") + " cards");
}
SimplePrinter.printNotice("");
if(sellClientId == SimpleClient.id) {
get(ClientEventCode.CODE_GAME_POKER_PLAY).call(channel, data);
}else {
SimplePrinter.printNotice("Next out player is " + map.get("sellClinetNickname") + ", please wait for him to out his poker");
SimplePrinter.printNotice("Next player is " + map.get("sellClinetNickname") + ". Please wait for him to play his cards.");
}
}
@@ -24,7 +24,7 @@ public class ClientEventListener_CODE_GAME_STARTING extends ClientEventListener{
List<Poker> pokers = Noson.convert(map.get("pokers"), new NoType<List<Poker>>() {});
SimplePrinter.printNotice("");
SimplePrinter.printNotice("Your pokers is");
SimplePrinter.printNotice("Your pokers are");
SimplePrinter.printPokers(pokers);
get(ClientEventCode.CODE_GAME_LANDLORD_ELECT).call(channel, data);
@@ -13,7 +13,7 @@ public class ClientEventListener_CODE_ROOM_CREATE_SUCCESS extends ClientEventLis
Room room = Noson.convert(data, Room.class);
SimplePrinter.printNotice("You has been create room with id " + room.getId());
SimplePrinter.printNotice("You have created a room with id " + room.getId());
SimplePrinter.printNotice("Please wait for other players to join !");
}
@@ -14,7 +14,7 @@ public class ClientEventListener_CODE_ROOM_JOIN_FAIL_BY_FULL extends ClientEvent
public void call(Channel channel, String data) {
Map<String, Object> dataMap = MapHelper.parser(data);
SimplePrinter.printNotice("Join room fail, room " + dataMap.get("roomId") + " player count is full!");
SimplePrinter.printNotice("Join room failed. Room " + dataMap.get("roomId") + " player count is full!");
ClientEventListener.get(ClientEventCode.CODE_SHOW_OPTIONS).call(channel, data);
}
@@ -14,7 +14,7 @@ public class ClientEventListener_CODE_ROOM_JOIN_FAIL_BY_INEXIST extends ClientEv
public void call(Channel channel, String data) {
Map<String, Object> dataMap = MapHelper.parser(data);
SimplePrinter.printNotice("Join room fail, room " + dataMap.get("roomId") + " is inexist!");
SimplePrinter.printNotice("Join room failed. Room " + dataMap.get("roomId") + " inexists!");
ClientEventListener.get(ClientEventCode.CODE_SHOW_OPTIONS).call(channel, data);
}
@@ -16,10 +16,10 @@ public class ClientEventListener_CODE_ROOM_JOIN_SUCCESS extends ClientEventListe
int joinClientId = (int) map.get("clientId");
if(SimpleClient.id == joinClientId) {
SimplePrinter.printNotice("You has been join room" + map.get("roomId") + ", there are " + map.get("roomClientCount") + " player in the room now");
SimplePrinter.printNotice("You have joined room" + map.get("roomId") + ". There are " + map.get("roomClientCount") + " players in the room now.");
SimplePrinter.printNotice("Please wait for other players to join, start a good game when the room player reaches three !");
}else {
SimplePrinter.printNotice(map.get("clientNickname") + " join room, the current number of rooms is " + map.get("roomClientCount"));
SimplePrinter.printNotice(map.get("clientNickname") + " joined room, the current number of room player is " + map.get("roomClientCount"));
}
@@ -18,6 +18,7 @@ public class ClientEventListener_CODE_SHOW_OPTIONS extends ClientEventListener{
SimplePrinter.printNotice("3. Setting");
SimplePrinter.printNotice("Please enter the number of options");
String line = SimpleWriter.write("options");
while(line == null || OptionsUtils.getOptions(line) == -1) {
SimplePrinter.printNotice("Invalid option, please choose again");
line = SimpleWriter.write("option");
@@ -18,13 +18,13 @@ public class ClientEventListener_CODE_SHOW_POKERS extends ClientEventListener{
Map<String, Object> map = MapHelper.parser(data);
SimplePrinter.printNotice(map.get("clientNickname") + " out of the poker");
SimplePrinter.printNotice("\n" + map.get("clientNickname") + " played:");
List<Poker> pokers = Noson.convert(map.get("pokers"), new NoType<List<Poker>>() {});
SimplePrinter.printPokers(pokers);
if(map.containsKey("sellClinetNickname")) {
SimplePrinter.printNotice("Next out player is " + map.get("sellClinetNickname") + ", please wait for him to out his poker");
SimplePrinter.printNotice("Next player is " + map.get("sellClinetNickname") + ". Please wait for him to play his pokers.");
}
}
@@ -3,6 +3,8 @@ package org.nico.ratel.landlords.print;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import org.nico.ratel.landlords.entity.Poker;
import org.nico.ratel.landlords.helper.PokerHelper;
@@ -19,6 +21,15 @@ public class SimplePrinter {
System.out.println(msg);
}
public static void printNotice(String msgKey, String locale) {
//TODO : read locale
Map<String,Map<String, String>> map = new HashMap<String,Map<String, String>>();
map.put("english", new HashMap<String, String>());
map.get("eng").put("caterpillar", "caterpillar's message!!");
System.out.println(map.get(locale).get(msgKey));
}
public static void serverLog(String msg) {
System.out.println(FORMAT.format(new Date()) + "-> " + msg);
}