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
093a1b08
Commit
093a1b08
authored
Jan 03, 2023
by
fallenstardust
Committed by
GitHub
Jan 03, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into patch-1
parents
2e5dbd48
907a7c0a
Changes
21
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
268 additions
and
33 deletions
+268
-33
Classes/gframe/drawing.cpp
Classes/gframe/drawing.cpp
+23
-6
Classes/gframe/duelclient.cpp
Classes/gframe/duelclient.cpp
+1
-1
Classes/gframe/event_handler.cpp
Classes/gframe/event_handler.cpp
+3
-3
Classes/gframe/image_manager.cpp
Classes/gframe/image_manager.cpp
+1
-1
mobile/assets/data/conf/bot.conf
mobile/assets/data/conf/bot.conf
+5
-0
mobile/assets/data/deck/[SAMPLE]CyberMata.ydk
mobile/assets/data/deck/[SAMPLE]CyberMata.ydk
+1
-1
mobile/assets/data/textures/lp2.png
mobile/assets/data/textures/lp2.png
+0
-0
mobile/assets/data/textures/lp3.png
mobile/assets/data/textures/lp3.png
+0
-0
mobile/assets/data/windbot/windbot/Decks/AI_Kashtira.ydk
mobile/assets/data/windbot/windbot/Decks/AI_Kashtira.ydk
+59
-0
mobile/assets/en/data/conf/bot.conf
mobile/assets/en/data/conf/bot.conf
+9
-4
mobile/assets/kor/data/conf/bot.conf
mobile/assets/kor/data/conf/bot.conf
+5
-0
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
+94
-2
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
+2
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeFragment.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeFragment.java
+1
-2
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
...c/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
+9
-11
mobile/src/main/java/cn/garymb/ygomobile/ui/settings/SettingFragment.java
...java/cn/garymb/ygomobile/ui/settings/SettingFragment.java
+29
-0
mobile/src/main/java/cn/garymb/ygomobile/utils/YGODialogUtil.java
...rc/main/java/cn/garymb/ygomobile/utils/YGODialogUtil.java
+1
-1
mobile/src/main/res/values-zh/strings.xml
mobile/src/main/res/values-zh/strings.xml
+6
-0
mobile/src/main/res/values/arrays.xml
mobile/src/main/res/values/arrays.xml
+5
-0
mobile/src/main/res/values/strings.xml
mobile/src/main/res/values/strings.xml
+7
-1
mobile/src/main/res/xml/preference_game.xml
mobile/src/main/res/xml/preference_game.xml
+7
-0
No files found.
Classes/gframe/drawing.cpp
View file @
093a1b08
...
...
@@ -586,12 +586,29 @@ void Game::DrawMisc() {
//driver->draw2DImage(imageManager.tLPFrame, recti(400 * mainGame->xScale, 10 * mainGame->yScale, 629 * mainGame->xScale, 30 * mainGame->yScale), recti(0, 0, 200, 20), 0, 0, true);
//driver->draw2DImage(imageManager.tLPFrame, recti(691 * mainGame->xScale, 10 * mainGame->yScale, 920 * mainGame->xScale, 30 * mainGame->yScale), recti(0, 0, 200, 20), 0, 0, true);
if
(
dInfo
.
start_lp
)
{
if
(
dInfo
.
lp
[
0
]
>=
dInfo
.
start_lp
)
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
recti
(
390
*
mainGame
->
xScale
,
12
*
mainGame
->
yScale
,
625
*
mainGame
->
xScale
,
74
*
mainGame
->
yScale
),
recti
(
0
,
0
,
60
,
60
),
0
,
0
,
true
);
else
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
recti
(
390
*
mainGame
->
xScale
,
12
*
mainGame
->
yScale
,
(
390
+
235
*
dInfo
.
lp
[
0
]
/
dInfo
.
start_lp
)
*
mainGame
->
xScale
,
74
*
mainGame
->
yScale
),
recti
(
0
,
0
,
60
,
60
),
0
,
0
,
true
);
if
(
dInfo
.
lp
[
1
]
>=
dInfo
.
start_lp
)
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
recti
(
695
*
mainGame
->
xScale
,
12
*
mainGame
->
yScale
,
930
*
mainGame
->
xScale
,
74
*
mainGame
->
yScale
),
recti
(
0
,
0
,
60
,
60
),
0
,
0
,
true
);
else
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
recti
((
930
-
235
*
dInfo
.
lp
[
1
]
/
dInfo
.
start_lp
)
*
mainGame
->
xScale
,
12
*
mainGame
->
yScale
,
930
*
mainGame
->
xScale
,
74
*
mainGame
->
yScale
),
recti
(
0
,
0
,
60
,
60
),
0
,
0
,
true
);
auto
maxLP
=
dInfo
.
isTag
?
dInfo
.
start_lp
/
2
:
dInfo
.
start_lp
;
if
(
dInfo
.
lp
[
0
]
>=
maxLP
)
{
auto
layerCount
=
dInfo
.
lp
[
0
]
/
maxLP
;
auto
partialLP
=
dInfo
.
lp
[
0
]
%
maxLP
;
auto
bgColorPos
=
(
layerCount
-
1
)
%
5
;
auto
fgColorPos
=
layerCount
%
5
;
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
recti
((
390
+
235
*
partialLP
/
maxLP
)
*
mainGame
->
xScale
,
12
*
mainGame
->
yScale
,
625
*
mainGame
->
xScale
,
74
*
mainGame
->
yScale
),
recti
(
0
,
bgColorPos
*
60
,
60
,
(
bgColorPos
+
1
)
*
60
),
0
,
0
,
true
);
if
(
partialLP
>
0
)
{
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
recti
(
390
*
mainGame
->
xScale
,
12
*
mainGame
->
yScale
,
(
390
+
235
*
partialLP
/
maxLP
)
*
mainGame
->
xScale
,
74
*
mainGame
->
yScale
),
recti
(
0
,
fgColorPos
*
60
,
60
,
(
fgColorPos
+
1
)
*
60
),
0
,
0
,
true
);
}
}
else
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
recti
(
390
*
mainGame
->
xScale
,
12
*
mainGame
->
yScale
,
(
390
+
235
*
dInfo
.
lp
[
0
]
/
maxLP
)
*
mainGame
->
xScale
,
74
*
mainGame
->
yScale
),
recti
(
0
,
0
,
60
,
60
),
0
,
0
,
true
);
if
(
dInfo
.
lp
[
1
]
>=
maxLP
)
{
auto
layerCount
=
dInfo
.
lp
[
1
]
/
maxLP
;
auto
partialLP
=
dInfo
.
lp
[
1
]
%
maxLP
;
auto
bgColorPos
=
(
layerCount
-
1
)
%
5
;
auto
fgColorPos
=
layerCount
%
5
;
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
recti
(
695
*
mainGame
->
xScale
,
12
*
mainGame
->
yScale
,
(
930
-
235
*
partialLP
/
maxLP
)
*
mainGame
->
xScale
,
74
*
mainGame
->
yScale
),
recti
(
0
,
bgColorPos
*
60
,
60
,
(
bgColorPos
+
1
)
*
60
),
0
,
0
,
true
);
if
(
partialLP
>
0
)
{
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
recti
((
930
-
235
*
partialLP
/
maxLP
)
*
mainGame
->
xScale
,
12
*
mainGame
->
yScale
,
930
*
mainGame
->
xScale
,
74
*
mainGame
->
yScale
),
recti
(
0
,
fgColorPos
*
60
,
60
,
(
fgColorPos
+
1
)
*
60
),
0
,
0
,
true
);
}
}
else
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
recti
((
930
-
235
*
dInfo
.
lp
[
1
]
/
maxLP
)
*
mainGame
->
xScale
,
12
*
mainGame
->
yScale
,
930
*
mainGame
->
xScale
,
74
*
mainGame
->
yScale
),
recti
(
0
,
0
,
60
,
60
),
0
,
0
,
true
);
}
if
(
lpframe
)
{
dInfo
.
lp
[
lpplayer
]
-=
lpd
;
...
...
Classes/gframe/duelclient.cpp
View file @
093a1b08
...
...
@@ -2182,7 +2182,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
mainGame
->
WaitFrameSignal
(
5
);
}
if
(
panel_confirm
.
size
())
{
if
(
panel_confirm
.
size
()
&&
mainGame
->
dInfo
.
player_type
!=
7
)
{
std
::
sort
(
panel_confirm
.
begin
(),
panel_confirm
.
end
(),
ClientCard
::
client_card_sort
);
mainGame
->
gMutex
.
lock
();
mainGame
->
dField
.
selectable_cards
=
panel_confirm
;
...
...
Classes/gframe/event_handler.cpp
View file @
093a1b08
...
...
@@ -1757,11 +1757,11 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case
irr
:
:
EMIE_LMOUSE_PRESSED_DOWN
:
{
if
(
!
mainGame
->
dInfo
.
isStarted
)
break
;
if
(
mainGame
->
wCardSelect
->
isVisible
())
break
;
//
if(mainGame->wCardSelect->isVisible())
//
break;
if
(
mainGame
->
wQuery
->
isVisible
()
||
mainGame
->
wANAttribute
->
isVisible
()
||
mainGame
->
wANCard
->
isVisible
()
||
mainGame
->
wANNumber
->
isVisible
()
||
mainGame
->
wCardSelect
->
isVisible
()
||
mainGame
->
wCardSelect
->
isVisible
()
||
mainGame
->
wCardDisplay
->
isVisible
()
||
mainGame
->
wOptions
->
isVisible
()){
display_cards
.
clear
();
int
loc_id
=
0
;
...
...
Classes/gframe/image_manager.cpp
View file @
093a1b08
...
...
@@ -27,7 +27,7 @@ bool ImageManager::Initial(const path dir) {
tSelFieldLinkArrows
[
8
]
=
driver
->
getTexture
((
dir
+
path
(
"/textures/link_marker_on_8.png"
)).
c_str
());
tSelFieldLinkArrows
[
9
]
=
driver
->
getTexture
((
dir
+
path
(
"/textures/link_marker_on_9.png"
)).
c_str
());
tNumber
=
driver
->
getTexture
((
dir
+
path
(
"/textures/number.png"
)).
c_str
());
tLPBar
=
driver
->
getTexture
((
dir
+
path
(
"/textures/lp
2
.png"
)).
c_str
());
tLPBar
=
driver
->
getTexture
((
dir
+
path
(
"/textures/lp
3
.png"
)).
c_str
());
tLPFrame
=
driver
->
getTexture
((
dir
+
path
(
"/textures/lpf.png"
)).
c_str
());
tMask
=
driver
->
getTexture
((
dir
+
path
(
"/textures/mask.png"
)).
c_str
());
tEquip
=
driver
->
getTexture
((
dir
+
path
(
"/textures/equip.png"
)).
c_str
());
...
...
mobile/assets/data/conf/bot.conf
View file @
093a1b08
...
...
@@ -194,6 +194,11 @@ Name=玻璃女巫 Deck=Witchcraft Dialog=verre.zh-CN
魔女术卡组。
AI_LV3
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
SUPPORT_MASTER_RULE_2020
!神数不神-刹帝利
Name
=神数不神
Deck
=
Kashtira
Dialog
=
Zefra
.
zh
-
CN
俱舍怒威族卡组。
AI_LV3
SUPPORT_MASTER_RULE_2020
![狂野模式]神数不神-雷龙
Name
=神数不神
Deck
=
ThunderDragon
Dialog
=
Zefra
.
zh
-
CN
深渊混沌雷龙卡组。
...
...
mobile/assets/data/deck/[SAMPLE]CyberMata.ydk
View file @
093a1b08
...
...
@@ -60,7 +60,7 @@
27204311
27204311
82385847
14532163
20899496
20899496
20899496
69946549
...
...
mobile/assets/data/textures/lp2.png
deleted
100644 → 0
View file @
2e5dbd48
4.39 KB
mobile/assets/data/textures/lp3.png
0 → 100644
View file @
093a1b08
15.3 KB
mobile/assets/data/windbot/windbot/Decks/AI_Kashtira.ydk
0 → 100644
View file @
093a1b08
#created by ...
#main
27204311
68304193
68304193
68304193
32909498
32909498
32909498
4928565
78534861
78534861
91800273
91800273
72090076
31149212
31149212
31149212
14558127
14558127
14558127
23434538
23434538
31480215
34447918
34447918
34447918
73628505
84211599
84211599
24224830
24224830
65681983
69540484
69540484
69540484
71832012
71832012
71832012
10045474
10045474
33925864
#extra
15291624
27548199
21915012
48626373
48626373
95474755
95474755
95474755
10389142
73542331
73542331
21887175
44097050
22423493
65741786
!side
mobile/assets/en/data/conf/bot.conf
View file @
093a1b08
...
...
@@ -185,7 +185,7 @@ Red-Eyes Dark Dragoon Deck
AI_LV3
SUPPORT_NEW_MASTER_RULE
SUPPORT_MASTER_RULE_2020
!
Smart
-
FiberAuroradon
BravePhenix
Name
=
Smart
Deck
=
Brave
Dialog
=
smart
.
zh
-
CN
Name
=
Smart
Deck
=
Brave
Dialog
=
default
Good
staff
Brave
Phenix
with
Halqifiberax
and
Auroradon
AI_LV3
SUPPORT_MASTER_RULE_2020
...
...
@@ -194,7 +194,12 @@ Name=Madame Verre Deck=Witchcraft Dialog=default
Witchcraft
Deck
AI_LV3
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
SUPPORT_MASTER_RULE_2020
!
Zefra
Never
be
Inmmortal
-
Thunder
Dragon
Name
=
Zefra
Never
be
Inmmortal
Deck
=
ThunderDragon
Dialog
=
Zefra
.
zh
-
CN
The
Byssted
Thunder
Dragon
!
Zeframortal
-
Kashtira
Name
=
Zeframortal
Deck
=
Kashtira
Dialog
=
default
Kashtira
Deck
AI_LV3
SUPPORT_MASTER_RULE_2020
!
Zeframortal
-
Thunder
Dragon
Name
=
Zeframortal
Deck
=
ThunderDragon
Dialog
=
default
The
Byssted
Thunder
Dragon
Deck
SUPPORT_MASTER_RULE_2020
\ No newline at end of file
mobile/assets/kor/data/conf/bot.conf
View file @
093a1b08
...
...
@@ -194,6 +194,11 @@ Name=베레 Deck=Witchcraft Dialog=verre.kor
위치크래프트 덱입니다. (마스터 룰
3
|신 마스터 룰|마스터 룰 개정판 사용 가능)
AI_LV3
SUPPORT_MASTER_RULE_3
SUPPORT_NEW_MASTER_RULE
SUPPORT_MASTER_RULE_2020
!세피라-
Kashtira
Name
=세피라
Deck
=
Kashtira
Dialog
=
Zefra
.
kor
Kashtira
Deck
SUPPORT_MASTER_RULE_2020
![하드 모드]세피라-썬더 드래곤
Name
=세피라
Deck
=
ThunderDragon
Dialog
=
Zefra
.
kor
심연 카오스 썬더 드래곤 덱입니다. (싱글 모드의
AI
덱은 사용하는 카드 풀이 리미트 레귤레이션에 대응하는 것이지만, 하드 모드에서는
AI
덱은 리미트 레귤레이션에 대응하지 않습니다.)
...
...
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
View file @
093a1b08
package
cn.garymb.ygomobile
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ASSETS_EN
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ASSETS_KOR
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
BOT_CONF
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_BOT_CONF_PATH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_DECK_PATH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_EXPANSIONS
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_LIMIT_PATH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_PACK_PATH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_REPLAY_PATH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_SINGLE_PATH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_STRING_PATH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_SYSTEM_PATH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DATABASE_NAME
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_FONT_SIZE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_KEEP_SCALE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_NOTCH_HEIGHT
;
...
...
@@ -24,6 +32,7 @@ import static cn.garymb.ygomobile.Constants.PREF_WINDOW_TOP_BOTTOM;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
WINDBOT_DECK_PATH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
WINDBOT_PATH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
YDK_FILE_EX
;
import
static
cn
.
garymb
.
ygomobile
.
ui
.
home
.
ResCheckTask
.
getDatapath
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
...
...
@@ -37,6 +46,7 @@ import androidx.annotation.Nullable;
import
org.json.JSONArray
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
...
...
@@ -47,6 +57,7 @@ import cn.garymb.ygomobile.lite.R;
import
cn.garymb.ygomobile.ui.settings.PreferenceFragmentPlus
;
import
cn.garymb.ygomobile.utils.DeckUtil
;
import
cn.garymb.ygomobile.utils.DensityUtils
;
import
cn.garymb.ygomobile.utils.FileUtils
;
import
cn.garymb.ygomobile.utils.IOUtils
;
public
class
AppsSettings
{
...
...
@@ -224,10 +235,10 @@ public class AppsSettings {
}
public
File
[]
getExpansionFiles
(){
public
File
[]
getExpansionFiles
()
{
return
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
Constants
.
CORE_EXPANSIONS
)
.
listFiles
((
file
)
->
{
if
(!
file
.
isFile
())
{
if
(!
file
.
isFile
())
{
return
false
;
}
String
s_name
=
file
.
getName
().
toLowerCase
();
...
...
@@ -355,6 +366,23 @@ public class AppsSettings {
mSharedPreferences
.
putString
(
Constants
.
PREF_IMAGE_QUALITY
,
""
+
quality
);
}
/***
* 资料语言
*/
public
void
setDataLanguage
(
int
language
)
{
mSharedPreferences
.
putString
(
Constants
.
PREF_DATA_LANGUAGE
,
""
+
language
);
}
/***
* 资料语言
*/
public
int
getDataLanguage
()
{
try
{
return
Integer
.
valueOf
(
mSharedPreferences
.
getString
(
Constants
.
PREF_DATA_LANGUAGE
,
""
+
Constants
.
PREF_DEF_DATA_LANGUAGE
));
}
catch
(
Exception
e
)
{
return
Constants
.
PREF_DEF_DATA_LANGUAGE
;
}
}
/**
* 根据卡密获取卡图的路径
...
...
@@ -687,4 +715,68 @@ public class AppsSettings {
// Log.i("kk", "saveTemp:" + array);
mSharedPreferences
.
putString
(
Constants
.
PREF_LAST_ROOM_LIST
,
array
.
toString
());
}
public
void
copyCnData
()
throws
IOException
{
//复制数据库
copyCdbFile
(
getDatapath
(
DATABASE_NAME
));
//复制游戏配置文件
IOUtils
.
copyFilesFromAssets
(
context
,
getDatapath
(
"conf"
)
+
"/"
+
CORE_STRING_PATH
,
getResourcePath
(),
true
);
IOUtils
.
copyFilesFromAssets
(
context
,
getDatapath
(
"conf"
)
+
"/"
+
BOT_CONF
,
getResourcePath
(),
true
);
//替换换行符
String
stringConfPath
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
CORE_STRING_PATH
).
getAbsolutePath
();
String
botConfPath
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
BOT_CONF
).
getAbsolutePath
();
fixString
(
stringConfPath
);
fixString
(
botConfPath
);
//设置语言为0=中文
AppsSettings
.
get
().
setDataLanguage
(
0
);
}
public
void
copyKorData
()
throws
IOException
{
String
korStringConf
=
ASSETS_KOR
+
getDatapath
(
"conf"
)
+
"/"
+
CORE_STRING_PATH
;
String
korBotConf
=
ASSETS_KOR
+
getDatapath
(
"conf"
)
+
"/"
+
CORE_BOT_CONF_PATH
;
String
korCdb
=
ASSETS_KOR
+
getDatapath
(
DATABASE_NAME
);
//复制数据库
copyCdbFile
(
korCdb
);
//复制游戏配置文件
IOUtils
.
copyFilesFromAssets
(
context
,
korStringConf
,
getResourcePath
(),
true
);
IOUtils
.
copyFilesFromAssets
(
context
,
korBotConf
,
getResourcePath
(),
true
);
//替换换行符
String
stringConfPath
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
CORE_STRING_PATH
).
getAbsolutePath
();
String
botConfPath
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
BOT_CONF
).
getAbsolutePath
();
fixString
(
stringConfPath
);
fixString
(
botConfPath
);
//设置语言为1=조선말
AppsSettings
.
get
().
setDataLanguage
(
1
);
}
public
void
copyEnData
()
throws
IOException
{
String
enStringConf
=
ASSETS_EN
+
getDatapath
(
"conf"
)
+
"/"
+
CORE_STRING_PATH
;
String
enBotConf
=
ASSETS_EN
+
getDatapath
(
"conf"
)
+
"/"
+
CORE_BOT_CONF_PATH
;
String
enCdb
=
ASSETS_EN
+
getDatapath
(
DATABASE_NAME
);
//复制数据库
copyCdbFile
(
enCdb
);
//复制人机资源
IOUtils
.
copyFilesFromAssets
(
context
,
getDatapath
(
Constants
.
WINDBOT_PATH
),
getResourcePath
(),
true
);
//复制游戏配置文件
IOUtils
.
copyFilesFromAssets
(
context
,
enStringConf
,
getResourcePath
(),
true
);
IOUtils
.
copyFilesFromAssets
(
context
,
enBotConf
,
getResourcePath
(),
true
);
//替换换行符
String
stringConfPath
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
CORE_STRING_PATH
).
getAbsolutePath
();
String
botConfPath
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
BOT_CONF
).
getAbsolutePath
();
fixString
(
stringConfPath
);
fixString
(
botConfPath
);
//设置语言为2=English
AppsSettings
.
get
().
setDataLanguage
(
2
);
}
private
void
fixString
(
String
stringPath
)
{
List
<
String
>
lines
=
FileUtils
.
readLines
(
stringPath
,
Constants
.
DEF_ENCODING
);
FileUtils
.
writeLines
(
stringPath
,
lines
,
Constants
.
DEF_ENCODING
,
"\n"
);
}
private
void
copyCdbFile
(
String
cdbPath
)
throws
IOException
{
File
dbFile
=
new
File
(
getDataBasePath
(),
DATABASE_NAME
);
if
(
dbFile
.
exists
())
dbFile
.
delete
();
//如果数据库存在先删除
IOUtils
.
copyFilesFromAssets
(
context
,
cdbPath
,
getDataBasePath
(),
true
);
}
}
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
View file @
093a1b08
...
...
@@ -20,6 +20,8 @@ public interface Constants {
String
PREF_IMAGE_QUALITY
=
"pref_key_game_image_quality"
;
int
PREF_DEF_IMAGE_QUALITY
=
1
;
String
PREF_DATA_LANGUAGE
=
"pref_key_game_data_language"
;
int
PREF_DEF_DATA_LANGUAGE
=
0
;
String
PREF_GAME_FONT
=
"pref_key_game_font_name"
;
String
PREF_USE_EXTRA_CARD_CARDS
=
"settings_game_diy_card_db"
;
boolean
PREF_DEF_USE_EXTRA_CARD_CARDS
=
true
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeFragment.java
View file @
093a1b08
...
...
@@ -33,7 +33,6 @@ import androidx.cardview.widget.CardView;
import
androidx.recyclerview.widget.DividerItemDecoration
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
com.ourygo.lib.duelassistant.listener.OnDuelAssistantListener
;
import
com.ourygo.lib.duelassistant.util.DuelAssistantManagement
;
import
com.ourygo.lib.duelassistant.util.Util
;
...
...
@@ -64,8 +63,8 @@ import cn.garymb.ygomobile.bean.Deck;
import
cn.garymb.ygomobile.bean.ServerInfo
;
import
cn.garymb.ygomobile.bean.ServerList
;
import
cn.garymb.ygomobile.bean.events.ServerInfoEvent
;
import
cn.garymb.ygomobile.ex_card.ExCardActivity
;
import
cn.garymb.ygomobile.ex_card.ExCard
;
import
cn.garymb.ygomobile.ex_card.ExCardActivity
;
import
cn.garymb.ygomobile.lite.BuildConfig
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
View file @
093a1b08
...
...
@@ -274,6 +274,9 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_PICS_ZIP
),
resPath
,
needsUpdate
);
}
//复制人机资源
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
WINDBOT_PATH
),
mSettings
.
getResourcePath
(),
needsUpdate
);
//根据系统语言复制特定资料文件
String
language
=
mContext
.
getResources
().
getConfiguration
().
locale
.
getLanguage
();
Log
.
i
(
BuildConfig
.
VERSION_NAME
,
language
);
if
(!
language
.
isEmpty
()){
...
...
@@ -297,22 +300,21 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
return
ERROR_NONE
;
}
p
rivate
int
copyCnData
(
Boolean
needsUpdate
)
throws
IOException
{
p
ublic
int
copyCnData
(
Boolean
needsUpdate
)
throws
IOException
{
//复制数据库
copyCdbFile
(
getDatapath
(
DATABASE_NAME
),
needsUpdate
);
//复制残局
setMessage
(
mContext
.
getString
(
R
.
string
.
check_things
,
mContext
.
getString
(
R
.
string
.
single_lua
)));
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
CORE_SINGLE_PATH
),
mSettings
.
getSingleDir
(),
needsUpdate
);
//复制人机资源
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
WINDBOT_PATH
),
mSettings
.
getResourcePath
(),
needsUpdate
);
//复制游戏配置文件
copyCoreConfig
(
getDatapath
(
"conf"
)
+
"/"
+
CORE_STRING_PATH
,
getDatapath
(
"conf"
)
+
"/"
+
BOT_CONF
,
mSettings
.
getResourcePath
(),
needsUpdate
);
AppsSettings
.
get
().
setDataLanguage
(
0
);
return
ERROR_NONE
;
}
p
rivate
int
copyEnData
(
Boolean
needsUpdate
)
throws
IOException
{
p
ublic
int
copyEnData
(
Boolean
needsUpdate
)
throws
IOException
{
String
enStringConf
=
ASSETS_EN
+
getDatapath
(
"conf"
)
+
"/"
+
CORE_STRING_PATH
;
String
enBotConf
=
ASSETS_EN
+
getDatapath
(
"conf"
)
+
"/"
+
CORE_BOT_CONF_PATH
;
String
enCdb
=
ASSETS_EN
+
getDatapath
(
DATABASE_NAME
);
...
...
@@ -322,29 +324,25 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
//复制残局
setMessage
(
mContext
.
getString
(
R
.
string
.
check_things
,
mContext
.
getString
(
R
.
string
.
single_lua
)));
IOUtils
.
copyFilesFromAssets
(
mContext
,
enSingle
,
mSettings
.
getSingleDir
(),
needsUpdate
);
//复制人机资源
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
WINDBOT_PATH
),
mSettings
.
getResourcePath
(),
needsUpdate
);
//复制游戏配置文件
copyCoreConfig
(
enStringConf
,
enBotConf
,
mSettings
.
getResourcePath
(),
needsUpdate
);
AppsSettings
.
get
().
setDataLanguage
(
1
);
return
ERROR_NONE
;
}
p
rivate
int
copyKorData
(
Boolean
needsUpdate
)
throws
IOException
{
p
ublic
int
copyKorData
(
Boolean
needsUpdate
)
throws
IOException
{
String
korStringConf
=
ASSETS_KOR
+
getDatapath
(
"conf"
)
+
"/"
+
CORE_STRING_PATH
;
String
korBotConf
=
ASSETS_KOR
+
getDatapath
(
"conf"
)
+
"/"
+
CORE_BOT_CONF_PATH
;
String
korCdb
=
ASSETS_KOR
+
getDatapath
(
DATABASE_NAME
);
String
korWindbotPath
=
ASSETS_KOR
+
getDatapath
(
WINDBOT_PATH
);
String
korSingle
=
ASSETS_EN
+
getDatapath
(
CORE_SINGLE_PATH
);
//复制数据库
copyCdbFile
(
korCdb
,
true
);
//复制残局
setMessage
(
mContext
.
getString
(
R
.
string
.
check_things
,
mContext
.
getString
(
R
.
string
.
single_lua
)));
IOUtils
.
copyFilesFromAssets
(
mContext
,
korSingle
,
mSettings
.
getSingleDir
(),
needsUpdate
);
//复制人机资源
IOUtils
.
copyFilesFromAssets
(
mContext
,
korWindbotPath
,
mSettings
.
getResourcePath
(),
needsUpdate
);
//复制游戏配置文件
copyCoreConfig
(
korStringConf
,
korBotConf
,
mSettings
.
getResourcePath
(),
needsUpdate
);
AppsSettings
.
get
().
setDataLanguage
(
2
);
return
ERROR_NONE
;
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/settings/SettingFragment.java
View file @
093a1b08
...
...
@@ -10,6 +10,7 @@ import static cn.garymb.ygomobile.Constants.ORI_REPLAY;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PERF_TEST_REPLACE_KERNEL
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_CHANGE_LOG
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_CHECK_UPDATE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_DATA_LANGUAGE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_DECK_DELETE_DILAOG
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_DEL_EX
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_FONT_ANTIALIAS
;
...
...
@@ -39,6 +40,7 @@ import static cn.garymb.ygomobile.ui.home.ResCheckTask.getDatapath;
import
android.annotation.SuppressLint
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.graphics.Color
;
...
...
@@ -78,6 +80,7 @@ import cn.garymb.ygomobile.lite.BuildConfig;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.adapters.SimpleListAdapter
;
import
cn.garymb.ygomobile.ui.home.MainActivity
;
import
cn.garymb.ygomobile.ui.home.ResCheckTask
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
cn.garymb.ygomobile.utils.FileUtils
;
...
...
@@ -165,6 +168,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
bind
(
PREF_DEL_EX
,
getString
(
R
.
string
.
about_delete_ex
));
bind
(
PERF_TEST_REPLACE_KERNEL
,
"需root权限,请在开发者的指导下食用"
);
bind
(
PREF_WINDOW_TOP_BOTTOM
,
""
+
mSettings
.
getScreenPadding
());
bind
(
PREF_DATA_LANGUAGE
,
""
+
mSettings
.
getDataLanguage
());
Preference
preference
=
findPreference
(
PREF_READ_EX
);
if
(
preference
!=
null
)
{
preference
.
setSummary
(
mSettings
.
getExpansionsPath
().
getAbsolutePath
());
...
...
@@ -229,6 +233,31 @@ public class SettingFragment extends PreferenceFragmentPlus {
if
(
preference
instanceof
ListPreference
)
{
ListPreference
listPreference
=
(
ListPreference
)
preference
;
mSharedPreferences
.
edit
().
putString
(
preference
.
getKey
(),
listPreference
.
getValue
()).
apply
();
if
(
preference
.
getKey
().
equals
(
PREF_DATA_LANGUAGE
))
{
Log
.
i
(
BuildConfig
.
VERSION_NAME
,
mSettings
.
getDataLanguage
()+
"xxxx"
);
if
(
mSettings
.
getDataLanguage
()
==
0
)
{
try
{
mSettings
.
copyCnData
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
if
(
mSettings
.
getDataLanguage
()
==
1
)
{
try
{
mSettings
.
copyKorData
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
if
(
mSettings
.
getDataLanguage
()
==
2
)
{
try
{
mSettings
.
copyEnData
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
DataManager
.
get
().
load
(
true
);
}
}
else
{
mSharedPreferences
.
edit
().
putString
(
preference
.
getKey
(),
""
+
value
).
apply
();
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/YGODialogUtil.java
View file @
093a1b08
...
...
@@ -380,7 +380,7 @@ public class YGODialogUtil {
deckAdp
.
notifyDataSetChanged
();
}
}));
//
itemTouchHelper.attachToRecyclerView(rv_type);
itemTouchHelper
.
attachToRecyclerView
(
rv_type
);
}
private
String
[]
getStringType
(
List
<
DeckType
>
deckTypeList
)
{
...
...
mobile/src/main/res/values-zh/strings.xml
View file @
093a1b08
...
...
@@ -75,6 +75,11 @@
<item>
低
</item>
<item>
高
</item>
</string-array>
<string-array
name=
"data_language"
translatable=
"false"
>
<item>
简体中文
</item>
<item>
조선말
</item>
<item>
English
</item>
</string-array>
<!-- settings -->
<string
name=
"server_list"
>
直连决斗
</string>
<string
name=
"server_name"
>
名称:
</string>
...
...
@@ -334,4 +339,5 @@
<string
name=
"edit_your_message"
>
输入聊天内容
</string>
<string
name=
"login_succeed"
>
登录成功
</string>
<string
name=
"reChatJoining"
>
连接断开,重新登陆中……
</string>
<string
name=
"settings_data_language"
>
资料语言
</string>
</resources>
mobile/src/main/res/values/arrays.xml
View file @
093a1b08
...
...
@@ -9,6 +9,11 @@
<item>
0
</item>
<item>
1
</item>
</string-array>
<string-array
name=
"data_language_value"
translatable=
"false"
>
<item>
0
</item>
<item>
1
</item>
<item>
2
</item>
</string-array>
<string-array
name=
"screen_top_bottom_value"
translatable=
"false"
>
<item>
0
</item>
<item>
5
</item>
...
...
mobile/src/main/res/values/strings.xml
View file @
093a1b08
...
...
@@ -84,6 +84,11 @@
<item>
Speed
</item>
<item>
Quality
</item>
</string-array>
<string-array
name=
"data_language"
translatable=
"false"
>
<item>
简体中文
</item>
<item>
조선말
</item>
<item>
English
</item>
</string-array>
<string-array
name=
"screen_top_bottom_desc"
translatable=
"false"
>
<item>
Disable
</item>
<item>
5
</item>
...
...
@@ -344,4 +349,5 @@
<string
name=
"edit_your_message"
>
Input your message
</string>
<string
name=
"login_succeed"
>
Chatroom logined
</string>
<string
name=
"reChatJoining"
>
relogining\.\.\.
</string>
<string
name=
"settings_data_language"
>
Language
</string>
</resources>
mobile/src/main/res/xml/preference_game.xml
View file @
093a1b08
...
...
@@ -129,6 +129,13 @@
android:persistent=
"true"
android:title=
"@string/settings_game_font_name"
/>
<ListPreference
android:entries=
"@array/data_language"
android:entryValues=
"@array/data_language_value"
android:key=
"pref_key_game_data_language"
android:persistent=
"true"
android:title=
"@string/settings_data_language"
/>
<!--<CheckBoxPreference
android:key="settings_game_diy_card_db"
android:persistent="true"
...
...
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