Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
金学艇
/
ChildEdu
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
8ee82dd7
...
8ee82dd7f49dd0f1f8a7c9d79368871bc1c37374
authored
2019-09-02 13:37:13 +0800
by
jinwawa
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
complete sceneCategory
1 parent
7e2248ea
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
21 deletions
assets/Script/Category.js
assets/Script/Category.js
View file @
8ee82dd
...
...
@@ -361,7 +361,7 @@ cc.Class({
// 'parentId': this._oInit.aNavList[this._oSceneContext.iNaviIndex].parentId, //废弃使用该字段,筛选所有带有“基础分类”的结果
"sortField"
:
"sequence"
,
"sortDirection"
:
"asc"
,
"parentId"
:
this
.
_oInit
.
aNavList
[
this
.
_oSceneContext
.
iNaviIndex
].
id
,
"parentId"
:
this
.
_oInit
.
aNavList
[
this
.
_oSceneContext
.
iNaviIndex
].
id
,
//
'token'
:
Common
.
TEST_API_TOKEN_EDU
,
};
Network
.
ajax
(
"GET"
,
Common
.
TOPDRAW_API_SERVER_EDU
+
"Category/ListByParent"
,
null
,
oCatgoryListParas
,
...
...
@@ -426,6 +426,7 @@ cc.Class({
//ture时渲染节目出来,需要两个值iRequestPageIndex,iCurrentActiveIndex
updateCatPage
:
function
(
flag
)
{
var
self
=
this
;
this
.
_nodeTypeList
.
y
=
0
;
//每次初始化typeList,先推上去,如果回退回来的界面会有其他变量恢复它
//先释放以前数据
// this._nodeTypeList.removeAllChildren(); //内存泄漏
...
...
@@ -433,6 +434,7 @@ cc.Class({
//------------------------
for
(
let
i
=
0
;
i
<
this
.
_nodeTypeList
.
childrenCount
;
i
++
)
{
this
.
_nodeTypeList
.
children
[
i
].
active
=
false
;
// cc.log("子节点名称:"+this._nodeTypeList.children[i].name);
}
//------------------------
...
...
@@ -443,6 +445,7 @@ cc.Class({
let
id
=
this
.
_oInit
.
oCatList
[
this
.
_oInit
.
aNavList
[
this
.
_oSceneContext
.
iNaviIndex
].
id
][
i
].
cId
;
let
nodeTypeListCell
=
cc
.
find
(
"TypeListCell_"
+
id
+
"_"
+
i
,
this
.
_nodeTypeList
);
if
(
!
nodeTypeListCell
)
{
// cc.log("造新节点");
nodeTypeListCell
=
cc
.
instantiate
(
this
.
PFB_TYPE
);
nodeTypeListCell
.
y
=
-
nodeTypeListCell
.
height
/
2
-
i
*
(
nodeTypeListCell
.
height
);
this
.
_nodeTypeList
.
addChild
(
nodeTypeListCell
,
10
,
"TypeListCell_"
+
id
+
"_"
+
i
);
...
...
@@ -452,6 +455,8 @@ cc.Class({
this
.
_aFocusTargets
[
0
][
'type_list_cell_'
+
id
]
=
nodeTypeListCell
;
}
nodeTypeListCell
.
active
=
true
;
// cc.log("nodeTypeListCell位置:"+nodeTypeListCell.position); //
// cc.log("nodeTypeList: "+this._nodeTypeList.active);
// nodeTypeListCell.getComponent('pfbCategoryTypeCell').init(this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][i], null);
// cc.log("/////"+this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][i]);
...
...
@@ -464,32 +469,55 @@ cc.Class({
// cc.log("inittype------------------>" + this._oSceneContext.iTypeIndex);
if
(
i
==
this
.
_oSceneContext
.
iTypeIndex
)
{
//默认第一个Type为选中状态
this
.
_oSceneContext
.
iTypeId
=
id
;
Network
.
loadImageInNativeRuntime
(
Common
.
TOPDRAW_IMAGE_SERVER_EDU_RIGHT
+
this
.
_oInit
.
oCatList
[
this
.
_oInit
.
aNavList
[
this
.
_oSceneContext
.
iNaviIndex
].
id
][
i
].
imgSrc
,
function
(
texture
)
{
//这种方式加载远程图片有问题 ,切换Type导航时不能显示图片
// Network.loadImageInNativeRuntime(
// Common.TOPDRAW_IMAGE_SERVER_EDU_RIGHT + this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][i].imgSrc,
// function (texture) {
// cc.find('Bg', nodeTypeListCell).getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, height, width, height));
// count--;
// if (!count) { //可能为最后一个!!!
// self._bInitTypeSuccess = true;
// self.checkDataReadyAndInitFocus(); //弄焦点
// }
// }, null, this
// );
cc
.
loader
.
load
(
Common
.
TOPDRAW_IMAGE_SERVER_EDU_RIGHT
+
this
.
_oInit
.
oCatList
[
this
.
_oInit
.
aNavList
[
this
.
_oSceneContext
.
iNaviIndex
].
id
][
i
].
imgSrc
,
function
(
err
,
texture
)
{
cc
.
find
(
'Bg'
,
nodeTypeListCell
).
getComponent
(
cc
.
Sprite
).
spriteFrame
=
new
cc
.
SpriteFrame
(
texture
,
cc
.
rect
(
0
,
height
,
width
,
height
));
count
--
;
if
(
!
count
)
{
//可能为最后一个!!!
self
.
_bInitTypeSuccess
=
true
;
self
.
checkDataReadyAndInitFocus
();
//弄焦点
}
},
null
,
this
);
});
}
else
{
var
self
=
this
;
Network
.
loadImageInNativeRuntime
(
Common
.
TOPDRAW_IMAGE_SERVER_EDU_RIGHT
+
this
.
_oInit
.
oCatList
[
this
.
_oInit
.
aNavList
[
this
.
_oSceneContext
.
iNaviIndex
].
id
][
i
].
imgSrc
,
function
(
texture
)
{
// cc.log("type list "+(Common.TOPDRAW_IMAGE_SERVER_EDU_RIGHT + this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][i].imgSrc));
// Network.loadImageInNativeRuntime(
// Common.TOPDRAW_IMAGE_SERVER_EDU_RIGHT + this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][i].imgSrc,
// function (texture) {
// cc.find('Bg', nodeTypeListCell).getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, width, height));
// count--;
// // cc.log("InitType-------------------->" + count);
// if (!count) {
// self._bInitTypeSuccess = true;
// self.checkDataReadyAndInitFocus(); //弄焦点
// }
// }, null, this
// );
cc
.
loader
.
load
(
Common
.
TOPDRAW_IMAGE_SERVER_EDU_RIGHT
+
this
.
_oInit
.
oCatList
[
this
.
_oInit
.
aNavList
[
this
.
_oSceneContext
.
iNaviIndex
].
id
][
i
].
imgSrc
,
function
(
err
,
texture
)
{
cc
.
find
(
'Bg'
,
nodeTypeListCell
).
getComponent
(
cc
.
Sprite
).
spriteFrame
=
new
cc
.
SpriteFrame
(
texture
,
cc
.
rect
(
0
,
0
,
width
,
height
));
count
--
;
// cc.log("InitType-------------------->" + count);
if
(
!
count
)
{
if
(
!
count
)
{
//可能为最后一个!!!
self
.
_bInitTypeSuccess
=
true
;
self
.
checkDataReadyAndInitFocus
();
//弄焦点
}
}
,
null
,
this
);
}
);
}
// cc.log("nodeTypeListCell位置:"+nodeTypeListCell.position);
}
}
...
...
@@ -756,12 +784,12 @@ cc.Class({
aCheckResult
=
this
.
checkFocusTarget
(
fiFocusTarget
,
oScrollParameter
);
fiFocusTarget
=
aCheckResult
[
0
];
oScrollParameter
=
aCheckResult
[
1
];
if
(
0
==
this
.
_fiCurrentFocus
.
node
.
name
.
indexOf
(
"NaviCell"
)
&&
0
!=
fiFocusTarget
.
node
.
name
.
indexOf
(
"NaviCell"
))
{
if
(
this
.
_bInitTypeSuccess
!=
undefined
&&
!
this
.
_bInitTypeSuccess
)
return
;
//type和promotion未初始完成不允许跳转(回退界面不会初始化this._bInitRighjtPromotionSuccess)
if
(
this
.
_bInitRightPromotionSuccess
!=
undefined
&&
!
this
.
_bInitRightPromotionSuccess
)
return
;
if
(
this
.
_bInitCategoryListSuccess
!=
undefined
&&
!
this
.
_bInitCategoryListSuccess
)
return
;
}
//
if (0 == this._fiCurrentFocus.node.name.indexOf("NaviCell") && 0 != fiFocusTarget.node.name.indexOf("NaviCell")) {
//
if (this._bInitTypeSuccess != undefined && !this._bInitTypeSuccess) return; //type和promotion未初始完成不允许跳转(回退界面不会初始化this._bInitRighjtPromotionSuccess)
//
if (this._bInitRightPromotionSuccess != undefined && !this._bInitRightPromotionSuccess) return;
//
if (this._bInitCategoryListSuccess != undefined && !this._bInitCategoryListSuccess) return;
//
}
cc
.
log
(
"flyFocus....."
);
this
.
scheduleOnce
(()
=>
{
//指定0让回调函数在下一帧立即执行(推荐位初始化图片后,需等待下一帧操作)
this
.
_cFocus
.
flyFocus
(
this
.
_fiCurrentFocus
,
fiFocusTarget
,
Direct
,
null
,
oScrollParameter
);
},
0
);
...
...
@@ -944,7 +972,7 @@ cc.Class({
// fiFrom.node.getChildByName("Bg").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, fiFrom.node.width, fiFrom.node.height));
// }, null, this
// );
cc
.
loader
.
load
(
Common
.
TOPDRAW_IMAGE_SERVER
+
this
.
_oInit
.
oCatList
[
this
.
_oInit
.
aNavList
[
this
.
_oSceneContext
.
iNaviIndex
].
id
][
this
.
_oSceneContext
.
iTypeIndex
].
imgSrc
,
function
(
err
,
texture
)
{
cc
.
loader
.
load
(
Common
.
TOPDRAW_IMAGE_SERVER
_EDU_RIGHT
+
this
.
_oInit
.
oCatList
[
this
.
_oInit
.
aNavList
[
this
.
_oSceneContext
.
iNaviIndex
].
id
][
this
.
_oSceneContext
.
iTypeIndex
].
imgSrc
,
function
(
err
,
texture
)
{
fiFrom
.
node
.
getChildByName
(
"Bg"
).
getComponent
(
cc
.
Sprite
).
spriteFrame
=
new
cc
.
SpriteFrame
(
texture
,
cc
.
rect
(
0
,
0
,
fiFrom
.
node
.
width
,
fiFrom
.
node
.
height
));
});
}
...
...
@@ -985,7 +1013,8 @@ cc.Class({
// fiTo.node.getChildByName("Bg").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height));
// }, null, this
// );
cc
.
loader
.
load
(
Common
.
TOPDRAW_IMAGE_SERVER
+
this
.
_oInit
.
oCatList
[
this
.
_oInit
.
aNavList
[
this
.
_oSceneContext
.
iNaviIndex
].
id
][
this
.
_oSceneContext
.
iTypeIndex
].
imgSrc
,
function
(
err
,
texture
)
{
// cc.log("切换后加载图片:"+(Common.TOPDRAW_IMAGE_SERVER + this._oInit.oCatList[this._oInit.aNavList[this._oSceneContext.iNaviIndex].id][this._oSceneContext.iTypeIndex].imgSrc));
cc
.
loader
.
load
(
Common
.
TOPDRAW_IMAGE_SERVER_EDU_RIGHT
+
this
.
_oInit
.
oCatList
[
this
.
_oInit
.
aNavList
[
this
.
_oSceneContext
.
iNaviIndex
].
id
][
this
.
_oSceneContext
.
iTypeIndex
].
imgSrc
,
function
(
err
,
texture
)
{
fiTo
.
node
.
getChildByName
(
"Bg"
).
getComponent
(
cc
.
Sprite
).
spriteFrame
=
new
cc
.
SpriteFrame
(
texture
,
cc
.
rect
(
0
,
fiTo
.
node
.
height
,
fiTo
.
node
.
width
,
fiTo
.
node
.
height
));
});
}
...
...
Please
register
or
sign in
to post a comment