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
d54e6d6c
Commit
d54e6d6c
authored
Sep 09, 2022
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DeckInfo readDeck将密码替换
第一张卡id密码替换
parent
6806cea8
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
13 deletions
+46
-13
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
+7
-3
mobile/src/main/java/cn/garymb/ygomobile/bean/events/DeckFile.java
...c/main/java/cn/garymb/ygomobile/bean/events/DeckFile.java
+2
-2
mobile/src/main/java/cn/garymb/ygomobile/loader/DeckLoader.java
.../src/main/java/cn/garymb/ygomobile/loader/DeckLoader.java
+30
-8
mobile/src/main/java/cn/garymb/ygomobile/utils/DeckUtil.java
mobile/src/main/java/cn/garymb/ygomobile/utils/DeckUtil.java
+7
-0
No files found.
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
View file @
d54e6d6c
This diff is collapsed.
Click to expand it.
mobile/src/main/java/cn/garymb/ygomobile/bean/events/DeckFile.java
View file @
d54e6d6c
...
...
@@ -25,8 +25,8 @@ public class DeckFile extends TextSelect {
if
(
index
>
0
)
{
name
=
name
.
substring
(
0
,
index
);
}
typeName
=
DeckUtil
.
getDeckTypeName
(
path
.
getAbsolutePath
());
firstCode
=
DeckUtil
.
getFirstCardCode
(
path
.
getAbsolutePath
());
typeName
=
DeckUtil
.
getDeckTypeName
(
path
.
getAbsolutePath
());
firstCode
=
DeckUtil
.
getFirstCardCode
(
path
.
getAbsolutePath
());
super
.
setName
(
name
);
setObject
(
this
);
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/loader/DeckLoader.java
View file @
d54e6d6c
...
...
@@ -13,11 +13,14 @@ import java.io.FileInputStream;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.OutputStream
;
import
java.io.OutputStreamWriter
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.bean.Deck
;
import
cn.garymb.ygomobile.bean.DeckInfo
;
import
cn.garymb.ygomobile.ui.cards.deck.DeckItemType
;
import
cn.garymb.ygomobile.ui.cards.deck.DeckUtils
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.hutool.core.util.ArrayUtil
;
import
ocgcore.data.Card
;
...
...
@@ -26,17 +29,17 @@ import ocgcore.data.LimitList;
public
class
DeckLoader
{
public
static
DeckInfo
readDeck
(
CardLoader
cardLoader
,
File
file
,
LimitList
limitList
)
{
DeckInfo
deckInfo
=
null
;
FileInputStream
inputStream
=
null
;
FileInputStream
file
inputStream
=
null
;
try
{
inputStream
=
new
FileInputStream
(
file
);
deckInfo
=
readDeck
(
cardLoader
,
inputStream
,
limitList
);
file
inputStream
=
new
FileInputStream
(
file
);
deckInfo
=
readDeck
(
cardLoader
,
file
inputStream
,
limitList
);
if
(
deckInfo
!=
null
)
{
deckInfo
.
source
=
file
;
}
}
catch
(
Exception
e
)
{
Log
.
e
(
"deckreader"
,
"read 1"
,
e
);
}
finally
{
IOUtils
.
close
(
inputStream
);
IOUtils
.
close
(
file
inputStream
);
}
return
deckInfo
;
}
...
...
@@ -76,10 +79,6 @@ public class DeckLoader {
if
(
type
==
DeckItemType
.
MainCard
&&
deck
.
getMainCount
()
<
Constants
.
DECK_MAIN_MAX
)
{
Integer
i
=
mIds
.
get
(
id
);
if
(
i
==
null
)
{
if
(
ArrayUtil
.
contains
(
oldIDsArray
,
id
))
{
id
=
ArrayUtil
.
get
(
newIDsArray
,
id
);
Log
.
i
(
"3.10.1"
,
"看看id="
+
id
);
}
mIds
.
put
(
id
,
1
);
deck
.
addMain
(
id
);
}
else
if
(
i
<
Constants
.
CARD_MAX_COUNT
)
{
...
...
@@ -113,18 +112,41 @@ public class DeckLoader {
}
DeckInfo
deckInfo
=
new
DeckInfo
();
SparseArray
<
Card
>
tmp
=
cardLoader
.
readCards
(
deck
.
getMainlist
(),
true
);
int
code
;
boolean
isChanged
=
false
;
for
(
Integer
id
:
deck
.
getMainlist
())
{
if
(
ArrayUtil
.
contains
(
oldIDsArray
,
tmp
.
get
(
id
).
getCode
()))
{
code
=
ArrayUtil
.
get
(
newIDsArray
,
ArrayUtil
.
indexOf
(
oldIDsArray
,
tmp
.
get
(
id
).
getCode
()));
tmp
.
remove
(
id
);
tmp
.
put
(
id
,
cardLoader
.
readAllCardCodes
().
get
(
code
));
isChanged
=
true
;
}
deckInfo
.
addMainCards
(
tmp
.
get
(
id
));
}
tmp
=
cardLoader
.
readCards
(
deck
.
getExtraList
(),
true
);
for
(
Integer
id
:
deck
.
getExtraList
())
{
if
(
ArrayUtil
.
contains
(
oldIDsArray
,
tmp
.
get
(
id
).
getCode
()))
{
code
=
ArrayUtil
.
get
(
newIDsArray
,
ArrayUtil
.
indexOf
(
oldIDsArray
,
tmp
.
get
(
id
).
getCode
()));
tmp
.
remove
(
id
);
tmp
.
put
(
id
,
cardLoader
.
readAllCardCodes
().
get
(
code
));
isChanged
=
true
;
}
deckInfo
.
addExtraCards
(
tmp
.
get
(
id
));
}
tmp
=
cardLoader
.
readCards
(
deck
.
getSideList
(),
true
);
// Log.i("kk", "desk:" + tmp.size()+"/"+side.size());
for
(
Integer
id
:
deck
.
getSideList
())
{
if
(
ArrayUtil
.
contains
(
oldIDsArray
,
tmp
.
get
(
id
).
getCode
()))
{
code
=
ArrayUtil
.
get
(
newIDsArray
,
ArrayUtil
.
indexOf
(
oldIDsArray
,
tmp
.
get
(
id
).
getCode
()));
tmp
.
remove
(
id
);
tmp
.
put
(
id
,
cardLoader
.
readAllCardCodes
().
get
(
code
));
isChanged
=
true
;
}
deckInfo
.
addSideCards
(
tmp
.
get
(
id
));
}
if
(
isChanged
)
{
//DeckUtils.save(deckInfo,inputStream.read());
}
return
deckInfo
;
}
}
mobile/src/main/java/cn/garymb/ygomobile/utils/DeckUtil.java
View file @
d54e6d6c
package
cn.garymb.ygomobile.utils
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
newIDsArray
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
oldIDsArray
;
import
android.content.Context
;
import
android.text.TextUtils
;
import
android.util.Log
;
...
...
@@ -24,6 +27,7 @@ import cn.garymb.ygomobile.bean.DeckType;
import
cn.garymb.ygomobile.bean.events.DeckFile
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.cards.deck.DeckItemType
;
import
cn.hutool.core.util.ArrayUtil
;
public
class
DeckUtil
{
...
...
@@ -212,6 +216,9 @@ public class DeckUtil {
continue
;
}
Integer
id
=
Integer
.
parseInt
(
line
);
if
(
ArrayUtil
.
contains
(
oldIDsArray
,
id
))
{
id
=
ArrayUtil
.
get
(
newIDsArray
,
ArrayUtil
.
indexOf
(
oldIDsArray
,
id
));
}
return
id
;
}
}
catch
(
IOException
e
)
{
...
...
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