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
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
204 additions
and
119 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
...
...
@@ -72,7 +72,7 @@ cc.Class({
this
.
_bIsDataListMoving
=
false
;
this
.
_bIsScrollViewMoving
=
false
;
this
.
_scrollview
=
this
.
node
.
getComponent
(
cc
.
ScrollView
);
this
.
_oSceneContext
.
focusPath
=
"scrollContent/TopNavi/topNav
2
"
;
this
.
_oSceneContext
.
focusPath
=
"scrollContent/TopNavi/topNav
i1
"
;
this
.
_oSceneContext
.
_iPageIndex
=
1
;
this
.
_oSceneContext
.
_iCurrentLeftIndex
=
1
;
this
.
_oSceneContext
.
_iViewPagerIndex
=
0
;
...
...
@@ -86,7 +86,7 @@ cc.Class({
// cc.log("current top navi..." + this._oSceneContext._iCurrentLeftIndex);
// }
//有必要的话恢复上下文
cc
.
log
(
"恢复上下文:"
+
this
.
_cApplication
.
getBackStatus
());
//
cc.log("恢复上下文:" + this._cApplication.getBackStatus());
if
(
this
.
_cApplication
.
getBackStatus
())
{
//恢复上下文 包括
//光标位置 focusPath
...
...
@@ -97,7 +97,7 @@ cc.Class({
}
this
.
_cApplication
.
setBackStatus
(
false
);
}
cc
.
log
(
"恢复上下文后的光标:"
+
this
.
_oSceneContext
.
_iCurrentLeft
Index
);
// cc.log("恢复上下文后的光标:" + this._oSceneContext._iPage
Index);
this
.
_oSceneContext
.
_iCurrentLeftIndex
=
this
.
_oSceneContext
.
_iCurrentLeftIndex
==
0
?
1
:
this
.
_oSceneContext
.
_iCurrentLeftIndex
;
this
.
node
.
getChildByName
(
"scrollContent"
).
height
=
2300
;
//这里暂且写死,scrollView有bug
this
.
_scrollview
.
scrollToTop
();
...
...
@@ -105,16 +105,10 @@ cc.Class({
//搞轮播图
this
.
initViewPager
();
this
.
initViewPagerRightLabel
();
// this.getTopNaviRequest("topNavi");
// this.getTopNaviRequest("topCell");
//搞通知框
this
.
initNotifyBox
();
// this.getUpdateDesc();
this
.
getMainLayoutJsonRequest
();
this
.
getCategoryListJsonRequest
();
// this.getRecommendModelRequest();
// this.getRightRecommendRequest(); //渲染右侧导航
// this.requestMediaList(9); //游戏列表
this
.
getCategoryListRecommendRequest
();
},
...
...
@@ -225,30 +219,6 @@ cc.Class({
},
this
,
"uuid"
);
},
getCategoryListJsonRequest
:
function
()
{
var
self
=
this
;
var
aJsonList
=
[
"catetory_xxyz_list.json"
,
"catetory_dztg_list.json"
,
"catetory_3dyx_list.json"
,
"catetory_jycl_list.json"
,
"catetory_jsby_list.json"
];
this
.
_oInit
.
aCategoryListJson
=
[
""
,
""
];
//先塞两个空数据,方便遍历数组
if
(
self
.
_oInit
.
oMainLayoutJson
&&
self
.
_oInit
.
oMainLayoutJson
.
children
.
length
>
0
)
{
return
;
}
for
(
let
i
=
0
;
i
<
aJsonList
.
length
;
i
++
)
{
Network
.
ajax
(
"GET"
,
Common
.
TOPDRAW_API_SERVER
+
"main/"
+
aJsonList
[
i
],
null
,
null
,
function
(
strResponse
)
{
try
{
// cc.log("远程数据:"+strResponse);
// var oJSONResult = JSON.parse(strResponse);
this
.
_oInit
.
aCategoryListJson
.
push
(
strResponse
);
}
catch
(
error
)
{
cc
.
log
(
"Business Exception:Get getCategoryListJsonRequest..."
+
error
);
}
},
function
(
strResponse
)
{
cc
.
log
(
"Business Error:Get getCategoryListJsonRequest..."
+
strResponse
);
},
this
,
"uuid"
);
}
},
//请求顶部个人中心和订购按钮
getTopNaviRequest
:
function
(
strCellName
)
{
// Network.ajax("GET", Common.TOPDRAW_API_SERVER + "main/main_layout.json", null, null,
...
...
@@ -288,20 +258,33 @@ cc.Class({
);
this
.
_aFocusTargets
[
0
][
strCellName
+
i
]
=
nodeNav
;
}
nodeNav
.
getComponent
(
'pfbCommonCell'
).
init
(
aTopNaviJson
[
i
],
function
()
{
//让细胞自己渲染
count
--
;
if
(
!
count
)
{
self
.
_bInitLeftNavigationSuccess
=
true
;
self
.
checkDataReadyAndInitFocus
();
}
},
strCellName
,
i
,
this
.
_oSceneContext
.
_iCurrentLeftIndex
);
nodeNav
.
width
=
aTopNaviJson
[
i
].
width
;
nodeNav
.
height
=
aTopNaviJson
[
i
].
height
;
nodeNav
.
getChildByName
(
'Pic'
).
width
=
aTopNaviJson
[
i
].
width
;
nodeNav
.
getChildByName
(
'Pic'
).
height
=
aTopNaviJson
[
i
].
height
;
Network
.
loadImageInNativeRuntime
(
Common
.
TOPDRAW_IMAGE_SERVER
+
aTopNaviJson
[
i
].
imageURL
,
null
,
function
(
texture
,
iRequestId
)
{
if
(
strCellName
==
"topNavi"
)
{
nodeNav
.
getChildByName
(
"Pic"
).
getComponent
(
cc
.
Sprite
).
spriteFrame
=
new
cc
.
SpriteFrame
(
texture
,
cc
.
rect
(
0
,
0
,
aTopNaviJson
[
i
].
width
,
aTopNaviJson
[
i
].
height
));
if
(
i
==
1
&&
1
==
this
.
_oSceneContext
.
_iCurrentLeftIndex
&&
this
.
_oSceneContext
.
focusPath
!=
"scrollContent/TopNavi/topNavi1"
)
{
//恢复光标记忆不需要选中状态,将i先改为1,其他导航暂时不做光标记忆,有点复杂,后续考虑做。。。
nodeNav
.
getChildByName
(
"Pic"
).
getComponent
(
cc
.
Sprite
).
spriteFrame
=
new
cc
.
SpriteFrame
(
texture
,
cc
.
rect
(
0
,
aTopNaviJson
[
i
].
height
*
2
,
aTopNaviJson
[
i
].
width
,
aTopNaviJson
[
i
].
height
));
}
else
if
(
i
==
this
.
_oSceneContext
.
_iCurrentLeftIndex
)
{
nodeNav
.
getChildByName
(
"Pic"
).
getComponent
(
cc
.
Sprite
).
spriteFrame
=
new
cc
.
SpriteFrame
(
texture
,
cc
.
rect
(
0
,
aTopNaviJson
[
i
].
height
,
aTopNaviJson
[
i
].
width
,
aTopNaviJson
[
i
].
height
));
}
}
else
{
nodeNav
.
getChildByName
(
"Pic"
).
getComponent
(
cc
.
Sprite
).
spriteFrame
=
new
cc
.
SpriteFrame
(
texture
,
cc
.
rect
(
0
,
0
,
aTopNaviJson
[
i
].
width
,
aTopNaviJson
[
i
].
height
));
}
},
function
()
{
},
this
);
if
(
strCellName
==
"topNavi"
&&
i
>
0
)
{
nodeNav
.
getComponent
(
cc
.
Widget
).
top
=
aTopNaviJson
[
i
].
top
-
aTopNaviJson
[
i
].
height
/
2
;
}
else
{
nodeNav
.
getComponent
(
cc
.
Widget
).
top
=
aTopNaviJson
[
i
].
top
;
}
nodeNav
.
getComponent
(
cc
.
Widget
).
left
=
aTopNaviJson
[
i
].
left
;
topNaviLayout
.
addChild
(
nodeNav
,
10
,
strCellName
+
i
);
if
(
i
==
this
.
_oSceneContext
.
_iCurrentLeftIndex
&&
strCellName
==
"topNavi"
)
{
//默认焦点框位置
this
.
_oSceneContext
.
focusPath
=
"scrollContent/TopNavi/"
+
strCellName
+
i
;
}
}
this
.
checkDataReadyAndInitFocus
();
...
...
@@ -607,14 +590,10 @@ cc.Class({
// cc.log("子节点:"+nodeLayout.childrenCount);
}
if
(
this
.
_oSceneContext
.
_iPageIndex
!=
1
)
this
.
recoverFocusPath
();
//有必要的话去恢复焦点记忆
// this.node.getChildByName("scrollContent").height = 2300; //这里暂且写死,scrollView有bug
// cc.log("ScrollView高度: " + bgHeight); 2239
// this._scrollview.scrollToTop();
// cc.log("ScrollView相对的偏移量 "+this._scrollview.getMaxScrollOffset());
// cc.log("子节点个数: "+rightNodeLayout.childrenCount);
// this.getNaviPromotion("page_d14e8acf-db3d-4f74-b535-c98458596eb8");x
}
catch
(
error
)
{
cc
.
log
(
"Business Exception:Get getRightRecommendRequest..."
+
error
);
}
...
...
@@ -624,6 +603,53 @@ cc.Class({
},
this
,
"uuid"
);
},
recoverFocusPath
:
function
()
{
if
(
this
.
_oSceneContext
.
_iCurrentLeftIndex
==
1
)
{
let
height
=
this
.
_aBgHeight
[
this
.
_oSceneContext
.
_iPageIndex
-
1
]
||
0
;
//-1,打补丁:解决回退回来页面对不上的bug
this
.
onScrollViewScrollStart
();
this
.
_scrollview
.
scrollToOffset
(
cc
.
v2
(
0
,
height
),
0.5
);
var
showFocusCallback
=
function
(
dt
)
{
this
.
_cFocus
.
show
();
this
.
onScrollViewScrollEnd
();
}
this
.
scheduleOnce
(
function
()
{
// 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
);
}
},
getSimulateRequest
:
function
()
{
var
self
=
this
;
if
(
this
.
_oSceneContext
.
_iCurrentLeftIndex
<=
1
)
{
this
.
requestMediaList
(
1
);
return
;
}
var
aJsonList
=
[
""
,
""
,
"catetory_xxyz_list.json"
,
"catetory_dztg_list.json"
,
"catetory_3dyx_list.json"
,
"catetory_jycl_list.json"
,
"catetory_jsby_list.json"
];
if
(
this
.
_oInit
[
this
.
_oSceneContext
.
_iCurrentLeftIndex
])
{
//已经加载过数据直接取
self
.
requestMediaList
(
1
);
}
else
{
Network
.
ajax
(
"GET"
,
Common
.
TOPDRAW_API_SERVER
+
"main/"
+
aJsonList
[
this
.
_oSceneContext
.
_iCurrentLeftIndex
],
null
,
null
,
function
(
strResponse
)
{
try
{
this
.
_oInit
[
this
.
_oSceneContext
.
_iCurrentLeftIndex
]
=
strResponse
;
this
.
scheduleOnce
(
function
()
{
self
.
requestMediaList
(
1
);
//重新渲染CategoryList
},
0
);
}
catch
(
error
)
{
cc
.
log
(
"Business Exception:Get getSimulateRequest..."
+
error
);
}
},
function
(
strResponse
)
{
cc
.
log
(
"Business Error:Get getSimulateRequest..."
+
strResponse
);
},
this
,
"uuid"
);
}
},
requestMediaList
:
function
(
cId
)
{
var
self
=
this
;
if
(
cId
)
{
...
...
@@ -736,7 +762,7 @@ cc.Class({
// lvCategoryList.loadData(
// function (strResponse) {
// cc.log("列表:" + JSON.stringify(this._aJsonList[this._oSceneContext._iCurrentLeftIndex]));
let
strResponse
=
this
.
_oInit
.
aCategoryListJson
[
this
.
_oSceneContext
.
_iCurrentLeftIndex
];
//这里采用列表
let
strResponse
=
this
.
_oInit
[
this
.
_oSceneContext
.
_iCurrentLeftIndex
];
//这里采用列表
lvCategoryList
.
renderInitData
(
strResponse
,
function
()
{
cc
.
log
(
"InitCategoryList-------------------->"
);
var
oJSONResult
=
JSON
.
parse
(
strResponse
);
...
...
@@ -786,8 +812,14 @@ cc.Class({
fiCloseBtn
.
init
(
''
,
false
,
null
,
null
,
1.1
);
this
.
_aFocusTargets
[
1
][
'hot_close_btn'
]
=
cc
.
find
(
'update/update_panel/close_btn'
,
this
.
node
);
cc
.
log
(
"返回路径:"
+
this
.
_oSceneContext
.
focusPath
);
var
nodeInitFocus
=
cc
.
find
(
this
.
_oSceneContext
.
focusPath
,
this
.
node
);
// cc.log("返回路径:" + this._oSceneContext.focusPath);
var
nodeInitFocus
;
if
(
this
.
_oSceneContext
.
_iCurrentLeftIndex
==
1
)
{
//只对导航1瀑布流做光标记忆,其他暂不做,以后考虑会做
nodeInitFocus
=
cc
.
find
(
this
.
_oSceneContext
.
focusPath
,
this
.
node
);
}
else
{
nodeInitFocus
=
cc
.
find
(
"scrollContent/TopNavi/topNavi"
+
this
.
_oSceneContext
.
_iCurrentLeftIndex
,
this
.
node
);
}
// cc.log("初始化 "+nodeInitFocus.name);
var
nodeFocus
=
new
cc
.
Node
(
'nodeFocus'
);
this
.
node
.
addChild
(
nodeFocus
,
10
);
...
...
@@ -796,8 +828,11 @@ cc.Class({
nodeInitFocus
.
getComponent
(
FocusInfo
),
Common
.
SCREEN_WIDTH
,
Common
.
SCREEN_HEIGHT
,
10
,
6
,
1.1
,
true
);
this
.
_cFocus
.
hide
();
if
(
this
.
_oSceneContext
.
_iCurrentLeftIndex
!=
1
)
{
//不是第一个焦点框就跳过去,恢复记忆
this
.
_cFocus
.
flyFocus
(
this
.
_fiCurrentFocus
,
nodeInitFocus
.
getComponent
(
FocusInfo
),
Common
.
MOVE_DIRECTION_RIGHT
,
null
,
null
);
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
;
...
...
@@ -836,7 +871,7 @@ cc.Class({
},
checkFocusTarget
:
function
(
fiFocusTarget
,
oScrollParameter
,
Direct
)
{
cc
.
log
(
"目标节点名称:"
+
fiFocusTarget
.
node
.
name
);
//
cc.log("目标节点名称:" + fiFocusTarget.node.name);
var
leftNavLayout
=
this
.
targetAry
[
0
].
target
;
if
(
fiFocusTarget
&&
0
==
fiFocusTarget
.
node
.
name
.
indexOf
(
"topNavi"
)
||
0
==
fiFocusTarget
.
node
.
name
.
indexOf
(
"topCell"
))
{
...
...
@@ -869,7 +904,7 @@ cc.Class({
}
if
(
fiFocusTarget
&&
0
==
fiFocusTarget
.
node
.
name
.
indexOf
(
"SpecialList"
))
{
cc
.
log
(
fiFocusTarget
.
node
.
x
+
" : "
+
fiFocusTarget
.
node
.
width
/
2
+
" : "
+
this
.
_specialListNode
.
x
+
" : "
+
this
.
_specialListRectNode
.
width
);
//
cc.log(fiFocusTarget.node.x + " : " + fiFocusTarget.node.width / 2 + " : " + this._specialListNode.x + " : " + this._specialListRectNode.width);
if
(
fiFocusTarget
.
node
.
x
+
this
.
_specialListNode
.
x
>=
this
.
_specialListRectNode
.
width
)
{
if
(
0
!=
this
.
_fiCurrentFocus
.
node
.
name
.
indexOf
(
"SpecialList"
))
{
return
[
null
,
oScrollParameter
];
...
...
@@ -906,9 +941,9 @@ cc.Class({
}
if
(
0
==
this
.
_fiCurrentFocus
.
node
.
getName
().
indexOf
(
'CategoryListCell'
))
{
var
index
=
parseInt
(
this
.
_fiCurrentFocus
.
node
.
getName
().
replace
(
'CategoryListCell'
,
''
));
cc
.
log
(
"当前时多少条目:"
+
index
);
//
cc.log("当前时多少条目:" + index);
let
lvCategoryList
=
this
.
node
.
getChildByName
(
"scrollContent"
).
getChildByName
(
'CategoryList'
).
getComponent
(
ListView
);
if
(
lvCategoryList
.
scrollARowUp
(
index
,
this
.
_oInit
.
aCategoryListJson
[
this
.
_oSceneContext
.
_iCurrentLeftIndex
]))
{
if
(
lvCategoryList
.
scrollARowUp
(
index
,
this
.
_oInit
[
this
.
_oSceneContext
.
_iCurrentLeftIndex
]))
{
return
;
}
}
...
...
@@ -972,7 +1007,7 @@ cc.Class({
if
(
0
==
this
.
_fiCurrentFocus
.
node
.
getName
().
indexOf
(
'CategoryListCell'
))
{
var
index
=
parseInt
(
this
.
_fiCurrentFocus
.
node
.
getName
().
replace
(
'CategoryListCell'
,
''
));
let
lvCategoryList
=
this
.
node
.
getChildByName
(
"scrollContent"
).
getChildByName
(
'CategoryList'
).
getComponent
(
ListView
);
if
(
lvCategoryList
.
scrollARowDown
(
null
,
index
,
this
.
_oInit
.
aCategoryListJson
[
this
.
_oSceneContext
.
_iCurrentLeftIndex
]))
{
if
(
lvCategoryList
.
scrollARowDown
(
null
,
index
,
this
.
_oInit
[
this
.
_oSceneContext
.
_iCurrentLeftIndex
]))
{
return
;
}
}
...
...
@@ -990,7 +1025,7 @@ cc.Class({
iTargetTop
=
fiFocusTarget
.
node
.
getParent
().
getComponent
(
cc
.
Widget
).
top
;
}
let
iCurrentFloorBottom
=
this
.
_aBgHeight
[
this
.
_oSceneContext
.
_iPageIndex
-
1
]
||
0
;
//当前楼层底部高度
cc
.
log
(
iCurrentFloorBottom
+
"目标节点的高度:"
+
iTargetTop
+
"::"
+
this
.
_oSceneContext
.
_iPageIndex
);
//
cc.log(iCurrentFloorBottom + "目标节点的高度:" + iTargetTop + "::" + this._oSceneContext._iPageIndex);
if
(
this
.
_bIsScrollViewMoving
)
{
return
;
}
...
...
@@ -1063,7 +1098,7 @@ cc.Class({
backToTop
:
function
()
{
this
.
_scrollview
.
scrollToTop
();
this
.
_oSceneContext
.
_iPageIndex
=
1
;
//当前页恢复
let
fiFocusTarget
=
cc
.
find
(
this
.
_oSceneContext
.
focusPath
,
this
.
node
).
getComponent
(
FocusInfo
);
let
fiFocusTarget
=
cc
.
find
(
"scrollContent/TopNavi/topNavi1"
,
this
.
node
).
getComponent
(
FocusInfo
);
//这里写死地址,不然恢复光标记忆时会错乱
setTimeout
(
function
()
{
//延迟0.8秒跳转
this
.
_cFocus
.
flyFocus
(
this
.
_fiCurrentFocus
,
fiFocusTarget
,
Common
.
MOVE_DIRECTION_UP
,
1.0
,
null
);
}.
bind
(
this
),
300
);
...
...
@@ -1172,7 +1207,7 @@ cc.Class({
if
(
0
==
fiTo
.
node
.
getName
().
indexOf
(
'topCell'
))
{
let
iIndex
=
fiTo
.
node
.
name
.
replace
(
"topCell"
,
''
);
cc
.
log
(
iIndex
+
"图片:"
+
this
.
_oInit
.
aTopCellImg
[
iIndex
]);
//
cc.log(iIndex + "图片:" + this._oInit.aTopCellImg[iIndex]);
if
(
this
.
_oInit
.
aTopCellImg
[
iIndex
])
{
// cc.loader.loadRes(this._oInit.aTopCellImg[iIndex], cc.Texture2D, function (err, texture) {
// fiTo.node.getChildByName("Pic").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height));
...
...
@@ -1205,7 +1240,7 @@ cc.Class({
if
(
0
==
fiTo
.
node
.
getName
().
indexOf
(
'topNavi'
))
{
let
iIndex
=
fiTo
.
node
.
name
.
replace
(
"topNavi"
,
''
);
// fiTo.node.getChildByName("Pic").getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height));
cc
.
log
(
iIndex
+
" ... "
+
this
.
_oInit
.
aTopNaviImg
[
iIndex
]);
//
cc.log(iIndex + " ... " + this._oInit.aTopNaviImg[iIndex]);
if
(
this
.
_oInit
.
aTopNaviImg
[
iIndex
-
1
])
{
// cc.loader.loadRes(this._oInit.aTopNaviImg[iIndex - 1], cc.Texture2D, function (err, texture) {
// fiTo.node.getChildByName("Pic").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height));
...
...
@@ -1223,7 +1258,8 @@ cc.Class({
this
.
_oSceneContext
.
_iCurrentLeftIndex
=
iIndex
;
this
.
scheduleOnce
(
function
()
{
this
.
requestMediaList
(
1
);
//重新渲染CategoryList
// this.requestMediaList(1); //重新渲染CategoryList
this
.
getSimulateRequest
();
},
0
);
// this.renderCategoryList(1);
...
...
@@ -1269,7 +1305,7 @@ cc.Class({
}
//这里想统一处理焦点框显示隐藏问题
cc
.
log
(
"节点名称:"
+
fiTo
.
node
.
getName
());
//
cc.log("节点名称:" + fiTo.node.getName());
if
(
0
==
fiTo
.
node
.
getName
().
indexOf
(
'view_pager_label'
)
||
0
==
fiTo
.
node
.
getName
().
indexOf
(
'topNavi'
)
||
0
==
fiTo
.
node
.
getName
().
indexOf
(
'topCell'
)
||
0
==
fiTo
.
node
.
getName
().
indexOf
(
'backToTop'
))
{
this
.
_cFocus
.
hide
();
...
...
@@ -1281,13 +1317,14 @@ cc.Class({
doCurrentFocusTVLinkAction
:
function
(
strAction
)
{
let
strTVLink
=
this
.
_fiCurrentFocus
.
getTVLink
();
cc
.
log
(
"tvlink==============="
+
strTVLink
);
// cc.log("tvlink===============" + strTVLink);
// cc.log("tvlink===============" + this._oSceneContext._iPageIndex);
try
{
let
oTVLink
=
JSON
.
parse
(
strTVLink
);
let
aOperationList
=
oTVLink
.
click
;
// var rightNavLayout = this.targetAry[2].target;
// rightNavLayout.destroyAllChildren(); //销毁完以前所有的子模块
this
.
_oSceneContext
.
_iPageIndex
=
1
;
//
this._oSceneContext._iPageIndex = 1;
for
(
let
i
=
0
;
i
<
aOperationList
.
length
;
i
++
)
{
switch
(
aOperationList
[
i
].
action
)
{
case
"changeLayout"
:
...
...
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