Commit 508f48b0 authored by fallenstardust's avatar fallenstardust

优化setname导入

parent ec342d31
......@@ -712,7 +712,7 @@
!setname 0x31 命运女郎 フォーチュンレディ
!setname 0x32 火山 ヴォルカニック
!setname 0x33 黑羽 BF(ブラックフェザー)
!setname 0x1033 强袭黑羽 A_BF(アサルト ブラックフェザー)
!setname 0x1033 强袭黑羽 A BF(アサルト ブラックフェザー)
!setname 0x34 宝玉 宝玉
!setname 0x1034 宝玉兽 宝玉獣
!setname 0x2034 究极宝玉神 究極宝玉神
......@@ -963,8 +963,8 @@
!setname 0xed 地中族 サブテラー
!setname 0x10ed 地中族邪界 サブテラーマリス
!setname 0xee 秘旋谍 SPYRAL
!setname 0x10ee 秘旋谍装备 SPYRAL_GEAR
!setname 0x20ee 秘旋谍任务 SPYRAL_MISSION
!setname 0x10ee 秘旋谍装备 SPYRAL GEAR
!setname 0x20ee 秘旋谍任务 SPYRAL MISSION
!setname 0xef 堕天使
!setname 0xf0 风魔女 WW(ウィンド・ウィッチ)
!setname 0xf1 十二兽 十二獣
......
......@@ -3,6 +3,9 @@ package ocgcore;
import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray;
import android.widget.Toast;
import androidx.core.content.res.TypedArrayUtils;
import java.io.BufferedReader;
import java.io.Closeable;
......@@ -13,6 +16,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.zip.ZipEntry;
......@@ -145,12 +149,17 @@ public class StringManager implements Closeable {
// System.out.println(Arrays.toString(words));
//setcode
long id = toNumber(words[1]);
CardSet cardSet;
if (words.length >= 5) {
cardSet = new CardSet(id, words[2] + " " + words[3]);
//setname
String setname;
int beforeTab = line.lastIndexOf("\t");
int afterSetCode = line.indexOf(words[1]) + words[1].length() + 1;
if (beforeTab != -1) {
setname = line.substring(afterSetCode, beforeTab);
} else {
cardSet = new CardSet(id, words[2]);
setname = line.substring(afterSetCode);
}
CardSet cardSet;
cardSet = new CardSet(id, setname);
int i = mCardSets.indexOf(cardSet);
if (i >= 0) {
CardSet cardSet1 = mCardSets.get(i);
......@@ -203,10 +212,10 @@ public class StringManager implements Closeable {
/**
* @param index 索引
* @param def 默认值
* @param def 默认值
*/
public String getSystemString(Integer index, String def){
if(index <= 0){
public String getSystemString(Integer index, String def) {
if (index <= 0) {
return def;
}
try {
......@@ -222,7 +231,7 @@ public class StringManager implements Closeable {
public String getLimitString(long id) {
LimitType value = LimitType.valueOf(id);
if(value == null){
if (value == null) {
return String.valueOf(id);
}
return getSystemString(value.getLanguageIndex(), value.name());
......@@ -230,7 +239,7 @@ public class StringManager implements Closeable {
public String getTypeString(long id) {
CardType value = CardType.valueOf(id);
if(value == null){
if (value == null) {
return String.valueOf(id);
}
return getSystemString(value.getLanguageIndex(), value.name());
......@@ -238,7 +247,7 @@ public class StringManager implements Closeable {
public String getAttributeString(long id) {
CardAttribute value = CardAttribute.valueOf(id);
if(value == null){
if (value == null) {
return String.valueOf(id);
}
return getSystemString(value.getLanguageIndex(), value.name());
......@@ -246,27 +255,27 @@ public class StringManager implements Closeable {
public String getRaceString(long id) {
CardRace value = CardRace.valueOf(id);
if(value == null){
if (value == null) {
return String.format("0x%x", id);
}
return getSystemString(value.getLanguageIndex(), value.name());
}
public String getOtString(int ot, boolean full) {
if(!full || ot == 0){
if (!full || ot == 0) {
CardOt value = CardOt.valueOf(ot);
if(value == null){
if (value == null) {
return String.valueOf(ot);
}
return getSystemString(value.getLanguageIndex(), value.name());
}
StringBuilder stringBuilder = new StringBuilder();
boolean first = true;
for(CardOt _ot : CardOt.values()){
for (CardOt _ot : CardOt.values()) {
if (_ot.getId() == CardOt.NO_EXCLUSIVE.getId())
continue;
if((_ot.getId() & ot) != 0){
if(first){
if ((_ot.getId() & ot) != 0) {
if (first) {
first = false;
} else {
stringBuilder.append("|");
......@@ -279,7 +288,7 @@ public class StringManager implements Closeable {
public String getCategoryString(long id) {
CardCategory value = CardCategory.valueOf(id);
if(value == null){
if (value == null) {
return String.valueOf(id);
}
return getSystemString(value.getLanguageIndex(), value.name());
......
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