Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fallenstardust
YGOMobile
Commits
66ed2360
Commit
66ed2360
authored
Dec 13, 2025
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加GeneSys的卡片信用分读取
添加GeneSys图标初始化
parent
94e2fe35
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
221 additions
and
53 deletions
+221
-53
mobile/assets/data/conf/strings.conf
mobile/assets/data/conf/strings.conf
+1
-0
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
+1
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/adapters/CardListAdapter.java
...java/cn/garymb/ygomobile/ui/adapters/CardListAdapter.java
+17
-4
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/deck/ImageTop_GeneSys.java
...a/cn/garymb/ygomobile/ui/cards/deck/ImageTop_GeneSys.java
+52
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/CardGroupView.java
...ain/java/cn/garymb/ygomobile/ui/widget/CardGroupView.java
+9
-10
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/CardView.java
...src/main/java/cn/garymb/ygomobile/ui/widget/CardView.java
+23
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/DeckGroupView.java
...ain/java/cn/garymb/ygomobile/ui/widget/DeckGroupView.java
+9
-3
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/DeckView.java
...src/main/java/cn/garymb/ygomobile/ui/widget/DeckView.java
+9
-3
mobile/src/main/java/ocgcore/LimitManager.java
mobile/src/main/java/ocgcore/LimitManager.java
+62
-27
mobile/src/main/java/ocgcore/data/LimitList.java
mobile/src/main/java/ocgcore/data/LimitList.java
+34
-2
mobile/src/main/java/ocgcore/enums/LimitType.java
mobile/src/main/java/ocgcore/enums/LimitType.java
+4
-3
No files found.
mobile/assets/data/conf/strings.conf
View file @
66ed2360
...
@@ -491,6 +491,7 @@
...
@@ -491,6 +491,7 @@
!
system
1475
已存在同名卡组
!
system
1475
已存在同名卡组
!
system
1476
删除失败
!
system
1476
删除失败
!
system
1477
卡片数:
!
system
1477
卡片数:
!
system
1480
GeneSys
!
system
1481
OCG
!
system
1481
OCG
!
system
1482
TCG
!
system
1482
TCG
!
system
1483
简体中文
!
system
1483
简体中文
...
...
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
View file @
66ed2360
...
@@ -67,6 +67,7 @@ public interface Constants {
...
@@ -67,6 +67,7 @@ public interface Constants {
String
ASSETS_PATH
=
"data/"
;
String
ASSETS_PATH
=
"data/"
;
String
ASSET_SERVER_LIST
=
"serverlist.xml"
;
String
ASSET_SERVER_LIST
=
"serverlist.xml"
;
String
ASSET_LIMIT_PNG
=
ASSETS_PATH
+
"textures/lim.png"
;
String
ASSET_LIMIT_PNG
=
ASSETS_PATH
+
"textures/lim.png"
;
String
ASSET_GENESYS_LIMIT_PNG
=
ASSETS_PATH
+
"textures/lim_credit.png"
;
String
DEFAULT_FONT_NAME
=
"ygo.ttf"
;
String
DEFAULT_FONT_NAME
=
"ygo.ttf"
;
String
DATABASE_NAME
=
"cards.cdb"
;
String
DATABASE_NAME
=
"cards.cdb"
;
String
BOT_CONF
=
"bot.conf"
;
String
BOT_CONF
=
"bot.conf"
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/adapters/CardListAdapter.java
View file @
66ed2360
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.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
...
@@ -16,6 +17,7 @@ import cn.garymb.ygomobile.loader.ImageLoader;
...
@@ -16,6 +17,7 @@ import cn.garymb.ygomobile.loader.ImageLoader;
import
cn.garymb.ygomobile.ui.activities.BaseActivity
;
import
cn.garymb.ygomobile.ui.activities.BaseActivity
;
import
cn.garymb.ygomobile.ui.cards.CardListProvider
;
import
cn.garymb.ygomobile.ui.cards.CardListProvider
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop_GeneSys
;
import
cn.garymb.ygomobile.utils.CardUtils
;
import
cn.garymb.ygomobile.utils.CardUtils
;
import
ocgcore.DataManager
;
import
ocgcore.DataManager
;
import
ocgcore.StringManager
;
import
ocgcore.StringManager
;
...
@@ -27,6 +29,7 @@ import ocgcore.enums.LimitType;
...
@@ -27,6 +29,7 @@ import ocgcore.enums.LimitType;
public
class
CardListAdapter
extends
BaseRecyclerAdapterPlus
<
Card
,
BaseViewHolder
>
implements
CardListProvider
{
public
class
CardListAdapter
extends
BaseRecyclerAdapterPlus
<
Card
,
BaseViewHolder
>
implements
CardListProvider
{
private
final
StringManager
mStringManager
;
private
final
StringManager
mStringManager
;
private
ImageTop
mImageTop
;
private
ImageTop
mImageTop
;
private
ImageTop_GeneSys
mImageTop_GeneSys
;
private
LimitList
mLimitList
;
private
LimitList
mLimitList
;
private
boolean
mItemBg
;
private
boolean
mItemBg
;
private
final
ImageLoader
imageLoader
;
private
final
ImageLoader
imageLoader
;
...
@@ -134,7 +137,7 @@ public class CardListAdapter extends BaseRecyclerAdapterPlus<Card, BaseViewHolde
...
@@ -134,7 +137,7 @@ public class CardListAdapter extends BaseRecyclerAdapterPlus<Card, BaseViewHolde
@Override
@Override
protected
void
convert
(
com
.
chad
.
library
.
adapter
.
base
.
viewholder
.
BaseViewHolder
holder
,
Card
item
)
{
protected
void
convert
(
com
.
chad
.
library
.
adapter
.
base
.
viewholder
.
BaseViewHolder
holder
,
Card
item
)
{
int
position
=
holder
.
getAdapterPosition
()
-
getHeaderLayoutCount
();
int
position
=
holder
.
get
Binding
AdapterPosition
()
-
getHeaderLayoutCount
();
imageLoader
.
bindImage
(
holder
.
getView
(
R
.
id
.
card_image
),
item
,
ImageLoader
.
Type
.
small
);
imageLoader
.
bindImage
(
holder
.
getView
(
R
.
id
.
card_image
),
item
,
ImageLoader
.
Type
.
small
);
holder
.
setText
(
R
.
id
.
card_name
,
item
.
Name
);
holder
.
setText
(
R
.
id
.
card_name
,
item
.
Name
);
if
(
item
.
isType
(
CardType
.
Monster
))
{
if
(
item
.
isType
(
CardType
.
Monster
))
{
...
@@ -184,7 +187,11 @@ public class CardListAdapter extends BaseRecyclerAdapterPlus<Card, BaseViewHolde
...
@@ -184,7 +187,11 @@ public class CardListAdapter extends BaseRecyclerAdapterPlus<Card, BaseViewHolde
if
(
mImageTop
==
null
)
{
if
(
mImageTop
==
null
)
{
mImageTop
=
new
ImageTop
(
context
);
mImageTop
=
new
ImageTop
(
context
);
}
}
if
(
mImageTop_GeneSys
==
null
)
{
mImageTop_GeneSys
=
new
ImageTop_GeneSys
(
context
);
}
if
(
mLimitList
!=
null
)
{
if
(
mLimitList
!=
null
)
{
holder
.
setGone
(
R
.
id
.
right_top
,
false
);
holder
.
setGone
(
R
.
id
.
right_top
,
false
);
if
(
mLimitList
.
check
(
item
,
LimitType
.
Forbidden
))
{
if
(
mLimitList
.
check
(
item
,
LimitType
.
Forbidden
))
{
holder
.
setImageBitmap
(
R
.
id
.
right_top
,
mImageTop
.
forbidden
);
holder
.
setImageBitmap
(
R
.
id
.
right_top
,
mImageTop
.
forbidden
);
...
@@ -192,6 +199,12 @@ public class CardListAdapter extends BaseRecyclerAdapterPlus<Card, BaseViewHolde
...
@@ -192,6 +199,12 @@ public class CardListAdapter extends BaseRecyclerAdapterPlus<Card, BaseViewHolde
holder
.
setImageBitmap
(
R
.
id
.
right_top
,
mImageTop
.
limit
);
holder
.
setImageBitmap
(
R
.
id
.
right_top
,
mImageTop
.
limit
);
}
else
if
(
mLimitList
.
check
(
item
,
LimitType
.
SemiLimit
))
{
}
else
if
(
mLimitList
.
check
(
item
,
LimitType
.
SemiLimit
))
{
holder
.
setImageBitmap
(
R
.
id
.
right_top
,
mImageTop
.
semiLimit
);
holder
.
setImageBitmap
(
R
.
id
.
right_top
,
mImageTop
.
semiLimit
);
}
else
if
(
mLimitList
.
check
(
item
,
LimitType
.
GeneSys
))
{
Integer
creditValue
=
0
;
if
(
mLimitList
.
getCredits
()
!=
null
)
{
creditValue
=
mLimitList
.
getCredits
().
get
(
item
.
Alias
==
0
?
item
.
Code
:
item
.
Alias
);
holder
.
setImageBitmap
(
R
.
id
.
right_top
,
mImageTop_GeneSys
.
geneSysLimit
.
get
(
creditValue
-
1
));
}
}
else
{
}
else
{
holder
.
setGone
(
R
.
id
.
right_top
,
true
);
holder
.
setGone
(
R
.
id
.
right_top
,
true
);
}
}
...
@@ -200,9 +213,9 @@ public class CardListAdapter extends BaseRecyclerAdapterPlus<Card, BaseViewHolde
...
@@ -200,9 +213,9 @@ public class CardListAdapter extends BaseRecyclerAdapterPlus<Card, BaseViewHolde
}
}
//卡片类型
//卡片类型
holder
.
setText
(
R
.
id
.
card_type
,
CardUtils
.
getAllTypeString
(
item
,
mStringManager
));
holder
.
setText
(
R
.
id
.
card_type
,
CardUtils
.
getAllTypeString
(
item
,
mStringManager
));
if
(
holder
.
getView
(
R
.
id
.
card_code
)
!=
null
)
{
holder
.
setText
(
R
.
id
.
card_code
,
String
.
format
(
"%08d"
,
item
.
getCode
()));
holder
.
setText
(
R
.
id
.
card_code
,
String
.
format
(
"%08d"
,
item
.
getCode
()));
}
bindMenu
(
holder
,
position
);
bindMenu
(
holder
,
position
);
if
(
mItemBg
)
{
if
(
mItemBg
)
{
holder
.
setBackgroundResource
(
R
.
id
.
swipe_layout
,
R
.
drawable
.
list_item_bg
);
holder
.
setBackgroundResource
(
R
.
id
.
swipe_layout
,
R
.
drawable
.
list_item_bg
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/deck/ImageTop_GeneSys.java
0 → 100644
View file @
66ed2360
package
cn.garymb.ygomobile.ui.cards.deck
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ASSET_GENESYS_LIMIT_PNG
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
java.util.ArrayList
;
import
java.util.List
;
import
cn.garymb.ygomobile.utils.BitmapUtil
;
public
class
ImageTop_GeneSys
{
public
final
List
<
Bitmap
>
geneSysLimit
;
public
ImageTop_GeneSys
(
Context
context
)
{
this
(
BitmapUtil
.
getBitmapFormAssets
(
context
,
ASSET_GENESYS_LIMIT_PNG
,
0
,
0
));
}
public
ImageTop_GeneSys
(
Bitmap
img
)
{
if
(
img
!=
null
)
{
geneSysLimit
=
new
ArrayList
<>();
int
width
=
img
.
getWidth
();
int
height
=
img
.
getHeight
();
int
itemWidth
=
width
/
10
;
// 每个小图标的宽度
int
itemHeight
=
height
/
10
;
// 每个小图标的高度
// 按10行10列切割图片
for
(
int
row
=
0
;
row
<
10
;
row
++)
{
for
(
int
col
=
0
;
col
<
10
;
col
++)
{
int
x
=
col
*
itemWidth
;
// 当前列的起始x坐标
int
y
=
row
*
itemHeight
;
// 当前行的起始y坐标
Bitmap
item
=
Bitmap
.
createBitmap
(
img
,
x
,
y
,
itemWidth
,
itemHeight
);
geneSysLimit
.
add
(
item
);
//注意索引从0开始,图标号从1开始
}
}
}
else
{
geneSysLimit
=
null
;
}
BitmapUtil
.
destroy
(
img
);
}
public
void
clear
()
{
for
(
Bitmap
bitmap
:
geneSysLimit
)
{
BitmapUtil
.
destroy
(
bitmap
);
}
}
}
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/CardGroupView.java
View file @
66ed2360
...
@@ -17,6 +17,7 @@ import cn.garymb.ygomobile.Constants;
...
@@ -17,6 +17,7 @@ import cn.garymb.ygomobile.Constants;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop_GeneSys
;
import
ocgcore.data.Card
;
import
ocgcore.data.Card
;
import
ocgcore.data.LimitList
;
import
ocgcore.data.LimitList
;
...
@@ -47,14 +48,12 @@ public class CardGroupView extends FrameLayout {
...
@@ -47,14 +48,12 @@ public class CardGroupView extends FrameLayout {
super
(
context
,
attrs
,
defStyleAttr
);
super
(
context
,
attrs
,
defStyleAttr
);
if
(
attrs
!=
null
)
{
if
(
attrs
!=
null
)
{
TypedArray
array
=
context
.
obtainStyledAttributes
(
attrs
,
R
.
styleable
.
CardGroupView
);
TypedArray
array
=
context
.
obtainStyledAttributes
(
attrs
,
R
.
styleable
.
CardGroupView
);
if
(
array
!=
null
)
{
mMaxLines
=
array
.
getInteger
(
R
.
styleable
.
CardGroupView_lines
,
mMaxLines
);
mMaxLines
=
array
.
getInteger
(
R
.
styleable
.
CardGroupView_lines
,
mMaxLines
);
mCardWidth
=
array
.
getInteger
(
R
.
styleable
.
CardGroupView_card_width
,
mCardWidth
);
mCardWidth
=
array
.
getInteger
(
R
.
styleable
.
CardGroupView_card_width
,
mCardWidth
);
mCardHeight
=
array
.
getInteger
(
R
.
styleable
.
CardGroupView_card_height
,
mCardHeight
);
mCardHeight
=
array
.
getInteger
(
R
.
styleable
.
CardGroupView_card_height
,
mCardHeight
);
mLineLimit
=
array
.
getInteger
(
R
.
styleable
.
CardGroupView_line_limit
,
mLineLimit
);
mLineLimit
=
array
.
getInteger
(
R
.
styleable
.
CardGroupView_line_limit
,
mLineLimit
);
mLineMaxCount
=
array
.
getInteger
(
R
.
styleable
.
CardGroupView_line_max_count
,
mLineMaxCount
);
mLineMaxCount
=
array
.
getInteger
(
R
.
styleable
.
CardGroupView_line_max_count
,
mLineMaxCount
);
mOrgLineLimit
=
mLineLimit
;
mOrgLineLimit
=
mLineLimit
;
}
}
}
}
}
...
@@ -271,11 +270,11 @@ public class CardGroupView extends FrameLayout {
...
@@ -271,11 +270,11 @@ public class CardGroupView extends FrameLayout {
}
}
public
void
updateTopImage
(
ImageTop
imageTop
,
LimitList
limitList
)
{
public
void
updateTopImage
(
ImageTop
imageTop
,
ImageTop_GeneSys
imageTop_GeneSys
,
LimitList
limitList
)
{
int
count
=
getChildCount
();
int
count
=
getChildCount
();
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
CardView
cardView
=
(
CardView
)
getChildAt
(
i
);
CardView
cardView
=
(
CardView
)
getChildAt
(
i
);
cardView
.
updateLimit
(
imageTop
,
limitList
);
cardView
.
updateLimit
(
imageTop
,
imageTop_GeneSys
,
limitList
);
}
}
}
}
}
}
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/CardView.java
View file @
66ed2360
...
@@ -3,6 +3,7 @@ package cn.garymb.ygomobile.ui.widget;
...
@@ -3,6 +3,7 @@ package cn.garymb.ygomobile.ui.widget;
import
android.content.Context
;
import
android.content.Context
;
import
android.os.Build
;
import
android.os.Build
;
import
android.util.AttributeSet
;
import
android.util.AttributeSet
;
import
android.util.Log
;
import
android.view.Gravity
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.FrameLayout
;
import
android.widget.FrameLayout
;
...
@@ -13,6 +14,7 @@ import androidx.annotation.Nullable;
...
@@ -13,6 +14,7 @@ import androidx.annotation.Nullable;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop_GeneSys
;
import
ocgcore.data.Card
;
import
ocgcore.data.Card
;
import
ocgcore.data.LimitList
;
import
ocgcore.data.LimitList
;
import
ocgcore.enums.LimitType
;
import
ocgcore.enums.LimitType
;
...
@@ -70,7 +72,7 @@ public class CardView extends FrameLayout {
...
@@ -70,7 +72,7 @@ public class CardView extends FrameLayout {
}
}
}
}
public
void
updateLimit
(
ImageTop
imageTop
,
LimitList
limitList
)
{
public
void
updateLimit
(
ImageTop
imageTop
,
ImageTop_GeneSys
imageTop_GeneSys
,
LimitList
limitList
)
{
if
(
mCard
!=
null
&&
imageTop
!=
null
)
{
if
(
mCard
!=
null
&&
imageTop
!=
null
)
{
mTopImage
.
setVisibility
(
View
.
VISIBLE
);
mTopImage
.
setVisibility
(
View
.
VISIBLE
);
if
(
limitList
!=
null
)
{
if
(
limitList
!=
null
)
{
...
@@ -80,6 +82,25 @@ public class CardView extends FrameLayout {
...
@@ -80,6 +82,25 @@ public class CardView extends FrameLayout {
mTopImage
.
setImageBitmap
(
imageTop
.
limit
);
mTopImage
.
setImageBitmap
(
imageTop
.
limit
);
}
else
if
(
limitList
.
check
(
mCard
,
LimitType
.
SemiLimit
))
{
}
else
if
(
limitList
.
check
(
mCard
,
LimitType
.
SemiLimit
))
{
mTopImage
.
setImageBitmap
(
imageTop
.
semiLimit
);
mTopImage
.
setImageBitmap
(
imageTop
.
semiLimit
);
}
else
if
(
limitList
.
check
(
mCard
,
LimitType
.
GeneSys
))
{
// 根据credits中的信用分值设置对应的图标
if
(
imageTop_GeneSys
!=
null
&&
imageTop_GeneSys
.
geneSysLimit
!=
null
&&
!
imageTop_GeneSys
.
geneSysLimit
.
isEmpty
())
{
// 获取卡牌的信用分值
Integer
creditValue
=
0
;
if
(
limitList
.
getCredits
()
!=
null
)
{
creditValue
=
limitList
.
getCredits
().
get
(
mCard
.
Alias
==
0
?
mCard
.
Code
:
mCard
.
Alias
);
Log
.
d
(
"cc"
,
"CreditValue: "
+
creditValue
);
}
// 根据信用分值设置对应的图标索引
if
(
creditValue
!=
null
&&
creditValue
>
0
&&
creditValue
<=
imageTop_GeneSys
.
geneSysLimit
.
size
())
{
mTopImage
.
setImageBitmap
(
imageTop_GeneSys
.
geneSysLimit
.
get
(
creditValue
-
1
));
// 索引从0开始
}
else
{
mTopImage
.
setVisibility
(
View
.
GONE
);
}
}
else
{
mTopImage
.
setVisibility
(
View
.
GONE
);
}
}
else
{
}
else
{
mTopImage
.
setVisibility
(
View
.
GONE
);
mTopImage
.
setVisibility
(
View
.
GONE
);
}
}
...
@@ -91,6 +112,7 @@ public class CardView extends FrameLayout {
...
@@ -91,6 +112,7 @@ public class CardView extends FrameLayout {
}
}
}
}
public
void
showCard
(
ImageLoader
imageLoader
,
Card
cardInfo
)
{
public
void
showCard
(
ImageLoader
imageLoader
,
Card
cardInfo
)
{
if
(
mCard
!=
null
&&
mCard
.
equals
(
cardInfo
))
return
;
if
(
mCard
!=
null
&&
mCard
.
equals
(
cardInfo
))
return
;
mCard
=
cardInfo
;
mCard
=
cardInfo
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/DeckGroupView.java
View file @
66ed2360
...
@@ -22,6 +22,7 @@ import cn.garymb.ygomobile.bean.DeckInfo;
...
@@ -22,6 +22,7 @@ import cn.garymb.ygomobile.bean.DeckInfo;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop_GeneSys
;
import
cn.garymb.ygomobile.ui.cards.deck.LabelInfo
;
import
cn.garymb.ygomobile.ui.cards.deck.LabelInfo
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
import
ocgcore.data.Card
;
import
ocgcore.data.Card
;
...
@@ -32,6 +33,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
...
@@ -32,6 +33,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
private
final
LabelInfo
mLabelInfo
;
private
final
LabelInfo
mLabelInfo
;
private
final
DeckInfo
mDeckInfo
;
private
final
DeckInfo
mDeckInfo
;
private
final
ImageTop
mImageTop
;
private
final
ImageTop
mImageTop
;
private
final
ImageTop_GeneSys
mImageTop_GeneSys
;
private
LimitList
mLimitList
;
private
LimitList
mLimitList
;
private
final
int
mainTop
;
private
final
int
mainTop
;
private
final
int
extraTop
;
private
final
int
extraTop
;
...
@@ -77,6 +79,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
...
@@ -77,6 +79,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
mLabelInfo
=
new
LabelInfo
(
context
);
mLabelInfo
=
new
LabelInfo
(
context
);
mDeckInfo
=
new
DeckInfo
();
mDeckInfo
=
new
DeckInfo
();
mImageTop
=
new
ImageTop
(
getContext
());
mImageTop
=
new
ImageTop
(
getContext
());
mImageTop_GeneSys
=
new
ImageTop_GeneSys
(
getContext
());
if
(
mCardWidth
<=
0
)
{
if
(
mCardWidth
<=
0
)
{
int
width
=
(
getMeasuredWidth
()
-
getPaddingLeft
()
-
getPaddingRight
());
int
width
=
(
getMeasuredWidth
()
-
getPaddingLeft
()
-
getPaddingRight
());
mCardWidth
=
width
/
10
;
mCardWidth
=
width
/
10
;
...
@@ -197,6 +200,9 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
...
@@ -197,6 +200,9 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
public
ImageTop
getImageTop
()
{
public
ImageTop
getImageTop
()
{
return
mImageTop
;
return
mImageTop
;
}
}
public
ImageTop_GeneSys
getmImageTop_GeneSys
()
{
return
mImageTop_GeneSys
;
}
public
void
setDeck
(
DeckInfo
deck
)
{
public
void
setDeck
(
DeckInfo
deck
)
{
setEditMode
(
EditMode
.
None
);
setEditMode
(
EditMode
.
None
);
...
@@ -271,7 +277,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
...
@@ -271,7 +277,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
count
--;
count
--;
}
}
if
(
mLimitChanged
)
{
if
(
mLimitChanged
)
{
cardView
.
updateLimit
(
getImageTop
(),
mLimitList
);
cardView
.
updateLimit
(
getImageTop
(),
getmImageTop_GeneSys
(),
mLimitList
);
}
}
}
else
{
}
else
{
cardView
.
showCard
(
mImageLoader
,
null
);
cardView
.
showCard
(
mImageLoader
,
null
);
...
@@ -301,7 +307,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
...
@@ -301,7 +307,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
}
}
if
(
mLimitChanged
)
{
if
(
mLimitChanged
)
{
mMainViews
.
get
(
i
).
updateLimit
(
getImageTop
(),
mLimitList
);
mMainViews
.
get
(
i
).
updateLimit
(
getImageTop
(),
getmImageTop_GeneSys
(),
mLimitList
);
}
}
}
else
{
}
else
{
cardView
.
showCard
(
mImageLoader
,
null
);
cardView
.
showCard
(
mImageLoader
,
null
);
...
@@ -321,7 +327,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
...
@@ -321,7 +327,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
count
--;
count
--;
}
}
if
(
mLimitChanged
)
{
if
(
mLimitChanged
)
{
cardView
.
updateLimit
(
getImageTop
(),
mLimitList
);
cardView
.
updateLimit
(
getImageTop
(),
getmImageTop_GeneSys
(),
mLimitList
);
}
}
}
else
{
}
else
{
cardView
.
showCard
(
mImageLoader
,
null
);
cardView
.
showCard
(
mImageLoader
,
null
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/DeckView.java
View file @
66ed2360
...
@@ -9,6 +9,7 @@ import androidx.annotation.Nullable;
...
@@ -9,6 +9,7 @@ import androidx.annotation.Nullable;
import
cn.garymb.ygomobile.bean.DeckInfo
;
import
cn.garymb.ygomobile.bean.DeckInfo
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop_GeneSys
;
import
cn.garymb.ygomobile.ui.cards.deck.LabelInfo
;
import
cn.garymb.ygomobile.ui.cards.deck.LabelInfo
;
import
ocgcore.data.Card
;
import
ocgcore.data.Card
;
import
ocgcore.data.LimitList
;
import
ocgcore.data.LimitList
;
...
@@ -19,6 +20,7 @@ public class DeckView extends LinearLayout {
...
@@ -19,6 +20,7 @@ public class DeckView extends LinearLayout {
private
final
LabelInfo
mLabelInfo
;
private
final
LabelInfo
mLabelInfo
;
private
LimitList
mLimitList
;
private
LimitList
mLimitList
;
private
final
ImageTop
mImageTop
;
private
final
ImageTop
mImageTop
;
private
final
ImageTop_GeneSys
mImageTop_GeneSys
;
private
boolean
mAutoSort
,
mEditMode
,
mLimitChanged
;
private
boolean
mAutoSort
,
mEditMode
,
mLimitChanged
;
private
ImageLoader
mImageLoader
;
private
ImageLoader
mImageLoader
;
...
@@ -36,6 +38,7 @@ public class DeckView extends LinearLayout {
...
@@ -36,6 +38,7 @@ public class DeckView extends LinearLayout {
super
(
context
,
attrs
,
defStyleAttr
);
super
(
context
,
attrs
,
defStyleAttr
);
setOrientation
(
VERTICAL
);
setOrientation
(
VERTICAL
);
mImageTop
=
new
ImageTop
(
getContext
());
mImageTop
=
new
ImageTop
(
getContext
());
mImageTop_GeneSys
=
new
ImageTop_GeneSys
(
getContext
());
mLabelInfo
=
new
LabelInfo
(
context
);
mLabelInfo
=
new
LabelInfo
(
context
);
mMainLabel
=
new
DeckLabel
(
context
);
mMainLabel
=
new
DeckLabel
(
context
);
mExtraLabel
=
new
DeckLabel
(
context
);
mExtraLabel
=
new
DeckLabel
(
context
);
...
@@ -81,6 +84,9 @@ public class DeckView extends LinearLayout {
...
@@ -81,6 +84,9 @@ public class DeckView extends LinearLayout {
public
ImageTop
getImageTop
()
{
public
ImageTop
getImageTop
()
{
return
mImageTop
;
return
mImageTop
;
}
}
public
ImageTop_GeneSys
getImageTop_GeneSys
()
{
return
mImageTop_GeneSys
;
}
public
boolean
isAutoSort
()
{
public
boolean
isAutoSort
()
{
return
mAutoSort
;
return
mAutoSort
;
...
@@ -155,9 +161,9 @@ public class DeckView extends LinearLayout {
...
@@ -155,9 +161,9 @@ public class DeckView extends LinearLayout {
mExtraLabel
.
setText
(
mLabelInfo
.
getExtraString
());
mExtraLabel
.
setText
(
mLabelInfo
.
getExtraString
());
mSideLabel
.
setText
(
mLabelInfo
.
getSideString
());
mSideLabel
.
setText
(
mLabelInfo
.
getSideString
());
if
(
mLimitChanged
)
{
if
(
mLimitChanged
)
{
mMainGroup
.
updateTopImage
(
getImageTop
(),
mLimitList
);
mMainGroup
.
updateTopImage
(
getImageTop
(),
getImageTop_GeneSys
(),
mLimitList
);
mExtraGroup
.
updateTopImage
(
getImageTop
(),
mLimitList
);
mExtraGroup
.
updateTopImage
(
getImageTop
(),
getImageTop_GeneSys
(),
mLimitList
);
mSideGroup
.
updateTopImage
(
getImageTop
(),
mLimitList
);
mSideGroup
.
updateTopImage
(
getImageTop
(),
getImageTop_GeneSys
(),
mLimitList
);
}
}
mLimitChanged
=
false
;
mLimitChanged
=
false
;
}
}
...
...
mobile/src/main/java/ocgcore/LimitManager.java
View file @
66ed2360
...
@@ -17,6 +17,7 @@ import java.io.InputStream;
...
@@ -17,6 +17,7 @@ import java.io.InputStream;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Enumeration
;
import
java.util.Enumeration
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -26,6 +27,7 @@ import java.util.Map;
...
@@ -26,6 +27,7 @@ import java.util.Map;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.LogUtil
;
import
ocgcore.data.CardSet
;
import
ocgcore.data.CardSet
;
import
ocgcore.data.LimitList
;
import
ocgcore.data.LimitList
;
...
@@ -63,7 +65,7 @@ public class LimitManager implements Closeable {
...
@@ -63,7 +65,7 @@ public class LimitManager implements Closeable {
}
}
public
LimitList
getTopLimit
()
{
public
LimitList
getTopLimit
()
{
if
(
mLimitNames
.
size
()
==
0
)
{
if
(
mLimitNames
.
isEmpty
()
)
{
return
null
;
return
null
;
}
}
return
mLimitLists
.
get
(
mLimitNames
.
get
(
0
));
return
mLimitLists
.
get
(
mLimitNames
.
get
(
0
));
...
@@ -116,8 +118,10 @@ public class LimitManager implements Closeable {
...
@@ -116,8 +118,10 @@ public class LimitManager implements Closeable {
++
mCount
;
++
mCount
;
return
rs1
&&
rs2
&&
res3
;
return
rs1
&&
rs2
&&
res3
;
}
}
/**
/**
* 从输入流加载配置文件数据
* 从输入流加载配置文件数据
*
* @param inputStream 配置文件的输入流
* @param inputStream 配置文件的输入流
* @return 加载成功返回true
* @return 加载成功返回true
*/
*/
...
@@ -144,23 +148,38 @@ public class LimitManager implements Closeable {
...
@@ -144,23 +148,38 @@ public class LimitManager implements Closeable {
tmp
=
new
LimitList
(
name
);
tmp
=
new
LimitList
(
name
);
mLimitLists
.
put
(
name
,
tmp
);
mLimitLists
.
put
(
name
,
tmp
);
mLimitNames
.
add
(
name
);
mLimitNames
.
add
(
name
);
}
else
if
(
line
.
startsWith
(
"$"
))
{
// 去掉$前缀并按空格分割
String
[]
words
=
line
.
substring
(
1
).
trim
().
split
(
"[\t| ]+"
);
if
(
words
.
length
>=
2
)
{
String
creditType
=
words
[
0
];
// 提取"genesys"
int
creditLimit
=
toNumber
(
words
[
1
]);
// 提取100并转换为整数
// 将creditType和creditLimit存储到LimitList对象中
if
(
tmp
!=
null
)
{
tmp
.
addCreditLimit
(
creditType
,
creditLimit
);
}
}
}
else
if
(
tmp
!=
null
)
{
}
else
if
(
tmp
!=
null
)
{
// 解析限制项配置
// 解析限制项配置
String
[]
words
=
line
.
trim
().
split
(
"[\t| ]+"
);
String
[]
words
=
line
.
trim
().
split
(
"[\t| ]+"
);
if
(
words
.
length
>=
2
)
{
if
(
words
.
length
>=
2
)
{
int
id
=
toNumber
(
words
[
0
]);
if
(
words
[
1
].
equals
(
"$genesys"
))
{
int
count
=
toNumber
(
words
[
1
]);
tmp
.
addCredits
(
toNumber
(
words
[
0
]),
toNumber
(
words
[
2
]));
//保存genesys行的卡牌id和信用分值
// 根据count值添加不同类型的限制
}
else
{
switch
(
count
)
{
int
id
=
toNumber
(
words
[
0
]);
case
0
:
int
count
=
toNumber
(
words
[
1
]);
tmp
.
addForbidden
(
id
);
// 根据count值添加不同类型的限制
break
;
switch
(
count
)
{
case
1
:
case
0
:
tmp
.
addLimit
(
id
);
tmp
.
addForbidden
(
id
);
break
;
break
;
case
2
:
case
1
:
tmp
.
addSemiLimit
(
id
);
tmp
.
addLimit
(
id
);
break
;
break
;
case
2
:
tmp
.
addSemiLimit
(
id
);
break
;
}
}
}
}
}
...
@@ -207,21 +226,37 @@ public class LimitManager implements Closeable {
...
@@ -207,21 +226,37 @@ public class LimitManager implements Closeable {
tmp
=
new
LimitList
(
name
);
tmp
=
new
LimitList
(
name
);
mLimitLists
.
put
(
name
,
tmp
);
mLimitLists
.
put
(
name
,
tmp
);
mLimitNames
.
add
(
name
);
mLimitNames
.
add
(
name
);
}
else
if
(
line
.
startsWith
(
"$"
))
{
// 去掉$前缀并按空格分割
String
[]
words
=
line
.
substring
(
1
).
trim
().
split
(
"[\t| ]+"
);
if
(
words
.
length
>=
2
)
{
String
creditType
=
words
[
0
];
// 提取"genesys"
int
creditLimit
=
toNumber
(
words
[
1
]);
// 提取100并转换为整数
// 将creditType和creditLimit存储到LimitList对象中
if
(
tmp
!=
null
)
{
tmp
.
addCreditLimit
(
creditType
,
creditLimit
);
}
}
}
else
if
(
tmp
!=
null
)
{
}
else
if
(
tmp
!=
null
)
{
String
[]
words
=
line
.
trim
().
split
(
"[\t| ]+"
);
String
[]
words
=
line
.
trim
().
split
(
"[\t| ]+"
);
if
(
words
.
length
>=
2
)
{
if
(
words
.
length
>=
2
)
{
int
id
=
toNumber
(
words
[
0
]);
if
(
words
[
1
].
equals
(
"$genesys"
))
{
int
count
=
toNumber
(
words
[
1
]);
tmp
.
addCredits
(
toNumber
(
words
[
0
]),
toNumber
(
words
[
2
]));
//保存genesys行的卡牌id和信用分值
switch
(
count
)
{
}
else
{
case
0
:
int
id
=
toNumber
(
words
[
0
]);
tmp
.
addForbidden
(
id
);
int
count
=
toNumber
(
words
[
1
]);
break
;
// 根据count值添加不同类型的限制
case
1
:
switch
(
count
)
{
tmp
.
addLimit
(
id
);
case
0
:
break
;
tmp
.
addForbidden
(
id
);
case
2
:
break
;
tmp
.
addSemiLimit
(
id
);
case
1
:
break
;
tmp
.
addLimit
(
id
);
break
;
case
2
:
tmp
.
addSemiLimit
(
id
);
break
;
}
}
}
}
}
...
...
mobile/src/main/java/ocgcore/data/LimitList.java
View file @
66ed2360
package
ocgcore.data
;
package
ocgcore.data
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
ocgcore.enums.LimitType
;
import
ocgcore.enums.LimitType
;
...
@@ -14,6 +16,8 @@ import ocgcore.enums.LimitType;
...
@@ -14,6 +16,8 @@ import ocgcore.enums.LimitType;
*/
*/
public
class
LimitList
{
public
class
LimitList
{
private
String
name
=
"?"
;
private
String
name
=
"?"
;
private
Map
<
String
,
Integer
>
credit_limits
;
private
Map
<
Integer
,
Integer
>
credits
;
/**
/**
* 0
* 0
*/
*/
...
@@ -72,6 +76,14 @@ public class LimitList {
...
@@ -72,6 +76,14 @@ public class LimitList {
return
strSemiLimit
;
return
strSemiLimit
;
}
}
public
Map
<
String
,
Integer
>
getCreditLimits
()
{
return
credit_limits
;
}
public
Map
<
Integer
,
Integer
>
getCredits
()
{
return
credits
;
}
public
String
getName
()
{
public
String
getName
()
{
return
name
;
return
name
;
}
}
...
@@ -93,6 +105,20 @@ public class LimitList {
...
@@ -93,6 +105,20 @@ public class LimitList {
}
}
}
}
public
void
addCreditLimit
(
String
creditType
,
Integer
limit
)
{
if
(
credit_limits
==
null
)
{
credit_limits
=
new
HashMap
<>();
}
credit_limits
.
put
(
creditType
,
limit
);
}
public
void
addCredits
(
Integer
cardId
,
Integer
creditCost
)
{
if
(
credits
==
null
)
{
credits
=
new
HashMap
<>();
}
credits
.
put
(
cardId
,
creditCost
);
}
public
boolean
has
(
Long
id
)
{
public
boolean
has
(
Long
id
)
{
return
allList
.
contains
(
id
);
return
allList
.
contains
(
id
);
}
}
...
@@ -104,10 +130,11 @@ public class LimitList {
...
@@ -104,10 +130,11 @@ public class LimitList {
}
}
public
List
<
Integer
>
getCodeList
()
{
public
List
<
Integer
>
getCodeList
()
{
if
(
allList
.
size
()
==
0
)
{
if
(
allList
.
isEmpty
()
)
{
allList
.
addAll
(
forbidden
);
allList
.
addAll
(
forbidden
);
allList
.
addAll
(
limit
);
allList
.
addAll
(
limit
);
allList
.
addAll
(
semiLimit
);
allList
.
addAll
(
semiLimit
);;
allList
.
addAll
(
credits
.
keySet
());
}
}
return
allList
;
return
allList
;
}
}
...
@@ -133,6 +160,8 @@ public class LimitList {
...
@@ -133,6 +160,8 @@ public class LimitList {
return
semiLimit
.
contains
(
code
)
||
semiLimit
.
contains
(
alias
);
return
semiLimit
.
contains
(
code
)
||
semiLimit
.
contains
(
alias
);
}
else
if
(
type
==
LimitType
.
Forbidden
)
{
}
else
if
(
type
==
LimitType
.
Forbidden
)
{
return
forbidden
.
contains
(
code
)
||
forbidden
.
contains
(
alias
);
return
forbidden
.
contains
(
code
)
||
forbidden
.
contains
(
alias
);
}
else
if
(
type
==
LimitType
.
GeneSys
)
{
return
credits
!=
null
&&
(
credits
.
containsKey
(
code
)
||
credits
.
containsKey
(
alias
));
}
else
{
}
else
{
return
false
;
return
false
;
}
}
...
@@ -143,6 +172,7 @@ public class LimitList {
...
@@ -143,6 +172,7 @@ public class LimitList {
int
result
=
forbidden
!=
null
?
forbidden
.
hashCode
()
:
0
;
int
result
=
forbidden
!=
null
?
forbidden
.
hashCode
()
:
0
;
result
=
31
*
result
+
(
limit
!=
null
?
limit
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
limit
!=
null
?
limit
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
semiLimit
!=
null
?
semiLimit
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
semiLimit
!=
null
?
semiLimit
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
credits
!=
null
?
credits
.
hashCode
()
:
0
);
return
result
;
return
result
;
}
}
...
@@ -150,6 +180,8 @@ public class LimitList {
...
@@ -150,6 +180,8 @@ public class LimitList {
public
String
toString
()
{
public
String
toString
()
{
return
"LimitList{"
+
return
"LimitList{"
+
"name='"
+
name
+
'\''
+
"name='"
+
name
+
'\''
+
", credit_limits="
+
credit_limits
+
", credits="
+
credits
+
", forbidden="
+
forbidden
+
", forbidden="
+
forbidden
+
", limit="
+
limit
+
", limit="
+
limit
+
", semiLimit="
+
semiLimit
+
", semiLimit="
+
semiLimit
+
...
...
mobile/src/main/java/ocgcore/enums/LimitType.java
View file @
66ed2360
...
@@ -5,14 +5,15 @@ import androidx.annotation.Nullable;
...
@@ -5,14 +5,15 @@ import androidx.annotation.Nullable;
public
enum
LimitType
{
public
enum
LimitType
{
None
(
0
),
None
(
0
),
All
(
999
,
1310
),
All
(
999
,
1310
),
GeneSys
(
100
,
1480
),
Forbidden
(
1
,
1316
),
Forbidden
(
1
,
1316
),
Limit
(
2
,
1317
),
Limit
(
2
,
1317
),
SemiLimit
(
3
,
1318
);
SemiLimit
(
3
,
1318
);
private
long
value
=
0
;
private
long
value
=
0
;
private
final
int
lang_index
;
private
final
Integer
lang_index
;
public
int
getLanguageIndex
()
{
public
Integer
getLanguageIndex
()
{
return
lang_index
;
return
lang_index
;
}
}
...
@@ -20,7 +21,7 @@ public enum LimitType {
...
@@ -20,7 +21,7 @@ public enum LimitType {
this
(
value
,
0
);
this
(
value
,
0
);
}
}
LimitType
(
long
value
,
int
lang_index
)
{
LimitType
(
long
value
,
Integer
lang_index
)
{
this
.
value
=
value
;
this
.
value
=
value
;
this
.
lang_index
=
lang_index
;
this
.
lang_index
=
lang_index
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment