Commit 2a26ebc5 authored by qq247321453's avatar qq247321453

读取字符串改动

parent d94847e8
......@@ -122,18 +122,11 @@ public interface Constants {
int REQUEST_CHOOSE_IMG = 0x1000 + 0x21;
int REQUEST_CHOOSE_FOLDER = 0x1000 + 0x22;
int REQUEST_SETTINGS_CODE = 0x1000 + 0x23;
int STRING_TYPE_START = 1050;
int STRING_ATTRIBUTE_START = 1010;
int STRING_RACE_START = 1020;
int STRING_OT_START = 1239;
int UNSORT_TIMES = 0x80;
int CARD_RESULT_GRAVITY = Gravity.LEFT;
int CARD_SEARCH_GRAVITY = Gravity.RIGHT;
int STRING_LIMIT_START = 1315;
int STRING_CATEGORY_START = 1100;
int DEFAULT_CARD_COUNT = 500;
int DECK_WIDTH_MAX_COUNT = 15;
int DECK_WIDTH_COUNT = 10;
......
......@@ -5,6 +5,7 @@ import android.text.TextUtils;
import java.util.List;
import ocgcore.data.Card;
import ocgcore.enums.CardOt;
import ocgcore.enums.CardType;
class CardSearchInfo {
......@@ -111,8 +112,12 @@ class CardSearchInfo {
}
}
}
if (ot > 0) {
if (card.Ot.getId() != ot) {
if (ot > CardOt.ALL.getId()) {
if(ot == CardOt.NO_EXCLUSIVE.getId()){
if(card.Ot == CardOt.OCG.getId() || card.Ot == CardOt.TCG.getId()){
return false;
}
} else if (card.Ot != ot) {
return false;
}
}
......@@ -136,7 +141,7 @@ class CardSearchInfo {
if (types.length > 0) {
boolean st = false;
for (long cardType : types) {
if (cardType == CardType.Spell.value() || cardType == CardType.Trap.value()) {
if (cardType == CardType.Spell.getId() || cardType == CardType.Trap.getId()) {
st = true;
break;
}
......@@ -145,46 +150,52 @@ class CardSearchInfo {
for (long type : types) {
if (type > 0) {
if (st) {
//效果以外
if (type == CardType.Non_Effect.getId()) {
if (card.isType(CardType.Effect)) {
return false;
}
}
//魔法
if (type == CardType.Normal.value()) {
else if (type == CardType.Normal.getId()) {
//通常
if (card.isType(CardType.Normal)) {
//带通常的魔法陷阱
if (card.Type != (CardType.Spell.value() | CardType.Normal.value())
&& card.Type != (CardType.Trap.value() | CardType.Normal.value())) {
if (card.Type != (CardType.Spell.getId() | CardType.Normal.getId())
&& card.Type != (CardType.Trap.getId() | CardType.Normal.getId())) {
return false;
}
} else {
//只有魔法/陷阱
if (card.Type != CardType.Spell.value() && card.Type != CardType.Trap.value())
if (card.Type != CardType.Spell.getId() && card.Type != CardType.Trap.getId())
return false;
}
continue;
}
} else {
//排除通常怪兽里的token卡
if (type == CardType.Normal.value()) {
if ((card.Type & CardType.Token.value()) == CardType.Token.value())
if (type == CardType.Normal.getId()) {
if ((card.Type & CardType.Token.getId()) == CardType.Token.getId())
return false;
}
}
//效果怪兽
if (type == CardType.Effect.value()) {
if ((card.Type & CardType.Effect.value()) == CardType.Effect.value()) {
if (type == CardType.Effect.getId()) {
if ((card.Type & CardType.Effect.getId()) == CardType.Effect.getId()) {
//如果是融合/仪式/同调/超量/连接
if ((card.Type & CardType.Fusion.value()) == CardType.Fusion.value()
|| (card.Type & CardType.Ritual.value()) == CardType.Ritual.value()
|| (card.Type & CardType.Synchro.value()) == CardType.Synchro.value()
|| (card.Type & CardType.Xyz.value()) == CardType.Xyz.value()
|| (card.Type & CardType.Link.value()) == CardType.Link.value()
if ((card.Type & CardType.Fusion.getId()) == CardType.Fusion.getId()
|| (card.Type & CardType.Ritual.getId()) == CardType.Ritual.getId()
|| (card.Type & CardType.Synchro.getId()) == CardType.Synchro.getId()
|| (card.Type & CardType.Xyz.getId()) == CardType.Xyz.getId()
|| (card.Type & CardType.Link.getId()) == CardType.Link.getId()
)
return false;
} else {
return false;
}
} else if (type == CardType.Non_Effect.value()) {
} else if (type == CardType.Non_Effect.getId()) {
//非效果怪兽
if ((card.Type & CardType.Effect.value()) == CardType.Effect.value())
if ((card.Type & CardType.Effect.getId()) == CardType.Effect.getId())
return false;
} else if ((card.Type & type) != type) {
return false;
......
......@@ -102,6 +102,9 @@ public class CardListAdapter extends BaseRecyclerAdapterPlus<Card, ViewHolder> i
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Card item = getItem(position);
if(item == null){
return;
}
imageLoader.bindImage(holder.cardImage, item.Code);
holder.cardName.setText(item.Name);
if (item.isType(CardType.Monster)) {
......
......@@ -278,7 +278,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
type.setText(CardUtils.getAllTypeString(cardInfo, mStringManager).replace("/", "|"));
attrView.setText(mStringManager.getAttributeString(cardInfo.Attribute));
otView.setText(mStringManager.getOtString(cardInfo.Ot.getId(), cardInfo.Ot.name()));
otView.setText(mStringManager.getOtString(cardInfo.Ot));
long[] sets = cardInfo.getSetCode();
setName.setText("");
int index = 0;
......
......@@ -233,7 +233,7 @@ public class CardSearcher implements View.OnClickListener {
pScale.setVisibility(View.INVISIBLE);
LinkMarkerButton.setVisibility(View.INVISIBLE);
resetMonster();
} else if (value == CardType.Spell.value()) {
} else if (value == CardType.Spell.getId()) {
layout_monster.setVisibility(View.INVISIBLE);
raceSpinner.setVisibility(View.GONE);
typeSpellSpinner.setVisibility(View.VISIBLE);
......@@ -241,7 +241,7 @@ public class CardSearcher implements View.OnClickListener {
pScale.setVisibility(View.INVISIBLE);
LinkMarkerButton.setVisibility(View.INVISIBLE);
resetMonster();
} else if (value == CardType.Trap.value()) {
} else if (value == CardType.Trap.getId()) {
layout_monster.setVisibility(View.INVISIBLE);
raceSpinner.setVisibility(View.GONE);
typeSpellSpinner.setVisibility(View.GONE);
......@@ -328,21 +328,14 @@ public class CardSearcher implements View.OnClickListener {
}*/
private void initOtSpinners(Spinner spinner) {
CardOt[] ots = CardOt.values();
List<SimpleSpinnerItem> items = new ArrayList<>();
items.add(new SimpleSpinnerItem(0, getString(R.string.label_ot)));
for (CardOt item : ots) {
if (item.ordinal() != 0) {
items.add(new SimpleSpinnerItem(item.ordinal(),
mStringManager.getOtString(item.ordinal(), item.toString()))
);
for (CardOt item : CardOt.values()) {
if (item != CardOt.ALL) {
items.add(new SimpleSpinnerItem(item.getId(),
mStringManager.getOtString(item.getId())));
}
}/*
items.add(new SimpleSpinnerItem(1,"OCG"));
items.add(new SimpleSpinnerItem(2,"TCG"));
items.add(new SimpleSpinnerItem(3,"OCG&TCG"));
items.add(new SimpleSpinnerItem(4,"DIY"));
items.add(new SimpleSpinnerItem(8,"简中"));*/
}
SimpleSpinnerAdapter adapter = new SimpleSpinnerAdapter(mContext);
adapter.setColor(Color.WHITE);
adapter.setColor(Color.WHITE);
......@@ -362,13 +355,12 @@ public class CardSearcher implements View.OnClickListener {
LimitType[] eitems = LimitType.values();
List<SimpleSpinnerItem> items = new ArrayList<>();
for (LimitType item : eitems) {
long val = item.value();
if (val == 0) {
items.add(new SimpleSpinnerItem(val, getString(R.string.label_limit)));
} else if (val == LimitType.All.value()) {
items.add(new SimpleSpinnerItem(val, getString(R.string.all)));
if (item == LimitType.None) {
items.add(new SimpleSpinnerItem(item.getId(), getString(R.string.label_limit)));
} else if (item == LimitType.All) {
items.add(new SimpleSpinnerItem(item.getId(), getString(R.string.all)));
} else {
items.add(new SimpleSpinnerItem(val, mStringManager.getLimitString(val)));
items.add(new SimpleSpinnerItem(item.getId(), mStringManager.getLimitString(item.getId())));
}
}
SimpleSpinnerAdapter adapter = new SimpleSpinnerAdapter(mContext);
......@@ -453,11 +445,10 @@ public class CardSearcher implements View.OnClickListener {
}
List<SimpleSpinnerItem> items = new ArrayList<>();
for (CardType item : eitems) {
long val = item.value();
if (val == 0) {
items.add(new SimpleSpinnerItem(val, getString(R.string.label_type)));
if (item == CardType.None) {
items.add(new SimpleSpinnerItem(item.getId(), getString(R.string.label_type)));
} else {
items.add(new SimpleSpinnerItem(val, mStringManager.getTypeString(val)));
items.add(new SimpleSpinnerItem(item.getId(), mStringManager.getTypeString(item.getId())));
}
}
SimpleSpinnerAdapter adapter = new SimpleSpinnerAdapter(mContext);
......@@ -470,11 +461,10 @@ public class CardSearcher implements View.OnClickListener {
CardAttribute[] attributes = CardAttribute.values();
List<SimpleSpinnerItem> items = new ArrayList<>();
for (CardAttribute item : attributes) {
long val = item.value();
if (val == 0) {
items.add(new SimpleSpinnerItem(val, getString(R.string.label_attr)));
if (item == CardAttribute.None) {
items.add(new SimpleSpinnerItem(CardAttribute.None.getId(), getString(R.string.label_attr)));
} else {
items.add(new SimpleSpinnerItem(val, mStringManager.getAttributeString(val)));
items.add(new SimpleSpinnerItem(item.getId(), mStringManager.getAttributeString(item.getId())));
}
}
SimpleSpinnerAdapter adapter = new SimpleSpinnerAdapter(mContext);
......
......@@ -73,11 +73,11 @@ public class CardSort implements Comparator<Card> {
if(sortKey1 == SORT_SPELL || sortKey2 == SORT_TRAP){
long type1, type2;
if(sortKey1 == SORT_SPELL){
type1 = c1.Type ^ CardType.Spell.value();
type2 = c2.Type ^ CardType.Spell.value();
type1 = c1.Type ^ CardType.Spell.getId();
type2 = c2.Type ^ CardType.Spell.getId();
} else {
type1 = c1.Type ^ CardType.Trap.value();
type2 = c2.Type ^ CardType.Trap.value();
type1 = c1.Type ^ CardType.Trap.getId();
type2 = c2.Type ^ CardType.Trap.getId();
}
int rs = comp(type1, type2);
if (rs == 0) {
......@@ -123,7 +123,7 @@ public class CardSort implements Comparator<Card> {
if (rs != 0) {
return rs;
}
rs = comp(c1.Ot.getId(), c2.Ot.getId());
rs = comp(c1.Ot, c2.Ot);
if (rs != 0) {
return rs;
}
......
......@@ -14,7 +14,7 @@ public class CardUtils {
if (card.isType(CardType.Spell)) {
for (CardType type : cardTypes) {
if (card.isType(type)) {
stringBuilder.append(stringManager.getTypeString(type.value()));
stringBuilder.append(stringManager.getTypeString(type.getId()));
// break;
}
}
......@@ -22,7 +22,7 @@ public class CardUtils {
} else if (card.isType(CardType.Trap)) {
for (CardType type : cardTypes) {
if (card.isType(type)) {
stringBuilder.append(stringManager.getTypeString(type.value()));
stringBuilder.append(stringManager.getTypeString(type.getId()));
}
// break;
}
......@@ -35,10 +35,10 @@ public class CardUtils {
} else {
isFrst = false;
}
String str = stringManager.getTypeString(type.value());
String str = stringManager.getTypeString(type.getId());
if (TextUtils.isEmpty(str)) {
stringBuilder.append("0x");
stringBuilder.append(String.format("%X", type.value()));
stringBuilder.append(String.format("%X", type.getId()));
} else {
stringBuilder.append(str);
}
......@@ -47,4 +47,24 @@ public class CardUtils {
}
return stringBuilder.toString();
}
public int value2Index(long type) {
//0 1 2 3 4
//1 2 4 8 16
int i = 0;
long start;
do {
start = (long) Math.pow(2, i);
if (start == type) {
return i;
} else if (start > type) {
return -1;
}
i++;
}
while (start < type);
return i;
}
}
......@@ -28,6 +28,7 @@ import cn.garymb.ygomobile.App;
import cn.garymb.ygomobile.AppsSettings;
import cn.garymb.ygomobile.utils.IOUtils;
import ocgcore.data.Card;
import ocgcore.enums.CardAttribute;
import ocgcore.enums.CardOt;
......@@ -192,7 +193,7 @@ public class CardManager {
do {
Card cardData = new Card();
cardData.Code = reader.getInt(0);
cardData.Ot = CardOt.of(reader.getInt(1));
cardData.Ot = reader.getInt(1);
cardData.Alias = reader.getInt(2);
cardData.SetCode = reader.getLong(3);
cardData.Type = reader.getLong(4);
......
......@@ -11,6 +11,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
......@@ -22,7 +23,12 @@ import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.utils.IOUtils;
import cn.garymb.ygomobile.utils.StringUtils;
import ocgcore.data.CardSet;
import ocgcore.enums.CardAttribute;
import ocgcore.enums.CardCategory;
import ocgcore.enums.CardOt;
import ocgcore.enums.CardRace;
import ocgcore.enums.CardType;
import ocgcore.enums.LimitType;
public class StringManager implements Closeable {
private static final String PRE_SYSTEM = "!system";
......@@ -125,7 +131,7 @@ public class StringManager implements Closeable {
FileInputStream inputStream = null;
try {
inputStream = new FileInputStream(file);
in = new InputStreamReader(inputStream, "utf-8");
in = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
BufferedReader reader = new BufferedReader(in);
String line = null;
while ((line = reader.readLine()) != null) {
......@@ -195,71 +201,71 @@ public class StringManager implements Closeable {
return 0;
}
public String getSystemString(int key) {
return mSystem.get(Integer.valueOf(key));
}
public String getSystemString(int start, long value) {
return getSystemString(start + value2Index(value));
}
public String getLimitString(long value) {
// String str =
// Log.d("kk", value + "=" + str);
return getSystemString((int) (Constants.STRING_LIMIT_START + value));
/**
* @param index 索引
* @param def 默认值
*/
public String getSystemString(Integer index, String def){
if(index <= 0){
return def;
}
try {
String str = mSystem.get(index);
if (TextUtils.isEmpty(str)) {
return def;
}
return StringUtils.toDBC(str);
} catch (Exception e) {
return def;
}
}
public String getTypeString(long value) {
return getSystemString(Constants.STRING_TYPE_START, value);
public String getLimitString(long id) {
LimitType value = LimitType.valueOf(id);
if(value == null){
return String.valueOf(id);
}
return getSystemString(value.getLanguageIndex(), value.name());
}
public String getAttributeString(long value) {
return getSystemString(Constants.STRING_ATTRIBUTE_START, value);
public String getTypeString(long id) {
CardType value = CardType.valueOf(id);
if(value == null){
return String.valueOf(id);
}
return getSystemString(value.getLanguageIndex(), value.name());
}
public String getRaceString(long value) {
String race = getSystemString(Constants.STRING_RACE_START, value);
if (TextUtils.isEmpty(race)) {
return String.format("0x%X", value);
public String getAttributeString(long id) {
CardAttribute value = CardAttribute.valueOf(id);
if(value == null){
return String.valueOf(id);
}
return race;
return getSystemString(value.getLanguageIndex(), value.name());
}
public String getOtString(int ot, String def) {
if (ot == CardOt.All.ordinal()) {
return "-";
}
try {
String str = getSystemString(Constants.STRING_OT_START + ot);
if (TextUtils.isEmpty(str)) {
return def;//String.valueOf(CardOt.values()[ot]);
}
return StringUtils.toDBC(str);
} catch (Exception e) {
return def;
public String getRaceString(long id) {
CardRace value = CardRace.valueOf(id);
if(value == null){
return String.format("0x%x", id);
}
return getSystemString(value.getLanguageIndex(), value.name());
}
public String getCategoryString(long value) {
return getSystemString(Constants.STRING_CATEGORY_START, value);
public String getOtString(int ot) {
CardOt value = CardOt.valueOf(ot);
if(value == null){
return String.valueOf(ot);
}
return getSystemString(value.getLanguageIndex(), value.name());
}
public int value2Index(long type) {
//0 1 2 3 4
//1 2 4 8 16
int i = 0;
long start;
do {
start = (long) Math.pow(2, i);
if (start == type) {
return i;
} else if (start > type) {
return -1;
}
i++;
public String getCategoryString(long id) {
CardCategory value = CardCategory.valueOf(id);
if(value == null){
return String.valueOf(id);
}
while (start < type);
return i;
return getSystemString(value.getLanguageIndex(), value.name());
}
private long toNumber(String str) {
......
......@@ -63,7 +63,7 @@ public class Card extends CardData implements Parcelable {
}
public static boolean isType(long Type, CardType type) {
return ((Type & type.value()) != 0);
return ((Type & type.getId()) != 0);
}
public static boolean isSpellTrap(long Type) {
......@@ -88,11 +88,11 @@ public class Card extends CardData implements Parcelable {
}
public boolean isType(CardType type) {
return ((Type & type.value()) != 0);
return ((Type & type.getId()) != 0);
}
public boolean onlyType(CardType type) {
return (Type == type.value());
return (Type == type.getId());
}
public boolean isSpellTrap() {
......
......@@ -3,6 +3,7 @@ package ocgcore.data;
import android.os.Parcel;
import android.os.Parcelable;
import ocgcore.enums.CardAttribute;
import ocgcore.enums.CardOt;
public class CardData implements Parcelable{
......@@ -14,7 +15,7 @@ public class CardData implements Parcelable{
Code = code;
}
public int Code;
public CardOt Ot;
public int Ot;
public int Alias;
public long SetCode;
public long Type;
......@@ -54,7 +55,7 @@ public class CardData implements Parcelable{
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.Code);
dest.writeInt(this.Ot.getId());
dest.writeInt(this.Ot);
dest.writeInt(this.Alias);
dest.writeLong(this.SetCode);
dest.writeLong(this.Type);
......@@ -70,7 +71,7 @@ public class CardData implements Parcelable{
protected CardData(Parcel in) {
this.Code = in.readInt();
this.Ot = CardOt.of(in.readInt());
this.Ot = in.readInt();
this.Alias = in.readInt();
this.SetCode = in.readLong();
this.Type = in.readLong();
......
package ocgcore.enums;
import androidx.annotation.Nullable;
public enum CardAttribute {
None(0),
Earth(0x01),
Water(0x02),
Fire(0x04),
Wind(0x08),
Light(0x10),
Dark(0x20),
Divine(0x40);
Earth(0x01, 1010),
Water(0x02, 1011),
Fire(0x04, 1012),
Wind(0x08, 1013),
Light(0x10, 1014),
Dark(0x20, 1015),
Divine(0x40, 1016);
private long value = 0;
private final int lang_index;
private int value = 0;
public int getLanguageIndex() {
return lang_index;
}
CardAttribute(long value){
this(value, 0);
}
private CardAttribute(int value) {
CardAttribute(long value, int lang_index) {
this.value = value;
this.lang_index = lang_index;
}
public static CardAttribute valueOf(int value) {
public static @Nullable CardAttribute valueOf(long value) {
CardAttribute[] attributes = CardAttribute.values();
for (CardAttribute attribute : attributes) {
if (attribute.value() == value) {
if (attribute.getId() == value) {
return attribute;
}
}
return null;
}
public int value() {
public long getId() {
return this.value;
}
}
\ No newline at end of file
......@@ -2,42 +2,53 @@ package ocgcore.enums;
public enum CardCategory {
None(0),
DESTROY(0x1),//破坏效果
RELEASE(0x2),//解放效果
REMOVE(0x4),//除外效果
TOHAND(0x8),//加入手牌效果
TODECK(0x10),//回卡组效果
TOGRAVE(0x20),//送去墓地效果
DECKDES(0x40),//卡组破坏效果
HANDES(0x80),//手牌破坏效果
SUMMON(0x100),//含召唤的效果
SPECIAL_SUMMON(0x200),//含特殊召唤的效果
TOKEN(0x400),//含衍生物效果
FLIP(0x800),//含翻转效果
POSITION(0x1000),//改变表示形式效果
CONTROL(0x2000),//改变控制权效果
DISABLE(0x4000),//使效果无效效果
DISABLE_SUMMON(0x8000),//无效召唤效果
DRAW(0x10000),//抽卡效果
SEARCH(0x20000),//检索卡组效果
EQUIP(0x40000),//装备效果
DAMAGE(0x80000),//伤害效果
RECOVER(0x100000),//回复效果
ATKCHANGE(0x200000),//改变攻击效果
DEFCHANGE(0x400000),//改变防御效果
COUNTER(0x800000),//指示物效果
COIN(0x1000000),//硬币效果
DICE(0x2000000),//骰子效果
LEAVE_GRAVE(0x4000000),//离开墓地效果
LVCHANGE(0x8000000),//改变等级效果
NEGATE(0x10000000),//使发动无效效果
ANNOUNCE(0x20000000),//發動時宣言卡名的效果
FUSION_SUMMON(0x40000000),
NEGATE_EFFECT(0x80000000L);//效果无效
DESTROY(0x1, 1100),//破坏效果
RELEASE(0x2, 1101),//解放效果
REMOVE(0x4, 1102),//除外效果
TOHAND(0x8, 1103),//加入手牌效果
TODECK(0x10, 1104),//回卡组效果
TOGRAVE(0x20, 1105),//送去墓地效果
DECKDES(0x40, 1106),//卡组破坏效果
HANDES(0x80, 1107),//手牌破坏效果
SUMMON(0x100, 1108),//含召唤的效果
SPECIAL_SUMMON(0x200, 1109),//含特殊召唤的效果
TOKEN(0x400, 1110),//含衍生物效果
FLIP(0x800, 1111),//含翻转效果
POSITION(0x1000, 1112),//改变表示形式效果
CONTROL(0x2000, 1113),//改变控制权效果
DISABLE(0x4000, 1114),//使效果无效效果
DISABLE_SUMMON(0x8000, 1115),//无效召唤效果
DRAW(0x10000, 1116),//抽卡效果
SEARCH(0x20000, 1117),//检索卡组效果
EQUIP(0x40000, 1118),//装备效果
DAMAGE(0x80000, 1119),//伤害效果
RECOVER(0x100000, 1120),//回复效果
ATKCHANGE(0x200000, 1121),//改变攻击效果
DEFCHANGE(0x400000, 1122),//改变防御效果
COUNTER(0x800000, 1123),//指示物效果
COIN(0x1000000, 1124),//硬币效果
DICE(0x2000000, 1125),//骰子效果
LEAVE_GRAVE(0x4000000, 1126),//离开墓地效果
LVCHANGE(0x8000000, 1127),//改变等级效果
NEGATE(0x10000000, 1128),//融合相关
ANNOUNCE(0x20000000, 1129),//同调相关
FUSION_SUMMON(0x40000000, 1130),//超量相关
NEGATE_EFFECT(0x80000000L, 1131);//效果无效
private long value = 0;
private final int lang_index;
public int getLanguageIndex() {
return lang_index;
}
CardCategory(long value){
this(value, 0);
}
private CardCategory(long value) {
CardCategory(long value, int lang_index) {
this.value = value;
this.lang_index = lang_index;
}
public static CardCategory valueOf(long value) {
......
package ocgcore.enums;
import androidx.annotation.Nullable;
public enum CardOt {
ALL(0),
OCG(1),
TCG(2),
NO_EXCLUSIVE(3),
CUSTOM(4),
SC_OCG(8),
UNKNOWN(999);/*简中*/
OCG(1, 1240),
TCG(2, 1241),
NO_EXCLUSIVE(3, 1242),
CUSTOM(4, 1243),
SC_OCG(8);
private final int value;
//1240
private final int lang_index;
CardOt(int value) {
this(value, 0);
}
private CardOt(int value) {
CardOt(int value, int lang_index) {
this.value = value;
this.lang_index = lang_index;
}
public int getLanguageIndex() {
return lang_index;
}
public int getId(){
public int getId() {
return value;
}
public static CardOt of(int value){
for(CardOt cardOt: values()){
if(cardOt.value == value){
public static @Nullable CardOt valueOf(int value) {
for (CardOt cardOt : values()) {
if (cardOt.value == value) {
return cardOt;
}
}
return UNKNOWN;
return null;
}
}
package ocgcore.enums;
import androidx.annotation.Nullable;
public enum CardRace {
None(0),
Warrior(0x1),
BestWarrior(0x8000),
SpellCaster(0x2),
Fairy(0x4),
Fiend(0x8),
Zombie(0x10),
Machine(0x20),
Aqua(0x40),
Pyro(0x80),
Rock(0x100),
WindBeast(0x200),
Plant(0x400),
Insect(0x800),
Thunder(0x1000),
Dragon(0x2000),
Beast(0x4000),
Dinosaur(0x10000),
Fish(0x20000),
SeaSerpent(0x40000),
Reptile(0x80000),
Psycho(0x100000),
DivineBeast(0x200000),
Creatorgod(0x400000),
Wyrm(0x800000),
Cyberse(0x1000000);
Warrior(0x1, 1020),
BestWarrior(0x8000, 1021),
SpellCaster(0x2, 1022),
Fairy(0x4, 1023),
Fiend(0x8, 1024),
Zombie(0x10, 1025),
Machine(0x20, 1026),
Aqua(0x40, 1027),
Pyro(0x80, 1028),
Rock(0x100, 1029),
WindBeast(0x200, 1030),
Plant(0x400, 1031),
Insect(0x800, 1032),
Thunder(0x1000, 1033),
Dragon(0x2000, 1034),
Beast(0x4000, 1035),
Dinosaur(0x10000, 1036),
Fish(0x20000, 1037),
SeaSerpent(0x40000, 1038),
Reptile(0x80000, 1039),
Psycho(0x100000, 1040),
DivineBeast(0x200000, 1041),
Creatorgod(0x400000, 1042),
Wyrm(0x800000, 1043),
Cyberse(0x1000000, 1044);
private long value = 0;
private final int lang_index;
public int getLanguageIndex() {
return lang_index;
}
CardRace(long value){
this(value, 0);
}
private CardRace(long value) {
CardRace(long value, int lang_index) {
this.value = value;
this.lang_index = lang_index;
}
public static CardRace valueOf(long value) {
public static @Nullable CardRace valueOf(long value) {
CardRace[] attributes = CardRace.values();
for (CardRace attribute : attributes) {
if (attribute.value() == value) {
......
package ocgcore.enums;
import androidx.annotation.Nullable;
public enum CardType {
None(0),
Normal(0x10),
Effect(0x20),
Fusion(0x40),
Ritual(0x80),
Synchro(0x2000),
Pendulum(0x1000000L),
Xyz(0x800000L),
Link(0x4000000L),
Non_Effect(0x8000000L),
Spirit(0x200),
Union(0x400),
Dual(0x800),
Tuner(0x1000),
Flip(0x200000),
Toon(0x400000),
Sp_Summon(0x2000000),
QuickPlay(0x10000),
Continuous(0x20000),
Equip(0x40000),
Field(0x80000),
Counter(0x100000),
Monster(0x1),
Spell(0x2),
TrapMonster(0x100),
Trap(0x4),
Token(0x4000);
Monster(0x1, 1050),
Spell(0x2, 1051),
Trap(0x4, 1052),
UNK1(0x8, 1053),
Normal(0x10, 1054),
Effect(0x20, 1055),
Fusion(0x40, 1056),
Ritual(0x80, 1057),
TrapMonster(0x100, 1058),
Spirit(0x200, 1059),
Union(0x400, 1060),
Dual(0x800, 1061),
Tuner(0x1000, 1062),
Synchro(0x2000, 1063),
Token(0x4000, 1064),
UNK2(0x8000, 1065),
QuickPlay(0x10000, 1066),
Continuous(0x20000, 1067),
Equip(0x40000, 1068),
Field(0x80000, 1069),
Counter(0x100000, 1070),
Flip(0x200000, 1071),
Toon(0x400000, 1072),
Xyz(0x800000, 1073),
Pendulum(0x1000000, 1074),
Sp_Summon(0x2000000, 1075),
Link(0x4000000, 1076),
Non_Effect(0x8000000, 1077);
private long value = 0;
private final int lang_index;
public int getLanguageIndex() {
return lang_index;
}
CardType(long value){
this(value, 0);
}
private CardType(long value) {
CardType(long value, int lang_index) {
this.value = value;
this.lang_index = lang_index;
}
public static CardType valueOf(long value) {
public static @Nullable CardType valueOf(long value) {
CardType[] attributes = CardType.values();
for (CardType attribute : attributes) {
if (attribute.value() == value) {
if (attribute.getId() == value) {
return attribute;
}
}
return null;
}
public long value() {
public long getId() {
return this.value;
}
}
package ocgcore.enums;
import androidx.annotation.Nullable;
public enum LimitType {
None(0),
All(999),
Forbidden(1),
Limit(2),
SemiLimit(3);
All(999, 1310),
Forbidden(1, 1316),
Limit(2, 1317),
SemiLimit(3, 1318);
private long value = 0;
private final int lang_index;
public int getLanguageIndex() {
return lang_index;
}
LimitType(long value){
this(value, 0);
}
private LimitType(long value) {
LimitType(long value, int lang_index) {
this.value = value;
this.lang_index = lang_index;
}
public static LimitType valueOf(long value) {
public static @Nullable LimitType valueOf(long value) {
LimitType[] attributes = LimitType.values();
for (LimitType attribute : attributes) {
if (attribute.value() == value) {
if (attribute.getId() == value) {
return attribute;
}
}
return null;
}
public long value() {
public long getId() {
return this.value;
}
}
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