[add] All
This commit is contained in:
commit
32a8b23c91
BIN
__MACOSX/assets/._.DS_Store
Normal file
BIN
__MACOSX/assets/._.DS_Store
Normal file
Binary file not shown.
BIN
__MACOSX/assets/core/._super-layout.ts
Normal file
BIN
__MACOSX/assets/core/._super-layout.ts
Normal file
Binary file not shown.
BIN
__MACOSX/assets/core/._super-scrollview.ts
Normal file
BIN
__MACOSX/assets/core/._super-scrollview.ts
Normal file
Binary file not shown.
BIN
__MACOSX/assets/scenes/._.DS_Store
Normal file
BIN
__MACOSX/assets/scenes/._.DS_Store
Normal file
Binary file not shown.
BIN
__MACOSX/assets/scripts/._baseItem.ts
Normal file
BIN
__MACOSX/assets/scripts/._baseItem.ts
Normal file
Binary file not shown.
BIN
__MACOSX/assets/scripts/._vertical.ts
Normal file
BIN
__MACOSX/assets/scripts/._vertical.ts
Normal file
Binary file not shown.
BIN
assets/.DS_Store
vendored
Normal file
BIN
assets/.DS_Store
vendored
Normal file
Binary file not shown.
12
assets/core.meta
Normal file
12
assets/core.meta
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "7bcbe514-0408-49f4-9e02-4705066f7709",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
1437
assets/core/super-layout.ts
Normal file
1437
assets/core/super-layout.ts
Normal file
File diff suppressed because it is too large
Load Diff
9
assets/core/super-layout.ts.meta
Normal file
9
assets/core/super-layout.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.22",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "4430b74f-56cb-48ca-b333-ba2056fa19e2",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
549
assets/core/super-scrollview.ts
Normal file
549
assets/core/super-scrollview.ts
Normal file
@ -0,0 +1,549 @@
|
||||
/*
|
||||
* @Author: steveJobs
|
||||
* @Email: icipiqkm@gmail.com
|
||||
* @Date: 2021-8-1 01:15:04
|
||||
* @Last Modified by: steveJobs
|
||||
* @Last Modified time: 2021-8-1 14:35:43
|
||||
* @Description:
|
||||
*/
|
||||
import { _decorator, Node, EventTouch, Vec3, Vec2, ScrollView, EventHandler, PageView, EventMouse } from 'cc';
|
||||
import { SuperLayout } from './super-layout';
|
||||
const { ccclass, property } = _decorator;
|
||||
const quintEaseOut = (time: number) => {
|
||||
time -= 1;
|
||||
return (time * time * time * time * time + 1)
|
||||
};
|
||||
const EPSILON = 1e-4
|
||||
const OUT_OF_BOUNDARY_BREAKING_FACTOR = 0.015
|
||||
const _tempVec2 = new Vec2()
|
||||
export enum ScrollViewDirection {
|
||||
HORIZONTAL,
|
||||
VERTICAL,
|
||||
NONE,
|
||||
}
|
||||
@ccclass('SuperScrollview')
|
||||
export class SuperScrollview extends ScrollView {
|
||||
private direction: ScrollViewDirection = ScrollViewDirection.NONE
|
||||
private _layout!: SuperLayout
|
||||
@property({
|
||||
tooltip: "注意!向上传递事件只会发送当前滑动相反方向,如果开启horizontal则会发送vertical事件。如果开启vertical则会发送horizontal事件。同时开启horizontal和vertical 不会发送任何事件"
|
||||
}) isTransmitEvent: boolean = false
|
||||
@property pullRefresh: boolean = false
|
||||
@property({
|
||||
displayName: "顶部偏移量",
|
||||
tooltip: "下拉时超过此偏移会发送下拉事件",
|
||||
visible: function () { return (this as any).pullRefresh }
|
||||
}) headerOutOffset: number = 200
|
||||
@property({
|
||||
displayName: "满足触发Header的倍数",
|
||||
visible: function () { return (this as any).pullRefresh }
|
||||
}) headerMultiple: number = 2
|
||||
@property({
|
||||
displayName: "底部偏移量",
|
||||
tooltip: "上拉时超过此偏移会发送上拉事件",
|
||||
visible: function () { return (this as any).pullRefresh }
|
||||
}) footerOutOffset: number = 200
|
||||
@property({
|
||||
displayName: "满足触发Footer的倍数",
|
||||
visible: function () { return (this as any).pullRefresh }
|
||||
}) footerMultiple: number = 2
|
||||
@property({
|
||||
type: EventHandler,
|
||||
visible: function () { return (this as any).pullRefresh }
|
||||
}) headerEvents: EventHandler[] = []
|
||||
@property({
|
||||
type: EventHandler,
|
||||
visible: function () { return (this as any).pullRefresh }
|
||||
}) footerEvents: EventHandler[] = []
|
||||
prevLocation: Vec2 = new Vec2()
|
||||
location: Vec2 = new Vec2()
|
||||
set autoScrolling(value: boolean) { this._autoScrolling = value }
|
||||
private _touchBeganPosition = new Vec2()
|
||||
private _touchEndPosition = new Vec2()
|
||||
private isMoveHeader: boolean = false
|
||||
private isMoveFooter: boolean = false
|
||||
private isLockHeader: boolean = false
|
||||
private isLockFooter: boolean = false
|
||||
private headerProgress: number = 0
|
||||
private footerProgress: number = 0
|
||||
private isCustomScroll: boolean = false
|
||||
canTouchMove: boolean = true
|
||||
onLoad() {
|
||||
if (this.layout.autoCenter) {
|
||||
this.brake = 0.7
|
||||
}
|
||||
}
|
||||
public onEnable() {
|
||||
super.onEnable()
|
||||
this.node.on(PageView.EventType.SCROLL_ENG_WITH_THRESHOLD, this.dispatchPageTurningEvent, this)
|
||||
}
|
||||
public onDisable() {
|
||||
super.onDisable()
|
||||
this.node.off(PageView.EventType.SCROLL_ENG_WITH_THRESHOLD, this.dispatchPageTurningEvent, this)
|
||||
}
|
||||
get layout() {
|
||||
if (!this._layout) { this._layout = this.content?.getComponent(SuperLayout)! }
|
||||
return this._layout
|
||||
}
|
||||
private isCallSoonFinish: boolean = false
|
||||
get curPageIdx() {
|
||||
return this.layout["_currPageIndex"]
|
||||
}
|
||||
getPages() {
|
||||
return new Array(this.layout.itemTotal)
|
||||
}
|
||||
protected _getContentTopBoundary() {
|
||||
if (!this._content) {
|
||||
return -1
|
||||
}
|
||||
let offset = this.layout.isOfTopBoundary == 0 ? this._topBoundary : this.layout.isOfTopBoundary
|
||||
return offset
|
||||
}
|
||||
protected _getContentBottomBoundary() {
|
||||
if (!this._content) {
|
||||
return -1
|
||||
}
|
||||
let offset = this.layout.isOfButtomBoundary == 0 ? this._bottomBoundary : this.layout.isOfButtomBoundary
|
||||
return offset
|
||||
}
|
||||
protected _getContentLeftBoundary() {
|
||||
if (!this._content) {
|
||||
return -1
|
||||
}
|
||||
let offset = this.layout.isOfLeftBoundary == 0 ? this._leftBoundary : this.layout.isOfLeftBoundary
|
||||
return offset
|
||||
}
|
||||
protected _getContentRightBoundary() {
|
||||
if (!this._content) {
|
||||
return -1
|
||||
}
|
||||
let offset = this.layout.isOfRightBoundary == 0 ? this._rightBoundary : this.layout.isOfRightBoundary
|
||||
return offset
|
||||
}
|
||||
protected _onTouchBegan(event: EventTouch, captureListeners?: Node[]) {
|
||||
this.isCallSoonFinish = false
|
||||
this.isCustomScroll = false
|
||||
this.layout["onTouchBegin"]()
|
||||
if (!this.canTouchMove) return
|
||||
this.direction = ScrollViewDirection.NONE
|
||||
if (this.layout.isPageView) {
|
||||
event.touch!.getUILocation(_tempVec2)
|
||||
Vec2.set(this._touchBeganPosition, _tempVec2.x, _tempVec2.y)
|
||||
}
|
||||
super._onTouchBegan(event, captureListeners)
|
||||
if (this.isTransmitEvent) {
|
||||
this.transmitEvent(event, Node.EventType.TOUCH_START)
|
||||
}
|
||||
}
|
||||
protected _onTouchMoved(event: EventTouch, captureListeners: any) {
|
||||
this.isCallSoonFinish = false
|
||||
this.isCustomScroll = false
|
||||
if (!this.canTouchMove) return
|
||||
if (this.isTransmitEvent) {
|
||||
if (this.direction == ScrollViewDirection.NONE) {
|
||||
var start = event.getStartLocation()
|
||||
var curre = event.getLocation()
|
||||
var xOffset = Math.abs(start.x - curre.x)
|
||||
var yOffset = Math.abs(start.y - curre.y)
|
||||
if (xOffset > yOffset) {
|
||||
// 本ScrollView滑动方向过程中达到一定偏移量是也可以向上发送事件
|
||||
// if (this.vertical) {
|
||||
// if (xOffset - yOffset > 50) {
|
||||
// this.direction = UIScrollViewDirection.HORIZONTAL
|
||||
// }
|
||||
// }
|
||||
this.direction = ScrollViewDirection.HORIZONTAL
|
||||
|
||||
} else if (yOffset > xOffset) {
|
||||
// 本ScrollView滑动方向过程中达到一定偏移量是也可以向上发送事件
|
||||
// if (this.horizontal) {
|
||||
// if (yOffset - xOffset > 50) {
|
||||
// this.direction = UIScrollViewDirection.VERTICAL
|
||||
// }
|
||||
// }
|
||||
this.direction = ScrollViewDirection.VERTICAL
|
||||
}
|
||||
}
|
||||
var canTransmit = (this.vertical && this.direction === ScrollViewDirection.HORIZONTAL) || this.horizontal && this.direction == ScrollViewDirection.VERTICAL
|
||||
if (canTransmit) {
|
||||
this.transmitEvent(event, Node.EventType.TOUCH_MOVE)
|
||||
return
|
||||
}
|
||||
}
|
||||
this.prevLocation = event.touch?.getPreviousLocation()!
|
||||
this.location = event.touch?.getLocation()!
|
||||
super._onTouchMoved(event, captureListeners)
|
||||
if (this.pullRefresh) {
|
||||
let outOfBoundary = this._getHowMuchOutOfBoundary()
|
||||
let offset = this.vertical ? outOfBoundary.y : -outOfBoundary.x
|
||||
if (offset > 0 && !this.isLockHeader && !this.isLockFooter) {
|
||||
this.headerProgress = offset < EPSILON ? 0 : offset / this.headerOutOffset
|
||||
this.isMoveHeader = this.headerProgress >= this.headerMultiple
|
||||
EventHandler.emitEvents(this.headerEvents, this, { action: false, progress: this.headerProgress, stage: this.isMoveHeader ? "wait" : "touch" })
|
||||
EventHandler.emitEvents(this.footerEvents, this, { action: false, progress: 0, stage: "release" })
|
||||
} else if (offset < 0 && !this.isLockHeader && !this.isLockFooter) {
|
||||
this.footerProgress = -offset < EPSILON ? 0 : -offset / this.footerOutOffset
|
||||
this.isMoveFooter = this.footerProgress >= this.footerMultiple
|
||||
EventHandler.emitEvents(this.footerEvents, this, { action: false, progress: this.footerProgress, stage: this.isMoveFooter ? "wait" : "touch" })
|
||||
EventHandler.emitEvents(this.headerEvents, this, { action: false, progress: 0, stage: "release" })
|
||||
} else if (offset == 0 && !this.isLockHeader && !this.isLockFooter) {
|
||||
this.clearProgress()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected _onTouchEnded(event: EventTouch, captureListeners: any) {
|
||||
this.isCallSoonFinish = false
|
||||
this.isCustomScroll = false
|
||||
if (!this.canTouchMove) return
|
||||
if (this.layout.isPageView) {
|
||||
event.touch!.getUILocation(_tempVec2)
|
||||
Vec2.set(this._touchEndPosition, _tempVec2.x, _tempVec2.y)
|
||||
}
|
||||
super._onTouchEnded(event, captureListeners)
|
||||
if (this.isTransmitEvent) {
|
||||
this.transmitEvent(event, Node.EventType.TOUCH_END)
|
||||
}
|
||||
}
|
||||
protected _onTouchCancelled(event: EventTouch, captureListeners: any) {
|
||||
this.isCallSoonFinish = false
|
||||
this.isCustomScroll = false
|
||||
if (!this.canTouchMove) return
|
||||
if (this.layout.isPageView) {
|
||||
event.touch!.getUILocation(_tempVec2)
|
||||
Vec2.set(this._touchEndPosition, _tempVec2.x, _tempVec2.y)
|
||||
}
|
||||
if (this.isTransmitEvent) {
|
||||
this.transmitEvent(event, Node.EventType.TOUCH_CANCEL)
|
||||
}
|
||||
super._onTouchCancelled(event, captureListeners)
|
||||
}
|
||||
scrollToAny(moveDelta: Vec3, timeInSecond?: number, attenuated: boolean = true) {
|
||||
this.isCustomScroll = true
|
||||
if (timeInSecond) {
|
||||
this._startAutoScroll(moveDelta, timeInSecond, attenuated, true)
|
||||
} else {
|
||||
this._moveContent(moveDelta)
|
||||
}
|
||||
}
|
||||
release() {
|
||||
this.isMoveHeader = false
|
||||
this.isMoveFooter = false
|
||||
if (this.isLockHeader || this.isLockFooter) {
|
||||
this.vertical && this.isLockHeader && (this._topBoundary += this.headerOutOffset)
|
||||
this.vertical && this.isLockFooter && (this._bottomBoundary -= this.footerOutOffset)
|
||||
this.horizontal && this.isLockHeader && (this._leftBoundary -= this.headerOutOffset)
|
||||
this.horizontal && this.isLockFooter && (this._rightBoundary += this.footerOutOffset)
|
||||
this.clearProgress()
|
||||
this.layout["onPositionChanged"]()
|
||||
this.isLockHeader = false
|
||||
this.isLockFooter = false
|
||||
this.startAutoScroll()
|
||||
}
|
||||
}
|
||||
startAutoScroll() {
|
||||
this._autoScrolling = true
|
||||
this._outOfBoundaryAmountDirty = true
|
||||
}
|
||||
protected _startAutoScroll(deltaMove: any, timeInSecond: any, attenuated: any, flag: boolean = false) {
|
||||
if (this.pullRefresh) { // 如果没有刷新/加载的监听者 则不计算
|
||||
if (this.isMoveHeader && !this.isLockHeader) {
|
||||
if (this.vertical) {
|
||||
this._topBoundary -= this.headerOutOffset
|
||||
deltaMove.y -= this.headerOutOffset
|
||||
}
|
||||
if (this.horizontal) {
|
||||
this._leftBoundary += this.headerOutOffset
|
||||
deltaMove.x += this.headerOutOffset
|
||||
}
|
||||
this.isLockHeader = true
|
||||
EventHandler.emitEvents(this.headerEvents, this, { action: true, progress: this.headerProgress, stage: 'lock' })
|
||||
} else if (this.isMoveFooter && !this.isLockFooter) {
|
||||
if (this.vertical) {
|
||||
this._bottomBoundary += this.footerOutOffset
|
||||
deltaMove.y += this.footerOutOffset
|
||||
}
|
||||
if (this.horizontal) {
|
||||
this._rightBoundary -= this.footerOutOffset
|
||||
deltaMove.x -= this.footerOutOffset
|
||||
}
|
||||
this.isLockFooter = true
|
||||
EventHandler.emitEvents(this.footerEvents, this, { action: true, progress: this.footerProgress, stage: 'lock' })
|
||||
}
|
||||
}
|
||||
super._startAutoScroll(deltaMove, timeInSecond, attenuated)
|
||||
if (!flag && this.layout.autoCenter) {
|
||||
const touchMoveVelocity = this._calculateTouchMoveVelocity()
|
||||
if (!this.isQuicklyScrollable(touchMoveVelocity)) {
|
||||
this.soonFinish()
|
||||
}
|
||||
}
|
||||
}
|
||||
protected _updateScrollBar(outOfBoundary: any) {
|
||||
super._updateScrollBar(new Vec2(outOfBoundary.x, outOfBoundary.y))
|
||||
if (this._autoScrollBraking) return // 自动回弹时不计算 (非手动)
|
||||
if (!this._autoScrolling) return // 非自动滚动时不计算
|
||||
if (!this.pullRefresh) return
|
||||
let offset = this.vertical ? outOfBoundary.y : -outOfBoundary.x
|
||||
if (offset > 0) { // 下滑
|
||||
let progress = offset < EPSILON ? 0 : offset / this.headerOutOffset //根据参数 headerOutOffset 计算当前下滑的办百分比
|
||||
if (this.isLockHeader) {
|
||||
this.headerProgress = this.headerProgress == 1 ? this.headerProgress : Math.max(progress, 1)
|
||||
EventHandler.emitEvents(this.headerEvents, this, { action: false, progress: this.headerProgress, stage: "lock" })
|
||||
} else {
|
||||
this.headerProgress = progress < this.headerProgress ? progress : this.headerProgress
|
||||
EventHandler.emitEvents(this.headerEvents, this, { action: false, progress: this.headerProgress, stage: "release" })
|
||||
}
|
||||
} else if (offset < 0) {
|
||||
let progress = -offset < EPSILON ? 0 : -offset / this.footerOutOffset //根据参数 footerOutOffset 计算当前下滑的办百分比
|
||||
if (this.isLockFooter) {
|
||||
this.footerProgress = this.footerProgress == 1 ? this.footerProgress : Math.max(progress, 1)
|
||||
EventHandler.emitEvents(this.footerEvents, this, { action: false, progress: this.footerProgress, stage: "lock" })
|
||||
} else {
|
||||
this.footerProgress = progress < this.footerProgress ? progress : this.footerProgress
|
||||
EventHandler.emitEvents(this.footerEvents, this, { action: false, progress: this.footerProgress, stage: "release" })
|
||||
}
|
||||
} else if (offset == 0) {
|
||||
// 正常滑动时 如果没有锁定头和尾时 释放所有进度
|
||||
if (!this.isLockHeader && !this.isLockFooter) {
|
||||
this.clearProgress()
|
||||
}
|
||||
}
|
||||
}
|
||||
private clearProgress() {
|
||||
EventHandler.emitEvents(this.headerEvents, this, { action: false, progress: 0, stage: "release" })
|
||||
EventHandler.emitEvents(this.footerEvents, this, { action: false, progress: 0, stage: "release" })
|
||||
}
|
||||
private dispatchPageTurningEvent() {
|
||||
if (this.layout["_lastPageIndex"] === this.layout["_currPageIndex"]) return
|
||||
this.layout["_lastPageIndex"] = this.layout["_currPageIndex"]
|
||||
EventHandler.emitEvents(this.layout.pageEvents, this, PageView.EventType.PAGE_TURNING)
|
||||
this.node.emit(PageView.EventType.PAGE_TURNING, this)
|
||||
}
|
||||
|
||||
protected _handleReleaseLogic(touch: any) {
|
||||
if (this.layout.isPageView) {
|
||||
this._autoScrollToPage();
|
||||
if (this._scrolling) {
|
||||
this._scrolling = false;
|
||||
if (!this._autoScrolling) {
|
||||
this._dispatchEvent(ScrollView.EventType.SCROLL_ENDED);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super._handleReleaseLogic(touch)
|
||||
}
|
||||
|
||||
}
|
||||
protected _autoScrollToPage() {
|
||||
const bounceBackStarted = this._startBounceBackIfNeeded();
|
||||
if (bounceBackStarted) {
|
||||
const bounceBackAmount = this._getHowMuchOutOfBoundary()
|
||||
this._clampDelta(bounceBackAmount)
|
||||
if (bounceBackAmount.x > 0 || bounceBackAmount.y < 0) {
|
||||
if (this.layout.horizontal) {
|
||||
if (this.layout.horizontalAxisDirection == SuperLayout.HorizontalAxisDirection.LEFT_TO_RIGHT) {
|
||||
this.layout["_currPageIndex"] = this.layout.itemTotal === 0 ? 0 : this.layout.itemTotal - 1
|
||||
} else {
|
||||
this.layout["_currPageIndex"] = 0
|
||||
}
|
||||
} else {
|
||||
if (this.layout.verticalAxisDirection == SuperLayout.VerticalAxisDirection.TOP_TO_BOTTOM) {
|
||||
this.layout["_currPageIndex"] = this.layout.itemTotal === 0 ? 0 : this.layout.itemTotal - 1
|
||||
} else {
|
||||
this.layout["_currPageIndex"] = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bounceBackAmount.x < 0 || bounceBackAmount.y > 0) {
|
||||
if (this.layout.horizontal) {
|
||||
if (this.layout.horizontalAxisDirection == SuperLayout.HorizontalAxisDirection.LEFT_TO_RIGHT) {
|
||||
this.layout["_currPageIndex"] = 0
|
||||
} else {
|
||||
this.layout["_currPageIndex"] = this.layout.itemTotal === 0 ? 0 : this.layout.itemTotal - 1
|
||||
}
|
||||
} else {
|
||||
if (this.layout.verticalAxisDirection == SuperLayout.VerticalAxisDirection.TOP_TO_BOTTOM) {
|
||||
this.layout["_currPageIndex"] = 0
|
||||
} else {
|
||||
this.layout["_currPageIndex"] = this.layout.itemTotal === 0 ? 0 : this.layout.itemTotal - 1
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.layout.indicator) {
|
||||
this.layout.indicator._changedState()
|
||||
}
|
||||
} else {
|
||||
const moveOffset = new Vec2()
|
||||
Vec2.subtract(moveOffset, this._touchBeganPosition, this._touchEndPosition)
|
||||
const index = this.layout["_currPageIndex"]
|
||||
var nextIndex = index + this.getDragDirection(moveOffset)
|
||||
var timeInSecond = this.layout.pageTurningSpeed * Math.abs(index - nextIndex)
|
||||
if (this.layout.footerLoop) {
|
||||
if (nextIndex >= this.layout.itemTotal) {
|
||||
nextIndex = 0
|
||||
}
|
||||
}
|
||||
if (this.layout.headerLoop) {
|
||||
if (nextIndex < 0) {
|
||||
nextIndex = this.layout.itemTotal - 1
|
||||
}
|
||||
}
|
||||
const count = this.layout.itemTotal
|
||||
if (nextIndex < count) {
|
||||
if (this.isScrollable(moveOffset, index, nextIndex)) {
|
||||
this.scrollToPage(nextIndex, timeInSecond)
|
||||
return;
|
||||
} else {
|
||||
const touchMoveVelocity = this._calculateTouchMoveVelocity()
|
||||
if (this.isQuicklyScrollable(touchMoveVelocity)) {
|
||||
this.scrollToPage(nextIndex, timeInSecond)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.scrollToPage(index, timeInSecond)
|
||||
}
|
||||
}
|
||||
savePageIndex(idx: number) {
|
||||
if (idx < 0 || idx >= this.layout.itemTotal) {
|
||||
return false
|
||||
}
|
||||
this.layout["_currPageIndex"] = idx
|
||||
if (this.layout.indicator) {
|
||||
this.layout.indicator._changedState()
|
||||
}
|
||||
return true
|
||||
}
|
||||
protected scrollToPage(idx: number, timeInSecond = 0.3) {
|
||||
if (idx < 0 || idx >= this.layout.itemTotal) {
|
||||
return
|
||||
}
|
||||
if (this.savePageIndex(idx)) {
|
||||
this.layout.scrollToIndex(idx, timeInSecond)
|
||||
}
|
||||
}
|
||||
// 快速滑动
|
||||
protected isQuicklyScrollable(touchMoveVelocity: Vec3) {
|
||||
if (this.horizontal) {
|
||||
if (Math.abs(touchMoveVelocity.x) > this.layout.autoPageTurningThreshold) {
|
||||
return true;
|
||||
}
|
||||
} else if (this.vertical) {
|
||||
if (Math.abs(touchMoveVelocity.y) > this.layout.autoPageTurningThreshold) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
protected getDragDirection(moveOffset: Vec2) {
|
||||
if (this.horizontal) {
|
||||
if (moveOffset.x === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (this.layout.horizontalAxisDirection == SuperLayout.HorizontalAxisDirection.LEFT_TO_RIGHT) {
|
||||
return (moveOffset.x > 0 ? this.layout.groupItemTotal : -this.layout.groupItemTotal);
|
||||
} else {
|
||||
return (moveOffset.x < 0 ? this.layout.groupItemTotal : -this.layout.groupItemTotal);
|
||||
}
|
||||
} else {
|
||||
// 由于滚动 Y 轴的原点在在右上角所以应该是小于 0
|
||||
if (moveOffset.y === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (this.layout.verticalAxisDirection == SuperLayout.VerticalAxisDirection.TOP_TO_BOTTOM) {
|
||||
return (moveOffset.y < 0 ? this.layout.groupItemTotal : -this.layout.groupItemTotal);
|
||||
} else {
|
||||
return (moveOffset.y > 0 ? this.layout.groupItemTotal : -this.layout.groupItemTotal);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 是否超过自动滚动临界值
|
||||
protected isScrollable(offset: Vec2, index: number, nextIndex: number) {
|
||||
const viewTrans = this.view
|
||||
if (!viewTrans) {
|
||||
return false
|
||||
}
|
||||
if (this.horizontal) {
|
||||
return Math.abs(offset.x) >= viewTrans.width * this.layout.scrollThreshold
|
||||
} else if (this.vertical) {
|
||||
return Math.abs(offset.y) >= viewTrans.height * this.layout.scrollThreshold
|
||||
}
|
||||
return false;
|
||||
}
|
||||
protected transmitEvent(event: EventTouch, eventType: string) {
|
||||
var e = new EventTouch(event.getTouches(), event.bubbles)
|
||||
e.type = eventType
|
||||
e.touch = event.touch
|
||||
let target: any = event.target!
|
||||
target.parent.dispatchEvent(e)
|
||||
}
|
||||
private soonFinish() {
|
||||
this.isCallSoonFinish = true
|
||||
this.layout["soonFinish"]()
|
||||
}
|
||||
/**
|
||||
* 重写此方法 实际上没有任何改动 只是修改了OUT_OF_BOUNDARY_BREAKING_FACTOR 从0.05 改成0.015
|
||||
* 吐槽一下 变量 OUT_OF_BOUNDARY_BREAKING_FACTOR 定义方式
|
||||
*/
|
||||
protected _processAutoScrolling(dt: number) {
|
||||
const isAutoScrollBrake = this._isNecessaryAutoScrollBrake();
|
||||
|
||||
const brakingFactor = isAutoScrollBrake ? OUT_OF_BOUNDARY_BREAKING_FACTOR : 1;
|
||||
this._autoScrollAccumulatedTime += dt * (1 / brakingFactor);
|
||||
let percentage = Math.min(1, this._autoScrollAccumulatedTime / this._autoScrollTotalTime);
|
||||
if (this._autoScrollAttenuate) {
|
||||
percentage = quintEaseOut(percentage);
|
||||
}
|
||||
const clonedAutoScrollTargetDelta = this._autoScrollTargetDelta.clone();
|
||||
clonedAutoScrollTargetDelta.multiplyScalar(percentage);
|
||||
const clonedAutoScrollStartPosition = this._autoScrollStartPosition.clone();
|
||||
clonedAutoScrollStartPosition.add(clonedAutoScrollTargetDelta);
|
||||
let reachedEnd = Math.abs(percentage - 1) <= EPSILON;
|
||||
|
||||
const fireEvent = Math.abs(percentage - 1) <= this.getScrollEndedEventTiming();
|
||||
if (fireEvent && !this._isScrollEndedWithThresholdEventFired) {
|
||||
this._dispatchEvent(ScrollView.EventType.SCROLL_ENG_WITH_THRESHOLD);
|
||||
this._isScrollEndedWithThresholdEventFired = true;
|
||||
}
|
||||
|
||||
if (this.elastic) {
|
||||
const brakeOffsetPosition = clonedAutoScrollStartPosition.clone();
|
||||
brakeOffsetPosition.subtract(this._autoScrollBrakingStartPosition);
|
||||
if (isAutoScrollBrake) {
|
||||
brakeOffsetPosition.multiplyScalar(brakingFactor);
|
||||
}
|
||||
clonedAutoScrollStartPosition.set(this._autoScrollBrakingStartPosition);
|
||||
clonedAutoScrollStartPosition.add(brakeOffsetPosition);
|
||||
} else {
|
||||
const moveDelta = clonedAutoScrollStartPosition.clone();
|
||||
moveDelta.subtract(this.getContentPosition());
|
||||
const outOfBoundary = this._getHowMuchOutOfBoundary(moveDelta);
|
||||
if (!outOfBoundary.equals(Vec3.ZERO, EPSILON)) {
|
||||
clonedAutoScrollStartPosition.add(outOfBoundary);
|
||||
reachedEnd = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (reachedEnd) {
|
||||
this._autoScrolling = false;
|
||||
}
|
||||
|
||||
if (this.layout.autoCenter && !this.isCallSoonFinish && !this.isCustomScroll) {
|
||||
if (this._autoScrollTotalTime < 2 || percentage >= 0.8) {
|
||||
this.soonFinish()
|
||||
}
|
||||
}
|
||||
const deltaMove = clonedAutoScrollStartPosition.clone();
|
||||
deltaMove.subtract(this.getContentPosition());
|
||||
this._clampDelta(deltaMove);
|
||||
this._moveContent(deltaMove, reachedEnd);
|
||||
this._dispatchEvent(ScrollView.EventType.SCROLLING);
|
||||
|
||||
if (!this._autoScrolling) {
|
||||
this._isBouncing = false;
|
||||
this._scrolling = false;
|
||||
this._dispatchEvent(ScrollView.EventType.SCROLL_ENDED);
|
||||
}
|
||||
}
|
||||
}
|
9
assets/core/super-scrollview.ts.meta
Normal file
9
assets/core/super-scrollview.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.22",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "72cf5dbc-6787-4afa-87cd-6263365dfdb6",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
12
assets/prefabs.meta
Normal file
12
assets/prefabs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "aaa1a670-c77e-48d5-8e14-3738d5266460",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
1660
assets/prefabs/chatItem.prefab
Normal file
1660
assets/prefabs/chatItem.prefab
Normal file
File diff suppressed because it is too large
Load Diff
13
assets/prefabs/chatItem.prefab.meta
Normal file
13
assets/prefabs/chatItem.prefab.meta
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.27",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "d78db84e-833b-4941-bf55-816f6f1fdd4c",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "chatItem"
|
||||
}
|
||||
}
|
1312
assets/prefabs/horizontal.prefab
Normal file
1312
assets/prefabs/horizontal.prefab
Normal file
File diff suppressed because it is too large
Load Diff
13
assets/prefabs/horizontal.prefab.meta
Normal file
13
assets/prefabs/horizontal.prefab.meta
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.27",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "59452f19-6f49-40fb-965c-0c4cd0988409",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "horizontal"
|
||||
}
|
||||
}
|
912
assets/prefabs/page-scrollview.prefab
Normal file
912
assets/prefabs/page-scrollview.prefab
Normal file
@ -0,0 +1,912 @@
|
||||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"asyncLoadAssets": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "page-scrollview",
|
||||
"_objFlags": 0,
|
||||
"_parent": null,
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 2
|
||||
},
|
||||
{
|
||||
"__id__": 12
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 39
|
||||
},
|
||||
{
|
||||
"__id__": 41
|
||||
},
|
||||
{
|
||||
"__id__": 43
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 45
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 250,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Label",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 3
|
||||
},
|
||||
{
|
||||
"__id__": 5
|
||||
},
|
||||
{
|
||||
"__id__": 7
|
||||
},
|
||||
{
|
||||
"__id__": 9
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 11
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 50,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 4
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 211.28,
|
||||
"height": 126
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "c68UOAlNhN171Umca6yVvF"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 6
|
||||
},
|
||||
"_visFlags": 0,
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "label",
|
||||
"_horizontalAlign": 1,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 100,
|
||||
"_fontSize": 100,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 100,
|
||||
"_overflow": 0,
|
||||
"_enableWrapText": true,
|
||||
"_font": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_isItalic": false,
|
||||
"_isBold": false,
|
||||
"_isUnderline": false,
|
||||
"_underlineHeight": 2,
|
||||
"_cacheMode": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "2frm37uaJHQr0AEEaYyM82"
|
||||
},
|
||||
{
|
||||
"__type__": "747fcCLlqVGuLwfCV1CjmZm",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 8
|
||||
},
|
||||
"label": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "b1U1qoDzlL/rxXDYZMnbGY"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Widget",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 10
|
||||
},
|
||||
"_alignFlags": 1,
|
||||
"_target": null,
|
||||
"_left": 0,
|
||||
"_right": 0,
|
||||
"_top": -13,
|
||||
"_bottom": 0,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
"_isAbsRight": true,
|
||||
"_isAbsTop": true,
|
||||
"_isAbsBottom": true,
|
||||
"_isAbsHorizontalCenter": true,
|
||||
"_isAbsVerticalCenter": true,
|
||||
"_originalWidth": 0,
|
||||
"_originalHeight": 0,
|
||||
"_alignMode": 2,
|
||||
"_lockFlags": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "471GV6HnxCMb1TyQntdlVA"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "04vHvd4y5JPpd2gnuAAyC5"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "ScrollView",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 13
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 30
|
||||
},
|
||||
{
|
||||
"__id__": 32
|
||||
},
|
||||
{
|
||||
"__id__": 19
|
||||
},
|
||||
{
|
||||
"__id__": 34
|
||||
},
|
||||
{
|
||||
"__id__": 36
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 38
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": -40,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "view",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 14
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 21
|
||||
},
|
||||
{
|
||||
"__id__": 25
|
||||
},
|
||||
{
|
||||
"__id__": 27
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 29
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "content",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 13
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 15
|
||||
},
|
||||
{
|
||||
"__id__": 17
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 24
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -10,
|
||||
"y": 125,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 14
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 16
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 220,
|
||||
"height": 400
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 1
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "99yn0cfL9MmZYfJbPmK9qL"
|
||||
},
|
||||
{
|
||||
"__type__": "4430bdPVstIyrMzuiBW+hni",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 14
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 18
|
||||
},
|
||||
"scrollView": {
|
||||
"__id__": 19
|
||||
},
|
||||
"view": {
|
||||
"__id__": 21
|
||||
},
|
||||
"prefab": {
|
||||
"__uuid__": "5a756b1c-bdd5-478c-a49e-b0bf0ff12dcc",
|
||||
"__expectedType__": "cc.Prefab"
|
||||
},
|
||||
"layoutType": 1,
|
||||
"indexVerticalAxisDirection": 0,
|
||||
"indexHorizontalAxisDirection": 0,
|
||||
"verticalAxisDirection": 0,
|
||||
"horizontalAxisDirection": 0,
|
||||
"groupItemTotal": 1,
|
||||
"multiple": 2,
|
||||
"paddingTop": 10,
|
||||
"paddingBottom": 10,
|
||||
"paddingLeft": 10,
|
||||
"paddingRight": 10,
|
||||
"spacingX": 0,
|
||||
"spacingY": 10,
|
||||
"affectedByScale": false,
|
||||
"isPageView": false,
|
||||
"pageTurningSpeed": 0.3,
|
||||
"scrollThreshold": 0.5,
|
||||
"autoPageTurningThreshold": 100,
|
||||
"pageEvents": [],
|
||||
"autoCenter": false,
|
||||
"centerTime": 1,
|
||||
"centerAnchor": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"headerLoop": false,
|
||||
"footerLoop": false,
|
||||
"refreshItemEvents": [
|
||||
{
|
||||
"__id__": 23
|
||||
}
|
||||
],
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "9aJKbVw8lJdIgiqUwUmkuW"
|
||||
},
|
||||
{
|
||||
"__type__": "72cf528Z4dK+ofNYmM2Xf22",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 20
|
||||
},
|
||||
"bounceDuration": 1,
|
||||
"brake": 0.5,
|
||||
"elastic": true,
|
||||
"inertia": true,
|
||||
"horizontal": false,
|
||||
"vertical": true,
|
||||
"cancelInnerEvents": true,
|
||||
"scrollEvents": [],
|
||||
"_content": {
|
||||
"__id__": 14
|
||||
},
|
||||
"_horizontalScrollBar": null,
|
||||
"_verticalScrollBar": null,
|
||||
"isTransmitEvent": true,
|
||||
"pullRefresh": false,
|
||||
"headerOutOffset": 200,
|
||||
"headerMultiple": 2,
|
||||
"footerOutOffset": 200,
|
||||
"footerMultiple": 2,
|
||||
"headerEvents": [],
|
||||
"footerEvents": [],
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "52BnJbMWxE+7VB6rD6e9Ai"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 13
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 22
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 960,
|
||||
"height": 80
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "adVJjE6iNG9YcIKwDKe/zq"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.ClickEvent",
|
||||
"target": {
|
||||
"__id__": 12
|
||||
},
|
||||
"component": "",
|
||||
"_componentId": "5f170uFuGRCJZCiHTMaOxhs",
|
||||
"handler": "onRefreshEvent",
|
||||
"customEventData": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "f15j+q97FM57c/7voTtH7C"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Mask",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 13
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 26
|
||||
},
|
||||
"_visFlags": 0,
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_type": 0,
|
||||
"_inverted": false,
|
||||
"_segments": 64,
|
||||
"_spriteFrame": null,
|
||||
"_alphaThreshold": 0.1,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "4eIg29oQZFVLk+NZnwDdlk"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Widget",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 13
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 28
|
||||
},
|
||||
"_alignFlags": 45,
|
||||
"_target": null,
|
||||
"_left": 0,
|
||||
"_right": 0,
|
||||
"_top": 0,
|
||||
"_bottom": 0,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
"_isAbsRight": true,
|
||||
"_isAbsTop": true,
|
||||
"_isAbsBottom": true,
|
||||
"_isAbsHorizontalCenter": true,
|
||||
"_isAbsVerticalCenter": true,
|
||||
"_originalWidth": 240,
|
||||
"_originalHeight": 250,
|
||||
"_alignMode": 2,
|
||||
"_lockFlags": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "9eWhbfMqdEgL1s1L4R8iA4"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "7138cbwpRF3JGckzKMnGYA"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 31
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 960,
|
||||
"height": 80
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "71kmounFRG/K27WWBbH2RB"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 33
|
||||
},
|
||||
"_visFlags": 0,
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 26,
|
||||
"g": 34,
|
||||
"b": 44,
|
||||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "b730527c-3233-41c2-aaf7-7cdab58f9749@f9941",
|
||||
"__expectedType__": "cc.SpriteFrame"
|
||||
},
|
||||
"_type": 1,
|
||||
"_fillType": 0,
|
||||
"_sizeMode": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_useGrayscale": false,
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "8ce2Xg/B9GhY0DNafD/vxa"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Widget",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 35
|
||||
},
|
||||
"_alignFlags": 45,
|
||||
"_target": null,
|
||||
"_left": 20,
|
||||
"_right": 20,
|
||||
"_top": 100,
|
||||
"_bottom": 20,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
"_isAbsRight": true,
|
||||
"_isAbsTop": true,
|
||||
"_isAbsBottom": true,
|
||||
"_isAbsHorizontalCenter": true,
|
||||
"_isAbsVerticalCenter": true,
|
||||
"_originalWidth": 240,
|
||||
"_originalHeight": 250,
|
||||
"_alignMode": 2,
|
||||
"_lockFlags": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "5dhz80CvlKao03uguOobI/"
|
||||
},
|
||||
{
|
||||
"__type__": "5f170uFuGRCJZCiHTMaOxhs",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 37
|
||||
},
|
||||
"layout": {
|
||||
"__id__": 17
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "84UUJD+g1G16Hw3UkNwoy4"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "09JySg68tFyLb+hCLJuuQN"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 40
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 1000,
|
||||
"height": 200
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "b5sM9g3kJDEq9eoxtvjd92"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 42
|
||||
},
|
||||
"_visFlags": 0,
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 78,
|
||||
"g": 156,
|
||||
"b": 87,
|
||||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "b730527c-3233-41c2-aaf7-7cdab58f9749@f9941",
|
||||
"__expectedType__": "cc.SpriteFrame"
|
||||
},
|
||||
"_type": 1,
|
||||
"_fillType": 0,
|
||||
"_sizeMode": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_useGrayscale": false,
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "caphIITHFPSpbjE921BKQI"
|
||||
},
|
||||
{
|
||||
"__type__": "747fcCLlqVGuLwfCV1CjmZm",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 44
|
||||
},
|
||||
"label": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "f63zVjUUFEPbBjasAZpcqi"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "5dx8C/N6VInL7ieraLnDy+"
|
||||
}
|
||||
]
|
13
assets/prefabs/page-scrollview.prefab.meta
Normal file
13
assets/prefabs/page-scrollview.prefab.meta
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.27",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "04f0cc66-4df6-4be8-ba1d-548f9ff7161a",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "page-scrollview"
|
||||
}
|
||||
}
|
320
assets/prefabs/page.prefab
Normal file
320
assets/prefabs/page.prefab
Normal file
@ -0,0 +1,320 @@
|
||||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"asyncLoadAssets": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "page",
|
||||
"_objFlags": 0,
|
||||
"_parent": null,
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 2
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 10
|
||||
},
|
||||
{
|
||||
"__id__": 12
|
||||
},
|
||||
{
|
||||
"__id__": 14
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 16
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 250,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Label",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 3
|
||||
},
|
||||
{
|
||||
"__id__": 5
|
||||
},
|
||||
{
|
||||
"__id__": 7
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 9
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 4
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 422.56,
|
||||
"height": 252
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "c68UOAlNhN171Umca6yVvF"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 6
|
||||
},
|
||||
"_visFlags": 0,
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "label",
|
||||
"_horizontalAlign": 1,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 200,
|
||||
"_fontSize": 200,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 200,
|
||||
"_overflow": 0,
|
||||
"_enableWrapText": true,
|
||||
"_font": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_isItalic": false,
|
||||
"_isBold": false,
|
||||
"_isUnderline": false,
|
||||
"_underlineHeight": 2,
|
||||
"_cacheMode": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "2frm37uaJHQr0AEEaYyM82"
|
||||
},
|
||||
{
|
||||
"__type__": "747fcCLlqVGuLwfCV1CjmZm",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 8
|
||||
},
|
||||
"label": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "b1U1qoDzlL/rxXDYZMnbGY"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "04vHvd4y5JPpd2gnuAAyC5"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 11
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 1000,
|
||||
"height": 300
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "b5sM9g3kJDEq9eoxtvjd92"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 13
|
||||
},
|
||||
"_visFlags": 0,
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 78,
|
||||
"g": 156,
|
||||
"b": 87,
|
||||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "b730527c-3233-41c2-aaf7-7cdab58f9749@f9941",
|
||||
"__expectedType__": "cc.SpriteFrame"
|
||||
},
|
||||
"_type": 1,
|
||||
"_fillType": 0,
|
||||
"_sizeMode": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_useGrayscale": false,
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "caphIITHFPSpbjE921BKQI"
|
||||
},
|
||||
{
|
||||
"__type__": "747fcCLlqVGuLwfCV1CjmZm",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 15
|
||||
},
|
||||
"label": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "f63zVjUUFEPbBjasAZpcqi"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "5dx8C/N6VInL7ieraLnDy+"
|
||||
}
|
||||
]
|
13
assets/prefabs/page.prefab.meta
Normal file
13
assets/prefabs/page.prefab.meta
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.27",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "5b7cc66e-729c-4d72-b5cb-3f2df7e2621c",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "page"
|
||||
}
|
||||
}
|
912
assets/prefabs/vertical-page-scrollview.prefab
Normal file
912
assets/prefabs/vertical-page-scrollview.prefab
Normal file
@ -0,0 +1,912 @@
|
||||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"asyncLoadAssets": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "vertical-page-scrollview",
|
||||
"_objFlags": 0,
|
||||
"_parent": null,
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 2
|
||||
},
|
||||
{
|
||||
"__id__": 12
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 39
|
||||
},
|
||||
{
|
||||
"__id__": 41
|
||||
},
|
||||
{
|
||||
"__id__": 43
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 45
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 250,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Label",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 3
|
||||
},
|
||||
{
|
||||
"__id__": 5
|
||||
},
|
||||
{
|
||||
"__id__": 7
|
||||
},
|
||||
{
|
||||
"__id__": 9
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 11
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 247.202,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 4
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 211.28,
|
||||
"height": 126
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "c68UOAlNhN171Umca6yVvF"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 6
|
||||
},
|
||||
"_visFlags": 0,
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "label",
|
||||
"_horizontalAlign": 1,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 100,
|
||||
"_fontSize": 100,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 100,
|
||||
"_overflow": 0,
|
||||
"_enableWrapText": true,
|
||||
"_font": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_isItalic": false,
|
||||
"_isBold": false,
|
||||
"_isUnderline": false,
|
||||
"_underlineHeight": 2,
|
||||
"_cacheMode": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "2frm37uaJHQr0AEEaYyM82"
|
||||
},
|
||||
{
|
||||
"__type__": "747fcCLlqVGuLwfCV1CjmZm",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 8
|
||||
},
|
||||
"label": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "b1U1qoDzlL/rxXDYZMnbGY"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Widget",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 10
|
||||
},
|
||||
"_alignFlags": 1,
|
||||
"_target": null,
|
||||
"_left": 0,
|
||||
"_right": 0,
|
||||
"_top": -10.201999999999984,
|
||||
"_bottom": 0,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
"_isAbsRight": true,
|
||||
"_isAbsTop": true,
|
||||
"_isAbsBottom": true,
|
||||
"_isAbsHorizontalCenter": true,
|
||||
"_isAbsVerticalCenter": true,
|
||||
"_originalWidth": 0,
|
||||
"_originalHeight": 0,
|
||||
"_alignMode": 2,
|
||||
"_lockFlags": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "471GV6HnxCMb1TyQntdlVA"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "04vHvd4y5JPpd2gnuAAyC5"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "ScrollView",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 13
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 30
|
||||
},
|
||||
{
|
||||
"__id__": 32
|
||||
},
|
||||
{
|
||||
"__id__": 19
|
||||
},
|
||||
{
|
||||
"__id__": 34
|
||||
},
|
||||
{
|
||||
"__id__": 36
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 38
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": -40,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "view",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 14
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 21
|
||||
},
|
||||
{
|
||||
"__id__": 25
|
||||
},
|
||||
{
|
||||
"__id__": 27
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 29
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "content",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 13
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 15
|
||||
},
|
||||
{
|
||||
"__id__": 17
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 24
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -10,
|
||||
"y": 125,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 14
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 16
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 220,
|
||||
"height": 400
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 1
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "99yn0cfL9MmZYfJbPmK9qL"
|
||||
},
|
||||
{
|
||||
"__type__": "4430bdPVstIyrMzuiBW+hni",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 14
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 18
|
||||
},
|
||||
"scrollView": {
|
||||
"__id__": 19
|
||||
},
|
||||
"view": {
|
||||
"__id__": 21
|
||||
},
|
||||
"prefab": {
|
||||
"__uuid__": "59452f19-6f49-40fb-965c-0c4cd0988409",
|
||||
"__expectedType__": "cc.Prefab"
|
||||
},
|
||||
"layoutType": 0,
|
||||
"indexVerticalAxisDirection": 0,
|
||||
"indexHorizontalAxisDirection": 0,
|
||||
"verticalAxisDirection": 0,
|
||||
"horizontalAxisDirection": 0,
|
||||
"groupItemTotal": 1,
|
||||
"multiple": 2,
|
||||
"paddingTop": 10,
|
||||
"paddingBottom": 10,
|
||||
"paddingLeft": 10,
|
||||
"paddingRight": 10,
|
||||
"spacingX": 10,
|
||||
"spacingY": 0,
|
||||
"affectedByScale": false,
|
||||
"isPageView": false,
|
||||
"pageTurningSpeed": 0.3,
|
||||
"scrollThreshold": 0.5,
|
||||
"autoPageTurningThreshold": 100,
|
||||
"pageEvents": [],
|
||||
"autoCenter": false,
|
||||
"centerTime": 1,
|
||||
"centerAnchor": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"headerLoop": false,
|
||||
"footerLoop": false,
|
||||
"refreshItemEvents": [
|
||||
{
|
||||
"__id__": 23
|
||||
}
|
||||
],
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "9aJKbVw8lJdIgiqUwUmkuW"
|
||||
},
|
||||
{
|
||||
"__type__": "72cf528Z4dK+ofNYmM2Xf22",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 20
|
||||
},
|
||||
"bounceDuration": 1,
|
||||
"brake": 0.5,
|
||||
"elastic": true,
|
||||
"inertia": true,
|
||||
"horizontal": true,
|
||||
"vertical": false,
|
||||
"cancelInnerEvents": true,
|
||||
"scrollEvents": [],
|
||||
"_content": {
|
||||
"__id__": 14
|
||||
},
|
||||
"_horizontalScrollBar": null,
|
||||
"_verticalScrollBar": null,
|
||||
"isTransmitEvent": true,
|
||||
"pullRefresh": false,
|
||||
"headerOutOffset": 200,
|
||||
"headerMultiple": 2,
|
||||
"footerOutOffset": 200,
|
||||
"footerMultiple": 2,
|
||||
"headerEvents": [],
|
||||
"footerEvents": [],
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "52BnJbMWxE+7VB6rD6e9Ai"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 13
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 22
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 960,
|
||||
"height": 80
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "adVJjE6iNG9YcIKwDKe/zq"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.ClickEvent",
|
||||
"target": {
|
||||
"__id__": 12
|
||||
},
|
||||
"component": "",
|
||||
"_componentId": "5f170uFuGRCJZCiHTMaOxhs",
|
||||
"handler": "onRefreshEvent",
|
||||
"customEventData": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "f15j+q97FM57c/7voTtH7C"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Mask",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 13
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 26
|
||||
},
|
||||
"_visFlags": 0,
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_type": 0,
|
||||
"_inverted": false,
|
||||
"_segments": 64,
|
||||
"_spriteFrame": null,
|
||||
"_alphaThreshold": 0.1,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "4eIg29oQZFVLk+NZnwDdlk"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Widget",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 13
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 28
|
||||
},
|
||||
"_alignFlags": 45,
|
||||
"_target": null,
|
||||
"_left": 0,
|
||||
"_right": 0,
|
||||
"_top": 0,
|
||||
"_bottom": 0,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
"_isAbsRight": true,
|
||||
"_isAbsTop": true,
|
||||
"_isAbsBottom": true,
|
||||
"_isAbsHorizontalCenter": true,
|
||||
"_isAbsVerticalCenter": true,
|
||||
"_originalWidth": 240,
|
||||
"_originalHeight": 250,
|
||||
"_alignMode": 2,
|
||||
"_lockFlags": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "9eWhbfMqdEgL1s1L4R8iA4"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "7138cbwpRF3JGckzKMnGYA"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 31
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 460,
|
||||
"height": 480
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "71kmounFRG/K27WWBbH2RB"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 33
|
||||
},
|
||||
"_visFlags": 0,
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 26,
|
||||
"g": 34,
|
||||
"b": 44,
|
||||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "b730527c-3233-41c2-aaf7-7cdab58f9749@f9941",
|
||||
"__expectedType__": "cc.SpriteFrame"
|
||||
},
|
||||
"_type": 1,
|
||||
"_fillType": 0,
|
||||
"_sizeMode": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_useGrayscale": false,
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "8ce2Xg/B9GhY0DNafD/vxa"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Widget",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 35
|
||||
},
|
||||
"_alignFlags": 45,
|
||||
"_target": null,
|
||||
"_left": 20,
|
||||
"_right": 20,
|
||||
"_top": 100,
|
||||
"_bottom": 20,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
"_isAbsRight": true,
|
||||
"_isAbsTop": true,
|
||||
"_isAbsBottom": true,
|
||||
"_isAbsHorizontalCenter": true,
|
||||
"_isAbsVerticalCenter": true,
|
||||
"_originalWidth": 240,
|
||||
"_originalHeight": 250,
|
||||
"_alignMode": 2,
|
||||
"_lockFlags": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "5dhz80CvlKao03uguOobI/"
|
||||
},
|
||||
{
|
||||
"__type__": "5f170uFuGRCJZCiHTMaOxhs",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 37
|
||||
},
|
||||
"layout": {
|
||||
"__id__": 17
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "84UUJD+g1G16Hw3UkNwoy4"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "09JySg68tFyLb+hCLJuuQN"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 40
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 500,
|
||||
"height": 600
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "b5sM9g3kJDEq9eoxtvjd92"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 42
|
||||
},
|
||||
"_visFlags": 0,
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 78,
|
||||
"g": 156,
|
||||
"b": 87,
|
||||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "b730527c-3233-41c2-aaf7-7cdab58f9749@f9941",
|
||||
"__expectedType__": "cc.SpriteFrame"
|
||||
},
|
||||
"_type": 1,
|
||||
"_fillType": 0,
|
||||
"_sizeMode": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_useGrayscale": false,
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "caphIITHFPSpbjE921BKQI"
|
||||
},
|
||||
{
|
||||
"__type__": "747fcCLlqVGuLwfCV1CjmZm",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 44
|
||||
},
|
||||
"label": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "f63zVjUUFEPbBjasAZpcqi"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "5dx8C/N6VInL7ieraLnDy+"
|
||||
}
|
||||
]
|
13
assets/prefabs/vertical-page-scrollview.prefab.meta
Normal file
13
assets/prefabs/vertical-page-scrollview.prefab.meta
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.27",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "c889dfe5-6b6d-47c2-bfe3-4d4c6f4c3879",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "vertical-page-scrollview"
|
||||
}
|
||||
}
|
1312
assets/prefabs/vertical.prefab
Normal file
1312
assets/prefabs/vertical.prefab
Normal file
File diff suppressed because it is too large
Load Diff
13
assets/prefabs/vertical.prefab.meta
Normal file
13
assets/prefabs/vertical.prefab.meta
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.27",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "5a756b1c-bdd5-478c-a49e-b0bf0ff12dcc",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "vertical"
|
||||
}
|
||||
}
|
12
assets/scenes.meta
Normal file
12
assets/scenes.meta
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "73ff6884-c3a2-4441-996c-7d485b0d2c0a",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
BIN
assets/scenes/.DS_Store
vendored
Normal file
BIN
assets/scenes/.DS_Store
vendored
Normal file
Binary file not shown.
12
assets/scenes/horizontal.meta
Normal file
12
assets/scenes/horizontal.meta
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "5eaffaa6-0ee8-450f-9527-946c4de6980b",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
4374
assets/scenes/horizontal/horizontal-auto-center-grid.scene
Normal file
4374
assets/scenes/horizontal/horizontal-auto-center-grid.scene
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
||||
{"ver":"1.1.27","importer":"scene","imported":true,"uuid":"051c4e18-1275-42de-9e37-580638774d36","files":[".json"],"subMetas":{},"userData":{}}
|
4374
assets/scenes/horizontal/horizontal-auto-center.scene
Normal file
4374
assets/scenes/horizontal/horizontal-auto-center.scene
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
||||
{"ver":"1.1.27","importer":"scene","imported":true,"uuid":"fc3d68bf-5526-44cc-adc0-82c9d4b41f26","files":[".json"],"subMetas":{},"userData":{}}
|
3635
assets/scenes/horizontal/horizontal-loop-grid.scene
Normal file
3635
assets/scenes/horizontal/horizontal-loop-grid.scene
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/scenes/horizontal/horizontal-loop-grid.scene.meta
Normal file
1
assets/scenes/horizontal/horizontal-loop-grid.scene.meta
Normal file
@ -0,0 +1 @@
|
||||
{"ver":"1.1.27","importer":"scene","imported":true,"uuid":"9fc8fe25-7fd3-481c-a6f3-47ce8874142c","files":[".json"],"subMetas":{},"userData":{}}
|
3635
assets/scenes/horizontal/horizontal-loop.scene
Normal file
3635
assets/scenes/horizontal/horizontal-loop.scene
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/scenes/horizontal/horizontal-loop.scene.meta
Normal file
1
assets/scenes/horizontal/horizontal-loop.scene.meta
Normal file
@ -0,0 +1 @@
|
||||
{"ver":"1.1.27","importer":"scene","imported":true,"uuid":"f92c1cb8-5ae7-4287-aea2-ee456f375152","files":[".json"],"subMetas":{},"userData":{}}
|
3774
assets/scenes/horizontal/horizontal-page-scrollview.scene
Normal file
3774
assets/scenes/horizontal/horizontal-page-scrollview.scene
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
||||
{"ver":"1.1.27","importer":"scene","imported":true,"uuid":"c9590421-e9c2-47d5-8b22-2803c0a47115","files":[".json"],"subMetas":{},"userData":{}}
|
3742
assets/scenes/horizontal/horizontal-page.scene
Normal file
3742
assets/scenes/horizontal/horizontal-page.scene
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/scenes/horizontal/horizontal-page.scene.meta
Normal file
1
assets/scenes/horizontal/horizontal-page.scene.meta
Normal file
@ -0,0 +1 @@
|
||||
{"ver":"1.1.27","importer":"scene","imported":true,"uuid":"66b03c1a-65a3-41ad-9901-db60208f9a2e","files":[".json"],"subMetas":{},"userData":{}}
|
5394
assets/scenes/main.scene
Normal file
5394
assets/scenes/main.scene
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/scenes/main.scene.meta
Normal file
1
assets/scenes/main.scene.meta
Normal file
@ -0,0 +1 @@
|
||||
{"ver":"1.1.27","importer":"scene","imported":true,"uuid":"d632b43c-2698-49f7-aadd-4bb08f9f189a","files":[".json"],"subMetas":{},"userData":{}}
|
12
assets/scenes/vertical.meta
Normal file
12
assets/scenes/vertical.meta
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "6d994c7e-a72a-4c04-8ff3-bd945a0eeb8c",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
4374
assets/scenes/vertical/vertical-auto-center-grid.scene
Normal file
4374
assets/scenes/vertical/vertical-auto-center-grid.scene
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
||||
{"ver":"1.1.27","importer":"scene","imported":true,"uuid":"41b73afe-edc4-49c1-ab35-a0f626db4b75","files":[".json"],"subMetas":{},"userData":{}}
|
4374
assets/scenes/vertical/vertical-auto-center.scene
Normal file
4374
assets/scenes/vertical/vertical-auto-center.scene
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/scenes/vertical/vertical-auto-center.scene.meta
Normal file
1
assets/scenes/vertical/vertical-auto-center.scene.meta
Normal file
@ -0,0 +1 @@
|
||||
{"ver":"1.1.27","importer":"scene","imported":true,"uuid":"fa64fa10-cf94-4140-b3b1-c5e52e34e88d","files":[".json"],"subMetas":{},"userData":{}}
|
1795
assets/scenes/vertical/vertical-chat.scene
Normal file
1795
assets/scenes/vertical/vertical-chat.scene
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/scenes/vertical/vertical-chat.scene.meta
Normal file
1
assets/scenes/vertical/vertical-chat.scene.meta
Normal file
@ -0,0 +1 @@
|
||||
{"ver":"1.1.27","importer":"scene","imported":true,"uuid":"10496c8f-346e-453b-a1fe-7f75b45fac68","files":[".json"],"subMetas":{},"userData":{}}
|
3635
assets/scenes/vertical/vertical-loop-grid.scene
Normal file
3635
assets/scenes/vertical/vertical-loop-grid.scene
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/scenes/vertical/vertical-loop-grid.scene.meta
Normal file
1
assets/scenes/vertical/vertical-loop-grid.scene.meta
Normal file
@ -0,0 +1 @@
|
||||
{"ver":"1.1.27","importer":"scene","imported":true,"uuid":"b567d910-611b-4b3c-9906-b676d2992233","files":[".json"],"subMetas":{},"userData":{}}
|
3677
assets/scenes/vertical/vertical-loop.scene
Normal file
3677
assets/scenes/vertical/vertical-loop.scene
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/scenes/vertical/vertical-loop.scene.meta
Normal file
1
assets/scenes/vertical/vertical-loop.scene.meta
Normal file
@ -0,0 +1 @@
|
||||
{"ver":"1.1.27","importer":"scene","imported":true,"uuid":"b752f9a8-c9cb-45de-b4dd-9a7c0b8906f7","files":[".json"],"subMetas":{},"userData":{}}
|
3774
assets/scenes/vertical/vertical-page-scrollview.scene
Normal file
3774
assets/scenes/vertical/vertical-page-scrollview.scene
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
||||
{"ver":"1.1.27","importer":"scene","imported":true,"uuid":"2ddf6347-6e76-48ec-be25-2d2161a3589f","files":[".json"],"subMetas":{},"userData":{}}
|
3576
assets/scenes/vertical/vertical-refresh-load-grid.scene
Normal file
3576
assets/scenes/vertical/vertical-refresh-load-grid.scene
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
||||
{"ver":"1.1.27","importer":"scene","imported":true,"uuid":"41250b95-8bc5-4b50-9298-d57736bc6f62","files":[".json"],"subMetas":{},"userData":{}}
|
3576
assets/scenes/vertical/vertical-refresh-load.scene
Normal file
3576
assets/scenes/vertical/vertical-refresh-load.scene
Normal file
File diff suppressed because it is too large
Load Diff
11
assets/scenes/vertical/vertical-refresh-load.scene.meta
Normal file
11
assets/scenes/vertical/vertical-refresh-load.scene.meta
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"ver": "1.1.27",
|
||||
"importer": "scene",
|
||||
"imported": true,
|
||||
"uuid": "324a4fd5-1faa-452d-abf7-204c4866d1a3",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
12
assets/scripts.meta
Normal file
12
assets/scripts.meta
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "cf65e955-f242-4294-8a14-f875e66e246c",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
20
assets/scripts/auto-center.ts
Normal file
20
assets/scripts/auto-center.ts
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
import { _decorator, Component, Node, EditBox, Label } from 'cc';
|
||||
import { Simple } from './simple';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('AutoCenter')
|
||||
export class AutoCenter extends Simple {
|
||||
@property(Label) label!: Label
|
||||
@property key: string = ""
|
||||
start() {
|
||||
this.label.string = `当前中心锚点:${(this.layout.centerAnchor as any)[this.key]}`
|
||||
}
|
||||
onInputAnchor(event: EditBox) {
|
||||
let anchor = Number(event.string)
|
||||
if (isNaN(anchor)) return
|
||||
(this.layout.centerAnchor as any)[this.key] = anchor
|
||||
this.layout.scrollToCenter()
|
||||
this.label.string = `当前中心锚点:${(this.layout.centerAnchor as any)[this.key]}`
|
||||
}
|
||||
}
|
9
assets/scripts/auto-center.ts.meta
Normal file
9
assets/scripts/auto-center.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.22",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "4c92cb3b-cfaf-47d6-8875-9ea25f168a16",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
41
assets/scripts/baseItem.ts
Normal file
41
assets/scripts/baseItem.ts
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
import { _decorator, Component, Node, Label, EditBox, Size, math } from 'cc';
|
||||
import { SuperLayout } from '../core/super-layout';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('BaseItem')
|
||||
export class BaseItem extends Component {
|
||||
@property(Label) label!: Label
|
||||
@property(EditBox) input!: EditBox
|
||||
layout: SuperLayout = null!
|
||||
private index!: number
|
||||
private clickFunc!: Function
|
||||
get transform() {
|
||||
return this.node._uiProps.uiTransformComp
|
||||
}
|
||||
show(data: any, index: number, callback: Function, layout: SuperLayout) {
|
||||
this.index = index
|
||||
this.label.string = data.message
|
||||
this.clickFunc = callback
|
||||
this.layout = layout
|
||||
|
||||
}
|
||||
onClick() {
|
||||
this.clickFunc?.call(this, this.index)
|
||||
}
|
||||
|
||||
onInput() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* [1] Class member could be defined like this.
|
||||
* [2] Use `property` decorator if your want the member to be serializable.
|
||||
* [3] Your initialization goes here.
|
||||
* [4] Your update function goes here.
|
||||
*
|
||||
* Learn more about scripting: https://docs.cocos.com/creator/3.0/manual/en/scripting/
|
||||
* Learn more about CCClass: https://docs.cocos.com/creator/3.0/manual/en/scripting/ccclass.html
|
||||
* Learn more about life-cycle callbacks: https://docs.cocos.com/creator/3.0/manual/en/scripting/life-cycle-callbacks.html
|
||||
*/
|
9
assets/scripts/baseItem.ts.meta
Normal file
9
assets/scripts/baseItem.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.22",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "747fc08b-96a5-46b8-bc1f-095d428e6666",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
46
assets/scripts/baseMain.ts
Normal file
46
assets/scripts/baseMain.ts
Normal file
@ -0,0 +1,46 @@
|
||||
|
||||
import { _decorator, Component, Node, EditBox, director } from 'cc';
|
||||
import { SuperLayout } from '../core/super-layout';
|
||||
import { BaseItem } from './baseItem';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('BaseMain')
|
||||
export class BaseMain extends Component {
|
||||
@property(SuperLayout) layout!: SuperLayout
|
||||
@property(EditBox) input!: EditBox
|
||||
protected datas: any[] = []
|
||||
|
||||
toHeader() {
|
||||
this.layout.scrollToHeader(1)
|
||||
}
|
||||
toFooter() {
|
||||
this.layout.scrollToFooter(1)
|
||||
}
|
||||
toIndex() {
|
||||
var index = Number(this.input.string)
|
||||
if (isNaN(index)) return
|
||||
this.layout.scrollToIndex(index, 1)
|
||||
}
|
||||
toBack() {
|
||||
director.loadScene("main")
|
||||
}
|
||||
|
||||
onRefreshEvent(item: Node, index: number) {
|
||||
if (!this.datas[index]) {
|
||||
console.error(index, this.datas)
|
||||
}
|
||||
item.getComponent(BaseItem)?.show(this.datas[index], index, this.onClickItem.bind(this), this.layout)
|
||||
}
|
||||
onClickItem(index: number) {
|
||||
this.datas.splice(index, 1)
|
||||
this.layout.total(this.datas.length)
|
||||
}
|
||||
addItem(event: any, args: any) {
|
||||
let count = Number(args)
|
||||
if (isNaN(count)) return
|
||||
for (let i = 0; i < count; i++) {
|
||||
this.datas.push({ message: this.datas.length })
|
||||
}
|
||||
this.layout.total(this.datas.length)
|
||||
}
|
||||
}
|
9
assets/scripts/baseMain.ts.meta
Normal file
9
assets/scripts/baseMain.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.22",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "d886e837-709b-4aa0-93b3-3b8b04247059",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
39
assets/scripts/chat-item.ts
Normal file
39
assets/scripts/chat-item.ts
Normal file
@ -0,0 +1,39 @@
|
||||
|
||||
import { _decorator, Component, Node, Sprite, Label, Size, Overflow, Widget } from 'cc';
|
||||
import { SuperLayout } from '../core/super-layout';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('ChatItem')
|
||||
export class ChatItem extends Component {
|
||||
@property(Node) me: Node = null!
|
||||
@property(Node) other: Node = null!
|
||||
get transform() { return this.node._uiProps.uiTransformComp! }
|
||||
start() {
|
||||
|
||||
}
|
||||
show(data: any, index: number, layout: SuperLayout) {
|
||||
var obj: Node = data.me ? this.me : this.other
|
||||
this.me.active = data.me
|
||||
this.other.active = !data.me
|
||||
var background: Sprite = obj.getChildByName("background")?.getComponent(Sprite)!
|
||||
var label: Label = background.node.getChildByName("label")?.getComponent(Label)!
|
||||
label.string = data.msg
|
||||
label.updateRenderData(true)
|
||||
var labelTrans = label.node._uiProps.uiTransformComp!
|
||||
var backgroundTrans = background.node._uiProps.uiTransformComp!
|
||||
if (labelTrans.width > this.transform.width - 150) {
|
||||
labelTrans.width = this.transform.width - 150
|
||||
label.overflow = Overflow.RESIZE_HEIGHT
|
||||
} else {
|
||||
label.overflow = Overflow.NONE
|
||||
}
|
||||
label.updateRenderData(true)
|
||||
|
||||
backgroundTrans.width = labelTrans.width + 20
|
||||
backgroundTrans.height = labelTrans.height + 10
|
||||
this.transform.height = backgroundTrans.height
|
||||
layout.updateItemSize(this.node, this.transform.contentSize)
|
||||
obj.getComponent(Widget)?.updateAlignment()
|
||||
}
|
||||
}
|
||||
|
9
assets/scripts/chat-item.ts.meta
Normal file
9
assets/scripts/chat-item.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.22",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "d1bf53c6-4f06-43c6-a4e5-f62182eadc61",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
37
assets/scripts/chat.ts
Normal file
37
assets/scripts/chat.ts
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
import { _decorator, Component, Node, EditBox } from 'cc';
|
||||
import { SuperLayout } from '../core/super-layout';
|
||||
import { ChatItem } from './chat-item';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('Chat')
|
||||
export class Chat extends Component {
|
||||
@property(SuperLayout) layout!: SuperLayout
|
||||
@property(EditBox) input!: EditBox
|
||||
|
||||
private datas: any[] = []
|
||||
onLoad() {
|
||||
|
||||
}
|
||||
onSend() {
|
||||
if (!this.input.string) return
|
||||
var msg = this.input.string
|
||||
this.sendMsg(true, msg)
|
||||
this.unscheduleAllCallbacks()
|
||||
this.scheduleOnce(() => {
|
||||
this.sendMsg(false, msg)
|
||||
}, 1)
|
||||
this.input.string = ""
|
||||
}
|
||||
sendMsg(me: boolean, msg: string) {
|
||||
this.datas.push({
|
||||
me: me,
|
||||
msg: msg
|
||||
})
|
||||
this.layout.total(this.datas.length)
|
||||
this.layout.scrollToFooter(0.2)
|
||||
}
|
||||
onRefreshEvent(item: Node, index: number) {
|
||||
item.getComponent(ChatItem)?.show(this.datas[index], index, this.layout)
|
||||
}
|
||||
}
|
9
assets/scripts/chat.ts.meta
Normal file
9
assets/scripts/chat.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.22",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "ae913d5c-ef10-49cc-82ec-cc20bd549147",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
37
assets/scripts/horizontal.ts
Normal file
37
assets/scripts/horizontal.ts
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
import { _decorator, Component, Node, Size } from 'cc';
|
||||
import { BaseItem } from './baseItem';
|
||||
import { SuperLayout } from '../core/super-layout';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('Horizontal')
|
||||
export class Horizontal extends BaseItem {
|
||||
onLoad() {
|
||||
this.input.placeholder = this.transform?.width.toString()!
|
||||
}
|
||||
onInput() {
|
||||
let width = Number(this.input.string)
|
||||
if (isNaN(width)) return
|
||||
if (width < 100) {
|
||||
return
|
||||
}
|
||||
this.transform?.setContentSize(new Size(Number(this.input.string), this.transform.contentSize.height))
|
||||
this.layout.updateItemSize(this.node, this.transform?.contentSize!)
|
||||
}
|
||||
show(data: any, index: number, callback: Function, layout: SuperLayout) {
|
||||
super.show(data, index, callback, layout)
|
||||
var time = Math.random() * 2
|
||||
// const width = Math.random() * 200 + 100
|
||||
var scale = Math.random()
|
||||
scale = Math.max(0.5, scale)
|
||||
scale = Math.min(2, scale)
|
||||
const width = index % 2 == 0 ? 100 : 150
|
||||
const size = new Size(width, this.transform?.height)
|
||||
// this.unscheduleAllCallbacks()
|
||||
// this.scheduleOnce(() => {
|
||||
// this.transform?.setContentSize(size)
|
||||
// }, time)
|
||||
// this.transform?.setContentSize(size)
|
||||
// layout.updateItemSize(this.node, size)
|
||||
}
|
||||
}
|
9
assets/scripts/horizontal.ts.meta
Normal file
9
assets/scripts/horizontal.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.22",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "a3055143-44df-4d77-8843-e8fe7975540d",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
22
assets/scripts/main.ts
Normal file
22
assets/scripts/main.ts
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
import { _decorator, Component, Node, director } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('Main')
|
||||
export class Main extends Component {
|
||||
|
||||
toScene(event:any,args:string){
|
||||
director.loadScene(args)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* [1] Class member could be defined like this.
|
||||
* [2] Use `property` decorator if your want the member to be serializable.
|
||||
* [3] Your initialization goes here.
|
||||
* [4] Your update function goes here.
|
||||
*
|
||||
* Learn more about scripting: https://docs.cocos.com/creator/3.0/manual/en/scripting/
|
||||
* Learn more about CCClass: https://docs.cocos.com/creator/3.0/manual/en/scripting/ccclass.html
|
||||
* Learn more about life-cycle callbacks: https://docs.cocos.com/creator/3.0/manual/en/scripting/life-cycle-callbacks.html
|
||||
*/
|
9
assets/scripts/main.ts.meta
Normal file
9
assets/scripts/main.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.22",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "9ec2ba6a-c457-453a-a456-61e08dfc9e50",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
28
assets/scripts/page.ts
Normal file
28
assets/scripts/page.ts
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { BaseItem } from './baseItem';
|
||||
import { SuperLayout } from '../core/super-layout';
|
||||
import { BaseMain } from './baseMain';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('Page')
|
||||
export class Page extends BaseMain {
|
||||
@property(SuperLayout) layout!: SuperLayout
|
||||
start() {
|
||||
for (let i = 0; i < 8; i++) {
|
||||
this.datas.push({
|
||||
message: i
|
||||
})
|
||||
}
|
||||
this.layout.total(this.datas.length)
|
||||
}
|
||||
onRefreshEvent(item: Node, index: number) {
|
||||
item.getComponent(BaseItem)?.show(this.datas[index], index, this.onClickItem.bind(this))
|
||||
}
|
||||
onClickItem() {
|
||||
}
|
||||
|
||||
onPageEvent(event: any) {
|
||||
console.error(this.layout.currPageIndex)
|
||||
}
|
||||
}
|
9
assets/scripts/page.ts.meta
Normal file
9
assets/scripts/page.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.22",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "b9acb047-de7c-4339-adee-64c0aa94a22a",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
92
assets/scripts/refresh-load.ts
Normal file
92
assets/scripts/refresh-load.ts
Normal file
@ -0,0 +1,92 @@
|
||||
|
||||
import { _decorator, Node, Tween, Vec3, Label } from 'cc';
|
||||
import { BaseMain } from './baseMain';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('RefreshLoad')
|
||||
export class RefreshLoad extends BaseMain {
|
||||
@property(Node) header!: Node
|
||||
@property(Node) footer!: Node
|
||||
onLoad() {
|
||||
this.header.setScale(new Vec3(1, 0, 1))
|
||||
this.footer.setScale(new Vec3(1, 0, 1))
|
||||
}
|
||||
|
||||
private headerTween!: Tween<Node>
|
||||
private footerTween!: Tween<Node>
|
||||
onHeader(scrollView: any, event: any) {
|
||||
if (event.progress > 2) {
|
||||
if (!(this.header as any)['playing']) {
|
||||
this.headerTween = new Tween(this.header!);
|
||||
this.headerTween.to(0.518, {
|
||||
scale: new Vec3(1, 1, 1),
|
||||
}, {
|
||||
easing: "elasticOut"
|
||||
});
|
||||
this.headerTween.start();
|
||||
(this.header as any)['playing'] = true
|
||||
}
|
||||
} else {
|
||||
this.headerTween?.stop();
|
||||
(this.header as any)['playing'] = false
|
||||
this.header.setScale(new Vec3(1, event.progress, 1))
|
||||
}
|
||||
|
||||
let label = this.header.getComponentInChildren(Label)!
|
||||
if (event.stage == "touch") {
|
||||
label.string = "↓ 继续下拉"
|
||||
}
|
||||
if (event.stage == "wait") {
|
||||
label.string = "↑ 松开刷新"
|
||||
}
|
||||
if (event.stage == "lock") {
|
||||
label.string = this.datas.length == 0 ? "没有数据" : "刷新中..."
|
||||
}
|
||||
if (event.stage == 'release') {
|
||||
label.string = ""
|
||||
}
|
||||
if (event.action) {
|
||||
this.scheduleOnce(() => this.layout.total(this.datas.length), 1)
|
||||
}
|
||||
}
|
||||
onFooter(scrollView: any, event: any) {
|
||||
if (event.progress > 2) {
|
||||
if (!(this.footer as any)['playing']) {
|
||||
this.footerTween = new Tween(this.footer!);
|
||||
this.footerTween.to(0.518, {
|
||||
scale: new Vec3(1, 1, 1),
|
||||
}, {
|
||||
easing: "elasticOut"
|
||||
});
|
||||
this.footerTween.start();
|
||||
(this.footer as any)['playing'] = true
|
||||
}
|
||||
} else {
|
||||
this.footerTween?.stop();
|
||||
(this.footer as any)['playing'] = false
|
||||
this.footer.setScale(new Vec3(1, event.progress, 1))
|
||||
}
|
||||
|
||||
let label = this.footer.getComponentInChildren(Label)!
|
||||
if (event.stage == "touch") {
|
||||
label.string = "↑ 继续上拉"
|
||||
}
|
||||
if (event.stage == "wait") {
|
||||
label.string = "↓ 松开加载"
|
||||
}
|
||||
if (event.stage == "lock") {
|
||||
label.string = "加载中..."
|
||||
}
|
||||
if (event.stage == 'release') {
|
||||
label.string = ""
|
||||
}
|
||||
if (event.action) {
|
||||
for (let i = 0; i < 6; i++) {
|
||||
this.datas.push({
|
||||
message: `${this.datas.length}`
|
||||
})
|
||||
}
|
||||
this.scheduleOnce(() => this.layout.total(this.datas.length), 1)
|
||||
}
|
||||
}
|
||||
}
|
9
assets/scripts/refresh-load.ts.meta
Normal file
9
assets/scripts/refresh-load.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.22",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "89a5c43f-a817-4468-b172-8adfec9cca6f",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
19
assets/scripts/simple.ts
Normal file
19
assets/scripts/simple.ts
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import { BaseMain } from './baseMain';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('Simple')
|
||||
export class Simple extends BaseMain {
|
||||
|
||||
async onLoad() {
|
||||
for (let i = 0; i < 20; i++) {
|
||||
this.datas.push({ message: i })
|
||||
}
|
||||
this.layout.total(this.datas.length)
|
||||
// 如果你是动态修改尺寸时 需要下一帧执行滚动
|
||||
this.scheduleOnce(() => {
|
||||
this.layout.scrollToHeader(1)
|
||||
})
|
||||
}
|
||||
}
|
9
assets/scripts/simple.ts.meta
Normal file
9
assets/scripts/simple.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.22",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "5f170b85-b864-4225-90a2-1d331a3b186c",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
37
assets/scripts/vertical.ts
Normal file
37
assets/scripts/vertical.ts
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
import { _decorator, Component, Node, Label, EditBox, Size } from 'cc';
|
||||
import { BaseItem } from './baseItem';
|
||||
import { SuperLayout } from '../core/super-layout';
|
||||
const { ccclass, property } = _decorator;
|
||||
@ccclass('Vertical')
|
||||
export class Vertical extends BaseItem {
|
||||
onLoad() {
|
||||
this.input.placeholder = this.transform?.height.toString()!
|
||||
}
|
||||
onInput() {
|
||||
let height = Number(this.input.string)
|
||||
if (isNaN(height)) return
|
||||
if (height < 100) {
|
||||
return
|
||||
}
|
||||
this.transform?.setContentSize(new Size(this.transform.contentSize.width, height))
|
||||
this.layout.updateItemSize(this.node, this.transform?.contentSize!)
|
||||
}
|
||||
show(data: any, index: number, callback: Function, layout: SuperLayout) {
|
||||
super.show(data, index, callback, layout)
|
||||
var time = Math.random() * 2
|
||||
// const height = Math.random() * 200 + 100
|
||||
var scale = Math.random()
|
||||
scale = Math.max(0.5, scale)
|
||||
scale = Math.min(2, scale)
|
||||
const height = index % 2 == 0 ? 100 : 150
|
||||
const size = new Size(this.transform?.width, height)
|
||||
// this.unscheduleAllCallbacks()
|
||||
// this.scheduleOnce(() => {
|
||||
// this.transform?.setContentSize(size)
|
||||
// }, time)
|
||||
this.transform?.setContentSize(size)
|
||||
layout.updateItemSize(this.node, size)
|
||||
}
|
||||
|
||||
}
|
9
assets/scripts/vertical.ts.meta
Normal file
9
assets/scripts/vertical.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.22",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "ea9d1b02-3661-4863-bf24-d43b44bb4c4e",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
9
package.json
Normal file
9
package.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "super-scrollview",
|
||||
"type": "3d",
|
||||
"uuid": "37ef4763-1b99-4f44-b147-9782d4a097c8",
|
||||
"version": "3.2.0",
|
||||
"creator": {
|
||||
"version": "3.2.0"
|
||||
}
|
||||
}
|
7
tsconfig.json
Normal file
7
tsconfig.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "./temp/tsconfig.cocos.json",
|
||||
"compilerOptions": {
|
||||
"allowSyntheticDefaultImports": true, // 需要开启
|
||||
"noImplicitThis": false,
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user