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
bf9c83e7
Commit
bf9c83e7
authored
Jul 16, 2021
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opt code
parent
30bd2e29
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
9 deletions
+28
-9
Classes/gframe/gframe.cpp
Classes/gframe/gframe.cpp
+28
-9
No files found.
Classes/gframe/gframe.cpp
View file @
bf9c83e7
...
@@ -9,19 +9,31 @@ bool exit_on_return = false;
...
@@ -9,19 +9,31 @@ bool exit_on_return = false;
bool
bot_mode
=
false
;
bool
bot_mode
=
false
;
void
ClickButton
(
irr
::
gui
::
IGUIElement
*
btn
)
{
void
ClickButton
(
irr
::
gui
::
IGUIElement
*
btn
)
{
irr
::
SEvent
event
;
irr
::
SEvent
event
{}
;
event
.
EventType
=
irr
::
EET_GUI_EVENT
;
event
.
EventType
=
irr
::
EET_GUI_EVENT
;
event
.
GUIEvent
.
EventType
=
irr
::
gui
::
EGET_BUTTON_CLICKED
;
event
.
GUIEvent
.
EventType
=
irr
::
gui
::
EGET_BUTTON_CLICKED
;
event
.
GUIEvent
.
Caller
=
btn
;
event
.
GUIEvent
.
Caller
=
btn
;
ygo
::
mainGame
->
device
->
postEventFromUser
(
event
);
ygo
::
mainGame
->
device
->
postEventFromUser
(
event
);
}
}
char
*
sub_string
(
const
char
*
str
,
int
start
,
int
count
=-
1
){
char
*
tmp
=
new
char
[
1024
];
int
len
=
strlen
(
str
);
int
index
=
0
;
if
(
count
<
0
){
count
=
len
-
start
;
}
for
(
int
j
=
start
;
j
<
len
&&
count
>
0
;
count
--
,
j
++
)
{
tmp
[
index
++
]
=
str
[
j
];
}
tmp
[
index
]
=
'\0'
;
return
tmp
;
}
#ifdef _IRR_ANDROID_PLATFORM_
#ifdef _IRR_ANDROID_PLATFORM_
int
GetListBoxIndex
(
IGUIListBox
*
listbox
,
const
wchar_t
*
target
){
int
GetListBoxIndex
(
IGUIListBox
*
listbox
,
const
wchar_t
*
target
){
int
count
=
listbox
->
getItemCount
();
int
count
=
listbox
->
getItemCount
();
for
(
int
i
=
0
;
i
<
count
;
i
++
){
for
(
int
i
=
0
;
i
<
count
;
i
++
){
auto
item
=
listbox
->
getListItem
(
i
);
auto
item
=
listbox
->
getListItem
(
i
);
if
(
wcscmp
(
item
,
target
)){
if
(
wcscmp
(
item
,
target
)
==
0
){
return
i
;
return
i
;
}
}
}
}
...
@@ -55,15 +67,20 @@ int main(int argc, char* argv[]) {
...
@@ -55,15 +67,20 @@ int main(int argc, char* argv[]) {
#ifdef _IRR_ANDROID_PLATFORM_
#ifdef _IRR_ANDROID_PLATFORM_
//android
//android
for
(
int
i
=
0
;
i
<
argc
;
++
i
)
{
for
(
int
i
=
0
;
i
<
argc
;
++
i
)
{
char
*
arg
=
argv
[
i
].
c_str
();
c
onst
c
har
*
arg
=
argv
[
i
].
c_str
();
#else
#else
//pc的第一个是exe的路径
//pc的第一个是exe的路径
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
char
*
arg
=
argv
[
i
];
char
*
arg
=
argv
[
i
];
#endif
#endif
if
(
arg
[
0
]
==
'-'
&&
arg
[
1
]
==
'e'
)
{
if
(
arg
[
0
]
==
'-'
&&
arg
[
1
]
==
'e'
)
{
ygo
::
dataManager
.
LoadDB
(
&
arg
[
2
]);
wchar_t
fname
[
1024
];
}
else
if
(
!
strcmp
(
arv
,
"-k"
))
{
// Keep on return
char
*
tmp
=
sub_string
(
arg
,
2
);
BufferIO
::
DecodeUTF8
(
tmp
,
fname
);
__android_log_print
(
ANDROID_LOG_INFO
,
"ygo"
,
"load cdb=%s"
,
tmp
);
ygo
::
dataManager
.
LoadDB
(
fname
);
delete
tmp
;
}
else
if
(
!
strcmp
(
arg
,
"-k"
))
{
// Keep on return
exit_on_return
=
false
;
exit_on_return
=
false
;
keep_on_return
=
true
;
keep_on_return
=
true
;
}
else
if
(
!
strcmp
(
arg
,
"-c"
))
{
// Create host
}
else
if
(
!
strcmp
(
arg
,
"-c"
))
{
// Create host
...
@@ -81,7 +98,7 @@ int main(int argc, char* argv[]) {
...
@@ -81,7 +98,7 @@ int main(int argc, char* argv[]) {
int
index
=
0
;
int
index
=
0
;
if
((
i
+
1
)
<
argc
){
//下一个参数是录像名
if
((
i
+
1
)
<
argc
){
//下一个参数是录像名
#ifdef _IRR_ANDROID_PLATFORM_
#ifdef _IRR_ANDROID_PLATFORM_
char
*
name
=
argv
[
i
+
1
].
c_str
();
c
onst
c
har
*
name
=
argv
[
i
+
1
].
c_str
();
#else
#else
char
*
name
=
argv
[
i
+
1
];
char
*
name
=
argv
[
i
+
1
];
#endif
#endif
...
@@ -91,6 +108,7 @@ int main(int argc, char* argv[]) {
...
@@ -91,6 +108,7 @@ int main(int argc, char* argv[]) {
index
=
GetListBoxIndex
(
ygo
::
mainGame
->
lstReplayList
,
fname
);
index
=
GetListBoxIndex
(
ygo
::
mainGame
->
lstReplayList
,
fname
);
}
}
ygo
::
mainGame
->
HideElement
(
ygo
::
mainGame
->
wMainMenu
);
ClickButton
(
ygo
::
mainGame
->
btnReplayMode
);
ClickButton
(
ygo
::
mainGame
->
btnReplayMode
);
if
(
open_file
){
if
(
open_file
){
ygo
::
mainGame
->
lstReplayList
->
setSelected
(
index
);
ygo
::
mainGame
->
lstReplayList
->
setSelected
(
index
);
...
@@ -103,7 +121,7 @@ int main(int argc, char* argv[]) {
...
@@ -103,7 +121,7 @@ int main(int argc, char* argv[]) {
int
index
=
0
;
int
index
=
0
;
if
((
i
+
1
)
<
argc
){
//下一个参数是文件名
if
((
i
+
1
)
<
argc
){
//下一个参数是文件名
#ifdef _IRR_ANDROID_PLATFORM_
#ifdef _IRR_ANDROID_PLATFORM_
char
*
name
=
argv
[
i
+
1
].
c_str
();
c
onst
c
har
*
name
=
argv
[
i
+
1
].
c_str
();
#else
#else
char
*
name
=
argv
[
i
+
1
];
char
*
name
=
argv
[
i
+
1
];
#endif
#endif
...
@@ -113,6 +131,7 @@ int main(int argc, char* argv[]) {
...
@@ -113,6 +131,7 @@ int main(int argc, char* argv[]) {
index
=
GetListBoxIndex
(
ygo
::
mainGame
->
lstReplayList
,
fname
);
index
=
GetListBoxIndex
(
ygo
::
mainGame
->
lstReplayList
,
fname
);
}
}
ygo
::
mainGame
->
HideElement
(
ygo
::
mainGame
->
wMainMenu
);
ClickButton
(
ygo
::
mainGame
->
btnSingleMode
);
ClickButton
(
ygo
::
mainGame
->
btnSingleMode
);
if
(
open_file
){
if
(
open_file
){
ygo
::
mainGame
->
lstSinglePlayList
->
setSelected
(
index
);
ygo
::
mainGame
->
lstSinglePlayList
->
setSelected
(
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