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
40c814d2
...
40c814d25d358094dbed4bcfef6bdd7340aee1dd
authored
2020-03-16 18:05:39 +0800
by
金学艇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.左侧标签快速切换后,焦点无法右移
2.首页【经营策略】导航栏游戏详情页返回向下翻页无焦点
1 parent
c4f60729
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
183 additions
and
32 deletions
assets/Scene/sceneMain.fire
assets/Script/gameCategory.js
assets/Script/listCell/pfbCategoryListCell.js
assets/Script/listCell/pfbMainCategoryListCell.js
assets/Script/main.js
assets/resources/Prefab/pfbMainCategoryListCell.prefab
assets/Scene/sceneMain.fire
View file @
40c814d
...
...
@@ -192,7 +192,7 @@
"array": [
0,
0,
2
71.0659484863281
,
2
65.0037841796875
,
0,
0,
0,
...
...
@@ -5708,8 +5708,8 @@
}
],
"_useOriginalSize": false,
"_string": "v
0.9.0.2020031610
",
"_N$string": "v
0.9.0.2020031610
",
"_string": "v
1.0.0.2020031617
",
"_N$string": "v
1.0.0.2020031617
",
"_fontSize": 24,
"_lineHeight": 24,
"_enableWrapText": true,
...
...
assets/Script/gameCategory.js
View file @
40c814d
...
...
@@ -25,6 +25,7 @@ cc.Class({
onLoad
:
function
()
{
this
.
_super
();
this
.
_oInit
=
{};
this
.
_lastFocus
=
null
;
this
.
_oSceneContext
.
_iCurrentLeftIndex
=
0
;
this
.
_oSceneContext
.
focusPath
=
"TypeListArea/TypeListWrapper/TypeList/topNavi"
+
this
.
_oSceneContext
.
_iCurrentLeftIndex
;
this
.
_bIsDataListMoving
=
false
;
...
...
@@ -311,7 +312,7 @@ cc.Class({
this
.
_cFocus
.
init
(
'focusContainer'
,
this
,
nodeInitFocus
.
getComponent
(
FocusInfo
),
Common
.
SCREEN_WIDTH
,
Common
.
SCREEN_HEIGHT
,
10
,
6
,
1.1
,
true
);
this
.
_lastFocus
=
nodeInitFocus
.
getComponent
(
FocusInfo
);
if
(
0
==
nodeInitFocus
.
name
.
indexOf
(
"topNavi"
))
{
this
.
_cFocus
.
hide
();
}
...
...
@@ -373,10 +374,23 @@ cc.Class({
return
[
fiFocusTarget
,
oScrollParameter
];
},
onKeyUp
:
function
(
event
)
{
// cc.log(this._lastFocus.node.name + " down->抬起。。。" + this._fiCurrentFocus.node.name);
cc
.
log
(
"抬起:"
+
event
.
keyCode
);
if
(
0
==
this
.
_lastFocus
.
node
.
getName
().
indexOf
(
'topNavi'
)
&&
0
==
this
.
_fiCurrentFocus
.
node
.
getName
().
indexOf
(
'topNavi'
)
&&
event
.
keyCode
!=
(
Common
.
ANDROID_KEY
.
left
||
cc
.
macro
.
KEY
.
left
))
{
this
.
scheduleOnce
(
function
()
{
this
.
getSimulateRequest
();
},
0
);
}
},
onKeyDown
:
function
(
event
)
{
this
.
_super
(
event
);
var
fiFocusTarget
=
null
;
var
fiCurrentFocus
=
this
.
_fiCurrentFocus
;
this
.
_lastFocus
=
this
.
_fiCurrentFocus
;
//存储上一个节点
switch
(
event
.
keyCode
)
{
case
cc
.
macro
.
KEY
.
up
:
case
Common
.
ANDROID_KEY
.
up
:
...
...
@@ -546,12 +560,14 @@ cc.Class({
}
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
);
// this.scheduleOnce(function () { //这个放到onKeyUp中去,解决长按导致的焦点丢失
// cc.log("onAfter..." + iIndex);
// // this.requestMediaList(1); //重新渲染CategoryList
// this.getSimulateRequest();
// }, 0);
}
}
...
...
assets/Script/listCell/pfbCategoryListCell.js
View file @
40c814d
...
...
@@ -65,12 +65,15 @@ cc.Class({
// cc.loader.loadRes(oData.image[0].fileUrl, cc.Texture2D, function (err, texture) {
// self.pic.spriteFrame = new cc.SpriteFrame(texture);
// });
Network
.
loadImageInNativeRuntime
(
Common
.
TOPDRAW_IMAGE_SERVER
+
oData
.
image
[
0
].
fileUrl
,
null
,
function
(
texture
,
iRequestId
)
{
self
.
pic
.
spriteFrame
=
new
cc
.
SpriteFrame
(
texture
);
},
function
()
{
},
this
);
cc
.
log
(
"pfbCategoryListCell.."
+
self
.
pic
);
if
(
self
.
pic
)
{
Network
.
loadImageInNativeRuntime
(
Common
.
TOPDRAW_IMAGE_SERVER
+
oData
.
image
[
0
].
fileUrl
,
null
,
function
(
texture
,
iRequestId
)
{
self
.
pic
.
spriteFrame
=
new
cc
.
SpriteFrame
(
texture
);
},
function
()
{
},
this
);
}
}
// cc.log("category list cell location: "+oData.image[0].fileUrl);
this
.
node
.
getComponent
(
FocusInfo
).
setTVLink
(
oData
.
tvlink
);
...
...
assets/Script/listCell/pfbMainCategoryListCell.js
0 → 100644
View file @
40c814d
//分类-动漫
var
Common
=
require
(
'Common'
);
var
FocusInfo
=
require
(
'FocusInfo'
);
var
ListCell
=
require
(
'ListCell'
);
var
Network
=
require
(
'Network'
);
cc
.
Class
({
extends
:
ListCell
,
properties
:
{
id
:
0
,
pic
:
cc
.
Sprite
,
activeName1
:
cc
.
Label
,
activeName2
:
cc
.
Label
,
normalName
:
cc
.
Label
,
Name
:
cc
.
Label
,
textScore
:
cc
.
Label
,
//分数
},
statics
:
{
PFB_NAME
:
'Prefab/pfbMainCategoryListCell'
,
CELL_NAME
:
'CategoryListCell'
,
},
init
:
function
(
iCellIndex
,
bIsFocusEnable
,
compSceneCanvas
)
{
//准备焦点坐标
let
fiCategoryBlock
=
this
.
node
.
addComponent
(
FocusInfo
);
fiCategoryBlock
.
init
(
null
,
true
,
null
,
null
,
1.1
);
compSceneCanvas
.
addNodeToFocusTarget
(
0
,
this
.
node
.
name
,
this
.
node
);
},
render
(
oData
,
iRecordIndex
)
{
// this.id = oData.id;
// cc.log("categoryList-->name: "+JSON.stringify(oData));
this
.
activeName1
.
string
=
oData
.
name
;
this
.
activeName2
.
string
=
oData
.
name
;
this
.
normalName
.
string
=
oData
.
name
;
this
.
Name
.
string
=
oData
.
name
;
// this.activeName1._updateRenderData(true);
// this.activeName2._updateRenderData(true);
// this.normalName._updateRenderData(true);
if
(
oData
.
score
)
{
this
.
textScore
.
string
=
parseInt
(
oData
.
score
*
10
)
/
10
;
}
if
(
oData
.
play_times
)
{
let
value
=
parseInt
(
oData
.
play_times
);
if
(
value
>
10000
)
{
this
.
textPlayTimes
.
string
=
parseInt
(
value
/
10000
)
+
"万+"
;
}
else
{
this
.
textPlayTimes
.
string
=
value
;
}
}
if
(
oData
.
image
[
0
])
{
var
self
=
this
;
// Network.loadImageInNativeRuntime(
// Common.TOPDRAW_IMAGE_SERVER + oData.image[0].fileUrl,null,
// function (texture) {
// self.pic.spriteFrame = new cc.SpriteFrame(texture);
// }, null, this
// );
// cc.log("categoryList..."+oData.image[0].fileUrl);
// cc.loader.loadRes(oData.image[0].fileUrl, cc.Texture2D, function (err, texture) {
// self.pic.spriteFrame = new cc.SpriteFrame(texture);
// });
cc
.
log
(
"pfbCategoryListCell.."
+
self
.
pic
);
if
(
self
.
pic
)
{
Network
.
loadImageInNativeRuntime
(
Common
.
TOPDRAW_IMAGE_SERVER
+
oData
.
image
[
0
].
fileUrl
,
null
,
function
(
texture
,
iRequestId
)
{
self
.
pic
.
spriteFrame
=
new
cc
.
SpriteFrame
(
texture
);
},
function
()
{
},
this
);
}
}
// cc.log("category list cell location: "+oData.image[0].fileUrl);
this
.
node
.
getComponent
(
FocusInfo
).
setTVLink
(
oData
.
tvlink
);
},
enableFocusInfo
:
function
()
{
this
.
node
.
getComponent
(
FocusInfo
).
setEnable
(
true
);
},
disableFocusInfo
:
function
()
{
this
.
node
.
getComponent
(
FocusInfo
).
setEnable
(
false
);
},
setUIWithFocus
:
function
()
{
let
nodeCellName
=
this
.
node
.
getChildByName
(
'Name'
);
cc
.
find
(
"NormalName"
,
nodeCellName
).
opacity
=
255
;
//超出滚动
let
nodeScreenTitleText
=
cc
.
find
(
'ActiveName/NameContainer/NameText'
,
nodeCellName
);
let
fOriginalX
=
nodeScreenTitleText
.
x
;
let
fOriginalY
=
nodeScreenTitleText
.
y
;
let
nodeScreenTitleText1
=
nodeScreenTitleText
.
getChildByName
(
'NameText1'
);
let
nodeScreenTitleText2
=
nodeScreenTitleText
.
getChildByName
(
'NameText2'
);
nodeScreenTitleText2
.
x
=
nodeScreenTitleText1
.
x
+
nodeScreenTitleText1
.
width
+
10
;
//TODO:补丁,解决滚动重叠
if
(
nodeScreenTitleText1
.
width
>
nodeScreenTitleText
.
width
)
{
cc
.
find
(
"ActiveName/NameContainer"
,
nodeCellName
).
opacity
=
255
;
cc
.
find
(
"NormalName"
,
nodeCellName
).
opacity
=
0
;
let
fEndPositionDelta
=
(
nodeScreenTitleText1
.
width
+
30
);
//下方时长和字有关系,才能速度一样
var
ftaScreenTitleMoveToTarget
=
cc
.
moveTo
(
10
*
(
nodeScreenTitleText1
.
width
/
nodeScreenTitleText
.
width
),
fOriginalX
-
fEndPositionDelta
,
fOriginalY
);
var
ftaScreenTitleMoveToBack
=
cc
.
moveTo
(
0
,
fOriginalX
,
fOriginalY
);
var
sequenceMediaTitle
=
cc
.
sequence
(
ftaScreenTitleMoveToTarget
,
ftaScreenTitleMoveToBack
);
var
repeatScreenTitle
=
cc
.
repeat
(
sequenceMediaTitle
,
10
);
repeatScreenTitle
.
setTag
(
Common
.
OVERLENGTH_MOVING
);
nodeScreenTitleText
.
runAction
(
repeatScreenTitle
);
nodeScreenTitleText2
.
active
=
true
;
}
},
setUIWithoutFocus
:
function
()
{
let
nodeCellName
=
this
.
node
.
getChildByName
(
'Name'
);
cc
.
find
(
"NormalName"
,
nodeCellName
).
opacity
=
255
;
//如有滚动停止滚动
let
nodeScreenTitleText
=
cc
.
find
(
'ActiveName/NameContainer/NameText'
,
nodeCellName
);
if
(
null
!=
nodeScreenTitleText
.
getActionByTag
(
Common
.
OVERLENGTH_MOVING
))
{
nodeScreenTitleText
.
stopActionByTag
(
Common
.
OVERLENGTH_MOVING
);
nodeScreenTitleText
.
getChildByName
(
'NameText2'
).
active
=
false
;
cc
.
find
(
"ActiveName/NameContainer"
,
nodeCellName
).
opacity
=
0
;
}
nodeScreenTitleText
.
x
=
0
;
},
});
assets/Script/main.js
View file @
40c814d
...
...
@@ -153,7 +153,7 @@ cc.Class({
},
i
);
let
fiNav
=
nodeNav
.
addComponent
(
FocusInfo
);
fiNav
.
init
(
null
,
tru
e
,
null
,
null
,
1.1
);
//最后一个参数决定要不要放大显示
fiNav
.
init
(
null
,
fals
e
,
null
,
null
,
1.1
);
//最后一个参数决定要不要放大显示
this
.
_aFocusTargets
[
0
][
"view_pager_label"
+
i
]
=
nodeNav
;
}
...
...
@@ -219,6 +219,7 @@ cc.Class({
cc
.
find
(
"scrollContent/BlockShadow"
,
this
.
node
).
active
=
true
;
}
else
{
this
.
getSimulateRequest
();
cc
.
log
(
"不显示轮播图。。。"
);
cc
.
find
(
"scrollContent/ViewPagerArea"
,
this
.
node
).
active
=
false
;
cc
.
find
(
"scrollContent/BlockShadow"
,
this
.
node
).
active
=
false
;
}
...
...
@@ -702,7 +703,7 @@ cc.Class({
// switch (strAppId) {
// case BusinessParameter.CARTOON_APPID:
// this._oSceneContext.focusPath = this._oSceneContext.focusPath || "SongList/DataContainerMask/DataContainer/ListCell0/SongTitleContainer";
this
.
_strSongListCellComponentName
=
"pfbCategoryListCell"
;
this
.
_strSongListCellComponentName
=
"pfb
Main
CategoryListCell"
;
this
.
_iBeginPositionX
=
-
440
;
this
.
_iBeginPositionY
=
160
;
this
.
_iShowCellRows
=
2
;
...
...
@@ -845,8 +846,10 @@ cc.Class({
fiViewPagerArea
.
init
(
''
,
false
,
null
,
null
,
1.0
);
this
.
_aFocusTargets
[
0
][
'view_pager_area'
]
=
cc
.
find
(
'scrollContent/ViewPagerArea'
,
this
.
node
);
cc
.
find
(
"scrollContent/ViewPagerArea"
,
this
.
node
).
active
=
false
;
//打补丁,解决第一次不能跳转到轮播图上面的问题
cc
.
find
(
"scrollContent/ViewPagerArea"
,
this
.
node
).
active
=
true
;
if
(
this
.
_oSceneContext
.
_iCurrentLeftIndex
==
1
)
{
cc
.
find
(
"scrollContent/ViewPagerArea"
,
this
.
node
).
active
=
false
;
//打补丁,解决第一次不能跳转到轮播图上面的问题
cc
.
find
(
"scrollContent/ViewPagerArea"
,
this
.
node
).
active
=
true
;
}
let
fiHotUpdateBtn
=
cc
.
find
(
'update/update_panel/update_btn'
,
this
.
node
).
addComponent
(
FocusInfo
);
//热更新按钮
fiHotUpdateBtn
.
init
(
''
,
false
,
null
,
null
,
1.1
);
...
...
@@ -883,11 +886,11 @@ cc.Class({
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 (this._oSceneContext._iCurrentLeftIndex > 1) { //不是第一个焦点框就跳过去,恢复记忆
//
this.scheduleOnce(function () {
//
this._cFocus.flyFocus(this._fiCurrentFocus, nodeInitFocus.getComponent(FocusInfo), Common.MOVE_DIRECTION_RIGHT, null, null);
//
}, 0);
//
}
},
keyDownDirection
:
function
(
Direct
)
{
...
...
@@ -896,6 +899,7 @@ cc.Class({
var
oScrollParameter
=
null
;
let
aCheckResult
;
fiFocusTarget
=
this
.
_cFocus
.
findTarget
(
fiCurrentFocus
,
this
.
_aFocusTargets
,
this
.
_iSceneStatus
,
Direct
);
// cc.log("目标节点:" + fiFocusTarget.node.name);
if
(
!
fiFocusTarget
)
{
return
;
}
aCheckResult
=
this
.
checkFocusTarget
(
fiFocusTarget
,
null
,
Direct
);
fiFocusTarget
=
aCheckResult
[
0
];
...
...
@@ -921,7 +925,8 @@ cc.Class({
},
checkFocusTarget
:
function
(
fiFocusTarget
,
oScrollParameter
,
Direct
)
{
// cc.log("目标节点名称:" + fiFocusTarget.node.name);
if
(
fiFocusTarget
)
cc
.
log
(
"目标节点名称:"
+
fiFocusTarget
.
node
.
name
);
var
leftNavLayout
=
this
.
targetAry
[
0
].
target
;
// if (!this._bInitCategoryListSuccess) {
...
...
@@ -1323,20 +1328,18 @@ cc.Class({
var
rightNodeLayout
=
this
.
targetAry
[
1
].
target
;
let
blockShadow
=
cc
.
find
(
"scrollContent/BlockShadow"
,
this
.
node
);
if
(
iIndex
==
1
)
{
this
.
scheduleOnce
(
function
()
{
// this.getRightRecommendRequestData();
},
0
);
cc
.
find
(
"scrollContent/ViewPagerArea"
,
this
.
node
).
active
=
true
;
cc
.
find
(
"scrollContent/BlockShadow"
,
this
.
node
).
active
=
true
;
// cc.find("scrollContent/CategoryListRecommendLayout", this.node).active = false;
blockShadow
.
active
=
true
;
}
else
{
cc
.
find
(
"scrollContent/ViewPagerArea"
,
this
.
node
).
active
=
false
;
cc
.
find
(
"scrollContent/BlockShadow"
,
this
.
node
).
active
=
false
;
// cc.find("scrollContent/CategoryListRecommendLayout", this.node).active = true;
blockShadow
.
active
=
false
;
}
if
(
rightNodeLayout
.
childrenCount
==
0
&&
iIndex
==
1
)
{
//恢复光标的界面可能需要初始化瀑布流
this
.
getRightRecommendRequestData
();
}
for
(
let
i
=
0
;
i
<
rightNodeLayout
.
childrenCount
;
i
++
)
{
if
(
iIndex
==
1
)
{
//“休闲益智”采用单独的框架渲染 || iIndex == 3
rightNodeLayout
.
children
[
i
].
active
=
true
;
...
...
assets/resources/Prefab/pfbMainCategoryListCell.prefab
0 → 100644
View file @
40c814d
This diff is collapsed.
Click to expand it.
Please
register
or
sign in
to post a comment