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
3a99e204
Commit
3a99e204
authored
Jul 22, 2021
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
arrange code
parent
e3f96e18
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
165 additions
and
200 deletions
+165
-200
libcore/jni/Application.mk
libcore/jni/Application.mk
+1
-1
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
.../src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
+2
-1
libcore/src/main/java/cn/garymb/ygomobile/core/IrrlichtBridge.java
...rc/main/java/cn/garymb/ygomobile/core/IrrlichtBridge.java
+30
-10
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
+1
-0
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
+108
-168
mobile/src/main/java/cn/garymb/ygomobile/YGOStarter.java
mobile/src/main/java/cn/garymb/ygomobile/YGOStarter.java
+1
-3
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
+11
-7
mobile/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
...le/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
+11
-10
No files found.
libcore/jni/Application.mk
View file @
3a99e204
APP_ABI
:=
arm64-v8a
#
armeabi-v7a x86
APP_ABI
:=
arm64-v8a armeabi-v7a x86
APP_PLATFORM
:=
android-21
APP_PLATFORM
:=
android-21
#APP_MODULES := YGOMobile
#APP_MODULES := YGOMobile
#NDK_TOOLCHAIN_VERSION=4.8
#NDK_TOOLCHAIN_VERSION=4.8
...
...
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
View file @
3a99e204
...
@@ -118,7 +118,7 @@ public class YGOMobileActivity extends NativeActivity implements
...
@@ -118,7 +118,7 @@ public class YGOMobileActivity extends NativeActivity implements
mFullScreenUtils
.
fullscreen
();
mFullScreenUtils
.
fullscreen
();
mFullScreenUtils
.
onCreate
();
mFullScreenUtils
.
onCreate
();
//argv
//argv
mArgV
=
getIntent
().
getStringArrayExtra
(
IrrlichtBridge
.
EXTRA_ARGV
);
mArgV
=
IrrlichtBridge
.
getArgs
(
getIntent
()
);
//
//
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
Log
.
e
(
"YGOStarter"
,
"跳转完成"
+
System
.
currentTimeMillis
());
Log
.
e
(
"YGOStarter"
,
"跳转完成"
+
System
.
currentTimeMillis
());
...
@@ -418,6 +418,7 @@ public class YGOMobileActivity extends NativeActivity implements
...
@@ -418,6 +418,7 @@ public class YGOMobileActivity extends NativeActivity implements
options
.
mArgvList
.
clear
();
options
.
mArgvList
.
clear
();
if
(
mArgV
!=
null
)
{
if
(
mArgV
!=
null
)
{
options
.
mArgvList
.
addAll
(
Arrays
.
asList
(
mArgV
));
options
.
mArgvList
.
addAll
(
Arrays
.
asList
(
mArgV
));
mArgV
=
null
;
}
}
return
options
.
toNativeBuffer
();
return
options
.
toNativeBuffer
();
}
}
...
...
libcore/src/main/java/cn/garymb/ygomobile/core/IrrlichtBridge.java
View file @
3a99e204
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
package
cn.garymb.ygomobile.core
;
package
cn.garymb.ygomobile.core
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.util.Log
;
import
android.util.Log
;
...
@@ -27,11 +28,16 @@ public final class IrrlichtBridge {
...
@@ -27,11 +28,16 @@ public final class IrrlichtBridge {
public
static
final
String
ACTION_STOP
=
"cn.garymb.ygomobile.game.stop"
;
public
static
final
String
ACTION_STOP
=
"cn.garymb.ygomobile.game.stop"
;
public
static
final
String
EXTRA_PID
=
"extras.mypid"
;
public
static
final
String
EXTRA_PID
=
"extras.mypid"
;
public
static
final
String
EXTRA_ARGV
=
"extras.argv"
;
public
static
final
String
EXTRA_ARGV
=
"extras.argv"
;
public
static
final
String
EXTRA_ARGV_TIME_OUT
=
"extras.argv_timeout"
;
private
static
final
boolean
DEBUG
=
false
;
private
static
final
String
TAG
=
IrrlichtBridge
.
class
.
getSimpleName
();
public
static
int
gPid
;
public
static
int
gPid
;
public
static
long
sNativeHandle
;
static
{
static
{
try
{
try
{
System
.
loadLibrary
(
"YGOMobile"
);
System
.
loadLibrary
(
"YGOMobile"
);
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
//ignore
//ignore
}
}
}
}
...
@@ -40,17 +46,21 @@ public final class IrrlichtBridge {
...
@@ -40,17 +46,21 @@ public final class IrrlichtBridge {
}
}
public
static
long
sNativeHandle
;
//显示卡图
//显示卡图
public
static
native
byte
[]
nativeBpgImage
(
byte
[]
data
);
public
static
native
byte
[]
nativeBpgImage
(
byte
[]
data
);
//插入文本(大概是发送消息)
//插入文本(大概是发送消息)
private
static
native
void
nativeInsertText
(
long
handle
,
String
text
);
private
static
native
void
nativeInsertText
(
long
handle
,
String
text
);
//刷新文字
//刷新文字
private
static
native
void
nativeRefreshTexture
(
long
handle
);
private
static
native
void
nativeRefreshTexture
(
long
handle
);
//忽略时点
//忽略时点
private
static
native
void
nativeIgnoreChain
(
long
handle
,
boolean
begin
);
private
static
native
void
nativeIgnoreChain
(
long
handle
,
boolean
begin
);
//强制时点
//强制时点
private
static
native
void
nativeReactChain
(
long
handle
,
boolean
begin
);
private
static
native
void
nativeReactChain
(
long
handle
,
boolean
begin
);
//取消连锁
//取消连锁
private
static
native
void
nativeCancelChain
(
long
handle
);
private
static
native
void
nativeCancelChain
(
long
handle
);
...
@@ -62,8 +72,18 @@ public final class IrrlichtBridge {
...
@@ -62,8 +72,18 @@ public final class IrrlichtBridge {
private
static
native
void
nativeSetInputFix
(
long
handle
,
int
x
,
int
y
);
private
static
native
void
nativeSetInputFix
(
long
handle
,
int
x
,
int
y
);
private
static
final
boolean
DEBUG
=
false
;
public
static
void
setArgs
(
Intent
intent
,
String
[]
args
)
{
private
static
final
String
TAG
=
IrrlichtBridge
.
class
.
getSimpleName
();
intent
.
putExtra
(
EXTRA_ARGV
,
args
);
intent
.
putExtra
(
EXTRA_ARGV_TIME_OUT
,
(
System
.
currentTimeMillis
()
+
15
*
1000
));
}
public
static
String
[]
getArgs
(
Intent
intent
)
{
long
time
=
intent
.
getLongExtra
(
EXTRA_ARGV_TIME_OUT
,
0
);
if
(
time
>
System
.
currentTimeMillis
())
{
return
intent
.
getStringArrayExtra
(
EXTRA_ARGV
);
}
return
null
;
}
public
static
Bitmap
getBpgImage
(
InputStream
inputStream
,
Bitmap
.
Config
config
)
{
public
static
Bitmap
getBpgImage
(
InputStream
inputStream
,
Bitmap
.
Config
config
)
{
ByteArrayOutputStream
outputStream
=
null
;
ByteArrayOutputStream
outputStream
=
null
;
...
@@ -121,7 +141,7 @@ public final class IrrlichtBridge {
...
@@ -121,7 +141,7 @@ public final class IrrlichtBridge {
}
}
}
}
public
static
void
setInputFix
(
int
x
,
int
y
){
public
static
void
setInputFix
(
int
x
,
int
y
)
{
nativeSetInputFix
(
sNativeHandle
,
x
,
y
);
nativeSetInputFix
(
sNativeHandle
,
x
,
y
);
}
}
...
@@ -166,9 +186,9 @@ public final class IrrlichtBridge {
...
@@ -166,9 +186,9 @@ public final class IrrlichtBridge {
String
getSetting
(
String
key
);
String
getSetting
(
String
key
);
int
getIntSetting
(
String
key
,
int
def
);
int
getIntSetting
(
String
key
,
int
def
);
void
saveIntSetting
(
String
key
,
int
value
);
void
saveIntSetting
(
String
key
,
int
value
);
float
getScreenWidth
();
float
getScreenWidth
();
...
...
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
View file @
3a99e204
...
@@ -124,6 +124,7 @@ public interface Constants {
...
@@ -124,6 +124,7 @@ public interface Constants {
int
REQUEST_CHOOSE_FILE
=
0x1000
+
0x20
;
int
REQUEST_CHOOSE_FILE
=
0x1000
+
0x20
;
int
REQUEST_CHOOSE_IMG
=
0x1000
+
0x21
;
int
REQUEST_CHOOSE_IMG
=
0x1000
+
0x21
;
int
REQUEST_CHOOSE_FOLDER
=
0x1000
+
0x22
;
int
REQUEST_CHOOSE_FOLDER
=
0x1000
+
0x22
;
int
REQUEST_SETTINGS_CODE
=
0x1000
+
0x23
;
int
STRING_TYPE_START
=
1050
;
int
STRING_TYPE_START
=
1050
;
int
STRING_ATTRIBUTE_START
=
1010
;
int
STRING_ATTRIBUTE_START
=
1010
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
View file @
3a99e204
This diff is collapsed.
Click to expand it.
mobile/src/main/java/cn/garymb/ygomobile/YGOStarter.java
View file @
3a99e204
...
@@ -176,9 +176,7 @@ public class YGOStarter {
...
@@ -176,9 +176,7 @@ public class YGOStarter {
intent
.
putExtra
(
YGOGameOptions
.
YGO_GAME_OPTIONS_BUNDLE_KEY
,
options
);
intent
.
putExtra
(
YGOGameOptions
.
YGO_GAME_OPTIONS_BUNDLE_KEY
,
options
);
intent
.
putExtra
(
YGOGameOptions
.
YGO_GAME_OPTIONS_BUNDLE_TIME
,
System
.
currentTimeMillis
());
intent
.
putExtra
(
YGOGameOptions
.
YGO_GAME_OPTIONS_BUNDLE_TIME
,
System
.
currentTimeMillis
());
}
}
if
(
args
!=
null
)
{
IrrlichtBridge
.
setArgs
(
intent
,
args
);
intent
.
putExtra
(
IrrlichtBridge
.
EXTRA_ARGV
,
args
);
}
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
Log
.
e
(
"YGOStarter"
,
"跳转前"
+
System
.
currentTimeMillis
());
Log
.
e
(
"YGOStarter"
,
"跳转前"
+
System
.
currentTimeMillis
());
activity
.
startActivity
(
intent
);
activity
.
startActivity
(
intent
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
View file @
3a99e204
...
@@ -2,7 +2,6 @@ package cn.garymb.ygomobile.ui.home;
...
@@ -2,7 +2,6 @@ package cn.garymb.ygomobile.ui.home;
import
android.Manifest
;
import
android.Manifest
;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.content.ComponentName
;
import
android.content.DialogInterface
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.graphics.Color
;
import
android.graphics.Color
;
...
@@ -22,15 +21,12 @@ import java.io.IOException;
...
@@ -22,15 +21,12 @@ import java.io.IOException;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.GameUriManager
;
import
cn.garymb.ygomobile.GameUriManager
;
import
cn.garymb.ygomobile.YGOMobileActivity
;
import
cn.garymb.ygomobile.YGOStarter
;
import
cn.garymb.ygomobile.YGOStarter
;
import
cn.garymb.ygomobile.core.IrrlichtBridge
;
import
cn.garymb.ygomobile.core.IrrlichtBridge
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.activities.PermissionsActivity
;
import
cn.garymb.ygomobile.ui.activities.WebActivity
;
import
cn.garymb.ygomobile.ui.activities.WebActivity
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
cn.garymb.ygomobile.utils.ComponentUtils
;
import
cn.garymb.ygomobile.utils.FileUtils
;
import
cn.garymb.ygomobile.utils.FileUtils
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.NetUtils
;
import
cn.garymb.ygomobile.utils.NetUtils
;
...
@@ -54,13 +50,12 @@ public class MainActivity extends HomeActivity {
...
@@ -54,13 +50,12 @@ public class MainActivity extends HomeActivity {
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
,
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
,
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
,
};
};
public
ConfigManager
favConf
=
DataManager
.
openConfig
(
AppsSettings
.
get
().
getSystemConfig
());
ResCheckTask
mResCheckTask
;
ResCheckTask
mResCheckTask
;
private
GameUriManager
mGameUriManager
;
private
GameUriManager
mGameUriManager
;
private
ImageUpdater
mImageUpdater
;
private
ImageUpdater
mImageUpdater
;
private
boolean
enableStart
;
private
boolean
enableStart
;
public
ConfigManager
favConf
=
DataManager
.
openConfig
(
AppsSettings
.
get
().
getSystemConfig
());
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
...
@@ -181,7 +176,7 @@ public class MainActivity extends HomeActivity {
...
@@ -181,7 +176,7 @@ public class MainActivity extends HomeActivity {
@Override
@Override
protected
void
onPermission
(
boolean
isOk
)
{
protected
void
onPermission
(
boolean
isOk
)
{
super
.
onPermission
(
isOk
);
super
.
onPermission
(
isOk
);
if
(
isOk
){
if
(
isOk
)
{
try
{
try
{
FileUtils
.
copyDir
(
ORI_DECK
,
AppsSettings
.
get
().
getDeckDir
(),
false
);
FileUtils
.
copyDir
(
ORI_DECK
,
AppsSettings
.
get
().
getDeckDir
(),
false
);
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
...
@@ -306,6 +301,15 @@ public class MainActivity extends HomeActivity {
...
@@ -306,6 +301,15 @@ public class MainActivity extends HomeActivity {
});
});
}
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
if
(
requestCode
==
Constants
.
REQUEST_SETTINGS_CODE
)
{
//TODO
}
else
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
}
}
/* checkResourceDownload((result, isNewVersion) -> {
/* checkResourceDownload((result, isNewVersion) -> {
Toast.makeText(this, R.string.tip_reset_game_res, Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.tip_reset_game_res, Toast.LENGTH_SHORT).show();
});*/
});*/
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
View file @
3a99e204
package
cn.garymb.ygomobile.utils
;
package
cn.garymb.ygomobile.utils
;
import
android.util.Log
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
...
@@ -79,24 +81,21 @@ public class FileUtils {
...
@@ -79,24 +81,21 @@ public class FileUtils {
return
true
;
return
true
;
}
}
public
static
void
copyFile
(
InputStream
in
,
File
out
)
{
public
static
void
copyFile
(
InputStream
in
,
File
out
)
throws
IOException
{
FileOutputStream
outputStream
=
null
;
FileOutputStream
outputStream
=
null
;
try
{
File
dir
=
out
.
getParentFile
();
File
dir
=
out
.
getParentFile
();
if
(!
dir
.
exists
())
{
if
(!
dir
.
exists
())
{
dir
.
mkdirs
();
dir
.
mkdirs
();
}
}
try
{
outputStream
=
new
FileOutputStream
(
out
);
outputStream
=
new
FileOutputStream
(
out
);
copy
(
in
,
outputStream
);
copy
(
in
,
outputStream
);
}
catch
(
Throwable
e
)
{
e
.
printStackTrace
();
}
finally
{
}
finally
{
IOUtils
.
close
(
outputStream
);
IOUtils
.
close
(
outputStream
);
IOUtils
.
close
(
in
);
}
}
}
}
public
static
void
copyFile
(
File
in
,
File
out
)
{
public
static
boolean
copyFile
(
File
in
,
File
out
)
{
FileOutputStream
outputStream
=
null
;
FileOutputStream
outputStream
=
null
;
FileInputStream
inputStream
=
null
;
FileInputStream
inputStream
=
null
;
try
{
try
{
...
@@ -108,11 +107,13 @@ public class FileUtils {
...
@@ -108,11 +107,13 @@ public class FileUtils {
outputStream
=
new
FileOutputStream
(
out
);
outputStream
=
new
FileOutputStream
(
out
);
copy
(
inputStream
,
outputStream
);
copy
(
inputStream
,
outputStream
);
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
e
.
printStackTrace
();
Log
.
e
(
"ygo"
,
"copy file"
,
e
);
return
false
;
}
finally
{
}
finally
{
IOUtils
.
close
(
outputStream
);
IOUtils
.
close
(
outputStream
);
IOUtils
.
close
(
inputStream
);
IOUtils
.
close
(
inputStream
);
}
}
return
true
;
}
}
public
static
void
copyFile
(
String
oldPath
,
String
newPath
,
boolean
isName
)
throws
FileNotFoundException
,
IOException
{
public
static
void
copyFile
(
String
oldPath
,
String
newPath
,
boolean
isName
)
throws
FileNotFoundException
,
IOException
{
...
...
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