|
@@ -33,6 +33,9 @@ export default class TableView extends cc.Component {
|
|
|
@property({ displayName: '滚动方向', tooltip: '', type: cc.Enum(Direction) })
|
|
@property({ displayName: '滚动方向', tooltip: '', type: cc.Enum(Direction) })
|
|
|
private direction = Direction.vertical;
|
|
private direction = Direction.vertical;
|
|
|
|
|
|
|
|
|
|
+ @property({displayName: "初始化时所有子节点隐藏"})
|
|
|
|
|
+ private isHideAllChild: boolean = false;
|
|
|
|
|
+
|
|
|
/** 数据 */
|
|
/** 数据 */
|
|
|
private itemData: any = null;
|
|
private itemData: any = null;
|
|
|
/** 滚动列表组件 */
|
|
/** 滚动列表组件 */
|
|
@@ -86,7 +89,7 @@ export default class TableView extends cc.Component {
|
|
|
this.layerHeight = this.node.height;
|
|
this.layerHeight = this.node.height;
|
|
|
this.layerWith = this.node.width;
|
|
this.layerWith = this.node.width;
|
|
|
for (let i = 0; i < this.item.length; i++) {
|
|
for (let i = 0; i < this.item.length; i++) {
|
|
|
- this.itemNode[i] = cc.instantiate(this.item[i]);
|
|
|
|
|
|
|
+ this.itemNode[i] = cc.instantiate(this.item[i]);
|
|
|
}
|
|
}
|
|
|
this.node.on('srollview-init', this.init, this);
|
|
this.node.on('srollview-init', this.init, this);
|
|
|
this.node.on('srollview-update', this.updateList, this);
|
|
this.node.on('srollview-update', this.updateList, this);
|
|
@@ -272,6 +275,8 @@ export default class TableView extends cc.Component {
|
|
|
item.parent = this.content;
|
|
item.parent = this.content;
|
|
|
item.pfbType = pfbType;
|
|
item.pfbType = pfbType;
|
|
|
item.index = i;
|
|
item.index = i;
|
|
|
|
|
+ if(this.isHideAllChild)
|
|
|
|
|
+ item.active = false;
|
|
|
if (this.direction == Direction.vertical) {
|
|
if (this.direction == Direction.vertical) {
|
|
|
if (i === 0) {
|
|
if (i === 0) {
|
|
|
item.y = 0;
|
|
item.y = 0;
|
|
@@ -582,17 +587,24 @@ export default class TableView extends cc.Component {
|
|
|
|
|
|
|
|
public getItemByIndexAndCount(index: number, count: number)
|
|
public getItemByIndexAndCount(index: number, count: number)
|
|
|
{
|
|
{
|
|
|
- const itemArray: Array<cc.Node> = [];
|
|
|
|
|
- for(let i = 0; i != count; ++i){
|
|
|
|
|
- for(let j = 0; j != this.itemArr.length; ++j)
|
|
|
|
|
- {
|
|
|
|
|
- if(this.itemArr[j].index == (index +i))
|
|
|
|
|
|
|
+ const itemArray: Array<any> = [];
|
|
|
|
|
+ for(let j = 0; j != this.itemArr.length; ++j)
|
|
|
|
|
+ {
|
|
|
|
|
+ let isCheckSuccess = false;
|
|
|
|
|
+ for(let i = index; i != (index + count); ++i){
|
|
|
|
|
+ if(this.itemArr[j].index == i)
|
|
|
{
|
|
{
|
|
|
itemArray.push(this.itemArr[j]);
|
|
itemArray.push(this.itemArr[j]);
|
|
|
|
|
+ isCheckSuccess = true;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+ if(!isCheckSuccess)
|
|
|
|
|
+ {
|
|
|
|
|
+ this.itemArr[j].active = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
return itemArray;
|
|
return itemArray;
|
|
|
}
|
|
}
|
|
|
|
|
|