mirror of
https://github.com/Leo501/CocosCreatorTutorial.git
synced 2026-05-07 14:17:49 +08:00
添加一个UI左右无限翻页组件
This commit is contained in:
51
RightLeftScrollDemo/.gitignore
vendored
Normal file
51
RightLeftScrollDemo/.gitignore
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# Fireball Projects
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/library/
|
||||
/temp/
|
||||
/local/
|
||||
/build/
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# npm files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
npm-debug.log
|
||||
node_modules/
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# Logs and databases
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# files for debugger
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
*.sln
|
||||
*.pidb
|
||||
*.suo
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# OS generated files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
.DS_Store
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# WebStorm files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
.idea/
|
||||
|
||||
#//////////////////////////
|
||||
# VS Code files
|
||||
#//////////////////////////
|
||||
|
||||
.vscode/
|
||||
2
RightLeftScrollDemo/README.md
Normal file
2
RightLeftScrollDemo/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# hello-world
|
||||
Hello world new project template.
|
||||
12
RightLeftScrollDemo/assets/Scene.meta
Normal file
12
RightLeftScrollDemo/assets/Scene.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.2",
|
||||
"uuid": "29f52784-2fca-467b-92e7-8fd9ef8c57b7",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
||||
2971
RightLeftScrollDemo/assets/Scene/helloworld.fire
Normal file
2971
RightLeftScrollDemo/assets/Scene/helloworld.fire
Normal file
File diff suppressed because it is too large
Load Diff
7
RightLeftScrollDemo/assets/Scene/helloworld.fire.meta
Normal file
7
RightLeftScrollDemo/assets/Scene/helloworld.fire.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.2.8",
|
||||
"uuid": "2d2f792f-a40c-49bb-a189-ed176a246e49",
|
||||
"asyncLoadAssets": false,
|
||||
"autoReleaseAssets": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
12
RightLeftScrollDemo/assets/Script.meta
Normal file
12
RightLeftScrollDemo/assets/Script.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.2",
|
||||
"uuid": "4734c20c-0db8-4eb2-92ea-e692f4d70934",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
||||
16
RightLeftScrollDemo/assets/Script/Helloworld.ts
Normal file
16
RightLeftScrollDemo/assets/Script/Helloworld.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
const {ccclass, property} = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class Helloworld extends cc.Component {
|
||||
|
||||
@property(cc.Label)
|
||||
label: cc.Label = null;
|
||||
|
||||
@property
|
||||
text: string = 'hello';
|
||||
|
||||
start () {
|
||||
// init logic
|
||||
this.label.string = this.text;
|
||||
}
|
||||
}
|
||||
9
RightLeftScrollDemo/assets/Script/Helloworld.ts.meta
Normal file
9
RightLeftScrollDemo/assets/Script/Helloworld.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.8",
|
||||
"uuid": "e1b90feb-a217-4493-849d-9a611900d683",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
12
RightLeftScrollDemo/assets/ScrollSelect.meta
Normal file
12
RightLeftScrollDemo/assets/ScrollSelect.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.2",
|
||||
"uuid": "c78e36c8-1c36-4808-b386-edbe0a19530c",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"ScrollSelect.prefab":"prefab","UIScrollSelect.ts":"typescript","weapon.plist":"sprite-atlas","weapon.png":"texture","commonbg.png":"texture","pagebtn.png":"texture"}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.0",
|
||||
"uuid": "8fa6a659-12d6-476f-a5a5-282cfa6e75d9",
|
||||
"subMetas": {}
|
||||
}
|
||||
2301
RightLeftScrollDemo/assets/ScrollSelect/ScrollSelect.prefab
Normal file
2301
RightLeftScrollDemo/assets/ScrollSelect/ScrollSelect.prefab
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"ver": "1.2.7",
|
||||
"uuid": "ba947ec9-d9f1-4571-a1cc-ac48c678fd49",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
12
RightLeftScrollDemo/assets/ScrollSelect/module.meta
Normal file
12
RightLeftScrollDemo/assets/ScrollSelect/module.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.2",
|
||||
"uuid": "415f1704-1847-4050-b0b0-c3b9b3a1c41b",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
||||
12
RightLeftScrollDemo/assets/ScrollSelect/module/ui.meta
Normal file
12
RightLeftScrollDemo/assets/ScrollSelect/module/ui.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.2",
|
||||
"uuid": "ca37bcbe-3594-4426-b85f-6125aef257f4",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
|
||||
export enum EventType {
|
||||
SCROLL_START,
|
||||
SCROLL_ING,
|
||||
SCROLL_END
|
||||
}
|
||||
|
||||
@ccclass
|
||||
export default class UIScrollSelect extends cc.Component {
|
||||
|
||||
public static EventType = EventType;
|
||||
@property(cc.Node)
|
||||
content :cc.Node = null;
|
||||
@property({
|
||||
type:cc.Integer,
|
||||
tooltip:'单个控件之间的距离'
|
||||
})
|
||||
deltaX : number = 100 //x间隔距离
|
||||
@property({
|
||||
type:cc.Integer,
|
||||
tooltip:'中心点的缩放比例'
|
||||
})
|
||||
centerScale : number = 1.0
|
||||
@property({
|
||||
type:cc.Integer,
|
||||
tooltip:'边缘点的缩放比例'
|
||||
})
|
||||
minScale : number = 1.0
|
||||
@property({
|
||||
type:cc.Integer,
|
||||
tooltip:'滚动时的速度'
|
||||
})
|
||||
scrollSpeed: number = 300;
|
||||
@property({
|
||||
type: cc.Component.EventHandler,
|
||||
tooltip: "选择后的回调"
|
||||
})
|
||||
selectEvents:Array<cc.Component.EventHandler> = [];
|
||||
|
||||
private childs:Array<cc.Node> = [];
|
||||
private isTouching : boolean = false;
|
||||
private hasTouchMove : boolean = false;
|
||||
private isTestX : boolean = false;
|
||||
private _touchId: any = null;
|
||||
private currentIndex:number = 0;
|
||||
private _toMoveX:number = 1; //移动方向
|
||||
private dx:number = 0;
|
||||
private moveAim : number = 0;
|
||||
|
||||
onLoad(){
|
||||
this.childs = [];
|
||||
for(var i=0; i<this.content.children.length; i++){
|
||||
this.childs[i] = this.content.children[i];
|
||||
this.childs[i].x = this.deltaX*(i-1);
|
||||
}
|
||||
this.isTouching = false
|
||||
this.hasTouchMove = false
|
||||
this.isTestX = false;
|
||||
this._touchId = null;
|
||||
// this.currentIndex = 0;
|
||||
this.scrollTo(0,false);
|
||||
}
|
||||
/** 滚动到指定节点
|
||||
* @param anim 是否带移动动画
|
||||
*/
|
||||
scrollTo(idx:number,anim:boolean=true){
|
||||
if(idx < 0 && idx >= this.childs.length){
|
||||
return console.error(this.node.name+'->移动超出边界面')
|
||||
}
|
||||
this.currentIndex = idx;
|
||||
this.moveAim = idx;
|
||||
if(!anim){
|
||||
for(var i=0; i<this.childs.length; i++){
|
||||
this._checkChildX(this.childs[i],(i-idx) *this.deltaX)
|
||||
}
|
||||
} else {
|
||||
this.isTestX = true
|
||||
cc.Component.EventHandler.emitEvents(this.selectEvents, {target :this,
|
||||
type :EventType.SCROLL_START,
|
||||
index : this.currentIndex});
|
||||
}
|
||||
}
|
||||
/** 向左滚一个点 */
|
||||
scrollToLeft(){
|
||||
this._toMoveX = 1
|
||||
this.scrollTo((this.currentIndex-1+this.childs.length)%this.childs.length)
|
||||
}
|
||||
|
||||
/** 向左滚一个点 */
|
||||
scrollToRight(){
|
||||
this._toMoveX = -1
|
||||
this.scrollTo((this.currentIndex+1+this.childs.length)%this.childs.length)
|
||||
}
|
||||
|
||||
_checkChildX(child,x){
|
||||
if(x > this.childs.length/2 * this.deltaX){
|
||||
x-=this.childs.length * this.deltaX
|
||||
} else if(x < -this.childs.length/2 * this.deltaX){
|
||||
x+=this.childs.length * this.deltaX
|
||||
}
|
||||
child.x = x;
|
||||
let dx = Math.min(Math.abs(x),this.deltaX)
|
||||
child.scale = (1-dx/this.deltaX)*(this.centerScale-this.minScale) + this.minScale
|
||||
}
|
||||
|
||||
start(){
|
||||
this.content.on(cc.Node.EventType.TOUCH_START,this._onTouch,this);
|
||||
this.content.on(cc.Node.EventType.TOUCH_MOVE,this._onTouch,this);
|
||||
this.content.on(cc.Node.EventType.TOUCH_END,this._onTouchEnd,this);
|
||||
this.content.on(cc.Node.EventType.TOUCH_CANCEL,this._onTouchEnd,this);
|
||||
}
|
||||
_onTouch(event ){
|
||||
if(this._touchId != null && event.touch != this._touchId){
|
||||
return;
|
||||
}
|
||||
if(event.type == cc.Node.EventType.TOUCH_START){
|
||||
this.isTouching = true;
|
||||
this.hasTouchMove = false
|
||||
this.isTestX = false;
|
||||
this._touchId = event.touch;
|
||||
this.dx = event.getStartLocation().x;
|
||||
let evt = {
|
||||
target :this,
|
||||
type :EventType.SCROLL_START,
|
||||
index : this.currentIndex
|
||||
}
|
||||
cc.Component.EventHandler.emitEvents(this.selectEvents, evt);
|
||||
return;
|
||||
}
|
||||
this.hasTouchMove = true;
|
||||
var dx = event.getLocation().x - this.dx
|
||||
this._move(dx);
|
||||
this.dx = event.getLocation().x
|
||||
var evt = {
|
||||
target :this,
|
||||
type :EventType.SCROLL_ING,
|
||||
dx:this.dx
|
||||
}
|
||||
cc.Component.EventHandler.emitEvents(this.selectEvents, evt);
|
||||
}
|
||||
_onTouchEnd(event){
|
||||
if(this._touchId != null && event.touch != this._touchId){
|
||||
return;
|
||||
}
|
||||
this.isTouching = false;
|
||||
if(event.type == cc.Node.EventType.TOUCH_END || event.type == cc.Node.EventType.TOUCH_CANCEL){
|
||||
this._touchId = null;
|
||||
}
|
||||
let lo = this.node.convertToNodeSpaceAR(event.getLocation())
|
||||
if(!this.hasTouchMove){
|
||||
|
||||
let mx = Math.ceil((lo.x - this.deltaX / 2) / this.deltaX)
|
||||
if(mx === 0){
|
||||
var event1 = {
|
||||
target :this,
|
||||
type :EventType.SCROLL_END,
|
||||
index : this.currentIndex
|
||||
}
|
||||
cc.Component.EventHandler.emitEvents(this.selectEvents, event1);
|
||||
} else {
|
||||
this.moveAim = (this.currentIndex+mx+this.childs.length)%this.childs.length
|
||||
this._toMoveX = mx > 0 ? -1 : 1
|
||||
this.isTestX = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
let max = this.deltaX;
|
||||
let minidx = 0
|
||||
for(let i=0; i<this.childs.length; i++){
|
||||
if(Math.abs(this.childs[i].x)<=max){
|
||||
max = Math.abs(this.childs[i].x)
|
||||
minidx = i;
|
||||
}
|
||||
}
|
||||
this.moveAim = minidx
|
||||
this._toMoveX = this.childs[minidx].x >= 0 ? -1 : 1
|
||||
this.isTestX = true;
|
||||
}
|
||||
_move(dt){
|
||||
for(var i=0; i<this.childs.length; i++){
|
||||
this._checkChildX(this.childs[i],this.childs[i].x+dt)
|
||||
}
|
||||
}
|
||||
|
||||
update(dt){
|
||||
if(this.isTouching || !this.isTestX){
|
||||
return;
|
||||
}
|
||||
var stepx = this._toMoveX * dt * this.scrollSpeed
|
||||
let lx = this.childs[this.moveAim].x
|
||||
for(var i=0; i<this.childs.length; i++){
|
||||
this._checkChildX(this.childs[i],this.childs[i].x+stepx)
|
||||
}
|
||||
|
||||
var x = this.childs[0].x;
|
||||
var idx = Math.round(x/this.deltaX);
|
||||
var tox = this.deltaX * idx;
|
||||
let cx = this.childs[this.moveAim].x
|
||||
if(lx * cx < 0 && Math.abs(cx) < this.deltaX){
|
||||
this.isTestX = false;
|
||||
for(let i=0; i<this.childs.length; i++){
|
||||
if(Math.abs(this.childs[i].x)<=Math.abs(stepx)){
|
||||
this.currentIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(var i=0; i<this.childs.length; i++){
|
||||
this._checkChildX(this.childs[i],this.childs[i].x+tox-x)
|
||||
}
|
||||
var event = {
|
||||
target :this,
|
||||
type :EventType.SCROLL_END,
|
||||
index : this.currentIndex
|
||||
}
|
||||
cc.Component.EventHandler.emitEvents(this.selectEvents, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.8",
|
||||
"uuid": "2c5b5e07-02cf-4a75-9f6a-a0f661caac57",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
12
RightLeftScrollDemo/assets/ScrollSelect/resources.meta
Normal file
12
RightLeftScrollDemo/assets/ScrollSelect/resources.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.2",
|
||||
"uuid": "85c5b257-c7a7-44a3-8e1d-a054d5c4875d",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
||||
12
RightLeftScrollDemo/assets/ScrollSelect/resources/Game.meta
Normal file
12
RightLeftScrollDemo/assets/ScrollSelect/resources/Game.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.2",
|
||||
"uuid": "f799feab-3832-4876-af13-a349ea5706c2",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.2",
|
||||
"uuid": "46d2bd73-f988-4e19-8da4-3c5100193cde",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>frames</key>
|
||||
<dict>
|
||||
<key>0.png</key>
|
||||
<dict>
|
||||
<key>frame</key>
|
||||
<string>{{122,271},{118,147}}</string>
|
||||
<key>offset</key>
|
||||
<string>{0,0}</string>
|
||||
<key>rotated</key>
|
||||
<false/>
|
||||
<key>sourceColorRect</key>
|
||||
<string>{{0,0},{118,147}}</string>
|
||||
<key>sourceSize</key>
|
||||
<string>{118,147}</string>
|
||||
</dict>
|
||||
<key>1.png</key>
|
||||
<dict>
|
||||
<key>frame</key>
|
||||
<string>{{122,122},{118,147}}</string>
|
||||
<key>offset</key>
|
||||
<string>{0,0}</string>
|
||||
<key>rotated</key>
|
||||
<false/>
|
||||
<key>sourceColorRect</key>
|
||||
<string>{{0,0},{118,147}}</string>
|
||||
<key>sourceSize</key>
|
||||
<string>{118,147}</string>
|
||||
</dict>
|
||||
<key>2.png</key>
|
||||
<dict>
|
||||
<key>frame</key>
|
||||
<string>{{271,2},{118,147}}</string>
|
||||
<key>offset</key>
|
||||
<string>{0,0}</string>
|
||||
<key>rotated</key>
|
||||
<true/>
|
||||
<key>sourceColorRect</key>
|
||||
<string>{{0,0},{118,147}}</string>
|
||||
<key>sourceSize</key>
|
||||
<string>{118,147}</string>
|
||||
</dict>
|
||||
<key>3.png</key>
|
||||
<dict>
|
||||
<key>frame</key>
|
||||
<string>{{122,2},{118,147}}</string>
|
||||
<key>offset</key>
|
||||
<string>{0,0}</string>
|
||||
<key>rotated</key>
|
||||
<true/>
|
||||
<key>sourceColorRect</key>
|
||||
<string>{{0,0},{118,147}}</string>
|
||||
<key>sourceSize</key>
|
||||
<string>{118,147}</string>
|
||||
</dict>
|
||||
<key>4.png</key>
|
||||
<dict>
|
||||
<key>frame</key>
|
||||
<string>{{2,300},{118,147}}</string>
|
||||
<key>offset</key>
|
||||
<string>{0,0}</string>
|
||||
<key>rotated</key>
|
||||
<false/>
|
||||
<key>sourceColorRect</key>
|
||||
<string>{{0,0},{118,147}}</string>
|
||||
<key>sourceSize</key>
|
||||
<string>{118,147}</string>
|
||||
</dict>
|
||||
<key>5.png</key>
|
||||
<dict>
|
||||
<key>frame</key>
|
||||
<string>{{2,151},{118,147}}</string>
|
||||
<key>offset</key>
|
||||
<string>{0,0}</string>
|
||||
<key>rotated</key>
|
||||
<false/>
|
||||
<key>sourceColorRect</key>
|
||||
<string>{{0,0},{118,147}}</string>
|
||||
<key>sourceSize</key>
|
||||
<string>{118,147}</string>
|
||||
</dict>
|
||||
<key>6.png</key>
|
||||
<dict>
|
||||
<key>frame</key>
|
||||
<string>{{2,2},{118,147}}</string>
|
||||
<key>offset</key>
|
||||
<string>{0,0}</string>
|
||||
<key>rotated</key>
|
||||
<false/>
|
||||
<key>sourceColorRect</key>
|
||||
<string>{{0,0},{118,147}}</string>
|
||||
<key>sourceSize</key>
|
||||
<string>{118,147}</string>
|
||||
</dict>
|
||||
<key>7.png</key>
|
||||
<dict>
|
||||
<key>frame</key>
|
||||
<string>{{242,122},{102,125}}</string>
|
||||
<key>offset</key>
|
||||
<string>{-3,2}</string>
|
||||
<key>rotated</key>
|
||||
<true/>
|
||||
<key>sourceColorRect</key>
|
||||
<string>{{5,9},{102,125}}</string>
|
||||
<key>sourceSize</key>
|
||||
<string>{118,147}</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>metadata</key>
|
||||
<dict>
|
||||
<key>format</key>
|
||||
<integer>2</integer>
|
||||
<key>realTextureFileName</key>
|
||||
<string>weapon.png</string>
|
||||
<key>size</key>
|
||||
<string>{512,512}</string>
|
||||
<key>smartupdate</key>
|
||||
<string>$TexturePacker:SmartUpdate:63b774d25546fde6b7e41ffdb7799d2c$</string>
|
||||
<key>textureFileName</key>
|
||||
<string>weapon.png</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"ver": "1.2.4",
|
||||
"uuid": "ddcf59d9-d4c5-4863-a899-9dc9991dae65",
|
||||
"rawTextureUuid": "30addcbe-c635-45af-bd12-153e5d831a1e",
|
||||
"size": {
|
||||
"width": 512,
|
||||
"height": 512
|
||||
},
|
||||
"type": "Texture Packer",
|
||||
"subMetas": {
|
||||
"0.png": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "1b6af0ef-58ce-4766-82ab-3e69202c082f",
|
||||
"rawTextureUuid": "30addcbe-c635-45af-bd12-153e5d831a1e",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 122,
|
||||
"trimY": 271,
|
||||
"width": 118,
|
||||
"height": 147,
|
||||
"rawWidth": 118,
|
||||
"rawHeight": 147,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"spriteType": "normal",
|
||||
"subMetas": {}
|
||||
},
|
||||
"1.png": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "e25e48e7-bd4a-4fdc-9f27-59693b54c4ee",
|
||||
"rawTextureUuid": "30addcbe-c635-45af-bd12-153e5d831a1e",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 122,
|
||||
"trimY": 122,
|
||||
"width": 118,
|
||||
"height": 147,
|
||||
"rawWidth": 118,
|
||||
"rawHeight": 147,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"spriteType": "normal",
|
||||
"subMetas": {}
|
||||
},
|
||||
"2.png": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "fae08ca5-df57-44df-b652-ded601c8ab3d",
|
||||
"rawTextureUuid": "30addcbe-c635-45af-bd12-153e5d831a1e",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": true,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 271,
|
||||
"trimY": 2,
|
||||
"width": 118,
|
||||
"height": 147,
|
||||
"rawWidth": 118,
|
||||
"rawHeight": 147,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"spriteType": "normal",
|
||||
"subMetas": {}
|
||||
},
|
||||
"3.png": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "6c0e3a55-c925-40d2-94ba-34694f9b9a25",
|
||||
"rawTextureUuid": "30addcbe-c635-45af-bd12-153e5d831a1e",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": true,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 122,
|
||||
"trimY": 2,
|
||||
"width": 118,
|
||||
"height": 147,
|
||||
"rawWidth": 118,
|
||||
"rawHeight": 147,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"spriteType": "normal",
|
||||
"subMetas": {}
|
||||
},
|
||||
"4.png": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "cb9a671c-2fff-4da5-8508-2fccce422e0b",
|
||||
"rawTextureUuid": "30addcbe-c635-45af-bd12-153e5d831a1e",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 2,
|
||||
"trimY": 300,
|
||||
"width": 118,
|
||||
"height": 147,
|
||||
"rawWidth": 118,
|
||||
"rawHeight": 147,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"spriteType": "normal",
|
||||
"subMetas": {}
|
||||
},
|
||||
"5.png": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "e228970e-92e3-40af-b8bd-e41c1fc95570",
|
||||
"rawTextureUuid": "30addcbe-c635-45af-bd12-153e5d831a1e",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 2,
|
||||
"trimY": 151,
|
||||
"width": 118,
|
||||
"height": 147,
|
||||
"rawWidth": 118,
|
||||
"rawHeight": 147,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"spriteType": "normal",
|
||||
"subMetas": {}
|
||||
},
|
||||
"6.png": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "4f931312-43a6-4634-a713-fdc99fa40bfe",
|
||||
"rawTextureUuid": "30addcbe-c635-45af-bd12-153e5d831a1e",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 2,
|
||||
"trimY": 2,
|
||||
"width": 118,
|
||||
"height": 147,
|
||||
"rawWidth": 118,
|
||||
"rawHeight": 147,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"spriteType": "normal",
|
||||
"subMetas": {}
|
||||
},
|
||||
"7.png": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "596900dc-eb5c-41b9-8bc2-f8761e8ae6bb",
|
||||
"rawTextureUuid": "30addcbe-c635-45af-bd12-153e5d831a1e",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": true,
|
||||
"offsetX": -3,
|
||||
"offsetY": 2,
|
||||
"trimX": 242,
|
||||
"trimY": 122,
|
||||
"width": 102,
|
||||
"height": 125,
|
||||
"rawWidth": 118,
|
||||
"rawHeight": 147,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"spriteType": "normal",
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"ver": "2.3.5",
|
||||
"uuid": "30addcbe-c635-45af-bd12-153e5d831a1e",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"weapon": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "5b2c25be-d936-42d3-864a-14c691037c33",
|
||||
"rawTextureUuid": "30addcbe-c635-45af-bd12-153e5d831a1e",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": -50.5,
|
||||
"offsetY": 30.5,
|
||||
"trimX": 2,
|
||||
"trimY": 4,
|
||||
"width": 407,
|
||||
"height": 443,
|
||||
"rawWidth": 512,
|
||||
"rawHeight": 512,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
RightLeftScrollDemo/assets/ScrollSelect/resources/UI.meta
Normal file
12
RightLeftScrollDemo/assets/ScrollSelect/resources/UI.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.2",
|
||||
"uuid": "688170d7-dcb0-4de5-9f15-437097f3c148",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.2",
|
||||
"uuid": "ed510cc5-5635-4bfc-accf-5d925bcd7a8c",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"ver": "2.3.5",
|
||||
"uuid": "42f1856a-fefd-4f32-a87a-0c65800b32c4",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 142,
|
||||
"height": 162,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"commonbg": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "e871590c-f9e2-4c7c-b80b-56d4cfcc2ba2",
|
||||
"rawTextureUuid": "42f1856a-fefd-4f32-a87a-0c65800b32c4",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 142,
|
||||
"height": 162,
|
||||
"rawWidth": 142,
|
||||
"rawHeight": 162,
|
||||
"borderTop": 10,
|
||||
"borderBottom": 11,
|
||||
"borderLeft": 8,
|
||||
"borderRight": 10,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"ver": "2.3.5",
|
||||
"uuid": "07341d6f-7bf0-4238-bc87-cf38423e45c6",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 26,
|
||||
"height": 64,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"pagebtn": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "cbbdd8f9-ca03-4803-bb0c-99bdf4d5f23e",
|
||||
"rawTextureUuid": "07341d6f-7bf0-4238-bc87-cf38423e45c6",
|
||||
"trimType": "custom",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 26,
|
||||
"height": 64,
|
||||
"rawWidth": 26,
|
||||
"rawHeight": 64,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
RightLeftScrollDemo/assets/Texture.meta
Normal file
12
RightLeftScrollDemo/assets/Texture.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.1.2",
|
||||
"uuid": "7b81d4e8-ec84-4716-968d-500ac1d78a54",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
||||
BIN
RightLeftScrollDemo/assets/Texture/HelloWorld.png
Normal file
BIN
RightLeftScrollDemo/assets/Texture/HelloWorld.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
36
RightLeftScrollDemo/assets/Texture/HelloWorld.png.meta
Normal file
36
RightLeftScrollDemo/assets/Texture/HelloWorld.png.meta
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"ver": "2.3.5",
|
||||
"uuid": "6aa0aa6a-ebee-4155-a088-a687a6aadec4",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 195,
|
||||
"height": 270,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"HelloWorld": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "31bc895a-c003-4566-a9f3-2e54ae1c17dc",
|
||||
"rawTextureUuid": "6aa0aa6a-ebee-4155-a088-a687a6aadec4",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 195,
|
||||
"height": 270,
|
||||
"rawWidth": 195,
|
||||
"rawHeight": 270,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
RightLeftScrollDemo/assets/Texture/singleColor.png
Normal file
BIN
RightLeftScrollDemo/assets/Texture/singleColor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 82 B |
36
RightLeftScrollDemo/assets/Texture/singleColor.png.meta
Normal file
36
RightLeftScrollDemo/assets/Texture/singleColor.png.meta
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"ver": "2.3.5",
|
||||
"uuid": "a8027877-d8d6-4645-97a0-52d4a0123dba",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 2,
|
||||
"height": 2,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"singleColor": {
|
||||
"ver": "1.0.4",
|
||||
"uuid": "410fb916-8721-4663-bab8-34397391ace7",
|
||||
"rawTextureUuid": "a8027877-d8d6-4645-97a0-52d4a0123dba",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 2,
|
||||
"height": 2,
|
||||
"rawWidth": 2,
|
||||
"rawHeight": 2,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
32212
RightLeftScrollDemo/creator.d.ts
vendored
Normal file
32212
RightLeftScrollDemo/creator.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
13
RightLeftScrollDemo/jsconfig.json
Normal file
13
RightLeftScrollDemo/jsconfig.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"module": "commonjs"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"library",
|
||||
"local",
|
||||
"settings",
|
||||
"temp"
|
||||
]
|
||||
}
|
||||
8
RightLeftScrollDemo/project.json
Normal file
8
RightLeftScrollDemo/project.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"engine": "cocos2d-html5",
|
||||
"packages": "packages",
|
||||
"version": "2.4.2",
|
||||
"name": "RightLeftScrollDemo",
|
||||
"id": "6ace3e40-21b6-4689-96f7-9a59c0638a13",
|
||||
"isNew": false
|
||||
}
|
||||
13
RightLeftScrollDemo/settings/builder.json
Normal file
13
RightLeftScrollDemo/settings/builder.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"excludeScenes": [],
|
||||
"orientation": {
|
||||
"landscapeLeft": true,
|
||||
"landscapeRight": true,
|
||||
"portrait": false,
|
||||
"upsideDown": false
|
||||
},
|
||||
"packageName": "org.cocos2d.helloworld",
|
||||
"startScene": "2d2f792f-a40c-49bb-a189-ed176a246e49",
|
||||
"title": "hello_world",
|
||||
"webOrientation": "auto"
|
||||
}
|
||||
7
RightLeftScrollDemo/settings/builder.panel.json
Normal file
7
RightLeftScrollDemo/settings/builder.panel.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"excludeScenes": [],
|
||||
"packageName": "org.cocos2d.helloworld",
|
||||
"platform": "web-mobile",
|
||||
"startScene": "2d2f792f-a40c-49bb-a189-ed176a246e49",
|
||||
"title": "HelloWorld"
|
||||
}
|
||||
35
RightLeftScrollDemo/settings/project.json
Normal file
35
RightLeftScrollDemo/settings/project.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"collision-matrix": [
|
||||
[
|
||||
true
|
||||
]
|
||||
],
|
||||
"excluded-modules": [],
|
||||
"group-list": [
|
||||
"default"
|
||||
],
|
||||
"start-scene": "2d2f792f-a40c-49bb-a189-ed176a246e49",
|
||||
"design-resolution-width": 960,
|
||||
"design-resolution-height": 640,
|
||||
"fit-width": false,
|
||||
"fit-height": true,
|
||||
"use-project-simulator-setting": false,
|
||||
"simulator-orientation": false,
|
||||
"use-customize-simulator": false,
|
||||
"simulator-resolution": {
|
||||
"width": 960,
|
||||
"height": 640
|
||||
},
|
||||
"last-module-event-record-time": 0,
|
||||
"assets-sort-type": "name",
|
||||
"facebook": {
|
||||
"enable": false,
|
||||
"appID": "",
|
||||
"live": {
|
||||
"enable": false
|
||||
},
|
||||
"audience": {
|
||||
"enable": false
|
||||
}
|
||||
}
|
||||
}
|
||||
6
RightLeftScrollDemo/settings/services.json
Normal file
6
RightLeftScrollDemo/settings/services.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"game": {
|
||||
"name": "未知游戏",
|
||||
"appid": "UNKNOW"
|
||||
}
|
||||
}
|
||||
BIN
RightLeftScrollDemo/template-banner.png
Normal file
BIN
RightLeftScrollDemo/template-banner.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
5
RightLeftScrollDemo/template.json
Normal file
5
RightLeftScrollDemo/template.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "TEMPLATES.helloworld-ts.name",
|
||||
"desc": "TEMPLATES.helloworld-ts.desc",
|
||||
"banner": "template-banner.png"
|
||||
}
|
||||
19
RightLeftScrollDemo/tsconfig.json
Normal file
19
RightLeftScrollDemo/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [ "es2015", "es2017", "dom" ],
|
||||
"target": "es5",
|
||||
"experimentalDecorators": true,
|
||||
"skipLibCheck": true,
|
||||
"outDir": "temp/vscode-dist",
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"library",
|
||||
"local",
|
||||
"temp",
|
||||
"build",
|
||||
"settings"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user