Commit d94847e8 authored by qq247321453's avatar qq247321453

新增规则

parent cecbd817
...@@ -112,13 +112,13 @@ class CardSearchInfo { ...@@ -112,13 +112,13 @@ class CardSearchInfo {
} }
} }
if (ot > 0) { if (ot > 0) {
if (card.Ot != ot) { if (card.Ot.getId() != ot) {
return false; return false;
} }
} }
if (pscale != -1) { if (pscale != -1) {
if (!card.isType(CardType.Pendulum) || card.LScale != pscale && card.RScale != pscale) { if (!card.isType(CardType.Pendulum) || card.LeftScale != pscale && card.RightScale != pscale) {
return false; return false;
} }
} }
......
package cn.garymb.ygomobile.ui.adapters; package cn.garymb.ygomobile.ui.adapters;
import android.content.Context; import android.content.Context;
import android.util.Log;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -122,7 +121,7 @@ public class CardListAdapter extends BaseRecyclerAdapterPlus<Card, ViewHolder> i ...@@ -122,7 +121,7 @@ public class CardListAdapter extends BaseRecyclerAdapterPlus<Card, ViewHolder> i
} }
if (item.isType(CardType.Pendulum)) { if (item.isType(CardType.Pendulum)) {
holder.layout_p_scale.setVisibility(View.VISIBLE); holder.layout_p_scale.setVisibility(View.VISIBLE);
holder.cardScale.setText(String.valueOf(item.LScale)); holder.cardScale.setText(String.valueOf(item.LeftScale));
} else { } else {
holder.layout_p_scale.setVisibility(View.GONE); holder.layout_p_scale.setVisibility(View.GONE);
} }
......
...@@ -278,7 +278,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder { ...@@ -278,7 +278,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
type.setText(CardUtils.getAllTypeString(cardInfo, mStringManager).replace("/", "|")); type.setText(CardUtils.getAllTypeString(cardInfo, mStringManager).replace("/", "|"));
attrView.setText(mStringManager.getAttributeString(cardInfo.Attribute)); attrView.setText(mStringManager.getAttributeString(cardInfo.Attribute));
otView.setText(mStringManager.getOtString(cardInfo.Ot, "" + cardInfo.Ot)); otView.setText(mStringManager.getOtString(cardInfo.Ot.getId(), cardInfo.Ot.name()));
long[] sets = cardInfo.getSetCode(); long[] sets = cardInfo.getSetCode();
setName.setText(""); setName.setText("");
int index = 0; int index = 0;
...@@ -316,7 +316,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder { ...@@ -316,7 +316,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
} }
if (cardInfo.isType(CardType.Pendulum)) { if (cardInfo.isType(CardType.Pendulum)) {
layoutDetailPScale.setVisibility(View.VISIBLE); layoutDetailPScale.setVisibility(View.VISIBLE);
detailCardScale.setText(String.valueOf(cardInfo.LScale)); detailCardScale.setText(String.valueOf(cardInfo.LeftScale));
} else { } else {
layoutDetailPScale.setVisibility(View.GONE); layoutDetailPScale.setVisibility(View.GONE);
} }
......
...@@ -123,7 +123,7 @@ public class CardSort implements Comparator<Card> { ...@@ -123,7 +123,7 @@ public class CardSort implements Comparator<Card> {
if (rs != 0) { if (rs != 0) {
return rs; return rs;
} }
rs = comp(c1.Ot, c2.Ot); rs = comp(c1.Ot.getId(), c2.Ot.getId());
if (rs != 0) { if (rs != 0) {
return rs; return rs;
} }
......
...@@ -28,6 +28,7 @@ import cn.garymb.ygomobile.App; ...@@ -28,6 +28,7 @@ import cn.garymb.ygomobile.App;
import cn.garymb.ygomobile.AppsSettings; import cn.garymb.ygomobile.AppsSettings;
import cn.garymb.ygomobile.utils.IOUtils; import cn.garymb.ygomobile.utils.IOUtils;
import ocgcore.data.Card; import ocgcore.data.Card;
import ocgcore.enums.CardOt;
public class CardManager { public class CardManager {
...@@ -191,14 +192,14 @@ public class CardManager { ...@@ -191,14 +192,14 @@ public class CardManager {
do { do {
Card cardData = new Card(); Card cardData = new Card();
cardData.Code = reader.getInt(0); cardData.Code = reader.getInt(0);
cardData.Ot = reader.getInt(1); cardData.Ot = CardOt.of(reader.getInt(1));
cardData.Alias = reader.getInt(2); cardData.Alias = reader.getInt(2);
cardData.Setcode = reader.getLong(3); cardData.SetCode = reader.getLong(3);
cardData.Type = reader.getLong(4); cardData.Type = reader.getLong(4);
int levelInfo = reader.getInt(5); int levelInfo = reader.getInt(5);
cardData.Level = levelInfo & 0xff; cardData.Level = levelInfo & 0xff;
cardData.LScale = (levelInfo >> 24) & 0xff; cardData.LeftScale = (levelInfo >> 24) & 0xff;
cardData.RScale = (levelInfo >> 16) & 0xff; cardData.RightScale = (levelInfo >> 16) & 0xff;
cardData.Race = reader.getLong(6); cardData.Race = reader.getLong(6);
cardData.Attribute = reader.getInt(7); cardData.Attribute = reader.getInt(7);
cardData.Attack = reader.getInt(8); cardData.Attack = reader.getInt(8);
......
...@@ -43,15 +43,15 @@ public class Card extends CardData implements Parcelable { ...@@ -43,15 +43,15 @@ public class Card extends CardData implements Parcelable {
if (cardData != null) { if (cardData != null) {
this.Code = cardData.Code; this.Code = cardData.Code;
this.Alias = cardData.Alias; this.Alias = cardData.Alias;
this.Setcode = cardData.Setcode; this.SetCode = cardData.SetCode;
this.Type = cardData.Type; this.Type = cardData.Type;
this.Level = cardData.Level; this.Level = cardData.Level;
this.Attribute = cardData.Attribute; this.Attribute = cardData.Attribute;
this.Race = cardData.Race; this.Race = cardData.Race;
this.Attack = cardData.Attack; this.Attack = cardData.Attack;
this.Defense = cardData.Defense; this.Defense = cardData.Defense;
this.LScale = cardData.LScale; this.LeftScale = cardData.LeftScale;
this.RScale = cardData.RScale; this.RightScale = cardData.RightScale;
this.Category = cardData.Category; this.Category = cardData.Category;
} }
} }
...@@ -83,6 +83,10 @@ public class Card extends CardData implements Parcelable { ...@@ -83,6 +83,10 @@ public class Card extends CardData implements Parcelable {
return (Level & 0xff); return (Level & 0xff);
} }
public int getLinkNumber(){
return getStar();
}
public boolean isType(CardType type) { public boolean isType(CardType type) {
return ((Type & type.value()) != 0); return ((Type & type.value()) != 0);
} }
...@@ -102,17 +106,17 @@ public class Card extends CardData implements Parcelable { ...@@ -102,17 +106,17 @@ public class Card extends CardData implements Parcelable {
public long[] getSetCode() { public long[] getSetCode() {
long[] setcodes = new long[SETCODE_MAX]; long[] setcodes = new long[SETCODE_MAX];
for (int i = 0, k = 0; i < SETCODE_MAX; k += 0x10, i++) { for (int i = 0, k = 0; i < SETCODE_MAX; k += 0x10, i++) {
setcodes[i] = (Setcode >> k) & 0xffff; setcodes[i] = (SetCode >> k) & 0xffff;
} }
return setcodes; return setcodes;
} }
public void setSetCode(long[] setcodes) { public void setSetCode(long[] setcodes) {
int i = 0; int i = 0;
this.Setcode = 0; this.SetCode = 0;
if (setcodes != null) { if (setcodes != null) {
for (long sc : setcodes) { for (long sc : setcodes) {
this.Setcode += (sc << i); this.SetCode += (sc << i);
i += 0x10; i += 0x10;
} }
} }
...@@ -138,15 +142,15 @@ public class Card extends CardData implements Parcelable { ...@@ -138,15 +142,15 @@ public class Card extends CardData implements Parcelable {
return "Card{" + return "Card{" +
"Code=" + Code + "Code=" + Code +
", Alias=" + Alias + ", Alias=" + Alias +
", Setcode=" + Setcode + ", Setcode=" + SetCode +
", Type=" + Type + ", Type=" + Type +
", Level=" + Level + ", Level=" + Level +
", Attribute=" + Attribute + ", Attribute=" + Attribute +
", Race=" + Race + ", Race=" + Race +
", Attack=" + Attack + ", Attack=" + Attack +
", Defense=" + Defense + ", Defense=" + Defense +
", LScale=" + LScale + ", LScale=" + LeftScale +
", RScale=" + RScale + ", RScale=" + RightScale +
", Name='" + Name + '\'' + ", Name='" + Name + '\'' +
", Desc='" + Desc + '\'' + ", Desc='" + Desc + '\'' +
'}'; '}';
......
...@@ -3,6 +3,8 @@ package ocgcore.data; ...@@ -3,6 +3,8 @@ package ocgcore.data;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import ocgcore.enums.CardOt;
public class CardData implements Parcelable{ public class CardData implements Parcelable{
public CardData() { public CardData() {
...@@ -11,19 +13,18 @@ public class CardData implements Parcelable{ ...@@ -11,19 +13,18 @@ public class CardData implements Parcelable{
public CardData(int code) { public CardData(int code) {
Code = code; Code = code;
} }
public int Code; public int Code;
public int Ot; public CardOt Ot;
public int Alias; public int Alias;
public long Setcode; public long SetCode;
public long Type; public long Type;
public int Level; public int Level;
public int Attribute; public int Attribute;
public long Race; public long Race;
public int Attack; public int Attack;
public int Defense; public int Defense;
public int LScale; public int LeftScale;
public int RScale; public int RightScale;
public long Category; public long Category;
@Override @Override
...@@ -32,15 +33,15 @@ public class CardData implements Parcelable{ ...@@ -32,15 +33,15 @@ public class CardData implements Parcelable{
"Code=" + Code + "Code=" + Code +
", Ot=" + Ot + ", Ot=" + Ot +
", Alias=" + Alias + ", Alias=" + Alias +
", Setcode=" + Setcode + ", Setcode=" + SetCode +
", Type=" + Type + ", Type=" + Type +
", Level=" + Level + ", Level=" + Level +
", Attribute=" + Attribute + ", Attribute=" + Attribute +
", Race=" + Race + ", Race=" + Race +
", Attack=" + Attack + ", Attack=" + Attack +
", Defense=" + Defense + ", Defense=" + Defense +
", LScale=" + LScale + ", LScale=" + LeftScale +
", RScale=" + RScale + ", RScale=" + RightScale +
", Category=" + Category + ", Category=" + Category +
'}'; '}';
} }
...@@ -53,33 +54,33 @@ public class CardData implements Parcelable{ ...@@ -53,33 +54,33 @@ public class CardData implements Parcelable{
@Override @Override
public void writeToParcel(Parcel dest, int flags) { public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.Code); dest.writeInt(this.Code);
dest.writeInt(this.Ot); dest.writeInt(this.Ot.getId());
dest.writeInt(this.Alias); dest.writeInt(this.Alias);
dest.writeLong(this.Setcode); dest.writeLong(this.SetCode);
dest.writeLong(this.Type); dest.writeLong(this.Type);
dest.writeInt(this.Level); dest.writeInt(this.Level);
dest.writeInt(this.Attribute); dest.writeInt(this.Attribute);
dest.writeLong(this.Race); dest.writeLong(this.Race);
dest.writeInt(this.Attack); dest.writeInt(this.Attack);
dest.writeInt(this.Defense); dest.writeInt(this.Defense);
dest.writeInt(this.LScale); dest.writeInt(this.LeftScale);
dest.writeInt(this.RScale); dest.writeInt(this.RightScale);
dest.writeLong(this.Category); dest.writeLong(this.Category);
} }
protected CardData(Parcel in) { protected CardData(Parcel in) {
this.Code = in.readInt(); this.Code = in.readInt();
this.Ot = in.readInt(); this.Ot = CardOt.of(in.readInt());
this.Alias = in.readInt(); this.Alias = in.readInt();
this.Setcode = in.readLong(); this.SetCode = in.readLong();
this.Type = in.readLong(); this.Type = in.readLong();
this.Level = in.readInt(); this.Level = in.readInt();
this.Attribute = in.readInt(); this.Attribute = in.readInt();
this.Race = in.readLong(); this.Race = in.readLong();
this.Attack = in.readInt(); this.Attack = in.readInt();
this.Defense = in.readInt(); this.Defense = in.readInt();
this.LScale = in.readInt(); this.LeftScale = in.readInt();
this.RScale = in.readInt(); this.RightScale = in.readInt();
this.Category = in.readLong(); this.Category = in.readLong();
} }
...@@ -94,4 +95,5 @@ public class CardData implements Parcelable{ ...@@ -94,4 +95,5 @@ public class CardData implements Parcelable{
return new CardData[size]; return new CardData[size];
} }
}; };
} }
package ocgcore.enums; package ocgcore.enums;
public enum CardOt { public enum CardOt {
All, ALL(0),
OCG, OCG(1),
TCG, TCG(2),
OCG_TCG, NO_EXCLUSIVE(3),
CUSTOM/*, CUSTOM(4),
简中*/ SC_OCG(8),
UNKNOWN(999);/*简中*/
private final int value;
private CardOt(int value) {
this.value = value;
}
public int getId(){
return value;
}
public static CardOt of(int value){
for(CardOt cardOt: values()){
if(cardOt.value == value){
return cardOt;
}
}
return UNKNOWN;
}
} }
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