Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
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-Cn-Ko-En
Commits
6f695c6a
Commit
6f695c6a
authored
Jan 27, 2025
by
Dark Zane
Committed by
GitHub
Jan 27, 2025
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fallenstardust:master' into master
parents
81fa4ca9
d1780756
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
341 additions
and
167 deletions
+341
-167
Classes/gframe/data_manager.cpp
Classes/gframe/data_manager.cpp
+15
-13
Classes/gframe/data_manager.h
Classes/gframe/data_manager.h
+4
-4
Classes/ocgcore/card.cpp
Classes/ocgcore/card.cpp
+4
-4
Classes/ocgcore/field.cpp
Classes/ocgcore/field.cpp
+3
-4
Classes/ocgcore/field.h
Classes/ocgcore/field.h
+1
-1
Classes/ocgcore/playerop.cpp
Classes/ocgcore/playerop.cpp
+12
-12
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/BaseActivity.java
.../java/cn/garymb/ygomobile/ui/activities/BaseActivity.java
+2
-45
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/FileLogActivity.java
...va/cn/garymb/ygomobile/ui/activities/FileLogActivity.java
+3
-2
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
...rc/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
+89
-72
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerFragment.java
...ava/cn/garymb/ygomobile/ui/cards/DeckManagerFragment.java
+4
-4
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ImageUpdater.java
...c/main/java/cn/garymb/ygomobile/ui/home/ImageUpdater.java
+3
-2
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/utils/ComparisonTableUtil.java
...n/java/cn/garymb/ygomobile/utils/ComparisonTableUtil.java
+200
-2
mobile/src/main/res/layout/dialog_cardinfo.xml
mobile/src/main/res/layout/dialog_cardinfo.xml
+0
-1
No files found.
Classes/gframe/data_manager.cpp
View file @
6f695c6a
...
@@ -386,30 +386,32 @@ uint32_t DataManager::CardReader(uint32_t code, card_data* pData) {
...
@@ -386,30 +386,32 @@ uint32_t DataManager::CardReader(uint32_t code, card_data* pData) {
pData
->
clear
();
pData
->
clear
();
return
0
;
return
0
;
}
}
unsigned
char
*
DataManager
::
ScriptReaderEx
(
const
char
*
script_
name
,
int
*
slen
)
{
unsigned
char
*
DataManager
::
ScriptReaderEx
(
const
char
*
script_
path
,
int
*
slen
)
{
// default script name: ./script/c%d.lua
// default script name: ./script/c%d.lua
if
(
std
::
strncmp
(
script_name
,
"./script"
,
8
)
!=
0
)
if
(
std
::
strncmp
(
script_path
,
"./script"
,
8
)
!=
0
)
// not a card script file
return
DefaultScriptReader
(
script_name
,
slen
);
return
ReadScriptFromFile
(
script_path
,
slen
);
const
char
*
script_name
=
script_path
+
2
;
char
expansions_path
[
1024
]{};
char
expansions_path
[
1024
]{};
std
::
snprintf
(
expansions_path
,
sizeof
expansions_path
,
"./expansions/%s"
,
script_name
+
2
);
std
::
snprintf
(
expansions_path
,
sizeof
expansions_path
,
"./expansions/%s"
,
script_name
);
if
(
mainGame
->
gameConf
.
prefer_expansion_script
)
{
if
(
mainGame
->
gameConf
.
prefer_expansion_script
)
{
// debug script with raw file in expansions
if
(
DefaultScriptReader
(
expansions_path
,
slen
))
if
(
ReadScriptFromFile
(
expansions_path
,
slen
))
return
scriptBuffer
;
return
scriptBuffer
;
else
if
(
ScriptReaderZip
(
script_name
+
2
,
slen
))
if
(
ReadScriptFromIrrFS
(
script_name
,
slen
))
return
scriptBuffer
;
return
scriptBuffer
;
else
if
(
DefaultScriptReader
(
script_name
,
slen
))
if
(
ReadScriptFromFile
(
script_path
,
slen
))
return
scriptBuffer
;
return
scriptBuffer
;
}
else
{
}
else
{
if
(
DefaultScriptReader
(
script_name
,
slen
))
if
(
ReadScriptFromIrrFS
(
script_name
,
slen
))
return
scriptBuffer
;
return
scriptBuffer
;
else
if
(
DefaultScriptReader
(
expansions
_path
,
slen
))
if
(
ReadScriptFromFile
(
script
_path
,
slen
))
return
scriptBuffer
;
return
scriptBuffer
;
else
if
(
ScriptReaderZip
(
script_name
+
2
,
slen
))
if
(
ReadScriptFromFile
(
expansions_path
,
slen
))
return
scriptBuffer
;
return
scriptBuffer
;
}
}
return
nullptr
;
return
nullptr
;
}
}
unsigned
char
*
DataManager
::
ScriptReaderZip
(
const
char
*
script_name
,
int
*
slen
)
{
unsigned
char
*
DataManager
::
ReadScriptFromIrrFS
(
const
char
*
script_name
,
int
*
slen
)
{
IReadFile
*
reader
=
FileSystem
->
createAndOpenFile
(
script_name
);
IReadFile
*
reader
=
FileSystem
->
createAndOpenFile
(
script_name
);
if
(
!
reader
)
if
(
!
reader
)
return
nullptr
;
return
nullptr
;
...
@@ -420,7 +422,7 @@ unsigned char* DataManager::ScriptReaderZip(const char* script_name, int* slen)
...
@@ -420,7 +422,7 @@ unsigned char* DataManager::ScriptReaderZip(const char* script_name, int* slen)
*
slen
=
size
;
*
slen
=
size
;
return
scriptBuffer
;
return
scriptBuffer
;
}
}
unsigned
char
*
DataManager
::
DefaultScriptReader
(
const
char
*
script_name
,
int
*
slen
)
{
unsigned
char
*
DataManager
::
ReadScriptFromFile
(
const
char
*
script_name
,
int
*
slen
)
{
wchar_t
fname
[
256
]{};
wchar_t
fname
[
256
]{};
BufferIO
::
DecodeUTF8
(
script_name
,
fname
);
BufferIO
::
DecodeUTF8
(
script_name
,
fname
);
FILE
*
fp
=
myfopen
(
fname
,
"rb"
);
FILE
*
fp
=
myfopen
(
fname
,
"rb"
);
...
...
Classes/gframe/data_manager.h
View file @
6f695c6a
...
@@ -82,13 +82,13 @@ public:
...
@@ -82,13 +82,13 @@ public:
static
unsigned
char
scriptBuffer
[
0x100000
];
static
unsigned
char
scriptBuffer
[
0x100000
];
static
const
wchar_t
*
unknown_string
;
static
const
wchar_t
*
unknown_string
;
static
uint32_t
CardReader
(
uint32_t
,
card_data
*
);
static
uint32_t
CardReader
(
uint32_t
,
card_data
*
);
static
unsigned
char
*
ScriptReaderEx
(
const
char
*
script_
name
,
int
*
slen
);
static
unsigned
char
*
ScriptReaderEx
(
const
char
*
script_
path
,
int
*
slen
);
//read by IFileSystem
//read by IFileSystem
static
unsigned
char
*
ScriptReader
(
const
char
*
script_name
,
int
*
slen
);
static
unsigned
char
*
ReadScriptFromIrrFS
(
const
char
*
script_name
,
int
*
slen
);
//read by fread
//read by fread
static
unsigned
char
*
DefaultScriptReader
(
const
char
*
script_name
,
int
*
slen
);
static
unsigned
char
*
ReadScriptFromFile
(
const
char
*
script_name
,
int
*
slen
);
static
unsigned
char
*
ScriptReaderZip
(
const
char
*
script_name
,
int
*
slen
);
static
irr
::
io
::
IFileSystem
*
FileSystem
;
static
irr
::
io
::
IFileSystem
*
FileSystem
;
static
bool
deck_sort_lv
(
code_pointer
l1
,
code_pointer
l2
);
static
bool
deck_sort_lv
(
code_pointer
l1
,
code_pointer
l2
);
...
...
Classes/ocgcore/card.cpp
View file @
6f695c6a
...
@@ -82,12 +82,12 @@ bool card::card_operation_sort(card* c1, card* c2) {
...
@@ -82,12 +82,12 @@ bool card::card_operation_sort(card* c1, card* c2) {
}
}
if
(
c1
->
current
.
location
!=
c2
->
current
.
location
)
if
(
c1
->
current
.
location
!=
c2
->
current
.
location
)
return
c1
->
current
.
location
<
c2
->
current
.
location
;
return
c1
->
current
.
location
<
c2
->
current
.
location
;
if
(
c1
->
current
.
location
&
LOCATION_OVERLAY
)
{
if
(
c1
->
current
.
location
==
LOCATION_OVERLAY
)
{
if
(
c1
->
overlay_target
&&
c2
->
overlay_target
&&
c1
->
overlay_target
->
current
.
sequence
!=
c2
->
overlay_target
->
current
.
sequence
)
if
(
c1
->
overlay_target
&&
c2
->
overlay_target
&&
c1
->
overlay_target
->
current
.
sequence
!=
c2
->
overlay_target
->
current
.
sequence
)
return
c1
->
overlay_target
->
current
.
sequence
<
c2
->
overlay_target
->
current
.
sequence
;
return
c1
->
overlay_target
->
current
.
sequence
<
c2
->
overlay_target
->
current
.
sequence
;
else
else
return
c1
->
current
.
sequence
<
c2
->
current
.
sequence
;
return
c1
->
current
.
sequence
<
c2
->
current
.
sequence
;
}
else
if
(
c1
->
current
.
location
&
LOCATION_DECK
&&
pduel
->
game_field
->
is_select_hide_deck_sequence
(
cp1
))
{
}
else
if
(
c1
->
current
.
location
==
LOCATION_DECK
&&
pduel
->
game_field
->
is_select_hide_deck_sequence
(
cp1
))
{
// if deck reversed and the card being at the top, it should go first
// if deck reversed and the card being at the top, it should go first
if
(
pduel
->
game_field
->
core
.
deck_reversed
)
{
if
(
pduel
->
game_field
->
core
.
deck_reversed
)
{
if
(
c1
->
current
.
sequence
==
pduel
->
game_field
->
player
[
cp1
].
list_main
.
size
()
-
1
)
if
(
c1
->
current
.
sequence
==
pduel
->
game_field
->
player
[
cp1
].
list_main
.
size
()
-
1
)
...
@@ -105,8 +105,8 @@ bool card::card_operation_sort(card* c1, card* c2) {
...
@@ -105,8 +105,8 @@ bool card::card_operation_sort(card* c1, card* c2) {
return
c2_faceup
;
return
c2_faceup
;
}
}
// sort deck as card property
// sort deck as card property
auto
c1_type
=
c1
->
data
.
type
&
0x7
;
auto
c1_type
=
c1
->
data
.
type
&
(
TYPE_MONSTER
|
TYPE_SPELL
|
TYPE_TRAP
)
;
auto
c2_type
=
c2
->
data
.
type
&
0x7
;
auto
c2_type
=
c2
->
data
.
type
&
(
TYPE_MONSTER
|
TYPE_SPELL
|
TYPE_TRAP
)
;
// monster should go before spell, and then trap
// monster should go before spell, and then trap
if
(
c1_type
!=
c2_type
)
if
(
c1_type
!=
c2_type
)
return
c1_type
>
c2_type
;
return
c1_type
>
c2_type
;
...
...
Classes/ocgcore/field.cpp
View file @
6f695c6a
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include "effect.h"
#include "effect.h"
#include "interpreter.h"
#include "interpreter.h"
#include <cstring>
#include <cstring>
#include <algorithm>
int32_t
field
::
field_used_count
[
32
]
=
{
0
,
1
,
1
,
2
,
1
,
2
,
2
,
3
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
2
,
3
,
3
,
4
,
3
,
4
,
4
,
5
};
int32_t
field
::
field_used_count
[
32
]
=
{
0
,
1
,
1
,
2
,
1
,
2
,
2
,
3
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
1
,
2
,
2
,
3
,
2
,
3
,
3
,
4
,
2
,
3
,
3
,
4
,
3
,
4
,
4
,
5
};
...
@@ -1094,11 +1095,9 @@ void field::reverse_deck(uint8_t playerid) {
...
@@ -1094,11 +1095,9 @@ void field::reverse_deck(uint8_t playerid) {
if
(
count
==
0
)
if
(
count
==
0
)
return
;
return
;
for
(
int32_t
i
=
0
;
i
<
count
/
2
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
count
/
2
;
++
i
)
{
card
*
tmp
=
player
[
playerid
].
list_main
[
i
];
player
[
playerid
].
list_main
[
i
]
->
current
.
sequence
=
count
-
1
-
i
;
tmp
->
current
.
sequence
=
count
-
1
-
i
;
player
[
playerid
].
list_main
[
count
-
1
-
i
]
->
current
.
sequence
=
i
;
player
[
playerid
].
list_main
[
count
-
1
-
i
]
->
current
.
sequence
=
i
;
player
[
playerid
].
list_main
[
i
]
=
player
[
playerid
].
list_main
[
count
-
1
-
i
];
std
::
swap
(
player
[
playerid
].
list_main
[
i
],
player
[
playerid
].
list_main
[
count
-
1
-
i
]);
player
[
playerid
].
list_main
[
count
-
1
-
i
]
=
tmp
;
}
}
}
}
void
field
::
refresh_player_info
(
uint8_t
playerid
)
{
void
field
::
refresh_player_info
(
uint8_t
playerid
)
{
...
...
Classes/ocgcore/field.h
View file @
6f695c6a
...
@@ -348,7 +348,7 @@ struct processor {
...
@@ -348,7 +348,7 @@ struct processor {
uint8_t
current_player
{
PLAYER_NONE
};
uint8_t
current_player
{
PLAYER_NONE
};
uint8_t
conti_player
{
PLAYER_NONE
};
uint8_t
conti_player
{
PLAYER_NONE
};
uint8_t
select_deck_sequence_revealed
{
FALSE
};
uint8_t
select_deck_sequence_revealed
{
FALSE
};
uint8_t
selecting_player
{
PLAYER_NONE
};
uint8_t
selecting_player
{
0
};
activity_map
summon_counter
;
activity_map
summon_counter
;
activity_map
normalsummon_counter
;
activity_map
normalsummon_counter
;
activity_map
spsummon_counter
;
activity_map
spsummon_counter
;
...
...
Classes/ocgcore/playerop.cpp
View file @
6f695c6a
...
@@ -261,10 +261,10 @@ int32_t field::select_card(uint16_t step, uint8_t playerid, uint8_t cancelable,
...
@@ -261,10 +261,10 @@ int32_t field::select_card(uint16_t step, uint8_t playerid, uint8_t cancelable,
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
uint8_t
deck_seq
_pointer
=
0
;
uint8_t
deck_seq
=
0
;
for
(
auto
&
pcard
:
core
.
select_cards
)
{
for
(
auto
&
pcard
:
core
.
select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
get_select_info_location
(
&
deck_seq
_pointer
));
pduel
->
write_buffer32
(
pcard
->
get_select_info_location
(
&
deck_seq
));
}
}
return
FALSE
;
return
FALSE
;
}
else
{
}
else
{
...
@@ -305,15 +305,15 @@ int32_t field::select_unselect_card(uint16_t step, uint8_t playerid, uint8_t can
...
@@ -305,15 +305,15 @@ int32_t field::select_unselect_card(uint16_t step, uint8_t playerid, uint8_t can
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
uint8_t
deck_seq
_pointer
=
0
;
uint8_t
deck_seq
=
0
;
for
(
auto
&
pcard
:
core
.
select_cards
)
{
for
(
auto
&
pcard
:
core
.
select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
get_select_info_location
(
&
deck_seq
_pointer
));
pduel
->
write_buffer32
(
pcard
->
get_select_info_location
(
&
deck_seq
));
}
}
pduel
->
write_buffer8
((
uint8_t
)
core
.
unselect_cards
.
size
());
pduel
->
write_buffer8
((
uint8_t
)
core
.
unselect_cards
.
size
());
for
(
auto
&
pcard
:
core
.
unselect_cards
)
{
for
(
auto
&
pcard
:
core
.
unselect_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
get_select_info_location
(
&
deck_seq
_pointer
));
pduel
->
write_buffer32
(
pcard
->
get_select_info_location
(
&
deck_seq
));
}
}
return
FALSE
;
return
FALSE
;
}
else
{
}
else
{
...
@@ -530,12 +530,12 @@ int32_t field::select_tribute(uint16_t step, uint8_t playerid, uint8_t cancelabl
...
@@ -530,12 +530,12 @@ int32_t field::select_tribute(uint16_t step, uint8_t playerid, uint8_t cancelabl
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
uint8_t
deck_seq
_pointer
=
0
;
uint8_t
deck_seq
=
0
;
for
(
auto
&
pcard
:
core
.
select_cards
)
{
for
(
auto
&
pcard
:
core
.
select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
&
deck_seq
_pointer
));
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
&
deck_seq
));
pduel
->
write_buffer8
(
pcard
->
release_param
);
pduel
->
write_buffer8
(
pcard
->
release_param
);
}
}
return
FALSE
;
return
FALSE
;
...
@@ -605,12 +605,12 @@ int32_t field::select_counter(uint16_t step, uint8_t playerid, uint16_t countert
...
@@ -605,12 +605,12 @@ int32_t field::select_counter(uint16_t step, uint8_t playerid, uint16_t countert
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
core
.
selecting_player
=
playerid
;
core
.
selecting_player
=
playerid
;
std
::
sort
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
card
::
card_operation_sort
);
std
::
sort
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
card
::
card_operation_sort
);
uint8_t
deck_seq
_pointer
=
0
;
uint8_t
deck_seq
=
0
;
for
(
auto
&
pcard
:
core
.
select_cards
)
{
for
(
auto
&
pcard
:
core
.
select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
&
deck_seq
_pointer
));
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
&
deck_seq
));
pduel
->
write_buffer16
(
pcard
->
get_counter
(
countertype
));
pduel
->
write_buffer16
(
pcard
->
get_counter
(
countertype
));
}
}
return
FALSE
;
return
FALSE
;
...
@@ -663,12 +663,12 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
...
@@ -663,12 +663,12 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
((
uint8_t
)
core
.
must_select_cards
.
size
());
pduel
->
write_buffer8
((
uint8_t
)
core
.
must_select_cards
.
size
());
uint8_t
deck_seq
_pointer
=
0
;
uint8_t
deck_seq
=
0
;
for
(
auto
&
pcard
:
core
.
must_select_cards
)
{
for
(
auto
&
pcard
:
core
.
must_select_cards
)
{
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
&
deck_seq
_pointer
));
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
&
deck_seq
));
pduel
->
write_buffer32
(
pcard
->
sum_param
);
pduel
->
write_buffer32
(
pcard
->
sum_param
);
}
}
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
pduel
->
write_buffer8
((
uint8_t
)
core
.
select_cards
.
size
());
...
@@ -676,7 +676,7 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
...
@@ -676,7 +676,7 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
&
deck_seq
_pointer
));
pduel
->
write_buffer8
(
pcard
->
get_select_sequence
(
&
deck_seq
));
pduel
->
write_buffer32
(
pcard
->
sum_param
);
pduel
->
write_buffer32
(
pcard
->
sum_param
);
}
}
return
FALSE
;
return
FALSE
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/BaseActivity.java
View file @
6f695c6a
...
@@ -24,6 +24,7 @@ import androidx.appcompat.app.AppCompatActivity;
...
@@ -24,6 +24,7 @@ import androidx.appcompat.app.AppCompatActivity;
import
androidx.appcompat.widget.Toolbar
;
import
androidx.appcompat.widget.Toolbar
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
import
ocgcore.data.Card
;
import
ocgcore.data.Card
;
...
@@ -288,52 +289,8 @@ public class BaseActivity extends AppCompatActivity {
...
@@ -288,52 +289,8 @@ public class BaseActivity extends AppCompatActivity {
// getContext().startActivity(new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, Uri.parse("package:" + getContext().getPackageName())).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
// getContext().startActivity(new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, Uri.parse("package:" + getContext().getPackageName())).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
// }
// }
}
else
{
}
else
{
show
Toast
(
"喵不给我权限让我怎么运行?!"
);
YGOUtil
.
showText
Toast
(
"喵不给我权限让我怎么运行?!"
);
finish
();
finish
();
}
}
}
}
@SuppressLint
(
"ShowToast"
)
private
Toast
makeToast
()
{
if
(
mToast
==
null
)
{
mToast
=
Toast
.
makeText
(
this
,
""
,
Toast
.
LENGTH_SHORT
);
}
return
mToast
;
}
/**
* Set how long to show the view for.
*
* @see android.widget.Toast#LENGTH_SHORT
* @see android.widget.Toast#LENGTH_LONG
*/
public
void
showToast
(
int
id
,
int
duration
)
{
showToast
(
getString
(
id
),
duration
);
}
public
void
showToast
(
CharSequence
text
)
{
showToast
(
text
,
Toast
.
LENGTH_SHORT
);
}
public
void
showToast
(
int
id
)
{
showToast
(
getString
(
id
));
}
/**
* Set how long to show the view for.
*
* @see android.widget.Toast#LENGTH_SHORT
* @see android.widget.Toast#LENGTH_LONG
*/
public
void
showToast
(
CharSequence
text
,
int
duration
)
{
if
(
Looper
.
myLooper
()
!=
Looper
.
getMainLooper
())
{
runOnUiThread
(()
->
showToast
(
text
,
duration
));
return
;
}
Toast
toast
=
makeToast
();
toast
.
setText
(
text
);
toast
.
setGravity
(
Gravity
.
TOP
,
0
,
0
);
toast
.
setDuration
(
duration
);
toast
.
show
();
}
}
}
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/FileLogActivity.java
View file @
6f695c6a
...
@@ -13,6 +13,7 @@ import java.io.IOException;
...
@@ -13,6 +13,7 @@ import java.io.IOException;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.utils.FileLogUtil
;
import
cn.garymb.ygomobile.utils.FileLogUtil
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
public
class
FileLogActivity
extends
BaseActivity
{
public
class
FileLogActivity
extends
BaseActivity
{
...
@@ -51,10 +52,10 @@ public class FileLogActivity extends BaseActivity {
...
@@ -51,10 +52,10 @@ public class FileLogActivity extends BaseActivity {
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
try
{
try
{
FileLogUtil
.
clear
();
FileLogUtil
.
clear
();
show
Toast
(
"清空完毕"
);
YGOUtil
.
showText
Toast
(
"清空完毕"
);
tv_log
.
setText
(
""
);
tv_log
.
setText
(
""
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
show
Toast
(
"清空失败,原因为"
+
e
.
getMessage
());
YGOUtil
.
showText
Toast
(
"清空失败,原因为"
+
e
.
getMessage
());
}
}
dialog
.
dismiss
();
dialog
.
dismiss
();
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
View file @
6f695c6a
...
@@ -7,7 +7,6 @@ import android.content.Intent;
...
@@ -7,7 +7,6 @@ import android.content.Intent;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.os.Message
;
import
android.text.Spannable
;
import
android.text.SpannableString
;
import
android.text.SpannableString
;
import
android.text.TextPaint
;
import
android.text.TextPaint
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
...
@@ -35,7 +34,9 @@ import com.feihua.dialogutils.util.DialogUtils;
...
@@ -35,7 +34,9 @@ import com.feihua.dialogutils.util.DialogUtils;
import
java.io.File
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Stack
;
import
java.util.Stack
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.AppsSettings
;
...
@@ -43,7 +44,6 @@ import cn.garymb.ygomobile.Constants;
...
@@ -43,7 +44,6 @@ import cn.garymb.ygomobile.Constants;
import
cn.garymb.ygomobile.core.IrrlichtBridge
;
import
cn.garymb.ygomobile.core.IrrlichtBridge
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.loader.CardLoader
;
import
cn.garymb.ygomobile.loader.CardLoader
;
import
cn.garymb.ygomobile.loader.CardSearchInfo
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
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.adapters.BaseAdapterPlus
;
import
cn.garymb.ygomobile.ui.adapters.BaseAdapterPlus
;
...
@@ -115,7 +115,6 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
...
@@ -115,7 +115,6 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
private
Button
btn_redownload
;
private
Button
btn_redownload
;
private
Button
btn_share
;
private
Button
btn_share
;
private
boolean
isDownloadCardImage
=
true
;
private
boolean
isDownloadCardImage
=
true
;
private
List
<
String
>
spanStringList
=
new
ArrayList
<>();
@SuppressLint
(
"HandlerLeak"
)
@SuppressLint
(
"HandlerLeak"
)
Handler
handler
=
new
Handler
()
{
Handler
handler
=
new
Handler
()
{
...
@@ -147,6 +146,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
...
@@ -147,6 +146,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
}
}
}
}
};
};
private
List
<
String
>
spanStringList
=
new
ArrayList
<>();
private
Shimmer
shimmer
;
private
Shimmer
shimmer
;
private
boolean
mShowAdd
=
false
;
private
boolean
mShowAdd
=
false
;
private
OnFavoriteChangedListener
mOnFavoriteChangedListener
;
private
OnFavoriteChangedListener
mOnFavoriteChangedListener
;
...
@@ -355,7 +355,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
...
@@ -355,7 +355,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
if
(
stack
.
isEmpty
())
{
if
(
stack
.
isEmpty
())
{
String
quotedText
=
text
.
substring
(
start
,
i
).
trim
();
String
quotedText
=
text
.
substring
(
start
,
i
).
trim
();
// 使用 queryable 方法判断是否高亮
// 使用 queryable 方法判断是否高亮
applySpan
(
spannableString
,
start
,
i
,
queryable
(
quotedText
)?
YGOUtil
.
c
(
R
.
color
.
holo_blue_bright
)
:
Color
.
WHITE
);
applySpan
(
spannableString
,
start
,
i
,
queryable
(
quotedText
)
?
YGOUtil
.
c
(
R
.
color
.
holo_blue_bright
)
:
Color
.
WHITE
);
spanStringList
.
add
(
quotedText
);
spanStringList
.
add
(
quotedText
);
currentQuoteType
=
QuoteType
.
NONE
;
currentQuoteType
=
QuoteType
.
NONE
;
}
}
...
@@ -367,7 +367,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
...
@@ -367,7 +367,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
stack
.
pop
();
stack
.
pop
();
if
(
stack
.
isEmpty
())
{
if
(
stack
.
isEmpty
())
{
String
quotedText
=
text
.
substring
(
start
,
i
).
trim
();
String
quotedText
=
text
.
substring
(
start
,
i
).
trim
();
applySpan
(
spannableString
,
start
,
i
,
queryable
(
quotedText
)?
YGOUtil
.
c
(
R
.
color
.
holo_blue_bright
)
:
Color
.
WHITE
);
applySpan
(
spannableString
,
start
,
i
,
queryable
(
quotedText
)
?
YGOUtil
.
c
(
R
.
color
.
holo_blue_bright
)
:
Color
.
WHITE
);
spanStringList
.
add
(
quotedText
);
spanStringList
.
add
(
quotedText
);
currentQuoteType
=
QuoteType
.
NONE
;
currentQuoteType
=
QuoteType
.
NONE
;
}
else
{
}
else
{
...
@@ -408,27 +408,39 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
...
@@ -408,27 +408,39 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
}
}
private
List
<
Card
>
queryList
(
String
keyword
)
{
private
List
<
Card
>
queryList
(
String
keyword
)
{
// 获取关键词对应的 setcode
long
setcode
=
DataManager
.
get
().
getStringManager
().
getSetCode
(
keyword
);
long
setcode
=
DataManager
.
get
().
getStringManager
().
getSetCode
(
keyword
);
// 从 cardManager 获取所有卡片
SparseArray
<
Card
>
cards
=
cardManager
.
getAllCards
();
SparseArray
<
Card
>
cards
=
cardManager
.
getAllCards
();
List
<
Card
>
matchingCards
=
new
ArrayList
<>();
if
(
cards
==
null
)
{
return
new
ArrayList
<>();
}
// 使用 HashSet 来保存匹配的卡片,避免重复并提高查找效率
Set
<
Card
>
matchingCards
=
new
HashSet
<>();
// 建立CardInfo拥有的字段表
List
<
Long
>
cardInfoSetCodes
=
new
ArrayList
<>();
List
<
Long
>
cardInfoSetCodes
=
new
ArrayList
<>();
// 检查关键词是否存在于卡片名字或描述中
for
(
int
i
=
0
;
i
<
cards
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
cards
.
size
();
i
++)
{
Card
card
=
cards
.
valueAt
(
i
);
Card
card
=
cards
.
valueAt
(
i
);
cardInfoSetCodes
.
clear
();
//每张卡调用前都清空字段表以防重复
// 如果 card.Name 或 card.Desc 为 null,则跳过该卡片
if
(
card
.
Name
==
null
&&
card
.
Desc
==
null
)
continue
;
// 清空字段表以防重复累加
cardInfoSetCodes
.
clear
();
// 将 card 的 setCode 转换为 List<Long>
// 将 card 的 setCode 转换为 List<Long>
for
(
long
setCode
:
card
.
getSetCode
())
{
for
(
long
setCode
:
card
.
getSetCode
())
{
if
(
setCode
>
0
)
cardInfoSetCodes
.
add
(
setCode
);
if
(
setCode
>
0
)
cardInfoSetCodes
.
add
(
setCode
);
}
}
//关键词如果有对应字段则添加进去
// 检查关键词是否有对应字段
if
(
cardInfoSetCodes
.
contains
(
setcode
)
&&
!
matchingCards
.
contains
(
card
))
matchingCards
.
add
(
card
);
if
(
setcode
>
0
&&
cardInfoSetCodes
.
contains
(
setcode
))
{
// 确保 card.Name 和 card.Desc 不为 null
matchingCards
.
add
(
card
);
if
((
card
.
Name
!=
null
&&
card
.
Name
.
contains
(
keyword
))
||
(
card
.
Desc
!=
null
&&
card
.
Desc
.
contains
(
keyword
)))
{
}
if
(!
matchingCards
.
contains
(
card
))
matchingCards
.
add
(
card
);
// 检查关键词是否存在于卡片名字或描述中
if
((
card
.
Name
!=
null
&&
card
.
Name
.
contains
(
keyword
))
||
(
card
.
Desc
!=
null
&&
card
.
Desc
.
contains
(
keyword
)))
{
matchingCards
.
add
(
card
);
}
}
}
}
return
matchingCards
;
// 将结果转换回 List<Card>
return
new
ArrayList
<>(
matchingCards
);
}
}
private
boolean
queryable
(
String
keyword
)
{
private
boolean
queryable
(
String
keyword
)
{
...
@@ -458,42 +470,45 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
...
@@ -458,42 +470,45 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
private
List
<
Card
>
relatedCards
(
Card
cardInfo
)
{
private
List
<
Card
>
relatedCards
(
Card
cardInfo
)
{
SparseArray
<
Card
>
cards
=
cardManager
.
getAllCards
();
SparseArray
<
Card
>
cards
=
cardManager
.
getAllCards
();
// 使用 HashSet 来保存匹配的卡片,避免重复并提高查找效率
Set
<
Card
>
matchingCards
=
new
HashSet
<>();
// 新创建一个表避免外部修改原本的表
// 新创建一个表避免外部修改原本的表
List
<
String
>
highlightedTexts
=
new
ArrayList
<>(
spanStringList
);
List
<
String
>
highlightedTexts
=
new
ArrayList
<>(
spanStringList
);
// 使用 ArrayList 来保存匹配的卡片
// 将 cardInfo 的 setCode 转换为 Set<Long>
List
<
Card
>
matchingCards
=
new
ArrayList
<>();
Set
<
Long
>
cardInfoSetCodes
=
new
HashSet
<>();
// 将 cardInfo 的 setCode 转换为 List<Long>
List
<
Long
>
cardInfoSetCodes
=
new
ArrayList
<>();
for
(
long
setCode
:
cardInfo
.
getSetCode
())
{
for
(
long
setCode
:
cardInfo
.
getSetCode
())
{
if
(
setCode
!=
0
)
cardInfoSetCodes
.
add
(
setCode
);
if
(
setCode
!=
0
)
cardInfoSetCodes
.
add
(
setCode
);
}
}
Log
.
w
(
"cc cardInfoSetCodes"
,
cardInfoSetCodes
.
toString
());
for
(
int
i
=
0
;
i
<
cards
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
cards
.
size
();
i
++)
{
Card
card
=
cards
.
valueAt
(
i
);
Card
card
=
cards
.
valueAt
(
i
);
// 空值检查
if
(
card
.
Name
==
null
||
card
.
Desc
==
null
)
continue
;
// 检查卡片名或描述是否包含给定卡片的名字
// 检查卡片名或描述是否包含给定卡片的名字
if
(!
card
.
Name
.
equals
(
cardInfo
.
Name
)
&&
(
card
.
Name
.
contains
(
cardInfo
.
Name
)
||
card
.
Desc
.
contains
(
cardInfo
.
Name
)))
{
if
(!
card
.
Name
.
equals
(
cardInfo
.
Name
))
{
// 检查卡片是否已经存在于匹配列表中
if
((
card
.
Name
!=
null
&&
card
.
Name
.
contains
(
cardInfo
.
Name
))
||
if
(!
matchingCards
.
contains
(
card
))
matchingCards
.
add
(
card
);
(
card
.
Desc
!=
null
&&
card
.
Desc
.
contains
(
cardInfo
.
Name
)))
{
matchingCards
.
add
(
card
);
}
}
}
// 获取卡片的字段并检查是否有相同的字段
// 获取卡片的字段并检查是否有相同的字段
for
(
long
setCode
:
card
.
getSetCode
())
{
for
(
long
setCode
:
card
.
getSetCode
())
{
if
(
cardInfoSetCodes
.
contains
(
setCode
))
{
if
(
cardInfoSetCodes
.
contains
(
setCode
))
{
if
(!
matchingCards
.
contains
(
card
)
&&
!
card
.
Name
.
equals
(
cardInfo
.
Name
))
matchingCards
.
add
(
card
);
if
(!
card
.
Name
.
equals
(
cardInfo
.
Name
))
matchingCards
.
add
(
card
);
}
}
}
}
for
(
String
keyword
:
highlightedTexts
)
{
for
(
String
keyword
:
highlightedTexts
)
{
if
((
card
.
Name
!=
null
&&
card
.
Name
.
equals
(
keyword
))
//和关键词完全一致的视为关联卡
boolean
nameMatch
=
card
.
Name
!=
null
&&
card
.
Name
.
equals
(
keyword
);
||
(
card
.
Desc
!=
null
&&
(
card
.
Desc
.
contains
(
"「"
+
keyword
+
"」"
)
||
card
.
Desc
.
contains
(
"\""
+
keyword
+
"\""
))))
{
//描述中关键词指向的字段一致的视为关联卡
boolean
descMatch
=
card
.
Desc
!=
null
&&
(
card
.
Desc
.
contains
(
"「"
+
keyword
+
"」"
)
||
card
.
Desc
.
contains
(
"\""
+
keyword
+
"\""
));
if
(!
matchingCards
.
contains
(
card
)
&&
!
card
.
Name
.
equals
(
cardInfo
.
Name
))
matchingCards
.
add
(
card
);
if
(
nameMatch
||
descMatch
)
{
// 和关键词完全一致的视为关联卡
if
(!
card
.
Name
.
equals
(
cardInfo
.
Name
))
matchingCards
.
add
(
card
);
}
}
}
}
}
}
return
matchingCards
;
// 将结果转换回 List<Card>
return
new
ArrayList
<>(
matchingCards
);
}
}
private
void
setCardInfo
(
Card
cardInfo
,
View
view
)
{
private
void
setCardInfo
(
Card
cardInfo
,
View
view
)
{
...
@@ -670,7 +685,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
...
@@ -670,7 +685,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
}
}
private
void
downloadCardImage
(
int
code
,
boolean
force
)
{
private
void
downloadCardImage
(
int
code
,
boolean
force
)
{
if
(
cardManager
.
getCard
(
code
)
==
null
)
{
if
(
String
.
valueOf
(
Math
.
abs
(
code
)).
length
()
>=
9
)
{
YGOUtil
.
showTextToast
(
context
.
getString
(
R
.
string
.
tip_expansions_image
));
YGOUtil
.
showTextToast
(
context
.
getString
(
R
.
string
.
tip_expansions_image
));
return
;
return
;
}
}
...
@@ -734,47 +749,49 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
...
@@ -734,47 +749,49 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
public
void
onPreCard
()
{
public
void
onPreCard
()
{
int
position
=
getCurPosition
();
int
position
=
getCurPosition
();
CardListProvider
provider
=
getProvider
();
CardListProvider
provider
=
getProvider
();
if
(
position
==
0
)
{
int
cardsCount
=
provider
.
getCardsCount
();
getContext
().
showToast
(
R
.
string
.
already_top
,
Toast
.
LENGTH_SHORT
);
Log
.
w
(
"cc onPreCard"
,
position
+
"/"
+
cardsCount
);
}
else
{
// 如果已经在顶部,显示提示并返回
int
index
=
position
;
if
(
position
<=
0
)
{
do
{
YGOUtil
.
showTextToast
(
R
.
string
.
already_top
,
Toast
.
LENGTH_SHORT
);
if
(
index
==
0
)
{
getContext
().
showToast
(
R
.
string
.
already_top
,
Toast
.
LENGTH_SHORT
);
return
;
return
;
}
else
{
index
--;
}
}
}
while
(
provider
.
getCard
(
index
)
==
null
||
provider
.
getCard
(
index
).
Name
==
null
||
provider
.
getCard
(
position
).
Name
.
equals
(
provider
.
getCard
(
index
).
Name
));
// 向前查找有效卡片
for
(
int
index
=
position
-
1
;
index
>=
0
;
index
--)
{
bind
(
provider
.
getCard
(
index
),
index
,
provider
);
//当进行高亮词、关联卡片查询到的结果比原列表少时,进行以下判断处理,避免index溢出错误
if
(
position
==
1
)
{
if
(
index
>
cardsCount
)
{
getContext
().
showToast
(
R
.
string
.
already_top
,
Toast
.
LENGTH_SHORT
);
index
=
0
;
position
=
cardsCount
-
1
;
}
Card
card
=
provider
.
getCard
(
index
);
if
(
card
!=
null
&&
card
.
Name
!=
null
&&
!
provider
.
getCard
(
position
).
Name
.
equals
(
card
.
Name
))
{
bind
(
card
,
index
,
provider
);
return
;
}
}
}
}
// 如果没有找到合适的前一张卡片(所有卡片名称相同或为null),显示提示
YGOUtil
.
showTextToast
(
R
.
string
.
already_top
,
Toast
.
LENGTH_SHORT
);
}
}
public
void
onNextCard
()
{
public
void
onNextCard
()
{
int
position
=
getCurPosition
();
int
position
=
getCurPosition
();
CardListProvider
provider
=
getProvider
();
CardListProvider
provider
=
getProvider
();
if
(
position
<
provider
.
getCardsCount
()
-
1
)
{
int
cardsCount
=
provider
.
getCardsCount
();
int
index
=
position
;
// 如果已经在底部,显示提示并返回
do
{
if
(
position
>=
cardsCount
-
1
)
{
if
(
index
==
provider
.
getCardsCount
()
-
1
)
{
YGOUtil
.
showTextToast
(
R
.
string
.
already_end
,
Toast
.
LENGTH_SHORT
);
getContext
().
showToast
(
R
.
string
.
already_end
,
Toast
.
LENGTH_SHORT
);
return
;
return
;
}
else
{
index
++;
}
}
}
while
(
provider
.
getCard
(
index
)
==
null
||
provider
.
getCard
(
index
).
Name
==
null
||
provider
.
getCard
(
position
).
Name
.
equals
(
provider
.
getCard
(
index
).
Name
));
// 向后查找有效卡片
for
(
int
index
=
position
+
1
;
index
<
cardsCount
;
index
++)
{
bind
(
provider
.
getCard
(
index
),
index
,
provider
);
Card
card
=
provider
.
getCard
(
index
);
if
(
position
==
provider
.
getCardsCount
()
-
1
)
{
if
(
card
!=
null
&&
card
.
Name
!=
null
&&
!
provider
.
getCard
(
position
).
Name
.
equals
(
card
.
Name
))
{
getContext
().
showToast
(
R
.
string
.
already_end
,
Toast
.
LENGTH_SHORT
);
bind
(
card
,
index
,
provider
);
return
;
}
}
}
else
{
getContext
().
showToast
(
R
.
string
.
already_end
,
Toast
.
LENGTH_SHORT
);
}
}
// 如果没有找到合适的下一张卡片(所有卡片名称相同或为null),显示提示
YGOUtil
.
showTextToast
(
R
.
string
.
already_end
,
Toast
.
LENGTH_SHORT
);
}
}
// 定义引号类型
// 定义引号类型
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerFragment.java
View file @
6f695c6a
...
@@ -634,9 +634,9 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
...
@@ -634,9 +634,9 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
if
(
checkLimit
(
cardInfo
))
{
if
(
checkLimit
(
cardInfo
))
{
boolean
rs
=
mDeckAdapater
.
AddCard
(
cardInfo
,
DeckItemType
.
SideCard
);
boolean
rs
=
mDeckAdapater
.
AddCard
(
cardInfo
,
DeckItemType
.
SideCard
);
if
(
rs
)
{
if
(
rs
)
{
activity
.
show
Toast
(
R
.
string
.
add_card_tip_ok
);
YGOUtil
.
showText
Toast
(
R
.
string
.
add_card_tip_ok
);
}
else
{
}
else
{
activity
.
show
Toast
(
R
.
string
.
add_card_tip_fail
);
YGOUtil
.
showText
Toast
(
R
.
string
.
add_card_tip_fail
);
}
}
return
rs
;
return
rs
;
}
}
...
@@ -652,9 +652,9 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
...
@@ -652,9 +652,9 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
rs
=
mDeckAdapater
.
AddCard
(
cardInfo
,
DeckItemType
.
MainCard
);
rs
=
mDeckAdapater
.
AddCard
(
cardInfo
,
DeckItemType
.
MainCard
);
}
}
if
(
rs
)
{
if
(
rs
)
{
activity
.
show
Toast
(
R
.
string
.
add_card_tip_ok
);
YGOUtil
.
showText
Toast
(
R
.
string
.
add_card_tip_ok
);
}
else
{
}
else
{
activity
.
show
Toast
(
R
.
string
.
add_card_tip_fail
);
YGOUtil
.
showText
Toast
(
R
.
string
.
add_card_tip_fail
);
}
}
return
rs
;
return
rs
;
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ImageUpdater.java
View file @
6f695c6a
...
@@ -26,6 +26,7 @@ import cn.garymb.ygomobile.ui.activities.BaseActivity;
...
@@ -26,6 +26,7 @@ import cn.garymb.ygomobile.ui.activities.BaseActivity;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
import
ocgcore.DataManager
;
import
ocgcore.DataManager
;
import
ocgcore.data.Card
;
import
ocgcore.data.Card
;
import
ocgcore.enums.CardType
;
import
ocgcore.enums.CardType
;
...
@@ -328,9 +329,9 @@ public class ImageUpdater implements DialogInterface.OnCancelListener {
...
@@ -328,9 +329,9 @@ public class ImageUpdater implements DialogInterface.OnCancelListener {
}
}
VUiKit
.
post
(()
->
{
VUiKit
.
post
(()
->
{
if
(
mError
==
0
)
{
if
(
mError
==
0
)
{
mContext
.
show
Toast
(
R
.
string
.
downloading_images_ok
,
Toast
.
LENGTH_SHORT
);
YGOUtil
.
showText
Toast
(
R
.
string
.
downloading_images_ok
,
Toast
.
LENGTH_SHORT
);
}
else
{
}
else
{
mContext
.
show
Toast
(
mContext
.
getString
(
R
.
string
.
download_image_error
,
mError
),
Toast
.
LENGTH_SHORT
);
YGOUtil
.
showText
Toast
(
mContext
.
getString
(
R
.
string
.
download_image_error
,
mError
),
Toast
.
LENGTH_SHORT
);
}
}
});
});
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
View file @
6f695c6a
...
@@ -65,7 +65,7 @@ public class MainActivity extends HomeActivity implements BottomNavigationBar.On
...
@@ -65,7 +65,7 @@ public class MainActivity extends HomeActivity implements BottomNavigationBar.On
super
.
onRequestPermissionsResult
(
requestCode
,
permissions
,
grantResults
);
super
.
onRequestPermissionsResult
(
requestCode
,
permissions
,
grantResults
);
// for(int i=0;i<permissions.length;i++){
// for(int i=0;i<permissions.length;i++){
// if(grantResults[i] == PackageManager.PERMISSION_DENIED){
// if(grantResults[i] == PackageManager.PERMISSION_DENIED){
//
show
Toast(getString(R.string.tip_no_permission,permissions[i]));
//
YGOUtil.showText
Toast(getString(R.string.tip_no_permission,permissions[i]));
// break;
// break;
// }
// }
// }
// }
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/ComparisonTableUtil.java
View file @
6f695c6a
...
@@ -473,7 +473,106 @@ public interface ComparisonTableUtil {
...
@@ -473,7 +473,106 @@ public interface ComparisonTableUtil {
100233201
,
100233201
,
100233018
,
100233018
,
100233019
,
100233019
,
100233020
100233020
,
100230501
,
100200265
,
101207081
,
101207082
,
101207083
,
101207084
,
101207085
,
101207086
,
101207087
,
101207088
,
101207089
,
101207090
,
101207091
,
101207092
,
101207093
,
101207094
,
101207095
,
101207096
,
101208000
,
101208201
,
101208202
,
101208203
,
101208004
,
101208005
,
101208006
,
101208007
,
101208008
,
101208009
,
101208010
,
101208011
,
101208012
,
101208013
,
101208014
,
101208015
,
101208016
,
101208017
,
101208018
,
101208019
,
101208020
,
101208021
,
101208022
,
101208023
,
101208024
,
101208025
,
101208026
,
101208027
,
101208028
,
101208029
,
101208030
,
101208031
,
101208032
,
101208033
,
101208034
,
101208035
,
101208036
,
101208037
,
101208204
,
101208039
,
101208040
,
101208041
,
101208042
,
101208043
,
101208205
,
101208045
,
101208046
,
101208047
,
101208048
,
101208049
,
101208050
,
101208206
,
101208052
,
101208053
,
101208207
,
101208055
,
101208056
,
101208057
,
101208058
,
101208059
,
101208060
,
101208061
,
101208062
,
101208063
,
101208064
,
101208065
,
101208066
,
101208067
,
101208068
,
101208069
,
101208208
,
101208071
,
101208072
,
101208073
,
101208074
,
101208075
,
101208076
,
101208077
,
101208078
,
101208079
,
101208080
};
};
int
[]
newIDsArray
=
{
int
[]
newIDsArray
=
{
...
@@ -945,6 +1044,105 @@ public interface ComparisonTableUtil {
...
@@ -945,6 +1044,105 @@ public interface ComparisonTableUtil {
875572
,
875572
,
37260677
,
37260677
,
73664385
,
73664385
,
59080
59080
,
66429798
,
93413793
,
21960890
,
58354899
,
94749594
,
21147203
,
57232301
,
83626916
,
20011655
,
56410769
,
83404468
,
82782870
,
18176525
,
19899073
,
55397172
,
45171524
,
81560239
,
17954937
,
58931850
,
3723262
,
30118811
,
66102515
,
2501624
,
35095329
,
61480937
,
98888032
,
34873741
,
60268386
,
97662494
,
23151193
,
60145298
,
96540807
,
22938501
,
59323650
,
95718355
,
22812963
,
58201062
,
94655777
,
21050476
,
57448410
,
84433129
,
20938824
,
56322832
,
83711531
,
19715246
,
56100345
,
82699999
,
19093698
,
45488703
,
81476402
,
18861006
,
44265115
,
71750854
,
17749468
,
43143567
,
70538272
,
16926971
,
43321985
,
79415624
,
5800323
,
42209438
,
78693036
,
5088741
,
31086840
,
77571454
,
4965193
,
30350202
,
67359907
,
3743515
,
39138610
,
6636319
,
42021064
,
79015062
,
5414777
,
31809476
,
78293584
,
4398189
,
31786838
,
67171933
,
4575541
,
30964246
,
66059345
,
93453053
,
39848658
,
66236707
,
92221402
,
38625110
,
65114115
,
91509824
,
28903523
,
64998567
,
90386276
,
27781371
,
53276089
,
90664684
,
22669793
,
58053438
,
85442146
,
21846145
};
};
}
}
mobile/src/main/res/layout/dialog_cardinfo.xml
View file @
6f695c6a
...
@@ -40,7 +40,6 @@
...
@@ -40,7 +40,6 @@
android:layout_marginLeft=
"5dp"
android:layout_marginLeft=
"5dp"
android:background=
"@drawable/button2_bg"
android:background=
"@drawable/button2_bg"
android:gravity=
"center"
android:gravity=
"center"
android:paddingRight=
"16dp"
android:shadowColor=
"@color/black"
android:shadowColor=
"@color/black"
android:text=
"@string/card_faq"
android:text=
"@string/card_faq"
android:textAppearance=
"@style/TextAppearance.AppCompat.Medium"
android:textAppearance=
"@style/TextAppearance.AppCompat.Medium"
...
...
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