Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
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-Cn-Ko-En
Commits
f3a145f3
Commit
f3a145f3
authored
Oct 25, 2019
by
kenan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kill game
parent
17fddcba
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
0 deletions
+46
-0
libcore/src/main/AndroidManifest.xml
libcore/src/main/AndroidManifest.xml
+8
-0
libcore/src/main/java/cn/garymb/ygomobile/AutoQuitReceiver.java
...e/src/main/java/cn/garymb/ygomobile/AutoQuitReceiver.java
+32
-0
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
.../src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
+2
-0
libcore/src/main/java/cn/garymb/ygomobile/core/YGOCore.java
libcore/src/main/java/cn/garymb/ygomobile/core/YGOCore.java
+4
-0
No files found.
libcore/src/main/AndroidManifest.xml
View file @
f3a145f3
...
@@ -26,6 +26,14 @@
...
@@ -26,6 +26,14 @@
android:name=
"android.app.lib_name"
android:name=
"android.app.lib_name"
android:value=
"YGOMobile"
/>
android:value=
"YGOMobile"
/>
</activity>
</activity>
<receiver
android:name=
"cn.garymb.ygomobile.AutoQuitReceiver"
android:exported=
"false"
>
<intent-filter>
<action
android:name=
"ygocore.action.game_start"
/>
<action
android:name=
"ygocore.action.game_end"
/>
</intent-filter>
</receiver>
</application>
</application>
</manifest>
</manifest>
libcore/src/main/java/cn/garymb/ygomobile/AutoQuitReceiver.java
0 → 100644
View file @
f3a145f3
package
cn.garymb.ygomobile
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Process
;
import
android.util.Log
;
import
cn.garymb.ygomobile.core.YGOCore
;
/***
* 解决重启游戏卡图变黑
*/
public
class
AutoQuitReceiver
extends
BroadcastReceiver
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
if
(
YGOCore
.
ACTION_END
.
equals
(
intent
.
getAction
()))
{
int
pid
=
intent
.
getIntExtra
(
YGOCore
.
EXTRA_PID
,
-
1
);
if
(
pid
!=
0
)
{
try
{
Log
.
e
(
"ygomobile"
,
"stop game pid="
+
pid
);
Process
.
killProcess
(
pid
);
}
catch
(
Throwable
e
)
{
e
.
printStackTrace
();
}
}
}
else
if
(
YGOCore
.
ACTION_START
.
equals
(
intent
.
getAction
()))
{
}
}
}
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
View file @
f3a145f3
...
@@ -171,6 +171,7 @@ public class YGOMobileActivity extends NativeActivity implements
...
@@ -171,6 +171,7 @@ public class YGOMobileActivity extends NativeActivity implements
}
}
mHost
.
initWindbot
(
mGameConfig
.
getNativeInitOptions
(),
mGameConfig
);
mHost
.
initWindbot
(
mGameConfig
.
getNativeInitOptions
(),
mGameConfig
);
mHost
.
onAfterCreate
(
this
);
mHost
.
onAfterCreate
(
this
);
sendBroadcast
(
new
Intent
(
YGOCore
.
ACTION_START
).
putExtra
(
YGOCore
.
EXTRA_PID
,
Process
.
myPid
()).
setPackage
(
getPackageName
()));
}
}
@SuppressLint
(
"WakelockTimeout"
)
@SuppressLint
(
"WakelockTimeout"
)
...
@@ -223,6 +224,7 @@ public class YGOMobileActivity extends NativeActivity implements
...
@@ -223,6 +224,7 @@ public class YGOMobileActivity extends NativeActivity implements
public
void
finish
()
{
public
void
finish
()
{
mCore
.
release
();
mCore
.
release
();
mHost
.
onGameExit
(
this
);
mHost
.
onGameExit
(
this
);
sendBroadcast
(
new
Intent
(
YGOCore
.
ACTION_END
).
putExtra
(
YGOCore
.
EXTRA_PID
,
Process
.
myPid
()).
setPackage
(
getPackageName
()));
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
finishAndRemoveTask
();
finishAndRemoveTask
();
}
else
{
}
else
{
...
...
libcore/src/main/java/cn/garymb/ygomobile/core/YGOCore.java
View file @
f3a145f3
...
@@ -18,6 +18,10 @@ import cn.garymb.ygomobile.YGOMobileActivity;
...
@@ -18,6 +18,10 @@ import cn.garymb.ygomobile.YGOMobileActivity;
import
cn.garymb.ygomobile.interfaces.GameConfig
;
import
cn.garymb.ygomobile.interfaces.GameConfig
;
public
class
YGOCore
{
public
class
YGOCore
{
public
static
final
String
ACTION_START
=
"ygocore.action.game_start"
;
public
static
final
String
ACTION_END
=
"ygocore.action.game_end"
;
public
static
final
String
EXTRA_PID
=
"pid"
;
public
static
final
float
GAME_WIDTH
=
1024.0f
;
public
static
final
float
GAME_WIDTH
=
1024.0f
;
public
static
final
float
GAME_HEIGHT
=
640.0f
;
public
static
final
float
GAME_HEIGHT
=
640.0f
;
private
static
final
String
TAG
=
"ygomobile"
;
private
static
final
String
TAG
=
"ygomobile"
;
...
...
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