Commit d3131963 authored by fallenstardust's avatar fallenstardust

serverInfo添加desc

parent cfd455c9
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
<server> <server>
<player-name>Knight of Hanoi</player-name> <player-name>Knight of Hanoi</player-name>
<name>萌卡直连正式+扩展卡服(右下角下载)</name> <name>萌卡直连正式+扩展卡服</name>
<desc>与本应用正式卡同步更新并提供超先行卡尝鲜</desc>
<ip>mygo.superpre.pro</ip> <ip>mygo.superpre.pro</ip>
<port>888</port> <port>888</port>
<keep>true</keep> <keep>true</keep>
...@@ -12,13 +13,15 @@ ...@@ -12,13 +13,15 @@
<server> <server>
<player-name>Knight of Hanoi</player-name> <player-name>Knight of Hanoi</player-name>
<name>决斗编年史</name> <name>决斗编年史</name>
<desc>由系统随机分配卡组决斗</desc>
<ip>duels.link</ip> <ip>duels.link</ip>
<port>2333</port> <port>2333</port>
<keep>true</keep> <keep>true</keep>
</server> </server>
<server> <server>
<player-name>Knight of Hanoi</player-name> <player-name>Knight of Hanoi</player-name>
<name>233正式1区(更新时间不定)</name> <name>233正式1区</name>
<desc>这些年更新时间不定</desc>
<ip>s1.ygo233.com</ip> <ip>s1.ygo233.com</ip>
<port>233</port> <port>233</port>
<keep>true</keep> <keep>true</keep>
...@@ -26,6 +29,7 @@ ...@@ -26,6 +29,7 @@
<server> <server>
<player-name>Knight of Hanoi</player-name> <player-name>Knight of Hanoi</player-name>
<name>2Pick轮抽</name> <name>2Pick轮抽</name>
<desc>临场随机组卡再进行决斗</desc>
<ip>2pick.mycard.moe</ip> <ip>2pick.mycard.moe</ip>
<port>765</port> <port>765</port>
<keep>true</keep> <keep>true</keep>
......
...@@ -6,6 +6,9 @@ import net.kk.xml.annotations.XmlElement; ...@@ -6,6 +6,9 @@ import net.kk.xml.annotations.XmlElement;
public class ServerInfo { public class ServerInfo {
@XmlElement("name") @XmlElement("name")
private String name; private String name;
@XmlElement("desc")
private String desc;
@XmlElement("ip") @XmlElement("ip")
private String serverAddr; private String serverAddr;
@XmlElement("port") @XmlElement("port")
...@@ -23,8 +26,9 @@ public class ServerInfo { ...@@ -23,8 +26,9 @@ public class ServerInfo {
} }
public ServerInfo(String name, String serverAddr, int port) { public ServerInfo(String name, String desc,String serverAddr, int port) {
this.name = name; this.name = name;
this.desc = desc;
this.serverAddr = serverAddr; this.serverAddr = serverAddr;
this.port = port; this.port = port;
} }
...@@ -45,6 +49,14 @@ public class ServerInfo { ...@@ -45,6 +49,14 @@ public class ServerInfo {
this.name = name; this.name = name;
} }
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getServerAddr() { public String getServerAddr() {
return serverAddr; return serverAddr;
} }
...@@ -103,6 +115,7 @@ public class ServerInfo { ...@@ -103,6 +115,7 @@ public class ServerInfo {
public String toString() { public String toString() {
return "ServerInfo{" + return "ServerInfo{" +
"name='" + name + '\'' + "name='" + name + '\'' +
"desc='" + desc + '\'' +
", serverAddr='" + serverAddr + '\'' + ", serverAddr='" + serverAddr + '\'' +
", port=" + port + ", port=" + port +
", playerName='" + playerName + '\'' + ", playerName='" + playerName + '\'' +
......
...@@ -213,7 +213,7 @@ public class ExCardListFragment extends Fragment { ...@@ -213,7 +213,7 @@ public class ExCardListFragment extends Fragment {
// break; // break;
case DownloadUtil.TYPE_DOWNLOAD_OK: case DownloadUtil.TYPE_DOWNLOAD_OK:
downloadState = DownloadState.NO_DOWNLOAD; downloadState = DownloadState.NO_DOWNLOAD;
AddServer(getActivity(), context.getString(R.string.Pre_Server_Name), Constants.URL_Mycard_Super_Pre_Server, Constants.PORT_Mycard_Super_Pre_Server, "Knight of Hanoi"); AddServer(getActivity(), context.getString(R.string.Pre_Server_Name), context.getString(R.string.tip_superpre_desc), Constants.URL_Mycard_Super_Pre_Server, Constants.PORT_Mycard_Super_Pre_Server, "Knight of Hanoi");
//changeDownloadButton();在下载完成后,通过EventBus通知下载完成(加入用户点击下载后临时切出本fragment,又在下载完成后切回,通过eventbus能保证按钮样式正确更新 //changeDownloadButton();在下载完成后,通过EventBus通知下载完成(加入用户点击下载后临时切出本fragment,又在下载完成后切回,通过eventbus能保证按钮样式正确更新
/* 注意,要先更新版本号 */ /* 注意,要先更新版本号 */
SharedPreferenceUtil.setExpansionDataVer(ServerUtil.serverExCardVersion); SharedPreferenceUtil.setExpansionDataVer(ServerUtil.serverExCardVersion);
......
...@@ -113,6 +113,7 @@ public class ServerListAdapter extends BaseRecyclerAdapterPlus<ServerInfo, BaseV ...@@ -113,6 +113,7 @@ public class ServerListAdapter extends BaseRecyclerAdapterPlus<ServerInfo, BaseV
int position = baseViewHolder.getAdapterPosition() int position = baseViewHolder.getAdapterPosition()
- getHeaderLayoutCount(); - getHeaderLayoutCount();
baseViewHolder.setText(R.id.server_name, serverInfo.getName()); baseViewHolder.setText(R.id.server_name, serverInfo.getName());
baseViewHolder.setText(R.id.server_desc, serverInfo.getDesc());
baseViewHolder.setText(R.id.text_ip, serverInfo.getServerAddr()); baseViewHolder.setText(R.id.text_ip, serverInfo.getServerAddr());
baseViewHolder.setText(R.id.text_player, serverInfo.getPlayerName()); baseViewHolder.setText(R.id.text_player, serverInfo.getPlayerName());
baseViewHolder.setText(R.id.text_port, String.valueOf(serverInfo.getPort())); baseViewHolder.setText(R.id.text_port, String.valueOf(serverInfo.getPort()));
......
package cn.garymb.ygomobile.utils; package cn.garymb.ygomobile.utils;
import static android.os.Build.VERSION_CODES.R;
import static cn.garymb.ygomobile.Constants.ASSET_SERVER_LIST; import static cn.garymb.ygomobile.Constants.ASSET_SERVER_LIST;
import static cn.garymb.ygomobile.Constants.URL_YGO233_DATAVER; import static cn.garymb.ygomobile.Constants.URL_YGO233_DATAVER;
import static cn.garymb.ygomobile.utils.StringUtils.isHost; import static cn.garymb.ygomobile.utils.StringUtils.isHost;
...@@ -32,6 +33,7 @@ import cn.garymb.ygomobile.bean.ServerInfo; ...@@ -32,6 +33,7 @@ import cn.garymb.ygomobile.bean.ServerInfo;
import cn.garymb.ygomobile.bean.ServerList; import cn.garymb.ygomobile.bean.ServerList;
import cn.garymb.ygomobile.bean.events.ExCardEvent; import cn.garymb.ygomobile.bean.events.ExCardEvent;
import cn.garymb.ygomobile.lite.BuildConfig; import cn.garymb.ygomobile.lite.BuildConfig;
import cn.garymb.ygomobile.lite.R;
import cn.garymb.ygomobile.ui.home.ServerListManager; import cn.garymb.ygomobile.ui.home.ServerListManager;
import cn.garymb.ygomobile.ui.plus.VUiKit; import cn.garymb.ygomobile.ui.plus.VUiKit;
import okhttp3.Call; import okhttp3.Call;
...@@ -112,7 +114,7 @@ public class ServerUtil { ...@@ -112,7 +114,7 @@ public class ServerUtil {
if (file.getName().endsWith(".zip") || file.getName().endsWith(".ypk")) { if (file.getName().endsWith(".zip") || file.getName().endsWith(".ypk")) {
LogUtil.e("GameUriManager", "读取压缩包"); LogUtil.e("GameUriManager", "读取压缩包");
try { try {
String serverName = null, serverHost = null, serverPort = null; String serverName = null, serverDesc = null, serverHost = null, serverPort = null;
ZipFile zipFile = new ZipFile(file.getAbsoluteFile(), "GBK"); ZipFile zipFile = new ZipFile(file.getAbsoluteFile(), "GBK");
Enumeration<ZipEntry> entris = zipFile.getEntries(); Enumeration<ZipEntry> entris = zipFile.getEntries();
ZipEntry entry; ZipEntry entry;
...@@ -139,6 +141,12 @@ public class ServerUtil { ...@@ -139,6 +141,12 @@ public class ServerUtil {
serverName = words[1]; serverName = words[1];
} }
} }
if (line.startsWith("ServerDesc")) {
String[] words = line.trim().split("[\t| =]+");
if (words.length >= 2) {
serverDesc = words[1];
}
}
if (line.startsWith("ServerHost")) { if (line.startsWith("ServerHost")) {
String[] words = line.trim().split("[\t| =]+"); String[] words = line.trim().split("[\t| =]+");
if (words.length >= 2) { if (words.length >= 2) {
...@@ -153,7 +161,7 @@ public class ServerUtil { ...@@ -153,7 +161,7 @@ public class ServerUtil {
} }
} }
if (serverName != null && (isHost(serverHost) || isValidIP(serverHost)) && isNumeric(serverPort)) { if (serverName != null && (isHost(serverHost) || isValidIP(serverHost)) && isNumeric(serverPort)) {
AddServer(context, serverName, serverHost, Integer.valueOf(serverPort), "Knight of Hanoi"); AddServer(context, serverName, serverDesc, serverHost, Integer.valueOf(serverPort), "Knight of Hanoi");
} else { } else {
Log.w(TAG,"can't parse ex-server properly"); Log.w(TAG,"can't parse ex-server properly");
} }
...@@ -202,7 +210,7 @@ public class ServerUtil { ...@@ -202,7 +210,7 @@ public class ServerUtil {
* @param port * @param port
* @param playerName * @param playerName
*/ */
public static void AddServer(Context context, String name, String Addr, int port, String playerName) { public static void AddServer(Context context, String name, String desc, String Addr, int port, String playerName) {
/* 读取本地文件server_list.xml */ /* 读取本地文件server_list.xml */
File xmlFile = new File(context.getFilesDir(), Constants.SERVER_FILE);//读取文件路径下的server_list.xml File xmlFile = new File(context.getFilesDir(), Constants.SERVER_FILE);//读取文件路径下的server_list.xml
...@@ -212,6 +220,7 @@ public class ServerUtil { ...@@ -212,6 +220,7 @@ public class ServerUtil {
List<ServerInfo> serverInfos = new ArrayList<>(); List<ServerInfo> serverInfos = new ArrayList<>();
ServerInfo mServerInfo = new ServerInfo(); ServerInfo mServerInfo = new ServerInfo();
mServerInfo.setName(name); mServerInfo.setName(name);
mServerInfo.setDesc(desc);
mServerInfo.setServerAddr(Addr); mServerInfo.setServerAddr(Addr);
mServerInfo.setPort(port); mServerInfo.setPort(port);
mServerInfo.setPlayerName(playerName); mServerInfo.setPlayerName(playerName);
......
...@@ -29,6 +29,31 @@ ...@@ -29,6 +29,31 @@
android:textColor="@color/holo_blue_bright" /> android:textColor="@color/holo_blue_bright" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="@dimen/label_width_middle"
android:layout_height="wrap_content"
android:text="@string/server_desc"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="@color/gold" />
<EditText
android:id="@+id/server_desc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="@string/optional_info"
android:inputType="textNoSuggestions"
android:maxLines="1"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="@color/holo_blue_bright" />
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
......
...@@ -67,7 +67,18 @@ ...@@ -67,7 +67,18 @@
android:textAppearance="@style/TextAppearance.AppCompat.Title" android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@color/brightgreen" android:textColor="@color/brightgreen"
android:textSize="15sp" android:textSize="15sp"
tools:text="233正式服务器" /> tools:text="serverName" />
<TextView
android:id="@+id/server_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="@color/holo_green_bright"
android:textSize="10sp"
tools:text="desc" />
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -109,6 +109,7 @@ ...@@ -109,6 +109,7 @@
<string name="server_list">Servidores de duelo</string> <string name="server_list">Servidores de duelo</string>
<string name="server_name">Nombre:</string> <string name="server_name">Nombre:</string>
<string name="server_desc">Nota:</string>
<string name="server_ip">Host:</string> <string name="server_ip">Host:</string>
<string name="server_user">Usuario:</string> <string name="server_user">Usuario:</string>
<string name="server_room_name">Nombre de la sala:</string> <string name="server_room_name">Nombre de la sala:</string>
...@@ -118,6 +119,7 @@ ...@@ -118,6 +119,7 @@
<string name="server_info_edit">Editar info del servidor</string> <string name="server_info_edit">Editar info del servidor</string>
<string name="save">Guardar</string> <string name="save">Guardar</string>
<string name="must_info">Información requerida</string> <string name="must_info">Información requerida</string>
<string name="optional_info">Información opcional</string>
<string name="server_is_exist">¡La información del servidor ya existe!</string> <string name="server_is_exist">¡La información del servidor ya existe!</string>
<string name="server_info_error">La información del servidor se completó incorrectamente</string> <string name="server_info_error">La información del servidor se completó incorrectamente</string>
<string name="card_search">Buscar</string> <string name="card_search">Buscar</string>
...@@ -369,5 +371,6 @@ ...@@ -369,5 +371,6 @@
<string name="Download_Precard_Failed">Falló la descarga de las cartas pre-lanzamiento</string> <string name="Download_Precard_Failed">Falló la descarga de las cartas pre-lanzamiento</string>
<string name="Pre_Server_Name">Servidor Super-pre Mycard</string> <string name="Pre_Server_Name">Servidor Super-pre Mycard</string>
<string name="tip_ypk_is_deleted">Please upgrade pre-released cards at once</string> <string name="tip_ypk_is_deleted">Please upgrade pre-released cards at once</string>
<string name="tip_superpre_desc">fastest upgrade. download expansions</string>
</resources> </resources>
...@@ -92,6 +92,7 @@ ...@@ -92,6 +92,7 @@
<!-- settings --> <!-- settings -->
<string name="server_list">ヂュエル</string> <string name="server_list">ヂュエル</string>
<string name="server_name">サーバー名:</string> <string name="server_name">サーバー名:</string>
<string name="server_desc">備考:</string>
<string name="server_ip">IP:</string> <string name="server_ip">IP:</string>
<string name="server_user">プレイヤ名:</string> <string name="server_user">プレイヤ名:</string>
<string name="server_room_name">房间密码:</string> <string name="server_room_name">房间密码:</string>
...@@ -101,6 +102,7 @@ ...@@ -101,6 +102,7 @@
<string name="server_info_edit">サーバー情報編集器</string> <string name="server_info_edit">サーバー情報編集器</string>
<string name="save">保存</string> <string name="save">保存</string>
<string name="must_info">必須</string> <string name="must_info">必須</string>
<string name="optional_info">任意</string>
<string name="server_is_exist">同名サーバー名がすでに存在しています!</string> <string name="server_is_exist">同名サーバー名がすでに存在しています!</string>
<string name="server_info_error">サーバー情報データエーラ発生</string> <string name="server_info_error">サーバー情報データエーラ発生</string>
<string name="card_search">カード検索</string> <string name="card_search">カード検索</string>
...@@ -358,4 +360,5 @@ ...@@ -358,4 +360,5 @@
<string name="tip_deckInfo_isNot_completeDeck">デッキ解析異常,オフィシャルパスコードに変更してください</string> <string name="tip_deckInfo_isNot_completeDeck">デッキ解析異常,オフィシャルパスコードに変更してください</string>
<string name="tip_ygopro_is_running">YGOPROは既に運行している,新しいデュエル開始できません,ルームパスワードを履歴に書きました、ゲームを終了してからこのルームを履歴から選択して入る事ができます</string> <string name="tip_ygopro_is_running">YGOPROは既に運行している,新しいデュエル開始できません,ルームパスワードを履歴に書きました、ゲームを終了してからこのルームを履歴から選択して入る事ができます</string>
<string name="tip_ypk_is_deleted">正式更新は非公式パスコードを無効にしますので常にパッチをダウンロードしてください</string> <string name="tip_ypk_is_deleted">正式更新は非公式パスコードを無効にしますので常にパッチをダウンロードしてください</string>
<string name="tip_superpre_desc">をアップデートする(新規カードを含める)</string>
</resources> </resources>
...@@ -92,6 +92,7 @@ ...@@ -92,6 +92,7 @@
<!-- settings --> <!-- settings -->
<string name="server_list">다이렉트 듀얼</string> <string name="server_list">다이렉트 듀얼</string>
<string name="server_name">이름:</string> <string name="server_name">이름:</string>
<string name="server_desc">비고:</string>
<string name="server_ip">호스트 정보:</string> <string name="server_ip">호스트 정보:</string>
<string name="server_user">별명:</string> <string name="server_user">별명:</string>
<string name="server_room_name">방 비밀번호:</string> <string name="server_room_name">방 비밀번호:</string>
...@@ -101,6 +102,7 @@ ...@@ -101,6 +102,7 @@
<string name="server_info_edit">서버 정보 편집</string> <string name="server_info_edit">서버 정보 편집</string>
<string name="save">저장</string> <string name="save">저장</string>
<string name="must_info">필수 입력</string> <string name="must_info">필수 입력</string>
<string name="optional_info">선택 사항 </string>
<string name="server_is_exist">서버 정보가 이미 존재합니다!</string> <string name="server_is_exist">서버 정보가 이미 존재합니다!</string>
<string name="server_info_error">서버 정보가 올바르지 않습니다</string> <string name="server_info_error">서버 정보가 올바르지 않습니다</string>
<string name="card_search">카드 검색</string> <string name="card_search">카드 검색</string>
...@@ -359,4 +361,5 @@ ...@@ -359,4 +361,5 @@
<string name="Download_Precard_Failed">Download pre-cards failed</string> <string name="Download_Precard_Failed">Download pre-cards failed</string>
<string name="Pre_Server_Name">Mycard Super-pre Server</string> <string name="Pre_Server_Name">Mycard Super-pre Server</string>
<string name="tip_ypk_is_deleted">Please upgrade pre-released cards at once</string> <string name="tip_ypk_is_deleted">Please upgrade pre-released cards at once</string>
<string name="tip_superpre_desc">Please upgrade pre-released cards at once</string>
</resources> </resources>
...@@ -92,6 +92,7 @@ ...@@ -92,6 +92,7 @@
<!-- settings --> <!-- settings -->
<string name="server_list">直连决斗</string> <string name="server_list">直连决斗</string>
<string name="server_name">名称:</string> <string name="server_name">名称:</string>
<string name="server_desc">备注:</string>
<string name="server_ip">主机信息:</string> <string name="server_ip">主机信息:</string>
<string name="server_user">昵称:</string> <string name="server_user">昵称:</string>
<string name="server_room_name">房间密码:</string> <string name="server_room_name">房间密码:</string>
...@@ -101,6 +102,7 @@ ...@@ -101,6 +102,7 @@
<string name="server_info_edit">服务器信息编辑</string> <string name="server_info_edit">服务器信息编辑</string>
<string name="save">保存</string> <string name="save">保存</string>
<string name="must_info">必填</string> <string name="must_info">必填</string>
<string name="optional_info">选填</string>
<string name="server_is_exist">服务器信息已经存在!</string> <string name="server_is_exist">服务器信息已经存在!</string>
<string name="server_info_error">服务器信息填写错误</string> <string name="server_info_error">服务器信息填写错误</string>
<string name="card_search">卡片搜索</string> <string name="card_search">卡片搜索</string>
...@@ -358,4 +360,5 @@ ...@@ -358,4 +360,5 @@
<string name="tip_deckInfo_isNot_completeDeck">当前卡组解析异常,将尽量转换为已有卡片</string> <string name="tip_deckInfo_isNot_completeDeck">当前卡组解析异常,将尽量转换为已有卡片</string>
<string name="tip_ygopro_is_running">当前有游戏正在运行,无法开启新的决斗,已将房间密码存入历史记录,请结束当前游戏后再选择该历史记录以加入房间</string> <string name="tip_ygopro_is_running">当前有游戏正在运行,无法开启新的决斗,已将房间密码存入历史记录,请结束当前游戏后再选择该历史记录以加入房间</string>
<string name="tip_ypk_is_deleted">正式卡更新会让旧先行卡失效,请及时重新下载先行卡补丁</string> <string name="tip_ypk_is_deleted">正式卡更新会让旧先行卡失效,请及时重新下载先行卡补丁</string>
<string name="tip_superpre_desc">与本应用正式卡同步更新并提供超先行卡尝鲜</string>
</resources> </resources>
...@@ -109,6 +109,7 @@ ...@@ -109,6 +109,7 @@
<string name="server_list">Duel Servers</string> <string name="server_list">Duel Servers</string>
<string name="server_name">Name:</string> <string name="server_name">Name:</string>
<string name="server_desc">Note:</string>
<string name="server_ip">Host:</string> <string name="server_ip">Host:</string>
<string name="server_user">User:</string> <string name="server_user">User:</string>
<string name="server_room_name">Room Name:</string> <string name="server_room_name">Room Name:</string>
...@@ -118,6 +119,7 @@ ...@@ -118,6 +119,7 @@
<string name="server_info_edit">Server Info Edit</string> <string name="server_info_edit">Server Info Edit</string>
<string name="save">Save</string> <string name="save">Save</string>
<string name="must_info">must info</string> <string name="must_info">must info</string>
<string name="optional_info">optional info</string>
<string name="server_is_exist">the server is exist</string> <string name="server_is_exist">the server is exist</string>
<string name="server_info_error">server info is bad.</string> <string name="server_info_error">server info is bad.</string>
<string name="card_search">Card Search</string> <string name="card_search">Card Search</string>
...@@ -368,4 +370,5 @@ ...@@ -368,4 +370,5 @@
<string name="tip_deckInfo_isNot_completeDeck">Card info Exception! Tried to become exsisted Card Info</string> <string name="tip_deckInfo_isNot_completeDeck">Card info Exception! Tried to become exsisted Card Info</string>
<string name="tip_ygopro_is_running">ygopro is running now. unable to create a new duel before it is closed. \nthe room password has been recorded in record list.\npls close ygopro and rejoin room through the record of room password</string> <string name="tip_ygopro_is_running">ygopro is running now. unable to create a new duel before it is closed. \nthe room password has been recorded in record list.\npls close ygopro and rejoin room through the record of room password</string>
<string name="tip_ypk_is_deleted">Please upgrade pre-released cards at once</string> <string name="tip_ypk_is_deleted">Please upgrade pre-released cards at once</string>
<string name="tip_superpre_desc">fastest upgrade. download expansions</string>
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment