Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
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
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
MyCard
ygopro-2pick
Commits
b275d130
Commit
b275d130
authored
Jul 30, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
multi language
parent
22434de9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
2 deletions
+56
-2
.gitignore
.gitignore
+1
-0
gframe/game.cpp
gframe/game.cpp
+25
-1
gframe/game.h
gframe/game.h
+4
-1
gframe/image_manager.cpp
gframe/image_manager.cpp
+24
-0
strings.conf
strings.conf
+1
-0
system.conf
system.conf
+1
-0
No files found.
.gitignore
View file @
b275d130
...
...
@@ -59,6 +59,7 @@
/sound/BGM
/update
/update*
/locales
# ygopro main program
/ygopro
...
...
gframe/game.cpp
View file @
b275d130
...
...
@@ -84,8 +84,10 @@ bool Game::Initialize() {
if
(
!
imageManager
.
Initial
())
return
false
;
LoadExpansionDB
();
if
(
dataManager
.
LoadDB
(
GetLocaleDir
(
"cards.cdb"
)))
{}
else
if
(
!
dataManager
.
LoadDB
(
"cards.cdb"
))
return
false
;
if
(
dataManager
.
LoadStrings
(
GetLocaleDir
(
"strings.conf"
)))
{}
else
if
(
!
dataManager
.
LoadStrings
(
"strings.conf"
))
return
false
;
dataManager
.
LoadStrings
(
"./expansions/strings.conf"
);
...
...
@@ -1049,7 +1051,9 @@ void Game::RefreshBot() {
if
(
!
gameConf
.
enable_bot_mode
)
return
;
botInfo
.
clear
();
FILE
*
fp
=
fopen
(
"bot.conf"
,
"r"
);
FILE
*
fp
=
fopen
(
GetLocaleDir
(
"bot.conf"
),
"r"
);
if
(
!
fp
)
fp
=
fopen
(
"bot.conf"
,
"r"
);
char
linebuf
[
256
];
char
strbuf
[
256
];
if
(
fp
)
{
...
...
@@ -1236,6 +1240,9 @@ void Game::LoadConfig() {
}
else
if
(
!
strcmp
(
strbuf
,
"lastdeck"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
lastdeck
,
64
);
}
else
if
(
!
strcmp
(
strbuf
,
"locale"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
locale
,
64
);
}
}
}
...
...
@@ -1343,6 +1350,9 @@ void Game::LoadConfig() {
}
else
if
(
!
strcmp
(
strbuf
,
"lastdeck"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
lastdeck
,
64
);
}
else
if
(
!
strcmp
(
strbuf
,
"locale"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
locale
,
64
);
}
}
}
...
...
@@ -1418,6 +1428,8 @@ void Game::SaveConfig() {
#endif
fprintf
(
fp
,
"enable_pendulum_scale = %d
\n
"
,
((
mainGame
->
chkEnablePScale
->
isChecked
())
?
1
:
0
));
fprintf
(
fp
,
"skin_index = %d
\n
"
,
gameConf
.
skin_index
);
BufferIO
::
EncodeUTF8
(
gameConf
.
locale
,
linebuf
);
fprintf
(
fp
,
"locale = %s
\n
"
,
linebuf
);
fclose
(
fp
);
}
void
Game
::
ShowCardInfo
(
int
code
,
bool
resize
)
{
...
...
@@ -1636,6 +1648,8 @@ void Game::initUtils() {
MakeDirectory
(
"sound/custom"
);
MakeDirectory
(
"sound/BGM/custom"
);
#endif
//locales
MakeDirectory
(
"locales"
);
//pics
MakeDirectory
(
"pics"
);
MakeDirectory
(
"pics/field"
);
...
...
@@ -2002,6 +2016,16 @@ void Game::takeScreenshot() {
}
else
device
->
getLogger
()
->
log
(
L"Failed to take screenshot."
,
irr
::
ELL_WARNING
);
}
const
char
*
Game
::
GetLocaleDir
(
const
char
*
dir
)
{
if
(
!
gameConf
.
locale
||
!
wcscmp
(
gameConf
.
locale
,
L"default"
))
return
dir
;
wchar_t
locale_buf
[
256
];
wchar_t
orig_dir
[
64
];
BufferIO
::
DecodeUTF8
(
dir
,
orig_dir
);
myswprintf
(
locale_buf
,
L"locales/%ls/%ls"
,
gameConf
.
locale
,
orig_dir
);
BufferIO
::
EncodeUTF8
(
locale_buf
,
locale_buf_utf8
);
return
locale_buf_utf8
;
}
void
Game
::
SetCursor
(
ECURSOR_ICON
icon
)
{
ICursorControl
*
cursor
=
mainGame
->
device
->
getCursorControl
();
if
(
cursor
->
getActiveIcon
()
!=
icon
)
{
...
...
gframe/game.h
View file @
b275d130
...
...
@@ -26,6 +26,7 @@ struct Config {
wchar_t
textfont
[
256
];
wchar_t
numfont
[
256
];
wchar_t
roompass
[
20
];
wchar_t
locale
[
64
];
//settings
int
chkMAutoPos
;
int
chkSTAutoPos
;
...
...
@@ -156,6 +157,7 @@ public:
int
LocalPlayer
(
int
player
);
const
wchar_t
*
LocalName
(
int
local_player
);
const
char
*
GetLocaleDir
(
const
char
*
dir
);
bool
HasFocus
(
EGUI_ELEMENT_TYPE
type
)
const
{
irr
::
gui
::
IGUIElement
*
focus
=
env
->
getFocus
();
...
...
@@ -233,8 +235,9 @@ public:
irr
::
core
::
dimension2d
<
irr
::
u32
>
window_size
;
float
xScale
;
float
yScale
;
CGUISkinSystem
*
skinSystem
;
char
locale_buf_utf8
[
256
];
ClientField
dField
;
DeckBuilder
deckBuilder
;
...
...
gframe/image_manager.cpp
View file @
b275d130
...
...
@@ -337,6 +337,14 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
sprintf
(
file
,
"expansions/pics/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
NULL
)
{
sprintf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.png"
),
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
NULL
)
{
sprintf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.jpg"
),
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
NULL
)
{
sprintf
(
file
,
"pics/%d.png"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
...
...
@@ -371,6 +379,14 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
sprintf
(
file
,
"expansions/pics/thumbnail/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
NULL
)
{
sprintf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/thumbnail/%d.png"
),
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
NULL
)
{
sprintf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/thumbnail/%d.jpg"
),
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
NULL
)
{
sprintf
(
file
,
"pics/thumbnail/%d.png"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
...
...
@@ -386,6 +402,14 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
sprintf
(
file
,
"expansions/pics/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
NULL
)
{
sprintf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.png"
),
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
NULL
)
{
sprintf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.jpg"
),
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
NULL
)
{
sprintf
(
file
,
"pics/%d.png"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
...
...
strings.conf
View file @
b275d130
...
...
@@ -314,6 +314,7 @@
!
system
1285
大
!
system
1286
特大
!
system
1287
数字灵摆图片
!
system
1288
语言(重启后生效):
!
system
1290
忽略对方发言
!
system
1291
忽略观战者发言
!
system
1292
忽略时点
...
...
system.conf
View file @
b275d130
...
...
@@ -43,3 +43,4 @@ window_height = 640
resize_popup_menu
=
0
enable_pendulum_scale
=
1
skin_index
= -
1
locale
=
default
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