Commit d94847e8 authored by qq247321453's avatar qq247321453

新增规则

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