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
4c38b95f
Commit
4c38b95f
authored
Jan 23, 2019
by
feihuaduo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加一些注释
parent
a145c556
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
9 deletions
+32
-9
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
.../src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
+3
-1
libcore/src/main/java/cn/garymb/ygomobile/core/IrrlichtBridge.java
...rc/main/java/cn/garymb/ygomobile/core/IrrlichtBridge.java
+6
-6
mobile/src/main/java/cn/garymb/ygomobile/YGOStarter.java
mobile/src/main/java/cn/garymb/ygomobile/YGOStarter.java
+23
-2
No files found.
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
View file @
4c38b95f
...
@@ -96,11 +96,11 @@ public class YGOMobileActivity extends NativeActivity implements
...
@@ -96,11 +96,11 @@ public class YGOMobileActivity extends NativeActivity implements
return
mApp
;
return
mApp
;
}
}
@SuppressWarnings
(
"WrongConstant"
)
@SuppressWarnings
(
"WrongConstant"
)
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
Log
.
e
(
"YGOStarter"
,
"跳转完成"
+
System
.
currentTimeMillis
());
mFullScreenUtils
=
new
FullScreenUtils
(
this
,
app
().
isImmerSiveMode
());
mFullScreenUtils
=
new
FullScreenUtils
(
this
,
app
().
isImmerSiveMode
());
mFullScreenUtils
.
fullscreen
();
mFullScreenUtils
.
fullscreen
();
mFullScreenUtils
.
onCreate
();
mFullScreenUtils
.
onCreate
();
...
@@ -119,12 +119,14 @@ public class YGOMobileActivity extends NativeActivity implements
...
@@ -119,12 +119,14 @@ public class YGOMobileActivity extends NativeActivity implements
.
setPackage
(
getPackageName
()));
.
setPackage
(
getPackageName
()));
}
}
//电池管理
private
PowerManager
mPM
;
private
PowerManager
mPM
;
private
PowerManager
.
WakeLock
mLock
;
private
PowerManager
.
WakeLock
mLock
;
@Override
@Override
protected
void
onResume
()
{
protected
void
onResume
()
{
super
.
onResume
();
super
.
onResume
();
Log
.
e
(
"YGOStarter"
,
"ygo显示"
+
System
.
currentTimeMillis
());
if
(
mLock
==
null
)
{
if
(
mLock
==
null
)
{
if
(
mPM
==
null
)
{
if
(
mPM
==
null
)
{
mPM
=
(
PowerManager
)
getSystemService
(
POWER_SERVICE
);
mPM
=
(
PowerManager
)
getSystemService
(
POWER_SERVICE
);
...
...
libcore/src/main/java/cn/garymb/ygomobile/core/IrrlichtBridge.java
View file @
4c38b95f
...
@@ -40,17 +40,17 @@ public final class IrrlichtBridge {
...
@@ -40,17 +40,17 @@ public final class IrrlichtBridge {
}
}
public
static
int
sNativeHandle
;
public
static
int
sNativeHandle
;
//显示卡图
public
static
native
byte
[]
nativeBpgImage
(
byte
[]
data
);
public
static
native
byte
[]
nativeBpgImage
(
byte
[]
data
);
//插入文本(大概是发送消息)
private
static
native
void
nativeInsertText
(
int
handle
,
String
text
);
private
static
native
void
nativeInsertText
(
int
handle
,
String
text
);
//刷新文字
private
static
native
void
nativeRefreshTexture
(
int
handle
);
private
static
native
void
nativeRefreshTexture
(
int
handle
);
//忽略时点
private
static
native
void
nativeIgnoreChain
(
int
handle
,
boolean
begin
);
private
static
native
void
nativeIgnoreChain
(
int
handle
,
boolean
begin
);
//强制时点
private
static
native
void
nativeReactChain
(
int
handle
,
boolean
begin
);
private
static
native
void
nativeReactChain
(
int
handle
,
boolean
begin
);
//取消连锁
private
static
native
void
nativeCancelChain
(
int
handle
);
private
static
native
void
nativeCancelChain
(
int
handle
);
private
static
native
void
nativeSetCheckBoxesSelection
(
int
handle
,
int
idx
);
private
static
native
void
nativeSetCheckBoxesSelection
(
int
handle
,
int
idx
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/YGOStarter.java
View file @
4c38b95f
...
@@ -10,6 +10,7 @@ import android.graphics.drawable.Drawable;
...
@@ -10,6 +10,7 @@ import android.graphics.drawable.Drawable;
import
android.os.Build
;
import
android.os.Build
;
import
android.support.v7.app.ActionBar
;
import
android.support.v7.app.ActionBar
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.app.AppCompatActivity
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.View
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
android.widget.Toast
;
import
android.widget.Toast
;
...
@@ -78,7 +79,8 @@ public class YGOStarter {
...
@@ -78,7 +79,8 @@ public class YGOStarter {
//读取当前的背景图,如果卡的话,可以考虑缓存bitmap
//读取当前的背景图,如果卡的话,可以考虑缓存bitmap
File
bgfile
=
new
File
(
AppsSettings
.
get
().
getCoreSkinPath
(),
Constants
.
CORE_SKIN_BG
);
File
bgfile
=
new
File
(
AppsSettings
.
get
().
getCoreSkinPath
(),
Constants
.
CORE_SKIN_BG
);
if
(
bgfile
.
exists
())
{
if
(
bgfile
.
exists
())
{
Glide
.
with
(
activity
.
getApplicationContext
()).
load
(
bgfile
)
// .getApplicationContext()
Glide
.
with
(
activity
).
load
(
bgfile
)
.
signature
(
new
StringSignature
(
bgfile
.
getName
()
+
bgfile
.
lastModified
()))
.
signature
(
new
StringSignature
(
bgfile
.
getName
()
+
bgfile
.
lastModified
()))
.
diskCacheStrategy
(
DiskCacheStrategy
.
NONE
)
.
diskCacheStrategy
(
DiskCacheStrategy
.
NONE
)
.
into
(
activityShowInfo
.
mViewTarget
);
.
into
(
activityShowInfo
.
mViewTarget
);
...
@@ -151,9 +153,13 @@ public class YGOStarter {
...
@@ -151,9 +153,13 @@ public class YGOStarter {
private
static
long
lasttime
=
0
;
private
static
long
lasttime
=
0
;
public
static
void
startGame
(
Activity
activity
,
YGOGameOptions
options
)
{
public
static
void
startGame
(
Activity
activity
,
YGOGameOptions
options
)
{
//如果距离上次加入游戏的时间大于1秒才处理
if
(
System
.
currentTimeMillis
()
-
lasttime
>=
1000
)
{
if
(
System
.
currentTimeMillis
()
-
lasttime
>=
1000
)
{
lasttime
=
System
.
currentTimeMillis
();
lasttime
=
System
.
currentTimeMillis
();
Log
.
e
(
"YGOStarter"
,
"设置背景前"
+
System
.
currentTimeMillis
());
//显示加载背景
showLoadingBg
(
activity
);
showLoadingBg
(
activity
);
Log
.
e
(
"YGOStarter"
,
"设置背景后"
+
System
.
currentTimeMillis
());
if
(!
ComponentUtils
.
isActivityRunning
(
activity
,
new
ComponentName
(
activity
,
YGOMobileActivity
.
class
)))
{
if
(!
ComponentUtils
.
isActivityRunning
(
activity
,
new
ComponentName
(
activity
,
YGOMobileActivity
.
class
)))
{
//random tips
//random tips
String
[]
tipsList
=
activity
.
getResources
().
getStringArray
(
R
.
array
.
tips
);
String
[]
tipsList
=
activity
.
getResources
().
getStringArray
(
R
.
array
.
tips
);
...
@@ -162,27 +168,42 @@ public class YGOStarter {
...
@@ -162,27 +168,42 @@ public class YGOStarter {
Toast
.
makeText
(
activity
,
tips
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
activity
,
tips
,
Toast
.
LENGTH_LONG
).
show
();
// } else {
// } else {
// options = null;
// options = null;
}
}
Intent
intent
=
new
Intent
(
activity
,
YGOMobileActivity
.
class
);
Intent
intent
=
new
Intent
(
activity
,
YGOMobileActivity
.
class
);
if
(
options
!=
null
)
{
if
(
options
!=
null
)
{
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
());
}
}
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
Log
.
e
(
"YGOStarter"
,
"跳转前"
+
System
.
currentTimeMillis
());
activity
.
startActivity
(
intent
);
activity
.
startActivity
(
intent
);
Log
.
e
(
"YGOStarter"
,
"跳转后"
+
System
.
currentTimeMillis
());
}
}
}
}
private
static
HashMap
<
Activity
,
ActivityShowInfo
>
Infos
=
new
HashMap
<>();
private
static
HashMap
<
Activity
,
ActivityShowInfo
>
Infos
=
new
HashMap
<>();
private
static
class
ActivityShowInfo
{
private
static
class
ActivityShowInfo
{
//根布局
View
mRoot
;
View
mRoot
;
ViewTarget
mViewTarget
;
ViewTarget
mViewTarget
;
//是否显示了标题栏
boolean
hasSupperbar
;
boolean
hasSupperbar
;
//是否显示了标题栏
boolean
hasBar
;
boolean
hasBar
;
View
mContentView
;
View
mContentView
;
//activity背景
Drawable
rootOld
;
Drawable
rootOld
;
boolean
isFirst
=
true
;
boolean
isFirst
=
true
;
//屏幕方向
// screenOrientations属性共有7中可选值(常量定义在 android.content.pm.ActivityInfo类中):
//1.landscape:横屏(风景照),显示时宽度大于高度;
//2.portrait:竖屏(肖像照), 显示时高度大于宽度;
//3.user:用户当前的首选方向;
//4.behind:继承Activity堆栈中当前Activity下面的那个Activity的方向;
//5.sensor:由物理感应器决定显示方向,它取决于用户如何持有设备,当设备被旋转时方向会随之变化——在横屏与竖屏之间;
//6.nosensor:忽略物理感应器——即显示方向与物理感应器无关,不管用户如何旋转设备显示方向都不会随着改变("unspecified"设置除外);
//7.unspecified:未指定,此为默认值,由Android系统自己选择适当的方向,选择策略视具体设备的配置情况而定,因此不同的设备会有不同的方向选择;
int
oldRequestedOrientation
;
int
oldRequestedOrientation
;
boolean
isRunning
=
false
;
boolean
isRunning
=
false
;
}
}
...
...
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