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
0e8d39b0
Commit
0e8d39b0
authored
May 21, 2018
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加本地人机
parent
8134065f
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
86 additions
and
1 deletion
+86
-1
Classes/gframe/menu_handler.cpp
Classes/gframe/menu_handler.cpp
+18
-0
libcore/android/android_tools.cpp
libcore/android/android_tools.cpp
+26
-0
libcore/android/android_tools.h
libcore/android/android_tools.h
+2
-0
libcore/src/main/java/cn/garymb/ygomobile/core/IrrlichtBridge.java
...rc/main/java/cn/garymb/ygomobile/core/IrrlichtBridge.java
+3
-0
mobile/build.gradle
mobile/build.gradle
+5
-0
mobile/libs/libWindbot.aar
mobile/libs/libWindbot.aar
+0
-0
mobile/src/main/java/cn/garymb/ygomobile/App.java
mobile/src/main/java/cn/garymb/ygomobile/App.java
+9
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
+23
-1
No files found.
Classes/gframe/menu_handler.cpp
View file @
0e8d39b0
...
...
@@ -328,6 +328,24 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
NetServer
::
StopServer
();
break
;
}
#elif defined(_IRR_ANDROID_PLATFORM_)
char
args
[
512
];
char
arg1
[
512
];
BufferIO
::
EncodeUTF8
(
mainGame
->
botInfo
[
sel
].
command
,
arg1
);
char
arg2
[
32
];
arg2
[
0
]
=
0
;
if
(
mainGame
->
chkBotHand
->
isChecked
())
sprintf
(
arg2
,
" Hand=1"
);
char
arg3
[
32
];
sprintf
(
arg3
,
" Port=%d"
,
mainGame
->
gameConf
.
serverport
);
sprintf
(
args
,
"%s%s%s"
,
arg1
,
arg2
,
arg3
);
android
::
runWindbot
(
mainGame
->
appMain
,
args
);
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
break
;
if
(
!
DuelClient
::
StartClient
(
0x7f000001
,
mainGame
->
gameConf
.
serverport
))
{
NetServer
::
StopServer
();
break
;
}
#else
if
(
fork
()
==
0
)
{
usleep
(
100000
);
...
...
libcore/android/android_tools.cpp
View file @
0e8d39b0
...
...
@@ -981,5 +981,31 @@ bool android_deck_delete(const char* deck_name) {
return
status
==
0
;
}
void
runWindbot
(
ANDROID_APP
app
,
const
char
*
args
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
JNIEnv
*
jni
=
0
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
;
// Retrieves NativeActivity.
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jclass
ClassNativeActivity
=
jni
->
GetObjectClass
(
lNativeActivity
);
jmethodID
MethodGetApp
=
jni
->
GetMethodID
(
ClassNativeActivity
,
"getApplication"
,
"()Landroid/app/Application;"
);
jobject
application
=
jni
->
CallObjectMethod
(
lNativeActivity
,
MethodGetApp
);
jclass
classApp
=
jni
->
GetObjectClass
(
application
);
jmethodID
runWindbotMethod
=
jni
->
GetMethodID
(
classApp
,
"runWindbot"
,
"(Ljava/lang/String;)V"
);
jstring
argsstring
=
jni
->
NewStringUTF
(
args
);
jni
->
CallVoidMethod
(
application
,
runWindbotMethod
,
argsstring
);
if
(
argsstring
)
{
jni
->
DeleteLocalRef
(
argsstring
);
}
jni
->
DeleteLocalRef
(
classApp
);
jni
->
DeleteLocalRef
(
ClassNativeActivity
);
app
->
activity
->
vm
->
DetachCurrentThread
();
}
}
// namespace android
}
// namespace irr
libcore/android/android_tools.h
View file @
0e8d39b0
...
...
@@ -177,6 +177,8 @@ extern unsigned char* android_script_reader(const char* script_name, int* slen);
extern
bool
android_deck_delete
(
const
char
*
deck_name
);
extern
void
runWindbot
(
ANDROID_APP
app
,
const
char
*
args
);
}
}
...
...
libcore/src/main/java/cn/garymb/ygomobile/core/IrrlichtBridge.java
View file @
0e8d39b0
...
...
@@ -169,6 +169,9 @@ public final class IrrlichtBridge {
float
getScreenHeight
();
void
playSoundEffect
(
String
path
);
void
runWindbot
(
String
args
);
// float getSmallerSize();
// float getXScale();
// float getYScale();
...
...
mobile/build.gradle
View file @
0e8d39b0
...
...
@@ -53,6 +53,9 @@ android {
exclude
'META-INF/DEPENDENCIES'
exclude
'META-INF/LICENSE'
}
aaptOptions
{
noCompress
'dll'
}
buildToolsVersion
'27.0.3'
}
...
...
@@ -77,6 +80,8 @@ dependencies {
implementation
'org.greenrobot:eventbus:3.0.0'
implementation
'com.tubb.smrv:swipemenu-recyclerview:5.4.0'
//
implementation
(
name:
'libWindbot'
,
ext:
'aar'
)
//
mycardImplementation
(
name:
'xwalk_core_library-22.52.561.4'
,
ext:
'aar'
)
implementation
'com.nightonke:boommenu:2.1.0'
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
...
...
mobile/libs/libWindbot.aar
0 → 100644
View file @
0e8d39b0
File added
mobile/src/main/java/cn/garymb/ygomobile/App.java
View file @
0e8d39b0
...
...
@@ -2,6 +2,7 @@ package cn.garymb.ygomobile;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.support.v7.app.AppCompatDelegate
;
public
class
App
extends
GameApplication
{
...
...
@@ -98,4 +99,12 @@ public class App extends GameApplication {
public
float
getScreenHeight
()
{
return
AppsSettings
.
get
().
getScreenHeight
();
}
@Override
public
void
runWindbot
(
String
args
)
{
Intent
intent
=
new
Intent
();
intent
.
putExtra
(
"args"
,
args
);
intent
.
setAction
(
"RUN_WINDBOT"
);
getBaseContext
().
sendBroadcast
(
intent
);
}
}
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
View file @
0e8d39b0
package
cn.garymb.ygomobile.ui.home
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.graphics.Color
;
import
android.os.Bundle
;
import
android.support.annotation.NonNull
;
...
...
@@ -27,6 +30,7 @@ import com.nightonke.boommenu.BoomMenuButton;
import
com.qihoo.appstore.common.updatesdk.lib.UpdateHelper
;
import
com.tubb.smrv.SwipeMenuRecyclerView
;
import
org.chromium.mojo.bindings.MessageReceiver
;
import
org.greenrobot.eventbus.EventBus
;
import
org.greenrobot.eventbus.Subscribe
;
import
org.greenrobot.eventbus.ThreadMode
;
...
...
@@ -52,6 +56,7 @@ import cn.garymb.ygomobile.ui.plus.DefaultOnBoomListener;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.preference.SettingsActivity
;
import
cn.garymb.ygomobile.utils.AlipayPayUtils
;
import
libwindbot.windbot.WindBot
;
abstract
class
HomeActivity
extends
BaseActivity
implements
NavigationView
.
OnNavigationItemSelectedListener
{
protected
SwipeMenuRecyclerView
mServerList
;
...
...
@@ -77,11 +82,17 @@ abstract class HomeActivity extends BaseActivity implements NavigationView.OnNav
mServerListManager
=
new
ServerListManager
(
this
,
mServerListAdapter
);
mServerListManager
.
bind
(
mServerList
);
mServerListManager
.
syncLoadData
();
//windbot
WindBot
.
initAndroid
(
"/storage/emulated/0/ygocore"
,
"/storage/emulated/0/ygocore/cards.cdb"
);
MessageReceiver
mReceiver
=
new
MessageReceiver
();
IntentFilter
filter
=
new
IntentFilter
();
filter
.
addAction
(
"RUN_WINDBOT"
);
getContext
().
registerReceiver
(
mReceiver
,
filter
);
//event
EventBus
.
getDefault
().
register
(
this
);
initBoomMenuButton
(
$
(
R
.
id
.
bmb
));
//trpay
TrPay
.
getInstance
(
HomeActivity
.
this
).
initPaySdk
(
"e1014da420ea4405898c01273d6731b6"
,
"
baidu
"
);
TrPay
.
getInstance
(
HomeActivity
.
this
).
initPaySdk
(
"e1014da420ea4405898c01273d6731b6"
,
"
YGOMobile
"
);
//autoupadte checking
checkForceUpdateSilent
();
}
...
...
@@ -92,6 +103,17 @@ abstract class HomeActivity extends BaseActivity implements NavigationView.OnNav
EventBus
.
getDefault
().
unregister
(
this
);
}
public
class
MessageReceiver
extends
BroadcastReceiver
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
String
action
=
intent
.
getAction
();
if
(
action
.
equals
(
"RUN_WINDBOT"
))
{
String
args
=
intent
.
getStringExtra
(
"args"
);
WindBot
.
runAndroid
(
args
);
}
}
};
@Subscribe
(
threadMode
=
ThreadMode
.
MAIN
)
public
void
onServerInfoEvent
(
ServerInfoEvent
event
)
{
if
(
event
.
delete
)
{
...
...
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