Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
apk_product
/
ForFun
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
b9f4b07e
...
b9f4b07e61de9fab2d1e5c4c5d3138b18374ced2
authored
2020-03-16 11:00:09 +0800
by
金学艇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.解决首页偶尔闪屏的问题
1 parent
2467b3d1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
33 deletions
assets/Scene/sceneMain.fire
assets/Script/main.js
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/res/layout/activity_main_obi_bg.xml
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/src/com/topdraw/melody/TopdrawSDKWrapper.java
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/src/org/cocos2dx/javascript/AppActivity.java
assets/Scene/sceneMain.fire
View file @
b9f4b07
...
...
@@ -5708,8 +5708,8 @@
}
],
"_useOriginalSize": false,
"_string": "v0.9.0.2020031
313
",
"_N$string": "v0.9.0.2020031
313
",
"_string": "v0.9.0.2020031
610
",
"_N$string": "v0.9.0.2020031
610
",
"_fontSize": 24,
"_lineHeight": 24,
"_enableWrapText": true,
...
...
assets/Script/main.js
View file @
b9f4b07
...
...
@@ -71,7 +71,8 @@ cc.Class({
this
.
_bAbleHotUpdate
=
false
;
this
.
_bIsDataListMoving
=
false
;
this
.
_bIsScrollViewMoving
=
false
;
this
.
_bInitCategoryListSuccess
=
true
;
this
.
_bInitCategoryListSuccess
=
false
;
this
.
_bInitRecommendDataSuccess
=
false
;
this
.
_scrollview
=
this
.
node
.
getComponent
(
cc
.
ScrollView
);
this
.
_oSceneContext
.
focusPath
=
"scrollContent/TopNavi/topNavi1"
;
this
.
_oSceneContext
.
_iPageIndex
=
1
;
...
...
@@ -621,6 +622,9 @@ cc.Class({
// cc.log("子节点:"+nodeLayout.childrenCount);
}
this
.
_bInitRecommendDataSuccess
=
true
;
this
.
checkDataReadyAndInitFocus
();
// this.node.getChildByName("scrollContent").height = 2300; //这里暂且写死,scrollView有bug
// this._scrollview.scrollToTop();
}
catch
(
error
)
{
...
...
@@ -633,13 +637,13 @@ cc.Class({
},
recoverFocusPath
:
function
()
{
if
(
this
.
_oSceneContext
.
_iCurrentLeftIndex
==
1
)
{
// if (this._oSceneContext._iCurrentLeftIndex == 1) {//在调用处已经判断了,不需要重复判断
if
(
this
.
_oSceneContext
.
_iPageIndex
==
1
)
{
this
.
scheduleOnce
(()
=>
{
let
fiFocusTarget
=
cc
.
find
(
this
.
_oSceneContext
.
focusPath
,
this
.
node
).
getComponent
(
FocusInfo
);
this
.
_cFocus
.
flyFocus
(
this
.
_fiCurrentFocus
,
fiFocusTarget
,
Common
.
MOVE_DIRECTION_DOWN
,
null
,
null
);
return
;
},
0
)
},
0
);
}
let
height
=
this
.
_aBgHeight
[
this
.
_oSceneContext
.
_iPageIndex
-
1
]
||
0
;
//-1,打补丁:解决回退回来页面对不上的bug
this
.
onScrollViewScrollStart
();
...
...
@@ -652,9 +656,9 @@ cc.Class({
// cc.log("执行恢复跳转。。。" + this._oSceneContext.focusPath);
let
fiFocusTarget
=
cc
.
find
(
this
.
_oSceneContext
.
focusPath
,
this
.
node
).
getComponent
(
FocusInfo
);
this
.
_cFocus
.
flyFocus
(
this
.
_fiCurrentFocus
,
fiFocusTarget
,
Common
.
MOVE_DIRECTION_DOWN
,
null
,
null
);
this
.
scheduleOnce
(
showFocusCallback
,
0.2
);
},
0.3
);
}
this
.
scheduleOnce
(
showFocusCallback
,
0.5
);
},
0.5
);
//
}
},
...
...
@@ -813,7 +817,7 @@ cc.Class({
this
.
_bInitCategoryListSuccess
=
true
;
this
.
_oSceneContext
.
categoryRecordIndexOfFirstCell
=
lvCategoryList
.
getRecordIndexOfFirstCellInPage
();
this
.
checkDataReadyAndInitFocus
(
this
.
_bInitCategoryListSuccess
);
this
.
checkDataReadyAndInitFocus
();
});
// },
// null,
...
...
@@ -824,7 +828,8 @@ cc.Class({
},
checkDataReadyAndInitFocus
:
function
()
{
if
(
!
this
.
_bIsFocusInit
)
{
// cc.log("checkDataReadyAndInitFocus:"+(!this._bIsFocusInit && (this._bInitRecommendDataSuccess || this._bInitCategoryListSuccess)));
if
(
!
this
.
_bIsFocusInit
&&
(
this
.
_bInitRecommendDataSuccess
||
this
.
_bInitCategoryListSuccess
))
{
this
.
scheduleOnce
(()
=>
{
//指定0让回调函数在下一帧立即执行
this
.
initFocus
();
},
0
);
...
...
@@ -868,19 +873,21 @@ cc.Class({
Common
.
SCREEN_WIDTH
,
Common
.
SCREEN_HEIGHT
,
10
,
6
,
1.1
,
true
);
this
.
_cFocus
.
hide
();
if
(
this
.
_oSceneContext
.
focusPath
!=
"scrollContent/TopNavi/topNavi1"
)
if
(
!
Common
.
_bIsHotUpdate
)
{
Common
.
_bIsHotUpdate
=
true
;
this
.
checkUpdate
();
//热更新
}
if
(
this
.
_oSceneContext
.
focusPath
!=
"scrollContent/TopNavi/topNavi1"
&&
this
.
_oSceneContext
.
_iCurrentLeftIndex
==
1
)
{
this
.
recoverFocusPath
();
//有必要的话去恢复焦点记忆
return
;
}
if
(
this
.
_oSceneContext
.
_iCurrentLeftIndex
>
1
)
{
//不是第一个焦点框就跳过去,恢复记忆
this
.
scheduleOnce
(
function
()
{
this
.
_cFocus
.
flyFocus
(
this
.
_fiCurrentFocus
,
nodeInitFocus
.
getComponent
(
FocusInfo
),
Common
.
MOVE_DIRECTION_RIGHT
,
null
,
null
);
},
0
);
}
if
(
!
Common
.
_bIsHotUpdate
)
{
Common
.
_bIsHotUpdate
=
true
;
this
.
checkUpdate
();
//热更新
}
},
keyDownDirection
:
function
(
Direct
)
{
...
...
@@ -917,9 +924,9 @@ cc.Class({
// cc.log("目标节点名称:" + fiFocusTarget.node.name);
var
leftNavLayout
=
this
.
targetAry
[
0
].
target
;
if
(
!
this
.
_bInitCategoryListSuccess
)
{
return
[
null
,
oScrollParameter
];
}
//
if (!this._bInitCategoryListSuccess) {
//
return [null, oScrollParameter];
//
}
if
(
fiFocusTarget
&&
0
==
fiFocusTarget
.
node
.
name
.
indexOf
(
"topNavi"
)
||
0
==
fiFocusTarget
.
node
.
name
.
indexOf
(
"topCell"
))
{
if
(
0
!=
this
.
_fiCurrentFocus
.
node
.
name
.
indexOf
(
"topNavi"
)
&&
0
!=
this
.
_fiCurrentFocus
.
node
.
name
.
indexOf
(
"topCell"
))
{
//如果不是TypeList之间跳转,则哪里来回哪里去
...
...
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/res/layout/activity_main_obi_bg.xml
0 → 100644
View file @
b9f4b07
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/ll_single"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:visibility=
"gone"
>
<ImageView
android:id=
"@+id/iv"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:src=
"@mipmap/icon_bg"
/>
</RelativeLayout>
\ No newline at end of file
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/src/com/topdraw/melody/TopdrawSDKWrapper.java
View file @
b9f4b07
...
...
@@ -151,8 +151,8 @@ public class TopdrawSDKWrapper {
public
static
void
startGame
(
String
apkName
,
final
String
strJSCallBack
)
{
Log
.
d
(
TAG
,
"TopdrawSDKWrapper starGame start..."
+
apkName
);
View
view
=
_activity
.
getProgressBarView
();
final
View
singleColorView
=
_activity
.
getSingleColorView
();
View
view
=
_activity
.
getProgressBarView
();
final
RelativeLayout
relativeLayout
=
view
.
findViewById
(
R
.
id
.
rl_img
);
if
(
pluginLoaded
)
{
return
;
...
...
@@ -248,6 +248,7 @@ public class TopdrawSDKWrapper {
return
;
}
pluginLoaded
=
true
;
final
View
obiView
=
_activity
.
getObiView
();
final
String
packageName
=
apkName
;
final
String
className
=
claName
;
OBiPluginLoader
.
getInstance
().
start
(
downloadUrl
,
packageName
,
new
OBiPluginLoader
.
OnResultListener
()
{
...
...
@@ -268,19 +269,12 @@ public class TopdrawSDKWrapper {
}
}
// _activity.runOnUiThread(new Runnable() { //直接加载游戏,传回去进度是100
// @Override
// public void run() {
// _activity.runOnGLThread(new Runnable() {
// @Override
// public void run() {
// Cocos2dxJavascriptJavaBridge.evalString(
// "cc.find('Canvas',cc.director.getScene()).getComponent(cc.Topdraw.TVCanvas)." + strJSCallBack + "('" + 100 + "');" //modify jerry
// );
// }
// });
// }
// });
_activity
.
runOnUiThread
(
new
Runnable
()
{
//直接加载游戏,传回去进度是100
@Override
public
void
run
()
{
obiView
.
setVisibility
(
View
.
VISIBLE
);
}
});
}
else
if
(-
10
==
i
)
{
Toast
.
makeText
(
_activity
,
msg
,
Toast
.
LENGTH_LONG
).
show
();
...
...
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/src/org/cocos2dx/javascript/AppActivity.java
View file @
b9f4b07
...
...
@@ -60,8 +60,10 @@ public class AppActivity extends Cocos2dxActivity {
private
BroadcastReceiver
receiver
=
null
;
private
View
view
;
private
View
singleView
;
private
View
obiView
;
private
RelativeLayout
relativeLayout
;
private
RelativeLayout
mRLSingleColor
;
private
RelativeLayout
mOBiLayout
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -71,6 +73,11 @@ public class AppActivity extends Cocos2dxActivity {
mRLSingleColor
=
singleView
.
findViewById
(
R
.
id
.
ll_single
);
mFrameLayout
.
addView
(
singleView
);
//---- end
//----解决奥比游戏安装时,露出详情页不能刷新的问题
obiView
=
LayoutInflater
.
from
(
this
).
inflate
(
R
.
layout
.
activity_main_obi_bg
,
null
);
mOBiLayout
=
obiView
.
findViewById
(
R
.
id
.
ll_single
);
mFrameLayout
.
addView
(
obiView
);
//---- end
//添加加载小游戏进度条(暂时将Cocos2dxActivity中的this.mGLSurfaceView.setZOrderOnTop(true);注释,否则显示不出来)
view
=
LayoutInflater
.
from
(
this
).
inflate
(
R
.
layout
.
activity_main
,
null
);
relativeLayout
=
view
.
findViewById
(
R
.
id
.
rl_img
);
...
...
@@ -143,6 +150,7 @@ public class AppActivity extends Cocos2dxActivity {
super
.
onResume
();
SDKWrapper
.
getInstance
().
onResume
();
mRLSingleColor
.
setVisibility
(
View
.
GONE
);
mOBiLayout
.
setVisibility
(
View
.
GONE
);
}
@Override
...
...
@@ -248,6 +256,10 @@ public class AppActivity extends Cocos2dxActivity {
return
mRLSingleColor
;
}
public
View
getObiView
()
{
return
mOBiLayout
;
}
//打出场景日志 Info
public
static
void
logInSceneI
(
String
strLog
)
{
Log
.
i
(
"logInSceneI"
,
strLog
);
...
...
Please
register
or
sign in
to post a comment