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
b994d0fb
...
b994d0fbd9d852eba636e8a8fde551766a52cba4
authored
2020-03-12 14:02:22 +0800
by
金学艇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.解决首页瀑布流和分类页的光标记忆问题
1 parent
74e4a3d7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
99 additions
and
51 deletions
assets/Scene/sceneGameCategory.fire
assets/Scene/sceneMain.fire
assets/Script/VideoPlayer.js
assets/Script/common/TVCanvas.js
assets/Script/gameCategory.js
assets/Script/main.js
assets/resources/data_template/main_recommend.json
assets/Scene/sceneGameCategory.fire
View file @
b994d0f
...
...
@@ -189,7 +189,7 @@
"array": [
0,
0,
2
71.0659484863281
,
2
65.0037841796875
,
0,
0,
0,
...
...
assets/Scene/sceneMain.fire
View file @
b994d0f
...
...
@@ -5708,8 +5708,8 @@
}
],
"_useOriginalSize": false,
"_string": "v
1.0.2.2020031115
",
"_N$string": "v
1.0.2.2020031115
",
"_string": "v
0.9.0.2020031117
",
"_N$string": "v
0.9.0.2020031117
",
"_fontSize": 24,
"_lineHeight": 24,
"_enableWrapText": true,
...
...
assets/Script/VideoPlayer.js
View file @
b994d0f
...
...
@@ -147,6 +147,39 @@ cc.Class({
},
onKeyUp
:
function
(
event
)
{
try
{
this
.
_super
(
event
);
var
fiFocusTarget
=
null
;
var
fiCurrentFocus
=
this
.
_fiCurrentFocus
;
var
oScrollParameter
=
null
;
let
nodeFrom
=
null
;
let
nodeTo
=
null
;
if
(
event
.
keyCode
==
cc
.
macro
.
KEY
.
right
||
event
.
keyCode
==
Common
.
ANDROID_KEY
.
right
)
{
if
(
fiCurrentFocus
.
node
.
name
==
"ProgressBtn"
||
this
.
_fiCurrentFocus
.
node
.
name
==
"Play"
)
{
this
.
_ComOperation
.
resumePlayState
();
this
.
_iFakeProgressStep
=
0
;
this
.
_bFakeProgressStart
=
false
;
this
.
unschedule
(
this
.
fakeStepForward
);
}
}
if
(
event
.
keyCode
==
cc
.
macro
.
KEY
.
left
||
event
.
keyCode
==
Common
.
ANDROID_KEY
.
left
)
{
if
(
fiCurrentFocus
.
node
.
name
==
"ProgressBtn"
||
this
.
_fiCurrentFocus
.
node
.
name
==
"Play"
)
{
this
.
_ComOperation
.
resumePlayState
();
this
.
_iFakeProgressStep
=
0
;
this
.
_bFakeProgressStart
=
false
;
this
.
unschedule
(
this
.
fakeStepBackward
);
}
}
}
catch
(
error
)
{
if
(
cc
.
sys
.
isNative
)
{
jsb
.
reflection
.
callStaticMethod
(
"org/cocos2dx/javascript/AppActivity"
,
"logInSceneI"
,
"(Ljava/lang/String;)V"
,
"onKeyUp Error in VarietyVideo==>"
+
error
);
}
}
},
onKeyDown
:
function
(
event
)
{
try
{
this
.
_super
(
event
);
...
...
@@ -184,19 +217,19 @@ cc.Class({
this
.
_strOperationBtnPath
=
this
.
_bMediaFree
?
"VideoArea/PlayPanel/Operation/Play"
:
"VideoArea/PlayPanel/Operation/Group/Collect"
;
this
.
showOperationBtns
();
}
else
if
(
this
.
_fiCurrentFocus
.
node
.
parent
.
name
==
"Operation"
||
this
.
_fiCurrentFocus
.
node
.
parent
.
parent
.
name
==
"Operation"
)
{
else
if
(
this
.
_fiCurrentFocus
.
node
.
parent
.
name
==
"Operation"
||
this
.
_fiCurrentFocus
.
node
.
parent
.
parent
.
name
==
"Operation"
)
{
//这里说什么要做抖动
fiFocusTarget
=
this
.
_cFocus
.
findTarget
(
this
.
_fiCurrentFocus
,
this
.
_aFocusTargets
,
this
.
_iFocusStatus
,
Common
.
MOVE_DIRECTION_DOWN
);
fiFocusTarget
=
this
.
checkFocusTarget
(
fiFocusTarget
);
this
.
_cFocus
.
flyFocus
(
this
.
_fiCurrentFocus
,
fiFocusTarget
,
Common
.
MOVE_DIRECTION_DOWN
,
1.0
,
oScrollParameter
);
}
}
else
{
fiFocusTarget
=
this
.
_cFocus
.
findTarget
(
this
.
_fiCurrentFocus
,
this
.
_aFocusTargets
,
this
.
_iFocusStatus
,
Common
.
MOVE_DIRECTION_DOWN
);
fiFocusTarget
=
this
.
checkFocusTarget
(
fiFocusTarget
);
// if (!this._bMediaFree && this._fiCurrentFocus.node.name == "ProgressBtn") {
// fiFocusTarget = cc.find("VideoArea/PlayPanel/Operation/Group/Collect", this.node).getComponent(FocusInfo);
// }
cc
.
log
(
"向下滑动:"
+
fiFocusTarget
.
node
.
name
);
cc
.
log
(
"向下滑动:"
+
fiFocusTarget
.
node
.
name
);
this
.
_cFocus
.
flyFocus
(
this
.
_fiCurrentFocus
,
fiFocusTarget
,
Common
.
MOVE_DIRECTION_DOWN
,
1.0
,
oScrollParameter
);
}
if
(
this
.
_fiCurrentFocus
.
node
.
name
==
"Play"
&&
this
.
_bShowProgress
)
{
...
...
@@ -488,7 +521,7 @@ cc.Class({
this
.
_ComOperation
.
initPlayer
(
0
,
0
,
Common
.
SCREEN_WIDTH
,
Common
.
SCREEN_HEIGHT
,
true
,
true
);
//测试
let
options
=
{};
options
.
playurl
=
"http
s://135zyv5.xw0371.com/2018/10/29/X05c7CG3VB91gi1M/playlist.m3u8
"
;
options
.
playurl
=
"http
://mirror.aarnet.edu.au/pub/TED-talks/911Mothers_2010W-480p.mp4
"
;
this
.
_ComOperation
.
setURL
(
options
);
//测试播放地址
}
catch
(
error
)
{
if
(
cc
.
sys
.
isNative
)
{
...
...
assets/Script/common/TVCanvas.js
View file @
b994d0f
...
...
@@ -457,9 +457,9 @@ cc.Topdraw.TVCanvas =
this
.
_oNextSceneParameter
.
sceneName
=
strForwardSceneName
;
aSceneParameter
.
push
(
this
.
_oNextSceneParameter
);
aSceneContext
.
push
(
this
.
_oSceneContext
);
this
.
_cLog
.
screenI
(
"跳转场景1111111"
);
//
this._cLog.screenI("跳转场景1111111");
this
.
_ComOperation
&&
this
.
_ComOperation
.
end
();
this
.
_cLog
.
screenI
(
"跳转场景2222222"
);
//
this._cLog.screenI("跳转场景2222222");
Common
.
g_strCurrentSceneName
=
strForwardSceneName
;
cc
.
director
.
loadScene
(
strForwardSceneName
);
}
...
...
assets/Script/gameCategory.js
View file @
b994d0f
...
...
@@ -26,7 +26,20 @@ cc.Class({
this
.
_super
();
this
.
_oInit
=
{};
this
.
_oSceneContext
.
_iCurrentLeftIndex
=
0
;
this
.
_oSceneContext
.
focusPath
=
"TypeListArea/TypeListWrapper/TypeList/topNavi"
+
this
.
_oSceneContext
.
_iCurrentLeftIndex
;
this
.
_bIsDataListMoving
=
false
;
this
.
_bInitCategoryListSuccess
=
false
;
if
(
this
.
_cApplication
.
getBackStatus
())
{
//恢复上下文 包括
//光标位置 focusPath
let
oSceneContext
=
this
.
_cApplication
.
popSceneContext
();
if
(
oSceneContext
)
{
this
.
_oSceneContext
=
oSceneContext
;
cc
.
log
(
this
.
_oSceneContext
);
}
this
.
_cApplication
.
setBackStatus
(
false
);
}
this
.
_nodeTypeListWrapper
=
cc
.
find
(
"TypeListArea/TypeListWrapper"
,
this
.
node
);
this
.
_nodeTypeList
=
cc
.
find
(
"TypeList"
,
this
.
_nodeTypeListWrapper
);
...
...
@@ -110,7 +123,7 @@ cc.Class({
);
this
.
_aFocusTargets
[
0
][
"topNavi"
+
i
]
=
node
;
}
this
.
_oSceneContext
.
focusPath
=
"TypeListArea/TypeListWrapper/TypeList/topNavi"
+
this
.
_oSceneContext
.
_iCurrentLeftIndex
;
//
this._oSceneContext.focusPath = "TypeListArea/TypeListWrapper/TypeList/topNavi" + this._oSceneContext._iCurrentLeftIndex;
this
.
checkDataReadyAndInitFocus
();
// this.requestMediaList(1);
this
.
getSimulateRequest
();
...
...
@@ -258,34 +271,29 @@ cc.Class({
iStart1
,
(
lvCategoryList
.
getShowCellRows
()
+
lvCategoryList
.
getAlphaCellRows
())
*
lvCategoryList
.
getCellCountEachRow
(),
null
,
null
);
// lvCategoryList.loadData(
// function (strResponse) {
// cc.log("/////" + this._oInit[this._oSceneContext._iCurrentLeftIndex]);
// let strResponse = this.aCategoryListJson[this._oSceneContext._iCurrentLeftIndex];
let
strResponse
=
this
.
_oInit
[
this
.
_oSceneContext
.
_iCurrentLeftIndex
];
lvCategoryList
.
renderInitData
(
strResponse
,
function
()
{
// cc.log("InitCategoryList-------------------->");
var
oJSONResult
=
JSON
.
parse
(
strResponse
);
// if (oJSONResult.resultSet.length <= 0) { //没有数据就显示占位图
// cc.find('BlankIcon', this.node).opacity = 255;
// } else {
// cc.find('BlankIcon', this.node).opacity = 0;
// }
this
.
_bInitCategoryListSuccess
=
true
;
this
.
_oSceneContext
.
categoryRecordIndexOfFirstCell
=
lvCategoryList
.
getRecordIndexOfFirstCellInPage
();
this
.
checkDataReadyAndInitFocus
(
this
.
_bInitCategoryListSuccess
);
});
// },
// null,
// this
// );
lvCategoryList
.
loadData
(
function
(
strResponse
)
{
lvCategoryList
.
renderInitData
(
strResponse
,
function
()
{
var
oJSONResult
=
JSON
.
parse
(
strResponse
);
// if (oJSONResult.resultSet.length <= 0) { //没有数据就显示占位图
// cc.find('BlankIcon', this.node).opacity = 255;
// } else {
// cc.find('BlankIcon', this.node).opacity = 0;
// }
this
.
_bInitCategoryListSuccess
=
true
;
this
.
_oSceneContext
.
categoryRecordIndexOfFirstCell
=
lvCategoryList
.
getRecordIndexOfFirstCellInPage
();
this
.
checkDataReadyAndInitFocus
();
});
},
null
,
this
,
strResponse
);
},
checkDataReadyAndInitFocus
:
function
()
{
if
(
!
this
.
_bIsFocusInit
)
{
if
(
!
this
.
_bIsFocusInit
&&
this
.
_bInitCategoryListSuccess
)
{
this
.
scheduleOnce
(()
=>
{
//指定0让回调函数在下一帧立即执行
this
.
initFocus
();
},
0
);
...
...
@@ -303,7 +311,10 @@ cc.Class({
this
.
_cFocus
.
init
(
'focusContainer'
,
this
,
nodeInitFocus
.
getComponent
(
FocusInfo
),
Common
.
SCREEN_WIDTH
,
Common
.
SCREEN_HEIGHT
,
10
,
6
,
1.1
,
true
);
this
.
_cFocus
.
hide
();
if
(
0
==
nodeInitFocus
.
name
.
indexOf
(
"topNavi"
))
{
this
.
_cFocus
.
hide
();
}
//处理焦点位于下方问题
if
(
this
.
_oSceneContext
.
typeListY
)
{
...
...
@@ -378,6 +389,7 @@ cc.Class({
// cc.log("当前时多少条目:" + index);
let
lvCategoryList
=
this
.
node
.
getChildByName
(
'CategoryList'
).
getComponent
(
ListView
);
if
(
lvCategoryList
.
scrollARowUp
(
index
,
this
.
_oInit
[
this
.
_oSceneContext
.
_iCurrentLeftIndex
]))
{
this
.
_oSceneContext
.
categoryRecordIndexOfFirstCell
=
lvCategoryList
.
getRecordIndexOfFirstCellInPage
();
return
;
}
}
...
...
@@ -396,6 +408,7 @@ cc.Class({
var
index
=
parseInt
(
this
.
_fiCurrentFocus
.
node
.
getName
().
replace
(
'CategoryListCell'
,
''
));
let
lvCategoryList
=
this
.
node
.
getChildByName
(
'CategoryList'
).
getComponent
(
ListView
);
if
(
lvCategoryList
.
scrollARowDown
(
null
,
index
,
this
.
_oInit
[
this
.
_oSceneContext
.
_iCurrentLeftIndex
]))
{
this
.
_oSceneContext
.
categoryRecordIndexOfFirstCell
=
lvCategoryList
.
getRecordIndexOfFirstCellInPage
();
return
;
}
}
...
...
@@ -532,12 +545,14 @@ cc.Class({
// );
}
this
.
_oSceneContext
.
_iCurrentLeftIndex
=
iIndex
;
this
.
scheduleOnce
(
function
()
{
// this.requestMediaList(1); //重新渲染CategoryList
this
.
getSimulateRequest
();
},
0
);
if
(
0
==
fiFrom
.
node
.
getName
().
indexOf
(
'topNavi'
))
{
this
.
_oSceneContext
.
_iCurrentLeftIndex
=
iIndex
;
this
.
_oSceneContext
.
categoryRecordIndexOfFirstCell
=
0
;
//将列表记录置空
this
.
scheduleOnce
(
function
()
{
// this.requestMediaList(1); //重新渲染CategoryList
this
.
getSimulateRequest
();
},
0
);
}
}
if
(
0
==
fiTo
.
node
.
getName
().
indexOf
(
'CategoryListCell'
))
{
...
...
assets/Script/main.js
View file @
b994d0f
This diff is collapsed.
Click to expand it.
assets/resources/data_template/main_recommend.json
View file @
b994d0f
...
...
@@ -39,7 +39,7 @@
"name"
:
"frame1"
,
"resultSet"
:
[
{
"name"
:
"Carousel
0
"
,
"name"
:
"Carousel
1
"
,
"code"
:
"promotionItem_fd456495-2e32-44e1-9d92-450227d4afa3"
,
"left"
:
64
,
"top"
:
0
,
...
...
@@ -49,7 +49,7 @@
"height"
:
167
},
{
"name"
:
"dailyRecommend"
,
"name"
:
"dailyRecommend
2
"
,
"code"
:
"promotionItem_4ca66642-33d0-41c9-9913-df131a79a375"
,
"left"
:
359
,
"top"
:
0
,
...
...
@@ -59,7 +59,7 @@
"height"
:
167
},
{
"name"
:
"dailyRecommend"
,
"name"
:
"dailyRecommend
3
"
,
"code"
:
"promotionItem_c5f58c16-48a5-4796-ab52-rwvh6u5j55"
,
"left"
:
652
,
"top"
:
0
,
...
...
@@ -69,7 +69,7 @@
"height"
:
167
},
{
"name"
:
"dailyRecommend"
,
"name"
:
"dailyRecommend
4
"
,
"code"
:
"promotionItem_c5f58c16-48a5-4796-ab52-41679fc88a6d"
,
"left"
:
946
,
"top"
:
0
,
...
...
@@ -141,19 +141,19 @@
"code"
:
"promotionItem_e29b33e4-8954-4eerthy6rthg54er"
},
{
"name"
:
"Subject
3
"
,
"name"
:
"Subject
4
"
,
"imageURL"
:
"upload/image/main/block4_4.png"
,
"tvlink"
:
"{
\"
click
\"
:[{
\"
action
\"
:
\"
ChangeScene
\"
,
\"
parameters
\"
:{
\"
sceneName
\"
:
\"
sceneGameCategory
\"
}}]}"
,
"code"
:
"promotionItem_e29b33e4-8954-vwregv54thw6"
},
{
"name"
:
"Subject
3
"
,
"name"
:
"Subject
5
"
,
"imageURL"
:
"upload/image/main/block4_5.png"
,
"tvlink"
:
"{
\"
click
\"
:[{
\"
action
\"
:
\"
ChangeScene
\"
,
\"
parameters
\"
:{
\"
sceneName
\"
:
\"
sceneGameCategory
\"
}}]}"
,
"code"
:
"promotionItem_e29b33e4-8954-bq4wrjhwbt4t"
},
{
"name"
:
"Subject
4
"
,
"name"
:
"Subject
6
"
,
"imageURL"
:
"upload/image/main/block4_6.png"
,
"tvlink"
:
"{
\"
click
\"
:[{
\"
action
\"
:
\"
ChangeScene
\"
,
\"
parameters
\"
:{
\"
sceneName
\"
:
\"
sceneGameCategory
\"
}}]}"
,
"code"
:
"promotionItem_57aea4b3-7716-4we5j56trhgser2"
...
...
@@ -184,7 +184,7 @@
"disable"
:
true
},
{
"name"
:
"SingerList"
,
"name"
:
"SingerList
1
"
,
"code"
:
"promotionItem_0a911d4c-9223-4d49-se5hj54uh4w5g45w"
,
"left"
:
63
,
"top"
:
64
,
...
...
@@ -194,7 +194,7 @@
"height"
:
228
},
{
"name"
:
"SingerList"
,
"name"
:
"SingerList
2
"
,
"code"
:
"promotionItem_c388af5a-0351-43c4-e5sjhu45h54wh45h"
,
"left"
:
653
,
"top"
:
64
,
...
...
@@ -214,7 +214,7 @@
"name"
:
"frame3"
,
"resultSet"
:
[
{
"name"
:
"SingerList"
,
"name"
:
"SingerList
3
"
,
"code"
:
"promotionItem_c388af5a-0351-43c4we5jh45j45jh54hj"
,
"left"
:
63
,
"top"
:
24
,
...
...
@@ -224,7 +224,7 @@
"height"
:
228
},
{
"name"
:
"SingerList"
,
"name"
:
"SingerList
4
"
,
"code"
:
"promotionItem_c388af5a-0351-43c4j56j54hw4h54"
,
"left"
:
456
,
"top"
:
24
,
...
...
@@ -234,7 +234,7 @@
"height"
:
228
},
{
"name"
:
"SingerList"
,
"name"
:
"SingerList
5
"
,
"code"
:
"promotionItem_c388af5a-0351-43c4-w45jh45h54h5h"
,
"left"
:
848
,
"top"
:
24
,
...
...
Please
register
or
sign in
to post a comment