Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-libs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
zeroing-libs
Commits
ca76151e
Commit
ca76151e
authored
Jun 10, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复
parent
2984fe79
Changes
68
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
68 changed files
with
4061 additions
and
5 deletions
+4061
-5
wait.json
dist/processes/base/wait.json
+1
-1
pick-image.json
dist/processes/other/pick-image.json
+12
-0
resize-image.json
dist/processes/other/resize-image.json
+44
-0
GameView.js
...zeroing-libs/src/custom/doll-machine/src/game/GameView.js
+182
-0
GameWrapper.js
...oing-libs/src/custom/doll-machine/src/game/GameWrapper.js
+41
-0
Goods.js
dist/zeroing-libs/src/custom/doll-machine/src/game/Goods.js
+70
-0
Zhuazi.js
dist/zeroing-libs/src/custom/doll-machine/src/game/Zhuazi.js
+135
-0
backBox.js
.../zeroing-libs/src/custom/doll-machine/src/game/backBox.js
+47
-0
frontBox.js
...zeroing-libs/src/custom/doll-machine/src/game/frontBox.js
+64
-0
object-pool-init.js
...libs/src/custom/doll-machine/src/game/object-pool-init.js
+10
-0
utils.js
dist/zeroing-libs/src/custom/doll-machine/src/game/utils.js
+20
-0
index.js
dist/zeroing-libs/src/custom/doll-machine/src/index.js
+11
-0
props.js
dist/zeroing-libs/src/custom/doll-machine/src/props.js
+12
-0
GameView.js
...eroing-libs/src/custom/doll-machine2/src/game/GameView.js
+122
-0
GameWrapper.js
...ing-libs/src/custom/doll-machine2/src/game/GameWrapper.js
+41
-0
Goods.js
dist/zeroing-libs/src/custom/doll-machine2/src/game/Goods.js
+70
-0
Zhuazi.js
.../zeroing-libs/src/custom/doll-machine2/src/game/Zhuazi.js
+142
-0
backBox.js
...zeroing-libs/src/custom/doll-machine2/src/game/backBox.js
+47
-0
frontBox.js
...eroing-libs/src/custom/doll-machine2/src/game/frontBox.js
+70
-0
object-pool-init.js
...ibs/src/custom/doll-machine2/src/game/object-pool-init.js
+10
-0
utils.js
dist/zeroing-libs/src/custom/doll-machine2/src/game/utils.js
+20
-0
index.js
dist/zeroing-libs/src/custom/doll-machine2/src/index.js
+11
-0
props.js
dist/zeroing-libs/src/custom/doll-machine2/src/props.js
+12
-0
Background.js
...eroing-libs/src/custom/dxbcyj-game/src/game/Background.js
+85
-0
GameView.js
.../zeroing-libs/src/custom/dxbcyj-game/src/game/GameView.js
+191
-0
GameWrapper.js
...roing-libs/src/custom/dxbcyj-game/src/game/GameWrapper.js
+18
-0
GuideLayer.js
...eroing-libs/src/custom/dxbcyj-game/src/game/GuideLayer.js
+89
-0
LoopComponent.js
...ing-libs/src/custom/dxbcyj-game/src/game/LoopComponent.js
+71
-0
Pier.js
dist/zeroing-libs/src/custom/dxbcyj-game/src/game/Pier.js
+61
-0
Player.js
dist/zeroing-libs/src/custom/dxbcyj-game/src/game/Player.js
+71
-0
Road.js
dist/zeroing-libs/src/custom/dxbcyj-game/src/game/Road.js
+99
-0
ScoreLabel.js
...eroing-libs/src/custom/dxbcyj-game/src/game/ScoreLabel.js
+37
-0
Strut.js
dist/zeroing-libs/src/custom/dxbcyj-game/src/game/Strut.js
+68
-0
object-pool-init.js
...-libs/src/custom/dxbcyj-game/src/game/object-pool-init.js
+10
-0
utils.js
dist/zeroing-libs/src/custom/dxbcyj-game/src/game/utils.js
+24
-0
index.js
dist/zeroing-libs/src/custom/dxbcyj-game/src/index.js
+11
-0
props.js
dist/zeroing-libs/src/custom/dxbcyj-game/src/props.js
+12
-0
GameView.js
dist/zeroing-libs/src/custom/open-gift/src/game/GameView.js
+58
-0
GameWrapper.js
...zeroing-libs/src/custom/open-gift/src/game/GameWrapper.js
+30
-0
utils.js
dist/zeroing-libs/src/custom/open-gift/src/game/utils.js
+20
-0
index.js
dist/zeroing-libs/src/custom/open-gift/src/index.js
+11
-0
props.js
dist/zeroing-libs/src/custom/open-gift/src/props.js
+12
-0
Background.js
...eroing-libs/src/custom/walking-cat/src/game/Background.js
+55
-0
Block.js
dist/zeroing-libs/src/custom/walking-cat/src/game/Block.js
+57
-0
GameView.js
.../zeroing-libs/src/custom/walking-cat/src/game/GameView.js
+219
-0
GameWrapper.js
...roing-libs/src/custom/walking-cat/src/game/GameWrapper.js
+27
-0
LoopComponent.js
...ing-libs/src/custom/walking-cat/src/game/LoopComponent.js
+69
-0
PlayGame.js
.../zeroing-libs/src/custom/walking-cat/src/game/PlayGame.js
+177
-0
Road.js
dist/zeroing-libs/src/custom/walking-cat/src/game/Road.js
+236
-0
ScoreLabel.js
...eroing-libs/src/custom/walking-cat/src/game/ScoreLabel.js
+44
-0
object-pool-init.js
...-libs/src/custom/walking-cat/src/game/object-pool-init.js
+10
-0
Head.js
...roing-libs/src/custom/walking-cat/src/game/player/Head.js
+60
-0
IPlayerPart.js
...ibs/src/custom/walking-cat/src/game/player/IPlayerPart.js
+0
-0
Player.js
...ing-libs/src/custom/walking-cat/src/game/player/Player.js
+508
-0
PlayerPart.js
...libs/src/custom/walking-cat/src/game/player/PlayerPart.js
+49
-0
utils.js
dist/zeroing-libs/src/custom/walking-cat/src/game/utils.js
+22
-0
index.js
dist/zeroing-libs/src/custom/walking-cat/src/index.js
+11
-0
localWave.js
dist/zeroing-libs/src/custom/walking-cat/src/localWave.js
+141
-0
props.js
dist/zeroing-libs/src/custom/walking-cat/src/props.js
+12
-0
index2.js
dist/zeroing-libs/src/process/base/compare/index2.js
+47
-0
process-context.v8.d.ts
libs/process-context.v8.d.ts
+1
-1
meta.json
src/process/base/compare/meta.json
+2
-1
index.ts
src/process/base/put-data/index.ts
+1
-1
index.ts
src/process/base/wait/index.ts
+1
-1
index.ts
src/process/other/pick-image/index.ts
+20
-0
meta.json
src/process/other/pick-image/meta.json
+10
-0
index.ts
src/process/other/resize-image/index.ts
+96
-0
meta.json
src/process/other/resize-image/meta.json
+14
-0
No files found.
dist/processes/base/wait.json
View file @
ca76151e
...
...
@@ -12,7 +12,7 @@
"complete"
],
"id"
:
"wait"
,
"script"
:
"var duration = engine.findVariable('duration', args, props);
\n
setTimeout(function () {
\n
next('complete');
\n
}, duration);
\n
"
,
"script"
:
"var duration = engine.findVariable('duration', args, props);
\n
setTimeout(function () {
\n
next('complete'
, args
);
\n
}, duration);
\n
"
,
"group"
:
"base"
,
"type"
:
"builtin"
}
dist/processes/other/pick-image.json
0 → 100644
View file @
ca76151e
{
"name"
:
"选择图片"
,
"desc"
:
"选择一个图片文件"
,
"props"
:
{},
"output"
:
[
"success"
],
"id"
:
"pick-image"
,
"script"
:
"var input = document.createElement('input');
\n
input.type = 'file';
\n
input.onchange = function (e) {
\n
processImage(input.files[0], function (imgData) {
\n
next('success', imgData);
\n
});
\n
};
\n
input.click();
\n
function processImage(file, callback) {
\n
var reader = new FileReader();
\n
reader.readAsDataURL(file);
\n
reader.onload = function (e) {
\n
callback(reader.result);
\n
};
\n
}
\n
"
,
"group"
:
"other"
,
"type"
:
"builtin"
}
dist/processes/other/resize-image.json
0 → 100644
View file @
ca76151e
{
"name"
:
"缩放图片"
,
"desc"
:
"缩放图片"
,
"props"
:
{
"width"
:
{
"type"
:
"number"
,
"alias"
:
"目标宽度"
},
"height"
:
{
"type"
:
"number"
,
"alias"
:
"目标高度"
},
"cutType"
:
{
"type"
:
"enum"
,
"enum"
:
[
"inner"
,
"outer"
],
"alias"
:
"裁剪类型"
,
"default"
:
"inner"
},
"type"
:
{
"type"
:
"enum"
,
"enum"
:
[
"png"
,
"jpeg"
],
"alias"
:
"输出类型"
,
"default"
:
"png"
},
"quality"
:
{
"type"
:
"number"
,
"alias"
:
"图片质量"
,
"default"
:
0.7
}
},
"output"
:
[
"success"
],
"id"
:
"resize-image"
,
"script"
:
"var width = engine.findVariable('width', args, props);
\n
var height = engine.findVariable('height', args, props);
\n
var cutType = engine.findVariable('cutType', args, props);
\n
var type = engine.findVariable('type', args, props);
\n
var quality = engine.findVariable('quality', args, props);
\n
var img = args;
\n
if (typeof args === 'string') {
\n
img = new Image();
\n
img.onload = function () {
\n
deal();
\n
};
\n
img.onerror = function (e) {
\n
console.log(e);
\n
};
\n
img.src = args;
\n
}
\n
else {
\n
deal();
\n
}
\n
function getExif(callback) {
\n
EXIF.getData(img, function () {
\n
var allMetaData = EXIF.getAllTags(this);
\n
callback(allMetaData);
\n
});
\n
}
\n
function deal() {
\n
getExif(function (allMetaData) {
\n
var m = cutType === 'inner' ? Math.min : Math.max;
\n
var r = m(width / img.width, height / img.height);
\n
var imgWidth = img.width * r;
\n
var imgHeight = img.height * r;
\n
var x = (width - imgWidth) / 2;
\n
var y = (height - imgHeight) / 2;
\n
var canvas = document.createElement('canvas');
\n
canvas.width = width;
\n
canvas.height = height;
\n
var ctx = canvas.getContext('2d');
\n
ctx.translate(x, y);
\n
ctx.scale(r, r);
\n
allMetaData.Orientation = 1;
\n
if (allMetaData.Orientation) {
\n
var orientation = allMetaData.Orientation;
\n
switch (orientation) {
\n
case 2:
\n
ctx.translate(img.width, 0);
\n
ctx.scale(-1, 1);
\n
break;
\n
case 3:
\n
ctx.translate(img.width, img.height);
\n
ctx.rotate(Math.PI);
\n
break;
\n
case 4:
\n
ctx.translate(0, img.height);
\n
ctx.scale(1, -1);
\n
break;
\n
case 5:
\n
ctx.rotate(-0.5 * Math.PI);
\n
ctx.scale(-1, 1);
\n
ctx.translate(x / r - y / r, y / r - x / r);
\n
break;
\n
case 6:
\n
ctx.rotate(-0.5 * Math.PI);
\n
ctx.translate(-img.width + y / r - x / r, y / r - x / r);
\n
break;
\n
case 7:
\n
ctx.rotate(0.5 * Math.PI);
\n
ctx.scale(-1, 1);
\n
ctx.translate(-img.width + y / r - x / r, -img.height + x / r - y / r);
\n
break;
\n
case 8:
\n
ctx.rotate(-0.5 * Math.PI);
\n
ctx.translate(-img.width + y / r - x / r, -x / r + y / r);
\n
break;
\n
}
\n
}
\n
ctx.drawImage(img, 0, 0);
\n
var dataUrl = canvas.toDataURL('image/' + type, quality);
\n
next('success', dataUrl);
\n
});
\n
}
\n
"
,
"group"
:
"other"
,
"type"
:
"builtin"
}
dist/zeroing-libs/src/custom/doll-machine/src/game/GameView.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
ObjectPool
=
engine
.
ObjectPool
;
var
utils_1
=
require
(
"./utils"
);
var
object_pool_init_1
=
require
(
"./object-pool-init"
);
var
frontBox_1
=
require
(
"./frontBox"
);
var
backBox_1
=
require
(
"./backBox"
);
var
Zhuazi_1
=
require
(
"./Zhuazi"
);
var
GameView
=
(
function
(
_super
)
{
__extends
(
GameView
,
_super
);
function
GameView
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
startstatus
=
false
;
_this
.
ifPrize
=
false
;
_this
.
goodsItems
=
[];
_this
.
once
(
engine
.
Event
.
ADDED_TO_STAGE
,
_this
.
setup
,
_this
);
return
_this
;
}
GameView
.
prototype
.
setup
=
function
()
{
if
(
this
.
_hasSetup
)
{
return
;
}
this
.
_hasSetup
=
true
;
var
frontBoxs
=
(
this
.
_frontBoxs
=
new
frontBox_1
.
FrontBoxs
());
this
.
_frontBoxs
.
GameView
=
this
;
var
backBoxs
=
(
this
.
_backBoxs
=
new
backBox_1
.
BackBoxs
());
this
.
_Zhuazi
=
new
Zhuazi_1
.
Zhuazi
();
this
.
_Zhuazi
.
GameView
=
this
;
this
.
frontTransfer
=
new
engine
.
Container
();
this
.
backTransfer
=
new
engine
.
Container
();
this
.
frontTransfer
.
width
=
0
;
this
.
frontTransfer
.
height
=
0
;
this
.
frontTransfer
.
alpha
=
1
;
this
.
backTransfer
.
width
=
0
;
this
.
backTransfer
.
height
=
0
;
this
.
backTransfer
.
alpha
=
1
;
this
.
rect
=
new
engine
.
Rect
();
this
.
rect
.
width
=
611
;
this
.
rect
.
height
=
704
;
this
.
rect
.
x
=
65
;
this
.
rect
.
y
=
263
;
this
.
NpcBg
=
new
engine
.
Container
();
this
.
addChild
(
this
.
NpcBg
);
this
.
addChild
(
this
.
rect
);
var
gameBg
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"游戏背景"
));
gameBg
.
x
=
65
;
gameBg
.
y
=
263
;
this
.
NpcBg
.
addChild
(
gameBg
);
this
.
frontDesk
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"前传输带"
));
this
.
frontDesk
.
x
=
60
;
this
.
frontDesk
.
y
=
781
;
this
.
backDesk
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"后传输带"
));
this
.
backDesk
.
x
=
60
;
this
.
backDesk
.
y
=
712
;
this
.
NpcBg
.
addChild
(
this
.
backDesk
);
this
.
NpcBg
.
addChild
(
this
.
frontDesk
);
this
.
NpcBg
.
addChild
(
this
.
backTransfer
);
this
.
NpcBg
.
addChild
(
this
.
frontTransfer
);
this
.
NpcBg
.
addChild
(
this
.
_Zhuazi
);
this
.
NpcBg
.
mask
=
this
.
rect
;
this
.
_Zhuazi
.
setup
();
this
.
backTransfer
.
addChild
(
this
.
_backBoxs
);
this
.
_backBoxs
.
setup
();
this
.
frontTransfer
.
addChild
(
this
.
_frontBoxs
);
this
.
_frontBoxs
.
setup
();
};
GameView
.
prototype
.
stopMove
=
function
()
{
this
.
_frontBoxs
.
stop
();
};
GameView
.
prototype
.
setMoveX
=
function
(
x
,
item
)
{
this
.
moveTime
=
x
;
this
.
prizeBox
=
item
;
this
.
_Zhuazi
.
move
();
};
GameView
.
prototype
.
setVisible
=
function
(
isshow
)
{
this
.
_frontBoxs
.
showHidePrizeBox
(
isshow
);
};
GameView
.
prototype
.
getMoveX
=
function
()
{
return
this
.
moveTime
;
};
GameView
.
prototype
.
resetMoveX
=
function
()
{
this
.
moveTime
=
null
;
};
GameView
.
prototype
.
getBox
=
function
()
{
return
this
.
prizeBox
;
};
GameView
.
prototype
.
reset
=
function
()
{
this
.
startstatus
=
false
;
this
.
ifPrize
=
false
;
this
.
_Zhuazi
.
getReset
();
};
GameView
.
prototype
.
start
=
function
(
type
)
{
if
(
type
===
void
0
)
{
type
=
null
;
}
this
.
speed
=
1
;
this
.
gameIng
=
true
;
console
.
log
(
'执行'
,
type
);
this
.
startstatus
=
true
;
this
.
ifPrize
=
type
&&
type
.
prize
||
false
;
};
GameView
.
prototype
.
beginNpc
=
function
()
{
var
_this
=
this
;
this
.
timer
=
setTimeout
(
function
()
{
if
(
_this
.
gameIng
)
{
}
},
2000
/
this
.
speed
);
};
GameView
.
prototype
.
pause
=
function
()
{
this
.
gameIng
=
false
;
};
GameView
.
prototype
.
revive
=
function
()
{
this
.
gameIng
=
true
;
};
GameView
.
prototype
.
resume
=
function
()
{
this
.
reset
();
this
.
start
();
};
GameView
.
prototype
.
initNpc
=
function
()
{
this
.
box1
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"草泥马盒"
));
this
.
box2
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"狗盒"
));
this
.
box3
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"猫盒"
));
this
.
box4
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"草泥马盒"
));
this
.
box5
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"猫盒"
));
this
.
box1
.
x
=
120
;
this
.
box1
.
y
=
434
;
this
.
box2
.
x
=
306
;
this
.
box2
.
y
=
434
;
this
.
box3
.
x
=
487
;
this
.
box3
.
y
=
434
;
this
.
box4
.
x
=
240
;
this
.
box4
.
scaleX
=
0.5
;
this
.
box4
.
scaleY
=
0.5
;
this
.
box4
.
y
=
390
;
this
.
box5
.
x
=
434
;
this
.
box5
.
y
=
390
;
this
.
box5
.
scaleX
=
0.5
;
this
.
box5
.
scaleY
=
0.5
;
this
.
backTransfer
.
addChild
(
this
.
box4
);
this
.
backTransfer
.
addChild
(
this
.
box5
);
this
.
frontTransfer
.
addChild
(
this
.
box1
);
this
.
frontTransfer
.
addChild
(
this
.
box2
);
this
.
frontTransfer
.
addChild
(
this
.
box3
);
};
GameView
.
prototype
.
died
=
function
()
{
this
.
score
=
0
;
this
.
pause
();
};
GameView
.
prototype
.
removeNpc
=
function
(
goods
)
{
this
.
NpcBg
.
removeChild
(
goods
);
ObjectPool
.
recycleObject
(
object_pool_init_1
.
PoolName
,
goods
);
goods
.
removeEventListener
(
engine
.
Event
.
ENTER_FRAME
,
goods
[
"onGoodsEnter"
],
this
);
var
index
=
this
.
goodsItems
.
indexOf
(
goods
);
if
(
index
>
-
1
)
{
this
.
goodsItems
.
splice
(
index
,
1
);
}
};
GameView
.
prototype
.
recycleGoods
=
function
()
{
clearTimeout
(
this
.
timer
);
clearInterval
(
this
.
countdownTimer
);
for
(
var
_i
=
0
,
_a
=
this
.
goodsItems
;
_i
<
_a
.
length
;
_i
++
)
{
var
goods
=
_a
[
_i
];
if
(
goods
)
{
this
.
removeChild
(
goods
);
ObjectPool
.
recycleObject
(
object_pool_init_1
.
PoolName
,
goods
);
goods
.
removeEventListener
(
engine
.
Event
.
ENTER_FRAME
,
goods
[
"onGoodsEnter"
],
this
);
}
}
this
.
goodsItems
=
[];
};
GameView
.
prototype
.
hasHit
=
function
(
a
,
b
)
{
if
(
Math
.
abs
(
a
.
x
+
a
.
width
/
2
-
(
b
.
x
+
b
.
width
/
2
))
<
a
.
width
/
2
+
b
.
width
/
2
&&
Math
.
abs
(
a
.
y
+
a
.
height
/
2
-
(
b
.
y
+
b
.
height
/
2
))
<
a
.
height
/
2
+
b
.
height
/
2
)
{
return
true
;
}
else
{
return
false
;
}
};
return
GameView
;
}(
engine
.
Container
));
exports
.
default
=
GameView
;
dist/zeroing-libs/src/custom/doll-machine/src/game/GameWrapper.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
GameView_1
=
require
(
"./GameView"
);
var
props_1
=
require
(
"../props"
);
var
GameWrapper
=
(
function
(
_super
)
{
__extends
(
GameWrapper
,
_super
);
function
GameWrapper
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
engine
.
globalEvent
.
addEventListener
(
'doll-machine-reset'
,
_this
.
reset
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'doll-machine-prize'
,
_this
.
start
,
_this
);
var
gameView
=
_this
.
_gameView
=
new
GameView_1
.
default
();
_this
.
addChild
(
gameView
);
return
_this
;
}
GameWrapper
.
prototype
.
reset
=
function
(
event
)
{
props_1
.
injectProps
(
event
.
data
);
this
.
_gameView
.
visible
=
true
;
this
.
_gameView
.
reset
();
};
GameWrapper
.
prototype
.
start
=
function
(
event
)
{
console
.
log
(
'监听开始'
);
props_1
.
injectProps
(
event
.
data
);
this
.
_gameView
.
start
(
event
.
data
);
};
GameWrapper
.
prototype
.
pause
=
function
()
{
this
.
_gameView
.
pause
();
};
GameWrapper
.
prototype
.
resume
=
function
()
{
this
.
_gameView
.
resume
();
};
GameWrapper
.
prototype
.
revive
=
function
()
{
this
.
_gameView
.
revive
();
};
GameWrapper
.
prototype
.
clear
=
function
()
{
this
.
_gameView
.
visible
=
false
;
};
GameWrapper
.
prototype
.
onTap
=
function
(
event
)
{
};
return
GameWrapper
;
}(
engine
.
Container
));
exports
.
GameWrapper
=
GameWrapper
;
dist/zeroing-libs/src/custom/doll-machine/src/game/Goods.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
utils_1
=
require
(
"./utils"
);
var
Goods
=
(
function
(
_super
)
{
__extends
(
Goods
,
_super
);
function
Goods
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
var
body
;
body
=
_this
.
_body
=
new
engine
.
Rect
();
var
box1
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"草泥马盒"
));
box1
[
"npcType"
]
=
"box1"
;
var
box2
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"狗盒"
));
box2
[
"npcType"
]
=
"box2"
;
var
box3
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"猫盒"
));
box3
[
"npcType"
]
=
"box3"
;
box1
.
visible
=
false
;
box2
.
visible
=
false
;
box3
.
visible
=
false
;
body
.
addChild
(
box1
);
body
.
addChild
(
box2
);
body
.
addChild
(
box3
);
_this
.
addChild
(
body
);
body
.
width
=
0.0001
;
body
.
height
=
0.0001
;
body
.
mouseEnabled
=
false
;
return
_this
;
}
Goods
.
prototype
.
getRandomNumberByRange
=
function
(
start
,
end
)
{
return
Math
.
floor
(
Math
.
random
()
*
(
end
-
start
)
+
start
);
};
Goods
.
prototype
.
reset
=
function
()
{
this
.
visible
=
true
;
this
.
y
=
200
;
this
.
x
=
0
;
this
.
rotation
=
0
;
var
random
=
Math
.
random
();
if
(
random
<
0.3
)
{
this
.
showNpc
(
"box1"
);
}
else
if
(
random
<
0.6
)
{
this
.
showNpc
(
"box2"
);
}
else
{
this
.
showNpc
(
"box3"
);
}
};
Goods
.
prototype
.
showNpc
=
function
(
type
)
{
for
(
var
i
=
0
;
i
<
this
.
_body
.
children
.
length
;
i
++
)
{
this
.
_body
.
children
[
i
].
visible
=
false
;
this
.
_body
.
children
[
i
].
mouseEnabled
=
false
;
}
for
(
var
i
=
0
;
i
<
this
.
_body
.
children
.
length
;
i
++
)
{
if
(
this
.
_body
.
children
[
i
][
"npcType"
]
==
type
)
{
this
[
"npcType"
]
=
type
;
console
.
log
(
type
);
this
.
_body
.
children
[
i
].
visible
=
true
;
this
.
_body
.
children
[
i
].
mouseEnabled
=
false
;
}
}
};
Object
.
defineProperty
(
Goods
.
prototype
,
"anchorOffsetY"
,
{
set
:
function
(
v
)
{
this
.
_body
.
y
=
v
;
},
enumerable
:
true
,
configurable
:
true
});
return
Goods
;
}(
engine
.
Container
));
exports
.
Goods
=
Goods
;
dist/zeroing-libs/src/custom/doll-machine/src/game/Zhuazi.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
utils_1
=
require
(
"./utils"
);
var
props_1
=
require
(
"../props"
);
var
Zhuazi
=
(
function
(
_super
)
{
__extends
(
Zhuazi
,
_super
);
function
Zhuazi
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
moveArr
=
[];
_this
.
prizeBoxs
=
[];
return
_this
;
}
Zhuazi
.
prototype
.
setup
=
function
()
{
this
.
ganNode
=
new
engine
.
Container
();
this
.
moveNode
=
new
engine
.
Container
();
this
.
ganNode
.
x
=
280
;
this
.
ganNode
.
y
=
350
;
this
.
bashouGan
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"把手杆子"
));
this
.
bashouGan
.
x
=
60
;
this
.
bashouGan
.
y
=
275
;
this
.
bashou
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"把手"
));
this
.
bashou
.
x
=
0
;
this
.
bashou
.
y
=
263
;
this
.
ganzi
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"伸缩杆"
));
this
.
ganzi
.
x
=
97
;
this
.
ganzi
.
y
=
290
;
this
.
connect
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"连接点"
));
this
.
connect
.
x
=
18
;
this
.
connect
.
y
=
-
5
;
this
.
left_zhuazi
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"左爪"
));
this
.
left_zhuazi
.
x
=
-
15
;
this
.
left_zhuazi
.
y
=
60
;
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
this
.
left_zhuazi
.
anchorY
=
0
;
this
.
right_zhuazi
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"右爪"
));
this
.
right_zhuazi
.
x
=
98
;
this
.
right_zhuazi
.
y
=
60
;
this
.
ganNode
.
addChild
(
this
.
left_zhuazi
);
this
.
ganNode
.
addChild
(
this
.
right_zhuazi
);
this
.
ganNode
.
addChild
(
this
.
connect
);
this
.
ganNode
.
x
=
30
;
this
.
zhuaziY
=
this
.
ganNode
.
y
;
this
.
moveNode
.
addChild
(
this
.
ganzi
);
this
.
moveNode
.
addChild
(
this
.
ganNode
);
this
.
moveNode
.
addChild
(
this
.
bashou
);
this
.
moveNode
.
x
=
262
;
this
.
addChild
(
this
.
bashouGan
);
this
.
addChild
(
this
.
moveNode
);
this
.
createPrizeBox
();
};
Zhuazi
.
prototype
.
createPrizeBox
=
function
()
{
var
_this
=
this
;
this
.
box1
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"中奖狗盒"
));
this
.
box1
[
"npcType"
]
=
"box1"
;
this
.
box2
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"中奖猫盒"
));
this
.
box2
[
"npcType"
]
=
"box2"
;
this
.
box3
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"中奖草泥马盒"
));
this
.
box3
[
"npcType"
]
=
"box3"
;
this
.
box4
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"中奖狗盒"
));
this
.
box4
[
"npcType"
]
=
"box4"
;
this
.
box5
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"中奖猫盒"
));
this
.
box5
[
"npcType"
]
=
"box5"
;
this
.
prizeBoxs
=
[
this
.
box1
,
this
.
box2
,
this
.
box3
,
this
.
box4
,
this
.
box5
];
this
.
prizeBoxs
.
forEach
(
function
(
item
)
{
_this
.
ganNode
.
addChild
(
item
);
item
.
visible
=
false
;
item
.
x
=
15
;
item
.
y
=
48
;
});
};
Zhuazi
.
prototype
.
showPrizeBox
=
function
()
{
var
_this
=
this
;
this
.
prizeBoxs
.
forEach
(
function
(
item
)
{
console
.
log
(
_this
.
GameView
.
getBox
()[
'npcType'
]);
if
(
item
[
'npcType'
]
===
_this
.
GameView
.
getBox
()[
'npcType'
])
{
item
.
visible
=
true
;
_this
.
itemShow
=
item
;
}
else
{
item
.
visible
=
false
;
}
});
};
Zhuazi
.
prototype
.
move
=
function
()
{
var
_this
=
this
;
var
rndist
=
Math
.
random
();
var
halfWidth
=
this
.
bashou
.
width
/
2
;
var
randomX
=
rndist
*
(
rndist
>
0.5
?
1
:
-
1
)
*
props_1
.
props
.
bashouMoveDist
;
console
.
log
(
randomX
);
engine
.
Tween
.
get
(
this
.
moveNode
).
to
({
x
:
370
+
halfWidth
-
71
},
1000
).
call
(
function
()
{
_this
.
zhangkai
();
});
};
Zhuazi
.
prototype
.
zhangkai
=
function
()
{
var
_this
=
this
;
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
this
.
left_zhuazi
.
anchorY
=
0
;
engine
.
Tween
.
get
(
this
.
left_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
props_1
.
props
.
leftRotation
},
1000
);
engine
.
Tween
.
get
(
this
.
right_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
props_1
.
props
.
rightRotation
},
1000
);
setTimeout
(
function
()
{
_this
.
getLong
();
},
500
);
};
Zhuazi
.
prototype
.
getLong
=
function
()
{
var
_this
=
this
;
var
droptime
=
Number
((
this
.
GameView
.
getMoveX
()
/
60
-
1
).
toFixed
(
2
))
*
1000
;
console
.
log
(
'dr'
,
droptime
);
var
times
=
(
props_1
.
props
.
ganMoveEndY
-
this
.
ganzi
.
y
)
/
this
.
ganzi
.
height
;
console
.
log
(
Number
(
times
.
toFixed
(
2
)));
engine
.
Tween
.
get
(
this
.
ganzi
).
to
({
scaleY
:
Number
(
times
.
toFixed
(
2
))
},
droptime
).
to
({
scaleY
:
1
},
droptime
);
console
.
log
(
'node'
,
this
.
zhuaziY
);
engine
.
Tween
.
get
(
this
.
ganNode
).
to
({
y
:
props_1
.
props
.
ganMoveEndY
},
droptime
).
call
(
function
()
{
_this
.
GameView
.
stopMove
();
if
(
_this
.
GameView
.
ifPrize
)
{
_this
.
showPrizeBox
();
_this
.
GameView
.
setVisible
(
false
);
}
}).
to
({
y
:
this
.
zhuaziY
},
droptime
).
call
(
function
()
{
if
(
_this
.
GameView
.
ifPrize
)
{
_this
.
itemShow
.
visible
=
false
;
}
engine
.
globalEvent
.
dispatchEvent
(
'doll-machine-gameover'
);
});
};
Zhuazi
.
prototype
.
getReset
=
function
()
{
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
this
.
left_zhuazi
.
anchorY
=
0
;
engine
.
Tween
.
get
(
this
.
moveNode
,
{
loop
:
false
}).
to
({
x
:
262
},
1000
);
engine
.
Tween
.
get
(
this
.
left_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
0
},
1000
);
engine
.
Tween
.
get
(
this
.
right_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
0
},
1000
);
this
.
GameView
.
resetMoveX
();
};
return
Zhuazi
;
}(
engine
.
Container
));
exports
.
Zhuazi
=
Zhuazi
;
dist/zeroing-libs/src/custom/doll-machine/src/game/backBox.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
utils_1
=
require
(
"./utils"
);
var
props_1
=
require
(
"../props"
);
var
BackBoxs
=
(
function
(
_super
)
{
__extends
(
BackBoxs
,
_super
);
function
BackBoxs
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
backBoxs
=
[];
return
_this
;
}
BackBoxs
.
prototype
.
setup
=
function
()
{
var
initX
,
initY
=
0
;
this
.
box1
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"后狗盒"
));
initX
=
this
.
box1
.
x
=
188
;
initY
=
this
.
box1
.
y
=
616
;
this
.
box2
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"后猫盒"
));
this
.
box3
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"后草泥马盒"
));
this
.
box4
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"后狗盒"
));
this
.
box5
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"后猫盒"
));
this
.
backBoxs
=
[
this
.
box1
,
this
.
box2
,
this
.
box3
,
this
.
box4
,
this
.
box5
];
for
(
var
i
=
0
;
i
<
this
.
backBoxs
.
length
;
i
++
)
{
if
(
i
==
0
)
{
this
.
backBoxs
[
i
].
x
=
initX
;
}
else
{
this
.
backBoxs
[
i
].
x
=
this
.
backBoxs
[
i
-
1
].
x
+
this
.
backBoxs
[
i
].
width
+
props_1
.
props
.
backmargin
;
}
this
.
backBoxs
[
i
].
y
=
initY
;
this
.
addChild
(
this
.
backBoxs
[
i
]);
}
this
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
frameMove
,
this
);
};
BackBoxs
.
prototype
.
frameMove
=
function
()
{
var
_this
=
this
;
this
.
backBoxs
.
forEach
(
function
(
item
)
{
item
.
x
-=
props_1
.
props
.
moveSpeed
;
if
(
item
.
x
<=
0
)
{
var
lastitem
=
_this
.
backBoxs
.
shift
();
lastitem
.
x
=
_this
.
backBoxs
[
_this
.
backBoxs
.
length
-
1
].
x
+
item
.
width
+
props_1
.
props
.
backmargin
;
_this
.
backBoxs
.
push
(
lastitem
);
}
});
};
return
BackBoxs
;
}(
engine
.
Container
));
exports
.
BackBoxs
=
BackBoxs
;
dist/zeroing-libs/src/custom/doll-machine/src/game/frontBox.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
utils_1
=
require
(
"./utils"
);
var
props_1
=
require
(
"../props"
);
var
FrontBoxs
=
(
function
(
_super
)
{
__extends
(
FrontBoxs
,
_super
);
function
FrontBoxs
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
frontBoxs
=
[];
return
_this
;
}
FrontBoxs
.
prototype
.
setup
=
function
()
{
var
initX
,
initY
=
0
;
this
.
box1
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"狗盒"
));
this
.
box1
[
"npcType"
]
=
"box1"
;
initX
=
this
.
box1
.
x
=
435
;
initY
=
this
.
box1
.
y
=
614
;
this
.
box2
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"猫盒"
));
this
.
box2
[
"npcType"
]
=
"box2"
;
this
.
box3
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"草泥马盒"
));
this
.
box3
[
"npcType"
]
=
"box3"
;
this
.
box4
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"狗盒"
));
this
.
box4
[
"npcType"
]
=
"box4"
;
this
.
box5
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"猫盒"
));
this
.
box5
[
"npcType"
]
=
"box5"
;
this
.
frontBoxs
=
[
this
.
box1
,
this
.
box2
,
this
.
box3
,
this
.
box4
];
for
(
var
i
=
0
;
i
<
this
.
frontBoxs
.
length
;
i
++
)
{
if
(
i
==
0
)
{
this
.
frontBoxs
[
i
].
x
=
initX
;
}
else
{
this
.
frontBoxs
[
i
].
x
=
this
.
frontBoxs
[
i
-
1
].
x
-
this
.
box1
.
width
-
props_1
.
props
.
frontmargin
;
}
this
.
frontBoxs
[
i
].
y
=
initY
;
this
.
addChild
(
this
.
frontBoxs
[
i
]);
}
this
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
frameMove
,
this
);
};
FrontBoxs
.
prototype
.
frameMove
=
function
()
{
var
_this
=
this
;
this
.
frontBoxs
.
forEach
(
function
(
item
,
index
)
{
item
.
x
+=
props_1
.
props
.
moveSpeed
;
if
(
item
.
x
<=
0
&&
!
item
.
visible
)
{
item
.
visible
=
true
;
}
if
(
item
.
x
>=
750
)
{
var
lastitem
=
_this
.
frontBoxs
.
shift
();
lastitem
.
x
=
_this
.
frontBoxs
[
_this
.
frontBoxs
.
length
-
1
].
x
-
_this
.
box1
.
width
-
props_1
.
props
.
frontmargin
;
if
(
!
_this
.
GameView
.
getMoveX
()
&&
item
.
x
<=
0
&&
_this
.
GameView
.
startstatus
)
{
_this
.
GameView
.
setMoveX
((
370
-
item
.
x
-
13
)
/
props_1
.
props
.
moveSpeed
,
item
);
_this
.
hideBox
=
item
;
}
_this
.
frontBoxs
.
push
(
lastitem
);
}
});
};
FrontBoxs
.
prototype
.
stop
=
function
()
{
};
FrontBoxs
.
prototype
.
showHidePrizeBox
=
function
(
isshow
)
{
this
.
hideBox
.
visible
=
isshow
;
};
return
FrontBoxs
;
}(
engine
.
Container
));
exports
.
FrontBoxs
=
FrontBoxs
;
dist/zeroing-libs/src/custom/doll-machine/src/game/object-pool-init.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
Goods_1
=
require
(
"./Goods"
);
var
ObjectPool
=
engine
.
ObjectPool
;
exports
.
PoolName
=
'goods'
;
ObjectPool
.
registerPool
(
exports
.
PoolName
,
function
()
{
return
new
Goods_1
.
Goods
();
},
function
(
item
,
data
)
{
item
.
reset
();
});
dist/zeroing-libs/src/custom/doll-machine/src/game/utils.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
exports
.
getTexture
=
getTexture
;
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
exports
.
getTextureByName
=
getTextureByName
;
function
playSound
(
name
)
{
engine
.
playSound
(
engine
.
getAssetByName
(
name
).
uuid
,
{
keep
:
true
});
}
exports
.
playSound
=
playSound
;
function
createSvga
(
name
,
anchorName
)
{
var
inst
=
new
svga
.
Svga
();
inst
.
source
=
'asset://'
+
engine
.
getAssetByName
(
name
).
uuid
;
return
inst
;
}
exports
.
createSvga
=
createSvga
;
dist/zeroing-libs/src/custom/doll-machine/src/index.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
GameWrapper_1
=
require
(
"./game/GameWrapper"
);
var
props_1
=
require
(
"./props"
);
function
default_1
(
props
)
{
props_1
.
prepareProps
();
props_1
.
injectProps
(
props
);
var
instance
=
new
GameWrapper_1
.
GameWrapper
();
return
instance
;
}
exports
.
default
=
default_1
;
dist/zeroing-libs/src/custom/doll-machine/src/props.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
exports
.
props
=
{};
function
prepareProps
()
{
var
metaProps
=
getProps
();
engine
.
injectProp
(
exports
.
props
,
metaProps
);
}
exports
.
prepareProps
=
prepareProps
;
function
injectProps
(
p
)
{
engine
.
injectProp
(
exports
.
props
,
p
);
}
exports
.
injectProps
=
injectProps
;
dist/zeroing-libs/src/custom/doll-machine2/src/game/GameView.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
props_1
=
require
(
"../props"
);
var
utils_1
=
require
(
"./utils"
);
var
frontBox_1
=
require
(
"./frontBox"
);
var
backBox_1
=
require
(
"./backBox"
);
var
Zhuazi_1
=
require
(
"./Zhuazi"
);
var
GameView
=
(
function
(
_super
)
{
__extends
(
GameView
,
_super
);
function
GameView
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
startstatus
=
false
;
_this
.
ifPrize
=
false
;
_this
.
goodsItems
=
[];
_this
.
once
(
engine
.
Event
.
ADDED_TO_STAGE
,
_this
.
setup
,
_this
);
return
_this
;
}
GameView
.
prototype
.
setup
=
function
()
{
var
_this
=
this
;
if
(
this
.
_hasSetup
)
{
return
;
}
this
.
_hasSetup
=
true
;
var
frontBoxs
=
(
this
.
_frontBoxs
=
new
frontBox_1
.
FrontBoxs
());
this
.
_frontBoxs
.
GameView
=
this
;
var
backBoxs
=
(
this
.
_backBoxs
=
new
backBox_1
.
BackBoxs
());
this
.
_Zhuazi
=
new
Zhuazi_1
.
Zhuazi
();
this
.
_Zhuazi
.
GameView
=
this
;
this
.
frontTransfer
=
new
engine
.
Container
();
this
.
backTransfer
=
new
engine
.
Container
();
this
.
frontTransfer
.
width
=
0
;
this
.
frontTransfer
.
height
=
0
;
this
.
frontTransfer
.
alpha
=
1
;
this
.
backTransfer
.
width
=
0
;
this
.
backTransfer
.
height
=
0
;
this
.
backTransfer
.
alpha
=
1
;
this
.
rect
=
new
engine
.
Rect
();
this
.
rect
.
width
=
props_1
.
props
.
gameStageWidth
;
this
.
rect
.
height
=
props_1
.
props
.
gameStageHeight
;
this
.
rect
.
x
=
65
;
this
.
rect
.
y
=
0
;
this
.
NpcBg
=
new
engine
.
Container
();
this
.
NpcBg
.
x
=
0
;
this
.
NpcBg
.
y
=
0
;
this
.
addChild
(
this
.
NpcBg
);
this
.
addChild
(
this
.
rect
);
this
.
frontDesk
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"前传输带"
));
this
.
frontDesk
.
x
=
props_1
.
props
.
initOffsetLeft
;
this
.
frontDesk
.
y
=
props_1
.
props
.
frontDeskY
-
props_1
.
props
.
initOffsetTop
;
this
.
backDesk
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"后传输带"
));
this
.
backDesk
.
x
=
props_1
.
props
.
initOffsetLeft
;
this
.
backDesk
.
y
=
props_1
.
props
.
backDeskY
-
props_1
.
props
.
initOffsetTop
;
if
(
props_1
.
props
.
single
)
{
this
.
backDesk
.
visible
=
false
;
}
var
pcarr
=
[
this
.
backDesk
,
this
.
frontDesk
,
this
.
backTransfer
,
this
.
frontTransfer
,
this
.
_Zhuazi
];
pcarr
.
forEach
(
function
(
item
)
{
_this
.
NpcBg
.
addChild
(
item
);
});
this
.
NpcBg
.
mask
=
this
.
rect
;
this
.
_Zhuazi
.
setup
();
this
.
backTransfer
.
addChild
(
this
.
_backBoxs
);
this
.
_backBoxs
.
setup
();
if
(
props_1
.
props
.
single
)
{
this
.
backTransfer
.
visible
=
false
;
}
this
.
frontTransfer
.
addChild
(
this
.
_frontBoxs
);
this
.
_frontBoxs
.
setup
();
};
GameView
.
prototype
.
stopMove
=
function
()
{
this
.
_frontBoxs
.
stop
();
};
GameView
.
prototype
.
setMoveX
=
function
(
x
,
item
)
{
this
.
moveTime
=
x
;
this
.
prizeBox
=
item
;
this
.
_Zhuazi
.
move
();
};
GameView
.
prototype
.
setVisible
=
function
(
isshow
)
{
this
.
_frontBoxs
.
showHidePrizeBox
(
isshow
);
};
GameView
.
prototype
.
getMoveX
=
function
()
{
return
this
.
moveTime
;
};
GameView
.
prototype
.
resetMoveX
=
function
()
{
this
.
moveTime
=
null
;
};
GameView
.
prototype
.
getBox
=
function
()
{
return
this
.
prizeBox
;
};
GameView
.
prototype
.
reset
=
function
()
{
this
.
startstatus
=
false
;
this
.
ifPrize
=
false
;
this
.
_Zhuazi
.
getReset
();
};
GameView
.
prototype
.
start
=
function
(
type
)
{
if
(
type
===
void
0
)
{
type
=
null
;
}
this
.
speed
=
1
;
this
.
gameIng
=
true
;
console
.
log
(
'执行'
,
type
);
this
.
startstatus
=
true
;
this
.
ifPrize
=
type
&&
type
.
prize
||
false
;
};
GameView
.
prototype
.
beginNpc
=
function
()
{
var
_this
=
this
;
this
.
timer
=
setTimeout
(
function
()
{
if
(
_this
.
gameIng
)
{
}
},
2000
/
this
.
speed
);
};
GameView
.
prototype
.
pause
=
function
()
{
this
.
gameIng
=
false
;
};
GameView
.
prototype
.
revive
=
function
()
{
this
.
gameIng
=
true
;
};
GameView
.
prototype
.
resume
=
function
()
{
this
.
reset
();
this
.
start
();
};
return
GameView
;
}(
engine
.
Container
));
exports
.
default
=
GameView
;
dist/zeroing-libs/src/custom/doll-machine2/src/game/GameWrapper.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
GameView_1
=
require
(
"./GameView"
);
var
props_1
=
require
(
"../props"
);
var
GameWrapper
=
(
function
(
_super
)
{
__extends
(
GameWrapper
,
_super
);
function
GameWrapper
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
engine
.
globalEvent
.
addEventListener
(
'doll-machine2-game-init'
,
_this
.
reset
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'doll-machine2-game-start'
,
_this
.
start
,
_this
);
var
gameView
=
_this
.
_gameView
=
new
GameView_1
.
default
();
_this
.
addChild
(
gameView
);
return
_this
;
}
GameWrapper
.
prototype
.
reset
=
function
(
event
)
{
props_1
.
injectProps
(
event
.
data
);
this
.
_gameView
.
visible
=
true
;
this
.
_gameView
.
reset
();
};
GameWrapper
.
prototype
.
start
=
function
(
event
)
{
console
.
log
(
'监听开始'
);
props_1
.
injectProps
(
event
.
data
);
this
.
_gameView
.
start
(
event
.
data
);
};
GameWrapper
.
prototype
.
pause
=
function
()
{
this
.
_gameView
.
pause
();
};
GameWrapper
.
prototype
.
resume
=
function
()
{
this
.
_gameView
.
resume
();
};
GameWrapper
.
prototype
.
revive
=
function
()
{
this
.
_gameView
.
revive
();
};
GameWrapper
.
prototype
.
clear
=
function
()
{
this
.
_gameView
.
visible
=
false
;
};
GameWrapper
.
prototype
.
onTap
=
function
(
event
)
{
};
return
GameWrapper
;
}(
engine
.
Container
));
exports
.
GameWrapper
=
GameWrapper
;
dist/zeroing-libs/src/custom/doll-machine2/src/game/Goods.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
utils_1
=
require
(
"./utils"
);
var
Goods
=
(
function
(
_super
)
{
__extends
(
Goods
,
_super
);
function
Goods
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
var
body
;
body
=
_this
.
_body
=
new
engine
.
Rect
();
var
box1
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"草泥马盒"
));
box1
[
"npcType"
]
=
"box1"
;
var
box2
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"狗盒"
));
box2
[
"npcType"
]
=
"box2"
;
var
box3
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"猫盒"
));
box3
[
"npcType"
]
=
"box3"
;
box1
.
visible
=
false
;
box2
.
visible
=
false
;
box3
.
visible
=
false
;
body
.
addChild
(
box1
);
body
.
addChild
(
box2
);
body
.
addChild
(
box3
);
_this
.
addChild
(
body
);
body
.
width
=
0.0001
;
body
.
height
=
0.0001
;
body
.
mouseEnabled
=
false
;
return
_this
;
}
Goods
.
prototype
.
getRandomNumberByRange
=
function
(
start
,
end
)
{
return
Math
.
floor
(
Math
.
random
()
*
(
end
-
start
)
+
start
);
};
Goods
.
prototype
.
reset
=
function
()
{
this
.
visible
=
true
;
this
.
y
=
200
;
this
.
x
=
0
;
this
.
rotation
=
0
;
var
random
=
Math
.
random
();
if
(
random
<
0.3
)
{
this
.
showNpc
(
"box1"
);
}
else
if
(
random
<
0.6
)
{
this
.
showNpc
(
"box2"
);
}
else
{
this
.
showNpc
(
"box3"
);
}
};
Goods
.
prototype
.
showNpc
=
function
(
type
)
{
for
(
var
i
=
0
;
i
<
this
.
_body
.
children
.
length
;
i
++
)
{
this
.
_body
.
children
[
i
].
visible
=
false
;
this
.
_body
.
children
[
i
].
mouseEnabled
=
false
;
}
for
(
var
i
=
0
;
i
<
this
.
_body
.
children
.
length
;
i
++
)
{
if
(
this
.
_body
.
children
[
i
][
"npcType"
]
==
type
)
{
this
[
"npcType"
]
=
type
;
console
.
log
(
type
);
this
.
_body
.
children
[
i
].
visible
=
true
;
this
.
_body
.
children
[
i
].
mouseEnabled
=
false
;
}
}
};
Object
.
defineProperty
(
Goods
.
prototype
,
"anchorOffsetY"
,
{
set
:
function
(
v
)
{
this
.
_body
.
y
=
v
;
},
enumerable
:
true
,
configurable
:
true
});
return
Goods
;
}(
engine
.
Container
));
exports
.
Goods
=
Goods
;
dist/zeroing-libs/src/custom/doll-machine2/src/game/Zhuazi.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
utils_1
=
require
(
"./utils"
);
var
props_1
=
require
(
"../props"
);
var
Zhuazi
=
(
function
(
_super
)
{
__extends
(
Zhuazi
,
_super
);
function
Zhuazi
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
moveArr
=
[];
_this
.
prizeBoxs
=
[];
return
_this
;
}
Zhuazi
.
prototype
.
setup
=
function
()
{
this
.
ganNode
=
new
engine
.
Container
();
this
.
moveNode
=
new
engine
.
Container
();
this
.
ganNode
.
x
=
280
;
this
.
ganNode
.
y
=
350
;
this
.
bashouGan
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"把手杆子"
));
this
.
bashouGan
.
x
=
60
;
this
.
bashouGan
.
y
=
12
;
this
.
bashou
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"把手"
));
this
.
bashou
.
x
=
0
;
this
.
bashou
.
y
=
0
;
this
.
ganzi
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"伸缩杆"
));
this
.
ganzi
.
x
=
97
;
this
.
ganzi
.
y
=
27
;
this
.
connect
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"连接点"
));
this
.
connect
.
x
=
18
;
this
.
connect
.
y
=
-
5
;
this
.
left_zhuazi
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"左爪"
));
this
.
left_zhuazi
.
x
=
props_1
.
props
.
leftLocX
;
this
.
left_zhuazi
.
y
=
props_1
.
props
.
leftLocY
;
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
this
.
left_zhuazi
.
anchorY
=
0
;
this
.
right_zhuazi
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
"右爪"
));
this
.
right_zhuazi
.
x
=
props_1
.
props
.
rightLocX
;
this
.
right_zhuazi
.
y
=
props_1
.
props
.
rightLocY
;
this
.
ganNode
.
addChild
(
this
.
left_zhuazi
);
this
.
ganNode
.
addChild
(
this
.
right_zhuazi
);
this
.
ganNode
.
addChild
(
this
.
connect
);
this
.
ganNode
.
x
=
30
;
this
.
ganNode
.
y
=
this
.
ganNode
.
y
-
263
;
this
.
zhuaziY
=
this
.
ganNode
.
y
;
this
.
moveNode
.
addChild
(
this
.
ganzi
);
this
.
moveNode
.
addChild
(
this
.
ganNode
);
this
.
moveNode
.
addChild
(
this
.
bashou
);
this
.
moveNode
.
x
=
262
;
this
.
bashouGan
.
y
=
this
.
bashouGan
.
y
;
this
.
moveNode
.
y
=
this
.
moveNode
.
y
;
this
.
addChild
(
this
.
bashouGan
);
this
.
addChild
(
this
.
moveNode
);
if
(
!
props_1
.
props
.
ganziShow
)
{
this
.
bashouGan
.
visible
=
false
;
}
if
(
!
props_1
.
props
.
bashouShow
)
{
this
.
bashou
.
visible
=
false
;
}
this
.
createPrizeBox
();
};
Zhuazi
.
prototype
.
createPrizeBox
=
function
()
{
var
_this
=
this
;
for
(
var
i
=
0
;
i
<
props_1
.
props
.
dollNum
;
i
++
)
{
if
(
!
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
'prizebox_'
+
i
)))
{
return
;
}
this
.
prizeBoxs
[
i
]
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
'prizebox_'
+
i
));
this
.
prizeBoxs
[
i
][
'npcType'
]
=
'box'
+
i
;
}
this
.
prizeBoxs
[
props_1
.
props
.
dollNum
]
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
'prizebox_0'
));
this
.
prizeBoxs
[
props_1
.
props
.
dollNum
][
'npcType'
]
=
'box'
+
props_1
.
props
.
dollNum
;
this
.
prizeBoxs
.
forEach
(
function
(
item
)
{
_this
.
ganNode
.
addChild
(
item
);
item
.
visible
=
false
;
item
.
x
=
props_1
.
props
.
prizeBoxInitX
;
item
.
y
=
props_1
.
props
.
prizeBoxInitY
;
});
};
Zhuazi
.
prototype
.
showPrizeBox
=
function
()
{
var
_this
=
this
;
this
.
prizeBoxs
.
forEach
(
function
(
item
)
{
console
.
log
(
_this
.
GameView
.
getBox
()[
'npcType'
]);
if
(
item
[
'npcType'
]
===
_this
.
GameView
.
getBox
()[
'npcType'
])
{
item
.
visible
=
true
;
_this
.
itemShow
=
item
;
}
else
{
item
.
visible
=
false
;
}
});
};
Zhuazi
.
prototype
.
move
=
function
()
{
var
_this
=
this
;
var
rndist
=
Math
.
random
();
var
halfWidth
=
this
.
bashou
.
width
/
2
;
var
randomX
=
rndist
*
(
rndist
>
0.5
?
1
:
-
1
)
*
props_1
.
props
.
bashouMoveDist
;
console
.
log
(
randomX
);
engine
.
Tween
.
get
(
this
.
moveNode
).
to
({
x
:
370
+
halfWidth
-
71
},
1000
).
call
(
function
()
{
_this
.
zhangkai
();
});
};
Zhuazi
.
prototype
.
zhangkai
=
function
()
{
var
_this
=
this
;
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
this
.
left_zhuazi
.
anchorY
=
0
;
engine
.
Tween
.
get
(
this
.
left_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
props_1
.
props
.
leftRotation
},
1000
);
engine
.
Tween
.
get
(
this
.
right_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
props_1
.
props
.
rightRotation
},
1000
);
setTimeout
(
function
()
{
_this
.
getLong
();
},
500
);
};
Zhuazi
.
prototype
.
getLong
=
function
()
{
var
_this
=
this
;
var
droptime
=
Number
((
this
.
GameView
.
getMoveX
()
/
60
-
1
).
toFixed
(
2
))
*
1000
-
130
;
console
.
log
(
'dr'
,
droptime
);
var
times
=
(
props_1
.
props
.
ganMoveEndY
-
this
.
ganzi
.
y
)
/
this
.
ganzi
.
height
;
console
.
log
(
Number
(
times
.
toFixed
(
2
)));
engine
.
Tween
.
get
(
this
.
ganzi
).
to
({
scaleY
:
Number
(
times
.
toFixed
(
2
))
},
droptime
).
to
({
scaleY
:
1
},
droptime
);
console
.
log
(
'node'
,
this
.
zhuaziY
);
engine
.
Tween
.
get
(
this
.
ganNode
).
to
({
y
:
props_1
.
props
.
ganMoveEndY
},
droptime
).
call
(
function
()
{
_this
.
GameView
.
stopMove
();
if
(
_this
.
GameView
.
ifPrize
)
{
_this
.
showPrizeBox
();
_this
.
GameView
.
setVisible
(
false
);
}
}).
to
({
y
:
this
.
zhuaziY
},
droptime
).
call
(
function
()
{
if
(
_this
.
GameView
.
ifPrize
)
{
_this
.
itemShow
.
visible
=
false
;
}
engine
.
globalEvent
.
dispatchEvent
(
'doll-machine2-game-end'
);
});
};
Zhuazi
.
prototype
.
getReset
=
function
()
{
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
this
.
left_zhuazi
.
anchorY
=
0
;
engine
.
Tween
.
get
(
this
.
moveNode
,
{
loop
:
false
}).
to
({
x
:
262
},
1000
);
engine
.
Tween
.
get
(
this
.
left_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
0
},
1000
);
engine
.
Tween
.
get
(
this
.
right_zhuazi
,
{
loop
:
false
}).
to
({
rotation
:
0
},
1000
);
this
.
GameView
.
resetMoveX
();
};
return
Zhuazi
;
}(
engine
.
Container
));
exports
.
Zhuazi
=
Zhuazi
;
dist/zeroing-libs/src/custom/doll-machine2/src/game/backBox.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
utils_1
=
require
(
"./utils"
);
var
props_1
=
require
(
"../props"
);
var
BackBoxs
=
(
function
(
_super
)
{
__extends
(
BackBoxs
,
_super
);
function
BackBoxs
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
backBoxs
=
[];
return
_this
;
}
BackBoxs
.
prototype
.
setup
=
function
()
{
var
initX
,
initY
=
0
;
for
(
var
i
=
0
;
i
<
props_1
.
props
.
dollNum
;
i
++
)
{
this
.
backBoxs
[
i
]
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
'backbox_'
+
i
));
initX
=
this
.
backBoxs
[
0
].
x
=
props_1
.
props
.
backInitX
;
initY
=
this
.
backBoxs
[
0
].
y
=
props_1
.
props
.
backInitY
-
props_1
.
props
.
initOffsetTop
;
this
.
backBoxs
[
i
][
'npcType'
]
=
'box'
+
i
;
}
this
.
backBoxs
[
props_1
.
props
.
dollNum
]
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
'backbox_0'
));
this
.
backBoxs
[
props_1
.
props
.
dollNum
][
'npcType'
]
=
'box'
+
props_1
.
props
.
dollNum
;
for
(
var
i
=
0
;
i
<
this
.
backBoxs
.
length
;
i
++
)
{
if
(
i
==
0
)
{
this
.
backBoxs
[
i
].
x
=
initX
;
}
else
{
this
.
backBoxs
[
i
].
x
=
this
.
backBoxs
[
i
-
1
].
x
+
this
.
backBoxs
[
i
].
width
+
props_1
.
props
.
backmargin
;
}
this
.
backBoxs
[
i
].
y
=
initY
;
this
.
addChild
(
this
.
backBoxs
[
i
]);
}
this
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
frameMove
,
this
);
};
BackBoxs
.
prototype
.
frameMove
=
function
()
{
var
_this
=
this
;
this
.
backBoxs
.
forEach
(
function
(
item
)
{
item
.
x
-=
props_1
.
props
.
moveSpeed
;
if
(
item
.
x
<=
0
)
{
var
lastitem
=
_this
.
backBoxs
.
shift
();
lastitem
.
x
=
_this
.
backBoxs
[
_this
.
backBoxs
.
length
-
1
].
x
+
item
.
width
+
props_1
.
props
.
backmargin
;
_this
.
backBoxs
.
push
(
lastitem
);
}
});
};
return
BackBoxs
;
}(
engine
.
Container
));
exports
.
BackBoxs
=
BackBoxs
;
dist/zeroing-libs/src/custom/doll-machine2/src/game/frontBox.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
utils_1
=
require
(
"./utils"
);
var
props_1
=
require
(
"../props"
);
var
FrontBoxs
=
(
function
(
_super
)
{
__extends
(
FrontBoxs
,
_super
);
function
FrontBoxs
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
frontBoxs
=
[];
return
_this
;
}
FrontBoxs
.
prototype
.
setup
=
function
()
{
var
initX
,
initY
=
0
;
for
(
var
i
=
0
;
i
<
props_1
.
props
.
dollNum
;
i
++
)
{
if
(
!
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
'frontbox_'
+
i
)))
{
return
;
}
this
.
frontBoxs
[
i
]
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
'frontbox_'
+
i
));
initX
=
this
.
frontBoxs
[
0
].
x
=
props_1
.
props
.
frontInitX
;
initY
=
this
.
frontBoxs
[
0
].
y
=
props_1
.
props
.
frontInitY
;
this
.
frontBoxs
[
i
][
'npcType'
]
=
'box'
+
i
;
}
this
.
frontBoxs
[
props_1
.
props
.
dollNum
]
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
'frontbox_0'
));
this
.
frontBoxs
[
props_1
.
props
.
dollNum
][
'npcType'
]
=
'box'
+
props_1
.
props
.
dollNum
;
console
.
log
(
this
.
frontBoxs
);
for
(
var
i
=
0
;
i
<
this
.
frontBoxs
.
length
;
i
++
)
{
if
(
i
==
0
)
{
this
.
frontBoxs
[
i
].
x
=
initX
;
}
else
{
this
.
frontBoxs
[
i
].
x
=
this
.
frontBoxs
[
i
-
1
].
x
-
this
.
frontBoxs
[
0
].
width
-
props_1
.
props
.
frontmargin
;
}
console
.
log
(
this
.
frontBoxs
[
i
].
x
);
this
.
frontBoxs
[
i
].
y
=
initY
;
this
.
addChild
(
this
.
frontBoxs
[
i
]);
console
.
log
(
'aaa'
,
this
.
frontBoxs
[
i
].
x
);
}
this
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
frameMove
,
this
);
};
FrontBoxs
.
prototype
.
frameMove
=
function
()
{
var
_this
=
this
;
this
.
frontBoxs
.
forEach
(
function
(
item
,
index
)
{
item
.
x
+=
props_1
.
props
.
moveSpeed
;
if
(
item
.
x
<=
0
&&
!
item
.
visible
)
{
item
.
visible
=
true
;
}
if
(
item
.
x
>=
750
)
{
var
tmpIndex
=
0
;
if
(
index
<=
0
)
{
tmpIndex
=
_this
.
frontBoxs
.
length
-
1
;
}
else
{
tmpIndex
=
index
-
1
;
}
item
.
x
=
_this
.
frontBoxs
[
tmpIndex
].
x
-
_this
.
frontBoxs
[
0
].
width
-
props_1
.
props
.
frontmargin
;
if
(
!
_this
.
GameView
.
getMoveX
()
&&
item
.
x
<=
0
&&
_this
.
GameView
.
startstatus
)
{
_this
.
GameView
.
setMoveX
((
370
-
item
.
x
-
13
)
/
props_1
.
props
.
moveSpeed
,
item
);
_this
.
hideBox
=
item
;
}
}
});
};
FrontBoxs
.
prototype
.
stop
=
function
()
{
};
FrontBoxs
.
prototype
.
showHidePrizeBox
=
function
(
isshow
)
{
this
.
hideBox
.
visible
=
isshow
;
};
return
FrontBoxs
;
}(
engine
.
Container
));
exports
.
FrontBoxs
=
FrontBoxs
;
dist/zeroing-libs/src/custom/doll-machine2/src/game/object-pool-init.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
Goods_1
=
require
(
"./Goods"
);
var
ObjectPool
=
engine
.
ObjectPool
;
exports
.
PoolName
=
'goods'
;
ObjectPool
.
registerPool
(
exports
.
PoolName
,
function
()
{
return
new
Goods_1
.
Goods
();
},
function
(
item
,
data
)
{
item
.
reset
();
});
dist/zeroing-libs/src/custom/doll-machine2/src/game/utils.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
exports
.
getTexture
=
getTexture
;
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
exports
.
getTextureByName
=
getTextureByName
;
function
playSound
(
name
)
{
engine
.
playSound
(
engine
.
getAssetByName
(
name
).
uuid
,
{
keep
:
true
});
}
exports
.
playSound
=
playSound
;
function
createSvga
(
name
,
anchorName
)
{
var
inst
=
new
svga
.
Svga
();
inst
.
source
=
'asset://'
+
engine
.
getAssetByName
(
name
).
uuid
;
return
inst
;
}
exports
.
createSvga
=
createSvga
;
dist/zeroing-libs/src/custom/doll-machine2/src/index.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
GameWrapper_1
=
require
(
"./game/GameWrapper"
);
var
props_1
=
require
(
"./props"
);
function
default_1
(
props
)
{
props_1
.
prepareProps
();
props_1
.
injectProps
(
props
);
var
instance
=
new
GameWrapper_1
.
GameWrapper
();
return
instance
;
}
exports
.
default
=
default_1
;
dist/zeroing-libs/src/custom/doll-machine2/src/props.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
exports
.
props
=
{};
function
prepareProps
()
{
var
metaProps
=
getProps
();
engine
.
injectProp
(
exports
.
props
,
metaProps
);
}
exports
.
prepareProps
=
prepareProps
;
function
injectProps
(
p
)
{
engine
.
injectProp
(
exports
.
props
,
p
);
}
exports
.
injectProps
=
injectProps
;
dist/zeroing-libs/src/custom/dxbcyj-game/src/game/Background.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
utils_1
=
require
(
"./utils"
);
var
LoopComponent_1
=
require
(
"./LoopComponent"
);
var
props_1
=
require
(
"./../props"
);
var
Background
=
(
function
(
_super
)
{
__extends
(
Background
,
_super
);
function
Background
()
{
var
_this
=
_super
!==
null
&&
_super
.
apply
(
this
,
arguments
)
||
this
;
_this
.
partResHHL
=
[
'hhl_after'
,
'hhl_front'
];
_this
.
partResHB
=
[
'hb_after'
,
'hb_front'
];
_this
.
partResWH
=
[
'wh_after'
,
'wh_front'
];
_this
.
speeds
=
[];
_this
.
resArray
=
[];
_this
.
frameMovePos
=
0
;
return
_this
;
}
Background
.
prototype
.
initBg
=
function
()
{
this
.
sumMovePos
=
0
;
this
.
speeds
.
push
(
props_1
.
props
.
afterBGMoveSpeed
);
this
.
speeds
.
push
(
props_1
.
props
.
frontBGMoveSpeed
);
var
bottomBg
=
new
engine
.
Rect
();
bottomBg
.
x
=
0
;
bottomBg
.
y
=
0
;
bottomBg
.
width
=
utils_1
.
getStage
().
width
;
bottomBg
.
height
=
0
;
bottomBg
.
fillColor
=
0x75c9f5
;
this
.
addChild
(
bottomBg
);
this
.
resArray
.
push
(
this
.
partResHHL
);
this
.
resArray
.
push
(
this
.
partResHB
);
this
.
resArray
.
push
(
this
.
partResWH
);
this
.
_bgIndex
=
0
;
var
parts
=
[];
for
(
var
i
=
0
;
i
<
2
;
i
++
)
{
var
part
=
new
LoopComponent_1
.
LoopComponent
();
part
.
setupLoop
([
this
.
resArray
[
0
][
i
],
this
.
resArray
[
0
][
i
],
]);
parts
.
push
(
part
);
this
.
addChild
(
part
);
}
parts
[
1
].
y
=
200
;
};
Background
.
prototype
.
setViewport
=
function
(
pos
)
{
this
.
needFrameSum
=
(
props_1
.
props
.
pierMoveTime
/
1000
)
*
60
;
this
.
frameMovePos
=
pos
/
this
.
needFrameSum
;
this
.
frameIndex
=
0
;
this
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
frameBack
,
this
);
};
Background
.
prototype
.
frameBack
=
function
()
{
if
(
this
.
frameIndex
<
this
.
needFrameSum
)
{
for
(
var
i
=
0
;
i
<
2
;
i
++
)
{
var
part
=
this
.
getChildAt
(
i
+
1
);
var
speed
=
this
.
speeds
[
i
];
var
tmpPos
=
((
this
.
frameMovePos
*
this
.
frameIndex
)
+
this
.
sumMovePos
)
*
speed
;
part
.
setViewport
(
tmpPos
);
}
this
.
frameIndex
++
;
}
else
{
this
.
sumMovePos
+=
this
.
frameMovePos
*
this
.
needFrameSum
;
this
.
frameIndex
=
0
;
this
.
removeEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
frameBack
,
this
);
}
};
Background
.
prototype
.
changeBg
=
function
(
index
)
{
for
(
var
i
=
0
;
i
<
2
;
i
++
)
{
var
part
=
this
.
getChildAt
(
i
+
1
);
part
.
changeBg
(
this
.
resArray
[
index
][
i
]);
if
(
i
==
1
&&
index
==
1
)
{
part
.
y
=
400
;
}
if
(
i
==
1
&&
index
==
2
)
{
part
.
y
=
250
;
}
}
this
.
_bgIndex
=
index
;
};
Background
.
prototype
.
getBgIndex
=
function
()
{
return
this
.
_bgIndex
;
};
return
Background
;
}(
engine
.
Container
));
exports
.
Background
=
Background
;
dist/zeroing-libs/src/custom/dxbcyj-game/src/game/GameView.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
Road_1
=
require
(
"./Road"
);
var
props_1
=
require
(
"../props"
);
var
utils_1
=
require
(
"./utils"
);
var
GuideLayer_1
=
require
(
"./GuideLayer"
);
var
Background_1
=
require
(
"./Background"
);
var
ObjectPool
=
engine
.
ObjectPool
;
var
Pier_1
=
require
(
"./Pier"
);
var
Player_1
=
require
(
"./Player"
);
var
Strut_1
=
require
(
"./Strut"
);
var
ScoreLabel_1
=
require
(
"./ScoreLabel"
);
exports
.
PoolName
=
'pier'
;
ObjectPool
.
registerPool
(
exports
.
PoolName
,
function
()
{
return
new
Pier_1
.
Pier
();
},
function
(
item
,
data
)
{
item
.
init
();
});
var
GameView
=
(
function
(
_super
)
{
__extends
(
GameView
,
_super
);
function
GameView
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
moveX
=
0
;
_this
.
once
(
engine
.
Event
.
ADDED_TO_STAGE
,
_this
.
setup
,
_this
);
return
_this
;
}
GameView
.
prototype
.
setup
=
function
()
{
if
(
this
.
_hasSetup
)
{
return
;
}
this
.
_hasSetup
=
true
;
this
.
_backgroud
=
new
Background_1
.
Background
();
this
.
addChild
(
this
.
_backgroud
);
this
.
_backgroud
.
initBg
();
var
road
=
this
.
_road
=
new
Road_1
.
Road
();
this
.
addChild
(
road
);
road
.
setup
();
var
pierWidth
=
this
.
_road
.
getFristPier
();
var
player
=
this
.
_player
=
new
Player_1
.
Player
();
this
.
addChild
(
player
);
player
.
initPlayer
(
pierWidth
);
var
strut
=
this
.
_strut
=
new
Strut_1
.
Strut
();
this
.
addChild
(
strut
);
strut
.
init
();
this
.
_scoreContainer
=
new
engine
.
Container
();
this
.
addChild
(
this
.
_scoreContainer
);
this
.
initLabScore
();
};
GameView
.
prototype
.
start
=
function
(
guide
)
{
return
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
var
initScore
;
return
__generator
(
this
,
function
(
_a
)
{
this
.
_isTouchLayer
=
true
;
this
.
_sumScore
=
0
;
this
.
_isMouseDown
=
false
;
this
.
_guide
=
guide
;
initScore
=
this
.
_road
.
getStartGold
(
0
)
?
props_1
.
props
.
goldScore
:
0
;
this
.
updateScore
(
initScore
);
if
(
this
.
_guide
==
'1'
)
{
this
.
setGuide
();
}
else
{
this
.
initTouch
();
this
.
registerEvent
();
}
return
[
2
];
});
});
};
GameView
.
prototype
.
setGuide
=
function
()
{
var
_this
=
this
;
this
.
_road
.
setGuide
();
var
guideLayer
=
this
.
guideLayer
=
new
GuideLayer_1
.
GuideLayer
();
this
.
addChild
(
guideLayer
);
this
.
guideLayer
.
show
(
1
,
{
x
:
20
,
y
:
650
,
guideText
:
props_1
.
props
.
guideText1
},
function
()
{
var
posX
=
_this
.
_road
.
getMovePos
();
_this
.
guideLayer
.
show
(
2
,
{
x
:
posX
+
20
,
y
:
620
,
guideText
:
props_1
.
props
.
guideText2
},
function
()
{
_this
.
initTouch
();
_this
.
registerEvent
();
});
});
};
GameView
.
prototype
.
initLabScore
=
function
()
{
var
scoreBg
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
'scoreBg'
));
scoreBg
.
x
=
utils_1
.
getStage
().
width
/
2
-
scoreBg
.
width
/
2
;
scoreBg
.
y
=
80
;
var
scoreHint
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
'scoreHint'
));
scoreHint
.
x
=
utils_1
.
getStage
().
width
/
2
-
scoreHint
.
width
/
2
;
scoreHint
.
y
=
40
;
this
.
_scoreContainer
.
addChild
(
scoreHint
);
this
.
labScore
=
new
ScoreLabel_1
.
ScoreLabel
();
this
.
labScore
.
fillColor
=
0xff7646
;
this
.
labScore
.
size
=
70
;
this
.
labScore
.
width
=
utils_1
.
getStage
().
width
;
this
.
labScore
.
height
=
scoreBg
.
height
;
this
.
labScore
.
textAlign
=
engine
.
TEXT_ALIGN
.
CENTER
;
this
.
labScore
.
x
=
0
;
this
.
labScore
.
y
=
scoreBg
.
y
+
10
;
this
.
_scoreContainer
.
addChild
(
this
.
labScore
);
};
GameView
.
prototype
.
registerEvent
=
function
()
{
this
.
_touchLayer
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_DOWN
,
this
.
onMouseDown
,
this
);
this
.
_touchLayer
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_UP
,
this
.
onMouseUp
,
this
);
};
GameView
.
prototype
.
removeListener
=
function
()
{
this
.
_touchLayer
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_DOWN
,
this
.
onMouseDown
,
this
);
this
.
_touchLayer
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_UP
,
this
.
onMouseUp
,
this
);
};
GameView
.
prototype
.
initTouch
=
function
()
{
this
.
_touchLayer
=
new
engine
.
Rect
();
this
.
addChild
(
this
.
_touchLayer
);
this
.
_touchLayer
.
width
=
utils_1
.
getStage
().
width
;
this
.
_touchLayer
.
height
=
utils_1
.
getStage
().
height
;
this
.
_touchLayer
.
x
=
0
;
this
.
_touchLayer
.
y
=
0
;
this
.
_touchLayer
.
alpha
=
0
;
};
GameView
.
prototype
.
setScoreShow
=
function
()
{
};
GameView
.
prototype
.
onMouseDown
=
function
()
{
if
(
this
.
_isTouchLayer
)
{
this
.
_isMouseDown
=
true
;
this
.
_strut
.
onMouseDown
(
this
.
_road
.
getFristPier
(),
this
.
_road
.
getDistance
(),
this
.
goCallBcak
.
bind
(
this
));
}
};
GameView
.
prototype
.
onMouseUp
=
function
()
{
if
(
this
.
_isTouchLayer
&&
this
.
_isMouseDown
)
{
this
.
_strut
.
onMouseUp
();
this
.
_isMouseDown
=
false
;
this
.
_isTouchLayer
=
false
;
}
};
GameView
.
prototype
.
goCallBcak
=
function
(
isSuccess
)
{
var
_this
=
this
;
if
(
isSuccess
)
{
console
.
log
(
'成功了'
);
var
movePos
=
this
.
_road
.
getMovePos
();
if
(
this
.
_road
.
getStartGold
(
1
,
false
))
{
this
.
updateScore
(
props_1
.
props
.
singleScore
+
props_1
.
props
.
goldScore
);
}
else
{
this
.
updateScore
(
props_1
.
props
.
singleScore
);
}
this
.
_player
.
setViewport
(
movePos
,
this
.
complete
.
bind
(
this
));
}
else
{
console
.
log
(
'失败了'
);
this
.
_player
.
setViewport
(
this
.
_strut
.
getStrutHeight
(),
function
()
{
console
.
log
(
'掉下去了'
);
engine
.
globalEvent
.
dispatchEvent
(
'dxbcyj-game-result'
,
{
score
:
_this
.
_sumScore
});
},
this
.
_road
.
getFristPier
());
}
};
GameView
.
prototype
.
complete
=
function
()
{
var
_this
=
this
;
this
.
_road
.
getStartGold
(
1
);
var
movePos
=
this
.
_road
.
getMovePos
();
this
.
_road
.
setViewport
();
this
.
_backgroud
.
setViewport
(
movePos
);
this
.
_player
.
setBackViewport
(
function
()
{
_this
.
_isTouchLayer
=
true
;
});
this
.
closeStrut
();
};
GameView
.
prototype
.
closeStrut
=
function
()
{
this
.
_strut
.
rest
();
};
GameView
.
prototype
.
updateScore
=
function
(
score
)
{
this
.
_sumScore
+=
score
;
if
(
0
<=
this
.
_sumScore
&&
this
.
_sumScore
<=
props_1
.
props
.
bgFristScore
)
{
this
.
changeBg
(
0
);
}
else
if
(
props_1
.
props
.
bgFristScore
<
this
.
_sumScore
&&
this
.
_sumScore
<=
props_1
.
props
.
bgSecondScore
)
{
this
.
changeBg
(
1
);
}
else
{
this
.
changeBg
(
2
);
}
this
.
labScore
.
updateScore
(
this
.
_sumScore
);
};
GameView
.
prototype
.
getScore
=
function
()
{
return
this
.
_sumScore
;
};
GameView
.
prototype
.
changeBg
=
function
(
index
)
{
if
(
this
.
_backgroud
.
getBgIndex
()
!=
index
)
{
this
.
_backgroud
.
changeBg
(
index
);
}
};
return
GameView
;
}(
engine
.
Container
));
exports
.
default
=
GameView
;
dist/zeroing-libs/src/custom/dxbcyj-game/src/game/GameWrapper.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
GameView_1
=
require
(
"./GameView"
);
var
GameWrapper
=
(
function
(
_super
)
{
__extends
(
GameWrapper
,
_super
);
function
GameWrapper
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
engine
.
globalEvent
.
addEventListener
(
'dxbcyj-game-start'
,
_this
.
start
,
_this
);
var
gameView
=
_this
.
_gameView
=
new
GameView_1
.
default
();
_this
.
addChild
(
gameView
);
return
_this
;
}
GameWrapper
.
prototype
.
start
=
function
(
event
)
{
this
.
_gameView
.
start
(
event
.
data
.
guide
);
};
return
GameWrapper
;
}(
engine
.
Container
));
exports
.
GameWrapper
=
GameWrapper
;
dist/zeroing-libs/src/custom/dxbcyj-game/src/game/GuideLayer.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
props_1
=
require
(
"../props"
);
var
utils_1
=
require
(
"./utils"
);
var
GuideLayer
=
(
function
(
_super
)
{
__extends
(
GuideLayer
,
_super
);
function
GuideLayer
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
_canClear
=
[];
_this
.
setup
();
return
_this
;
}
GuideLayer
.
prototype
.
setup
=
function
()
{
};
GuideLayer
.
prototype
.
show
=
function
(
id
,
options
,
callback
)
{
this
.
visible
=
true
;
this
.
_callBack
=
callback
?
callback
:
null
;
if
(
!
this
.
guideMask
)
{
this
.
_options
=
options
;
var
_a
=
this
.
stage
,
width
=
_a
.
width
,
height
=
_a
.
height
;
var
guideMask
=
this
.
guideMask
=
new
engine
.
Container
();
var
guideHole
=
this
.
_guideHole
=
new
engine
.
Image
(
utils_1
.
getTextureByName
(
'guide'
));
guideHole
.
x
=
options
.
x
;
guideHole
.
y
=
options
.
y
;
guideHole
.
width
=
250
;
guideHole
.
height
=
250
;
guideHole
.
name
=
'guideHole'
;
guideMask
.
addChild
(
guideHole
);
this
.
createRect
(
guideMask
,
0
,
0
,
width
,
guideHole
.
y
);
this
.
createRect
(
guideMask
,
0
,
guideHole
.
y
,
guideHole
.
x
,
guideHole
.
height
);
this
.
createRect
(
guideMask
,
guideHole
.
x
+
guideHole
.
width
,
guideHole
.
y
,
width
-
guideHole
.
x
-
guideHole
.
width
,
guideHole
.
height
);
this
.
createRect
(
guideMask
,
0
,
guideHole
.
y
+
guideHole
.
height
,
width
,
height
-
guideHole
.
y
-
guideHole
.
height
);
this
.
guideStep
(
id
);
var
label
=
this
.
label
=
new
engine
.
Label
();
label
.
fillColor
=
'white'
;
label
.
size
=
30
;
label
.
text
=
options
.
guideText
;
label
.
x
=
(
width
-
label
.
width
)
/
2
;
label
.
y
=
guideHole
.
y
+
guideHole
.
height
+
50
;
label
.
textAlign
=
engine
.
TEXT_ALIGN
.
CENTER
;
label
.
name
=
'labHint'
;
guideMask
.
addChild
(
label
);
this
.
addChild
(
guideMask
);
}
this
.
once
(
engine
.
MouseEvent
.
CLICK
,
function
()
{
this
.
removeChild
(
this
.
guideMask
);
this
.
guideMask
=
null
;
if
(
this
.
_callBack
)
{
this
.
_callBack
();
}
},
this
);
};
GuideLayer
.
prototype
.
createRect
=
function
(
container
,
x
,
y
,
width
,
height
)
{
var
rect
=
new
engine
.
Rect
();
rect
.
x
=
x
;
rect
.
y
=
y
;
rect
.
width
=
width
;
rect
.
height
=
height
;
rect
.
fillColor
=
'black'
;
rect
.
alpha
=
0.7
;
container
.
addChild
(
rect
);
};
GuideLayer
.
prototype
.
guideStep
=
function
(
id
)
{
if
(
id
==
1
)
{
var
guideHand
=
new
engine
.
Image
(
utils_1
.
getTextureByName
(
'guideHand'
));
guideHand
.
x
=
this
.
_options
.
x
+
300
;
guideHand
.
y
=
this
.
_options
.
y
+
100
;
this
.
guideMask
.
addChild
(
guideHand
);
var
rect
=
new
engine
.
Rect
();
rect
.
x
=
this
.
_options
.
x
+
200
;
rect
.
y
=
this
.
_options
.
y
-
15
;
rect
.
width
=
props_1
.
props
.
strutWidth
;
rect
.
height
=
200
;
rect
.
fillColor
=
props_1
.
props
.
strutColor
;
this
.
guideMask
.
addChild
(
rect
);
this
.
_canClear
.
push
(
guideHand
);
this
.
_canClear
.
push
(
rect
);
}
if
(
id
==
2
)
{
var
know
=
new
engine
.
Image
(
utils_1
.
getTextureByName
(
'know'
));
know
.
x
=
(
this
.
stage
.
width
-
know
.
width
)
/
2
;
know
.
y
=
this
.
_options
.
y
+
400
;
this
.
guideMask
.
addChild
(
know
);
this
.
_canClear
.
push
(
know
);
}
};
return
GuideLayer
;
}(
engine
.
Container
));
exports
.
GuideLayer
=
GuideLayer
;
dist/zeroing-libs/src/custom/dxbcyj-game/src/game/LoopComponent.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
utils_1
=
require
(
"./utils"
);
var
LoopComponent
=
(
function
(
_super
)
{
__extends
(
LoopComponent
,
_super
);
function
LoopComponent
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
onceInfo
=
{
width
:
0
,
height
:
0
,
count
:
0
};
_this
.
loopInfo
=
{
width
:
0
,
height
:
0
,
count
:
0
};
_this
.
parts
=
[];
return
_this
;
}
LoopComponent
.
prototype
.
setup
=
function
(
parts
,
info
)
{
var
_this
=
this
;
parts
.
forEach
(
function
(
item
,
index
)
{
var
part
;
if
(
typeof
item
==
'string'
)
{
part
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
item
));
}
else
if
(
item
instanceof
engine
.
Texture
)
{
part
=
new
engine
.
Sprite
(
item
);
}
else
{
part
=
item
;
}
_this
.
addChild
(
part
);
_this
.
parts
.
push
(
part
);
if
(
index
==
0
)
{
info
.
width
=
part
.
width
;
info
.
height
=
part
.
height
;
}
});
info
.
count
=
parts
.
length
;
this
.
setViewport
(
0
,
0
);
};
LoopComponent
.
prototype
.
changeBg
=
function
(
changName
)
{
this
.
parts
.
forEach
(
function
(
item
,
index
)
{
item
.
texture
=
utils_1
.
getTextureByName
(
changName
);
});
};
LoopComponent
.
prototype
.
setupLoop
=
function
(
resArr
)
{
this
.
setup
(
resArr
,
this
.
loopInfo
);
};
LoopComponent
.
prototype
.
setViewport
=
function
(
x
,
y
)
{
if
(
y
===
void
0
)
{
y
=
0
;
}
var
sizeField
=
y
==
0
?
'width'
:
'height'
;
var
posField
=
y
==
0
?
'x'
:
'y'
;
var
pos
=
y
==
0
?
x
:
y
;
var
index
;
var
onceSize
=
this
.
onceInfo
[
sizeField
];
var
onceCount
=
this
.
onceInfo
.
count
;
var
loopCount
=
this
.
loopInfo
.
count
;
var
loopSize
=
this
.
loopInfo
[
sizeField
];
index
=
onceSize
==
0
?
-
1
:
Math
.
floor
(
pos
/
onceSize
);
if
(
index
<
0
||
index
>=
onceCount
)
{
var
loopIndex
=
Math
.
floor
((
pos
-
onceCount
*
onceSize
)
/
this
.
loopInfo
[
sizeField
]);
index
=
onceCount
+
loopIndex
;
}
var
formerIndex
=
index
<
onceCount
?
index
:
(
index
)
%
loopCount
+
onceCount
;
var
latterIndex
=
index
<
onceCount
?
index
+
1
:
(
index
-
onceCount
+
1
)
%
loopCount
+
onceCount
;
var
former
=
this
.
parts
[
formerIndex
];
var
latter
=
this
.
parts
[
latterIndex
];
if
(
!
former
||
!
latter
)
{
console
.
log
(
formerIndex
,
latterIndex
);
}
former
[
posField
]
=
-
(
pos
-
loopSize
*
(
index
<
onceCount
?
index
:
index
-
onceCount
)
-
(
index
<
onceCount
?
0
:
onceCount
*
onceSize
));
latter
[
posField
]
=
former
.
x
+
(
index
<
onceCount
?
onceSize
:
loopSize
);
};
return
LoopComponent
;
}(
engine
.
Container
));
exports
.
LoopComponent
=
LoopComponent
;
dist/zeroing-libs/src/custom/dxbcyj-game/src/game/Pier.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
props_1
=
require
(
"./../props"
);
var
utils_1
=
require
(
"./utils"
);
var
Pier
=
(
function
(
_super
)
{
__extends
(
Pier
,
_super
);
function
Pier
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
bmp
=
new
engine
.
Sprite
();
_this
.
addChild
(
_this
.
bmp
);
return
_this
;
}
Pier
.
prototype
.
init
=
function
()
{
var
bmp
=
this
.
bmp
;
bmp
.
alpha
=
1
;
bmp
.
texture
=
utils_1
.
getTextureByName
(
'pier'
);
bmp
.
x
=
0
;
bmp
.
y
=
bmp
.
height
;
if
(
this
.
children
.
length
<
2
)
{
var
gold
=
new
engine
.
Sprite
();
gold
.
texture
=
utils_1
.
getTextureByName
(
'gold'
);
gold
.
name
=
'gold'
;
this
.
addChild
(
gold
);
}
this
.
setGoldPosX
(
bmp
);
this
.
setShowGold
();
};
Pier
.
prototype
.
setShowGold
=
function
()
{
var
nodeGold
=
this
.
getChildByName
(
'gold'
);
var
randomWard
=
Math
.
random
();
nodeGold
.
alpha
=
1
;
var
isShow
=
randomWard
<
props_1
.
props
.
reward
?
true
:
false
;
nodeGold
.
visible
=
isShow
;
this
.
haveGold
=
isShow
;
};
Pier
.
prototype
.
setGoldPosX
=
function
(
bmp
)
{
var
nodeGold
=
this
.
getChildByName
(
'gold'
);
var
pos
=
bmp
.
width
/
2
-
nodeGold
.
width
/
2
;
nodeGold
.
x
=
pos
;
nodeGold
.
y
=
bmp
.
height
-
nodeGold
.
height
-
50
;
nodeGold
.
visible
=
false
;
};
Pier
.
prototype
.
closeGold
=
function
()
{
var
_this
=
this
;
this
.
children
.
forEach
(
function
(
item
)
{
if
(
item
.
name
==
'gold'
)
{
item
.
anchorX
=
item
.
width
/
2
;
item
.
anchorY
=
item
.
height
/
2
;
engine
.
Tween
.
get
(
item
,
{
loop
:
false
})
.
to
({
scaleX
:
2.5
,
scaleY
:
2.5
},
200
,
engine
.
Ease
.
cubicOut
)
.
to
({
scaleX
:
1
,
scaleY
:
1
,
alpha
:
0
},
200
,
engine
.
Ease
.
cubicIn
)
.
call
(
function
()
{
item
.
visible
=
false
;
_this
.
haveGold
=
false
;
});
}
});
};
return
Pier
;
}(
engine
.
Container
));
exports
.
Pier
=
Pier
;
dist/zeroing-libs/src/custom/dxbcyj-game/src/game/Player.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
props_1
=
require
(
"../props"
);
var
utils_1
=
require
(
"./utils"
);
var
Player
=
(
function
(
_super
)
{
__extends
(
Player
,
_super
);
function
Player
()
{
return
_super
!==
null
&&
_super
.
apply
(
this
,
arguments
)
||
this
;
}
Player
.
prototype
.
initPlayer
=
function
(
pierWidth
)
{
this
.
_container
=
new
engine
.
Container
();
this
.
addChild
(
this
.
_container
);
this
.
playerNode
=
utils_1
.
createSvga
(
'walk'
);
this
.
_container
.
addChild
(
this
.
playerNode
);
this
.
playerNode
.
y
=
675
;
this
.
playerNode
.
x
=
pierWidth
/
2
-
80
;
this
.
playerNode
.
play
();
};
Player
.
prototype
.
setViewport
=
function
(
pos
,
callBack
,
pierWidth
)
{
var
tmpPos
=
0
;
var
isSuccess
=
false
;
if
(
!
pierWidth
)
{
tmpPos
=
pos
;
isSuccess
=
true
;
}
else
{
tmpPos
=
pierWidth
-
this
.
playerNode
.
x
+
pos
-
60
;
}
this
.
playGoTween
(
tmpPos
,
callBack
,
isSuccess
);
};
Player
.
prototype
.
playGoTween
=
function
(
pos
,
callBack
,
isSuccess
)
{
var
_this
=
this
;
engine
.
Tween
.
get
(
this
.
_container
,
{
loop
:
false
})
.
to
({
x
:
pos
},
props_1
.
props
.
playerMoveSpeed
)
.
call
(
function
()
{
engine
.
Tween
.
removeTweens
(
_this
.
_container
);
if
(
isSuccess
)
{
if
(
callBack
)
{
callBack
();
}
}
else
{
_this
.
playDropTween
(
callBack
);
}
});
};
Player
.
prototype
.
playDropTween
=
function
(
callBack
)
{
var
_this
=
this
;
engine
.
Tween
.
get
(
this
.
_container
,
{
loop
:
false
})
.
to
({
y
:
2000
},
1000
)
.
call
(
function
()
{
engine
.
Tween
.
removeTweens
(
_this
.
_container
);
if
(
callBack
)
{
callBack
();
}
});
};
Player
.
prototype
.
setBackViewport
=
function
(
callBack
)
{
var
_this
=
this
;
engine
.
Tween
.
get
(
this
.
_container
,
{
loop
:
false
})
.
to
({
x
:
0
},
props_1
.
props
.
pierMoveTime
)
.
call
(
function
()
{
engine
.
Tween
.
removeTweens
(
_this
.
_container
);
if
(
callBack
)
{
callBack
();
}
});
};
return
Player
;
}(
engine
.
Container
));
exports
.
Player
=
Player
;
dist/zeroing-libs/src/custom/dxbcyj-game/src/game/Road.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
props_1
=
require
(
"./../props"
);
var
ObjectPool
=
engine
.
ObjectPool
;
var
Road
=
(
function
(
_super
)
{
__extends
(
Road
,
_super
);
function
Road
()
{
return
_super
!==
null
&&
_super
.
apply
(
this
,
arguments
)
||
this
;
}
Road
.
prototype
.
setup
=
function
()
{
this
.
lastPos
=
0
;
this
.
addPier
();
};
Road
.
prototype
.
getFristPier
=
function
()
{
return
this
.
getChildAt
(
0
).
width
;
};
Road
.
prototype
.
getDistance
=
function
()
{
var
distance
=
[];
var
pier1
=
this
.
getChildAt
(
0
);
var
pier2
=
this
.
getChildAt
(
1
);
distance
.
push
(
pier2
.
x
-
pier1
.
x
);
distance
.
push
(
pier2
.
width
);
return
distance
;
};
Road
.
prototype
.
addPier
=
function
()
{
while
(
this
.
children
.
length
<
props_1
.
props
.
pierCount
+
1
)
{
var
childrenNum
=
this
.
children
.
length
;
var
randomPos
=
this
.
makeRandomFloat
(
props_1
.
props
.
pierMaxDistance
,
props_1
.
props
.
pierMinDistance
);
var
pier
=
ObjectPool
.
getObject
(
'pier'
);
this
.
addChild
(
pier
);
if
(
childrenNum
==
0
)
{
pier
.
x
=
0
;
}
else
{
pier
.
x
=
this
.
lastPos
+
randomPos
;
}
this
.
lastPos
=
pier
.
x
;
}
};
Road
.
prototype
.
moveAddPier
=
function
()
{
var
randomPos
=
this
.
makeRandomFloat
(
props_1
.
props
.
pierMaxDistance
,
props_1
.
props
.
pierMinDistance
);
var
pier
=
ObjectPool
.
getObject
(
'pier'
);
var
lastChild
=
this
.
getChildAt
(
this
.
children
.
length
-
1
);
pier
.
x
=
lastChild
.
x
+
randomPos
;
this
.
addChild
(
pier
);
};
Road
.
prototype
.
makeRandomFloat
=
function
(
max
,
min
)
{
if
(
min
===
void
0
)
{
min
=
0
;
}
return
Math
.
random
()
*
(
max
-
min
)
+
min
;
};
Road
.
prototype
.
setViewport
=
function
()
{
var
_this
=
this
;
var
tmpMovepos
=
this
.
getMovePos
();
this
.
children
.
forEach
(
function
(
item
,
index
)
{
_this
.
playTween
(
item
,
index
,
tmpMovepos
);
});
};
Road
.
prototype
.
getMovePos
=
function
()
{
var
movePos
=
this
.
getChildAt
(
1
);
return
movePos
.
x
;
};
Road
.
prototype
.
playTween
=
function
(
item
,
index
,
tmpMovepos
)
{
var
_this
=
this
;
engine
.
Tween
.
get
(
item
,
{
loop
:
false
})
.
to
({
x
:
item
.
x
-
tmpMovepos
},
props_1
.
props
.
pierMoveTime
)
.
call
(
function
()
{
if
(
_this
.
getChildIndex
(
item
)
==
0
)
{
engine
.
Tween
.
removeTweens
(
item
);
_this
.
removeChild
(
item
);
ObjectPool
.
recycleObject
(
'pier'
,
item
);
}
if
(
index
==
0
)
{
_this
.
moveAddPier
();
}
});
};
Road
.
prototype
.
getStartGold
=
function
(
index
,
isClose
)
{
if
(
isClose
===
void
0
)
{
isClose
=
true
;
}
var
tmpNode
=
this
.
getChildAt
(
index
);
var
haveGold
=
tmpNode
.
haveGold
;
if
(
haveGold
&&
isClose
)
{
tmpNode
.
closeGold
();
}
return
haveGold
;
};
Road
.
prototype
.
setGuide
=
function
()
{
var
tmpNode
=
this
.
getChildAt
(
1
);
if
(
!
tmpNode
.
haveGold
)
{
tmpNode
.
children
.
forEach
(
function
(
item
)
{
if
(
item
.
name
==
'gold'
)
{
item
.
visible
=
true
;
}
});
tmpNode
.
haveGold
=
true
;
}
};
return
Road
;
}(
engine
.
Container
));
exports
.
Road
=
Road
;
dist/zeroing-libs/src/custom/dxbcyj-game/src/game/ScoreLabel.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
ScoreLabel
=
(
function
(
_super
)
{
__extends
(
ScoreLabel
,
_super
);
function
ScoreLabel
()
{
return
_super
!==
null
&&
_super
.
apply
(
this
,
arguments
)
||
this
;
}
ScoreLabel
.
prototype
.
updateScore
=
function
(
score
,
animation
)
{
if
(
animation
===
void
0
)
{
animation
=
true
;
}
this
.
_value
=
score
;
if
(
animation
&&
this
.
_tmp
)
{
this
.
animationUpdate
();
}
else
{
this
.
updateLocal
(
score
);
}
};
ScoreLabel
.
prototype
.
animationUpdate
=
function
()
{
var
_this
=
this
;
var
tmpInterval
=
setInterval
(
function
()
{
_this
.
_tmp
+=
1
;
if
(
_this
.
_tmp
<=
_this
.
_value
)
{
_this
.
text
=
_this
.
_tmp
;
}
else
{
_this
.
_tmp
=
_this
.
_value
;
clearInterval
(
tmpInterval
);
}
},
50
);
};
ScoreLabel
.
prototype
.
updateLocal
=
function
(
v
)
{
this
.
_tmp
=
v
;
this
.
text
=
v
;
};
return
ScoreLabel
;
}(
engine
.
Label
));
exports
.
ScoreLabel
=
ScoreLabel
;
dist/zeroing-libs/src/custom/dxbcyj-game/src/game/Strut.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
props_1
=
require
(
"../props"
);
var
Strut
=
(
function
(
_super
)
{
__extends
(
Strut
,
_super
);
function
Strut
()
{
return
_super
!==
null
&&
_super
.
apply
(
this
,
arguments
)
||
this
;
}
Strut
.
prototype
.
init
=
function
()
{
this
.
_strut
=
new
engine
.
Rect
();
this
.
addChild
(
this
.
_strut
);
this
.
_strut
.
width
=
props_1
.
props
.
strutWidth
;
this
.
_strut
.
y
=
833
;
this
.
_strut
.
fillColor
=
props_1
.
props
.
strutColor
;
this
.
_strut
.
rotation
=
180
;
};
Strut
.
prototype
.
onMouseDown
=
function
(
pierWidth
,
distance
,
callBack
)
{
this
.
_strut
.
x
=
pierWidth
-
60
;
this
.
_distance
=
distance
;
this
.
_callBack
=
callBack
;
this
.
_strut
.
visible
=
true
;
this
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
frameStrut
,
this
);
};
Strut
.
prototype
.
onMouseUp
=
function
()
{
var
_this
=
this
;
this
.
removeEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
frameStrut
,
this
);
setTimeout
(
function
()
{
_this
.
strutRotation
();
},
200
);
};
Strut
.
prototype
.
strutRotation
=
function
()
{
var
_this
=
this
;
engine
.
Tween
.
get
(
this
.
_strut
,
{
loop
:
false
})
.
to
({
rotation
:
270
},
props_1
.
props
.
strutRotationSpeed
)
.
call
(
function
()
{
_this
.
judgeResult
();
engine
.
Tween
.
removeTweens
(
_this
.
_strut
);
});
};
Strut
.
prototype
.
judgeResult
=
function
()
{
var
isSuccess
=
false
;
if
(
this
.
_distance
[
0
]
-
this
.
_distance
[
1
]
+
100
<=
this
.
_strut
.
height
&&
this
.
_strut
.
height
<=
this
.
_distance
[
0
]
+
20
)
{
isSuccess
=
true
;
}
if
(
this
.
_callBack
)
{
this
.
_callBack
(
isSuccess
);
}
};
Strut
.
prototype
.
frameStrut
=
function
()
{
if
(
this
.
_strut
.
height
<
1000
)
{
this
.
_strut
.
height
+=
props_1
.
props
.
strutUpSpeed
;
}
};
Strut
.
prototype
.
rest
=
function
()
{
this
.
_strut
.
width
=
props_1
.
props
.
strutWidth
;
this
.
_strut
.
y
=
833
;
this
.
_strut
.
fillColor
=
props_1
.
props
.
strutColor
;
this
.
_strut
.
rotation
=
180
;
this
.
_strut
.
height
=
0
;
this
.
_strut
.
visible
=
false
;
};
Strut
.
prototype
.
getStrutHeight
=
function
()
{
var
distance
=
this
.
_strut
.
height
>
1000
?
1000
:
this
.
_strut
.
height
;
return
distance
;
};
return
Strut
;
}(
engine
.
Container
));
exports
.
Strut
=
Strut
;
dist/zeroing-libs/src/custom/dxbcyj-game/src/game/object-pool-init.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
Pier_1
=
require
(
"./Pier"
);
var
ObjectPool
=
engine
.
ObjectPool
;
exports
.
PoolName
=
'pier'
;
ObjectPool
.
registerPool
(
exports
.
PoolName
,
function
()
{
return
new
Pier_1
.
Pier
();
},
function
(
item
,
data
)
{
item
.
init
();
});
dist/zeroing-libs/src/custom/dxbcyj-game/src/game/utils.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
exports
.
getTexture
=
getTexture
;
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
exports
.
getTextureByName
=
getTextureByName
;
function
playSound
(
name
)
{
engine
.
playSound
(
engine
.
getAssetByName
(
name
).
uuid
,
{
keep
:
true
});
}
exports
.
playSound
=
playSound
;
function
getStage
()
{
return
engine
.
gameStage
.
stage
;
}
exports
.
getStage
=
getStage
;
function
createSvga
(
name
)
{
var
inst
=
new
svga
.
Svga
();
inst
.
source
=
engine
.
getAssetByName
(
name
).
uuid
;
return
inst
;
}
exports
.
createSvga
=
createSvga
;
dist/zeroing-libs/src/custom/dxbcyj-game/src/index.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
GameWrapper_1
=
require
(
"./game/GameWrapper"
);
var
props_1
=
require
(
"./props"
);
function
default_1
(
props
)
{
props_1
.
prepareProps
();
props_1
.
injectProps
(
props
);
var
instance
=
new
GameWrapper_1
.
GameWrapper
();
return
instance
;
}
exports
.
default
=
default_1
;
dist/zeroing-libs/src/custom/dxbcyj-game/src/props.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
exports
.
props
=
{};
function
prepareProps
()
{
var
metaProps
=
getProps
();
engine
.
injectProp
(
exports
.
props
,
metaProps
);
}
exports
.
prepareProps
=
prepareProps
;
function
injectProps
(
p
)
{
engine
.
injectProp
(
exports
.
props
,
p
);
}
exports
.
injectProps
=
injectProps
;
dist/zeroing-libs/src/custom/open-gift/src/game/GameView.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
props_1
=
require
(
"../props"
);
var
utils_1
=
require
(
"./utils"
);
var
GameView
=
(
function
(
_super
)
{
__extends
(
GameView
,
_super
);
function
GameView
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
once
(
engine
.
Event
.
ADDED_TO_STAGE
,
_this
.
setup
,
_this
);
return
_this
;
}
GameView
.
prototype
.
setup
=
function
()
{
if
(
this
.
_hasSetup
)
{
return
;
}
this
.
_hasSetup
=
true
;
this
.
NpcBg
=
new
engine
.
Container
();
this
.
NpcBg
.
x
=
props_1
.
props
.
initX
;
this
.
NpcBg
.
y
=
props_1
.
props
.
initY
;
this
.
addChild
(
this
.
NpcBg
);
this
.
bottomCircle
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
'底座'
));
this
.
bottomCircle
.
x
=
17
;
this
.
bottomCircle
.
y
=
305
;
this
.
loveDot
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
'点缀'
));
this
.
loveDot
.
x
=
0
;
this
.
loveDot
.
y
=
6
;
this
.
giftboxSvga
=
utils_1
.
createSvga
(
'初始礼盒'
);
this
.
giftboxSvga
.
x
=
105
;
this
.
giftboxSvga
.
y
=
37
;
this
.
giftAfterSvga
=
utils_1
.
createSvga
(
"拆礼盒"
);
this
.
giftAfterSvga
.
x
=
105
;
this
.
giftAfterSvga
.
y
=
0
;
this
.
giftAfterSvga
.
visible
=
false
;
this
.
NpcBg
.
addChild
(
this
.
bottomCircle
);
this
.
NpcBg
.
addChild
(
this
.
giftboxSvga
);
this
.
NpcBg
.
addChild
(
this
.
giftAfterSvga
);
this
.
NpcBg
.
addChild
(
this
.
loveDot
);
this
.
giftboxSvga
.
play
(
false
,
true
);
};
GameView
.
prototype
.
reset
=
function
()
{
this
.
giftboxSvga
.
visible
=
true
;
this
.
giftAfterSvga
.
visible
=
false
;
};
GameView
.
prototype
.
start
=
function
()
{
this
.
giftAfterSvga
.
visible
=
true
;
this
.
giftboxSvga
.
visible
=
false
;
this
.
giftAfterSvga
.
play
(
false
,
false
);
this
.
giftAfterSvga
.
once
(
engine
.
Event
.
END_FRAME
,
function
()
{
engine
.
globalEvent
.
dispatchEvent
(
'open-gift-game-end'
);
},
this
);
};
GameView
.
prototype
.
resume
=
function
()
{
this
.
reset
();
this
.
start
();
};
return
GameView
;
}(
engine
.
Container
));
exports
.
default
=
GameView
;
dist/zeroing-libs/src/custom/open-gift/src/game/GameWrapper.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
GameView_1
=
require
(
"./GameView"
);
var
props_1
=
require
(
"../props"
);
var
GameWrapper
=
(
function
(
_super
)
{
__extends
(
GameWrapper
,
_super
);
function
GameWrapper
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
engine
.
globalEvent
.
addEventListener
(
'open-gift-game-init'
,
_this
.
reset
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'open-gift-game-start'
,
_this
.
start
,
_this
);
var
gameView
=
_this
.
_gameView
=
new
GameView_1
.
default
();
_this
.
addChild
(
gameView
);
return
_this
;
}
GameWrapper
.
prototype
.
reset
=
function
(
event
)
{
props_1
.
injectProps
(
event
.
data
);
this
.
_gameView
.
visible
=
true
;
this
.
_gameView
.
reset
();
};
GameWrapper
.
prototype
.
start
=
function
(
event
)
{
console
.
log
(
'监听开始'
);
props_1
.
injectProps
(
event
.
data
);
this
.
_gameView
.
start
();
};
GameWrapper
.
prototype
.
clear
=
function
()
{
this
.
_gameView
.
visible
=
false
;
};
return
GameWrapper
;
}(
engine
.
Container
));
exports
.
GameWrapper
=
GameWrapper
;
dist/zeroing-libs/src/custom/open-gift/src/game/utils.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
exports
.
getTexture
=
getTexture
;
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
exports
.
getTextureByName
=
getTextureByName
;
function
playSound
(
name
)
{
engine
.
playSound
(
engine
.
getAssetByName
(
name
).
uuid
,
{
keep
:
true
});
}
exports
.
playSound
=
playSound
;
function
createSvga
(
name
,
anchorName
)
{
var
inst
=
new
svga
.
Svga
();
inst
.
source
=
'asset://'
+
engine
.
getAssetByName
(
name
).
uuid
;
return
inst
;
}
exports
.
createSvga
=
createSvga
;
dist/zeroing-libs/src/custom/open-gift/src/index.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
GameWrapper_1
=
require
(
"./game/GameWrapper"
);
var
props_1
=
require
(
"./props"
);
function
default_1
(
props
)
{
props_1
.
prepareProps
();
props_1
.
injectProps
(
props
);
var
instance
=
new
GameWrapper_1
.
GameWrapper
();
return
instance
;
}
exports
.
default
=
default_1
;
dist/zeroing-libs/src/custom/open-gift/src/props.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
exports
.
props
=
{};
function
prepareProps
()
{
var
metaProps
=
getProps
();
engine
.
injectProp
(
exports
.
props
,
metaProps
);
}
exports
.
prepareProps
=
prepareProps
;
function
injectProps
(
p
)
{
engine
.
injectProp
(
exports
.
props
,
p
);
}
exports
.
injectProps
=
injectProps
;
dist/zeroing-libs/src/custom/walking-cat/src/game/Background.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
utils_1
=
require
(
"./utils"
);
var
LoopComponent_1
=
require
(
"./LoopComponent"
);
var
utils_2
=
require
(
"./utils"
);
var
Background
=
(
function
(
_super
)
{
__extends
(
Background
,
_super
);
function
Background
()
{
var
_this
=
_super
!==
null
&&
_super
.
apply
(
this
,
arguments
)
||
this
;
_this
.
partRes
=
[
'bg_far'
,
'bg_mid'
,
'bg_near'
];
_this
.
speeds
=
[
0.05
,
0.5
,
1
];
return
_this
;
}
Background
.
prototype
.
setup
=
function
()
{
var
bottomBg
=
new
engine
.
Rect
();
bottomBg
.
x
=
0
;
bottomBg
.
y
=
0
;
bottomBg
.
width
=
utils_2
.
getStage
().
width
;
bottomBg
.
height
=
0
;
bottomBg
.
fillColor
=
0x75c9f5
;
this
.
addChild
(
bottomBg
);
var
parts
=
[];
for
(
var
i
=
0
;
i
<
3
;
i
++
)
{
var
part
=
new
LoopComponent_1
.
LoopComponent
();
part
.
setupLoop
([
this
.
partRes
[
i
],
this
.
partRes
[
i
],
]);
parts
.
push
(
part
);
this
.
addChild
(
part
);
}
var
height
=
utils_2
.
getStage
().
height
;
parts
[
0
].
y
=
(
height
-
parts
[
0
].
height
)
/
2
-
400
;
parts
[
1
].
y
=
(
height
-
parts
[
1
].
height
)
/
2
-
120
;
parts
[
2
].
y
=
(
height
-
parts
[
2
].
height
)
/
2
+
300
;
bottomBg
.
y
=
parts
[
2
].
y
;
bottomBg
.
height
=
height
-
parts
[
2
].
y
;
var
moon
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
'moon'
));
moon
.
x
=
100
;
moon
.
y
=
100
;
this
.
addChild
(
moon
);
};
Background
.
prototype
.
setViewport
=
function
(
pos
)
{
for
(
var
i
=
0
;
i
<
3
;
i
++
)
{
var
part
=
this
.
getChildAt
(
i
+
1
);
var
speed
=
this
.
speeds
[
i
];
part
.
setViewport
(
pos
*
speed
);
}
};
Background
.
prototype
.
reset
=
function
(
revive
)
{
if
(
revive
===
void
0
)
{
revive
=
false
;
}
};
return
Background
;
}(
engine
.
Container
));
exports
.
Background
=
Background
;
dist/zeroing-libs/src/custom/walking-cat/src/game/Block.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
utils_1
=
require
(
"./utils"
);
var
Block
=
(
function
(
_super
)
{
__extends
(
Block
,
_super
);
function
Block
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
bmp
=
new
engine
.
Sprite
();
_this
.
addChild
(
_this
.
bmp
=
new
engine
.
Sprite
());
return
_this
;
}
Block
.
prototype
.
reset
=
function
(
_a
)
{
var
type
=
_a
.
type
;
this
.
type
=
type
;
var
bmp
=
this
.
bmp
;
bmp
.
alpha
=
1
;
bmp
.
texture
=
this
.
getBlock
();
var
_b
=
Block
.
configs
[
type
],
width
=
_b
.
width
,
off
=
_b
.
off
;
bmp
.
x
=
-
(
off
+
width
/
2
);
bmp
.
y
=
-
(
bmp
.
height
/
2
);
};
Block
.
prototype
.
getBlock
=
function
()
{
return
utils_1
.
getTextureByName
(
'block_'
+
this
.
type
);
};
Block
.
prototype
.
playEffect
=
function
()
{
};
Block
.
prototype
.
playFadeOut
=
function
()
{
return
this
.
getTweenPromise
(
engine
.
Tween
.
get
(
this
.
bmp
)
.
to
({
alpha
:
0
},
100
)
.
to
({
alpha
:
1
},
100
)
.
to
({
alpha
:
0
},
100
));
};
Block
.
prototype
.
onEffectComplete
=
function
(
event
)
{
this
.
effectResolve
&&
this
.
effectResolve
();
this
.
effectResolve
=
null
;
};
Block
.
prototype
.
getTweenPromise
=
function
(
tween
)
{
return
new
Promise
(
function
(
resolve
)
{
tween
.
call
(
resolve
);
});
};
Block
.
configs
=
[
{
ratio
:
0.6
,
width
:
15
,
off
:
32
,
effect
:
''
,
effect_offset
:
{
x
:
0
,
y
:
0
}
},
{
ratio
:
0.1
,
width
:
10
,
off
:
18
,
effect
:
''
,
effect_offset
:
{
x
:
0
,
y
:
0
}
},
{
ratio
:
0.15
,
width
:
30
,
off
:
32
,
effect
:
''
,
effect_offset
:
{
x
:
0
,
y
:
0
}
},
{
ratio
:
0.1
,
width
:
86
,
off
:
28
,
effect
:
''
,
effect_offset
:
{
x
:
0
,
y
:
0
}
},
{
ratio
:
0.5
,
width
:
70
,
off
:
20
,
effect
:
''
,
effect_offset
:
{
x
:
0
,
y
:
-
20
}
},
{
ratio
:
0
,
width
:
0
,
off
:
0
,
effect
:
''
,
effect_offset
:
{
x
:
0
,
y
:
0
}
},
{
ratio
:
0
,
width
:
0
,
off
:
0
,
effect
:
''
,
effect_offset
:
{
x
:
0
,
y
:
0
}
},
{
ratio
:
0
,
width
:
0
,
off
:
0
,
effect
:
''
,
effect_offset
:
{
x
:
0
,
y
:
0
}
},
{
ratio
:
0
,
width
:
0
,
off
:
0
,
effect
:
''
,
effect_offset
:
{
x
:
0
,
y
:
0
}
},
{
ratio
:
0
,
width
:
0
,
off
:
0
,
effect
:
''
,
effect_offset
:
{
x
:
0
,
y
:
0
}
},
{
ratio
:
0
,
width
:
123
,
off
:
23
,
effect
:
''
,
effect_offset
:
{
x
:
0
,
y
:
0
}
},
];
return
Block
;
}(
engine
.
Container
));
exports
.
Block
=
Block
;
dist/zeroing-libs/src/custom/walking-cat/src/game/GameView.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
PlayGame_1
=
require
(
"./PlayGame"
);
var
Background_1
=
require
(
"./Background"
);
var
Road_1
=
require
(
"./Road"
);
var
Player_1
=
require
(
"./player/Player"
);
var
utils_1
=
require
(
"./utils"
);
var
Block_1
=
require
(
"./Block"
);
var
ObjectPool
=
engine
.
ObjectPool
;
exports
.
PoolName
=
'block'
;
ObjectPool
.
registerPool
(
exports
.
PoolName
,
function
()
{
return
new
Block_1
.
Block
();
},
function
(
item
,
data
)
{
item
.
reset
(
data
);
});
var
GameView
=
(
function
(
_super
)
{
__extends
(
GameView
,
_super
);
function
GameView
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
offset
=
{
x
:
-
100
,
y
:
320
};
_this
.
worldFPS
=
60
;
_this
.
_viewport
=
{
x
:
0
,
y
:
0
,
};
return
_this
;
}
Object
.
defineProperty
(
GameView
,
"instance"
,
{
get
:
function
()
{
if
(
this
.
_instance
==
undefined
)
{
this
.
_instance
=
new
GameView
();
}
return
this
.
_instance
;
},
enumerable
:
true
,
configurable
:
true
});
GameView
.
prototype
.
eventStart
=
function
()
{
var
_this
=
this
;
if
(
this
.
hasPreSetup
)
{
return
;
}
this
.
hasPreSetup
=
true
;
var
background
=
this
.
background
=
new
Background_1
.
Background
();
background
.
setup
();
this
.
addChild
(
background
);
var
road
=
this
.
road
=
new
Road_1
.
Road
();
road
.
y
=
utils_1
.
getStage
().
height
/
2
+
310
;
this
.
addChild
(
road
);
this
.
road
.
preSetup
();
this
.
setupWorld
();
this
.
player
.
fade
(
0
,
false
);
this
.
viewport
=
0
;
this
.
startWorld
();
this
.
reset
();
this
.
setup
();
var
playHint
=
new
engine
.
Label
();
playHint
.
fillColor
=
'block'
;
playHint
.
size
=
30
;
playHint
.
text
=
'注意不要踩到线和陷阱哦,后果很严重哦~'
;
playHint
.
x
=
(
utils_1
.
getStage
().
width
-
playHint
.
width
)
/
2
;
playHint
.
y
=
utils_1
.
getStage
().
height
/
2
+
500
;
this
.
addChild
(
playHint
);
this
.
playGame
=
new
PlayGame_1
.
PlayGame
();
setTimeout
(
function
()
{
_this
.
playGame
.
GameView
=
_this
;
_this
.
addChild
(
_this
.
playGame
);
_this
.
start
();
},
500
);
};
GameView
.
prototype
.
setup
=
function
()
{
if
(
this
.
hasSetup
)
{
return
;
}
this
.
hasSetup
=
true
;
this
.
road
.
setup
();
};
GameView
.
prototype
.
setupWorld
=
function
()
{
var
OTHER
=
Math
.
pow
(
2
,
1
),
BODYPARTS
=
Math
.
pow
(
2
,
2
),
GROUND
=
Math
.
pow
(
2
,
3
);
var
world
=
this
.
world
=
new
p2
.
World
({});
world
.
sleepMode
=
p2
.
World
.
BODY_SLEEPING
;
var
planeShape
=
new
p2
.
Plane
();
var
ground
=
new
p2
.
Body
({
position
:
[
0
,
0
],
});
ground
.
addShape
(
planeShape
);
planeShape
.
collisionGroup
=
GROUND
;
planeShape
.
collisionMask
=
BODYPARTS
|
OTHER
;
world
.
addBody
(
ground
);
var
player
=
this
.
player
=
new
Player_1
.
Player
();
player
.
setup
({
collisionGroup
:
BODYPARTS
,
collisionMask
:
GROUND
|
OTHER
,
world
:
world
,
ground
:
ground
,
});
player
.
addEventListener
(
'move'
,
this
.
onMove
,
this
);
player
.
addEventListener
(
'foot_down'
,
this
.
onFootDown
,
this
);
};
GameView
.
prototype
.
onTicker
=
function
(
dt
)
{
var
world
=
this
.
world
;
this
.
world
.
step
(
this
.
worldFPS
/
1000
);
var
l
=
world
.
bodies
.
length
;
for
(
var
i
=
0
;
i
<
l
;
i
++
)
{
var
body
=
world
.
bodies
[
i
];
var
display
=
body
.
displays
?
body
.
displays
[
0
]
:
null
;
if
(
display
)
{
if
(
!
this
.
contains
(
display
))
{
this
.
addChild
(
display
);
}
display
.
localUpdate
(
body
.
position
[
0
]
*
utils_1
.
getfactor
()
+
utils_1
.
getStage
().
width
/
2
+
this
.
offset
.
x
-
this
.
viewport
,
utils_1
.
getStage
().
height
/
2
-
body
.
position
[
1
]
*
utils_1
.
getfactor
()
+
this
.
offset
.
y
,
360
-
(
body
.
angle
+
body
.
shapes
[
0
].
angle
)
*
180
/
Math
.
PI
,
body
.
sleepState
==
p2
.
Body
.
SLEEPING
);
}
}
return
false
;
};
GameView
.
prototype
.
reset
=
function
(
revive
)
{
if
(
revive
===
void
0
)
{
revive
=
false
;
}
this
.
background
.
reset
(
revive
);
this
.
road
.
reset
(
revive
);
this
.
player
.
reset
(
revive
);
this
.
player
.
fade
(
0
);
this
.
viewport
=
revive
?
this
.
revivePos
:
0
;
};
GameView
.
prototype
.
start
=
function
(
revive
)
{
if
(
revive
===
void
0
)
{
revive
=
false
;
}
this
.
road
.
start
(
revive
);
this
.
player
.
fade
(
1
);
this
.
playGame
.
start
(
revive
);
};
GameView
.
prototype
.
startWorld
=
function
()
{
if
(
this
.
playing
)
{
return
;
}
this
.
playing
=
true
;
engine
.
gameStage
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
onTicker
,
this
);
};
GameView
.
prototype
.
stopWorld
=
function
()
{
if
(
!
this
.
playing
)
{
return
;
}
this
.
playing
=
false
;
engine
.
gameStage
.
removeEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
onTicker
,
this
);
};
Object
.
defineProperty
(
GameView
.
prototype
,
"viewport"
,
{
get
:
function
()
{
return
this
.
_viewport
.
x
;
},
set
:
function
(
v
)
{
this
.
_viewport
.
x
=
v
;
this
.
updateViewport
();
},
enumerable
:
true
,
configurable
:
true
});
GameView
.
prototype
.
updateViewport
=
function
()
{
var
_a
=
this
.
_viewport
,
x
=
_a
.
x
,
y
=
_a
.
y
;
var
pos
=
Math
.
max
(
0
,
x
);
this
.
background
.
setViewport
(
pos
);
this
.
road
.
setViewport
(
pos
);
};
GameView
.
prototype
.
onMove
=
function
(
event
)
{
var
_a
=
event
.
data
,
pos
=
_a
.
pos
,
bodyPos
=
_a
.
bodyPos
;
this
.
viewport
=
pos
;
if
(
this
.
road
.
hitReward
(
bodyPos
))
{
this
.
dispatchEvent
(
'scoreChange'
,
{
rewardScore
:
100
,
passType
:
10
,
},
true
);
}
};
GameView
.
prototype
.
down
=
function
()
{
if
(
this
.
lock
)
{
return
;
}
this
.
player
.
down
();
};
GameView
.
prototype
.
up
=
function
()
{
if
(
this
.
lock
)
{
return
;
}
this
.
player
.
up
();
};
GameView
.
prototype
.
onFootDown
=
function
(
event
)
{
var
_a
=
event
.
data
,
mileage
=
_a
.
mileage
,
pos
=
_a
.
pos
;
this
.
revivePos
=
pos
;
var
_b
=
this
.
road
.
hitBlock
(
pos
),
target
=
_b
.
target
,
lastTarget
=
_b
.
lastTarget
;
this
.
road
.
playDust
(
pos
);
if
(
target
)
{
this
.
lock
=
true
;
this
.
stopWorld
();
this
.
dispatchEvent
(
engine
.
Event
.
COMPLETE
,
null
,
true
);
target
.
playFadeOut
();
target
.
playEffect
();
if
(
target
.
type
==
4
)
{
this
.
player
.
setSkin
(
'gray'
);
}
this
.
road
.
removeBlock
(
target
);
this
.
player
.
switchFace
(
target
.
type
);
if
(
target
.
type
==
0
)
{
this
.
player
.
fall
();
}
this
.
lock
=
false
;
this
.
startWorld
();
}
else
{
this
.
player
.
switchFace
(
'normal'
);
var
score
=
Math
.
floor
(
mileage
/
50
*
5
);
this
.
dispatchEvent
(
'scoreChange'
,
{
score
:
score
,
passType
:
lastTarget
?
lastTarget
.
type
:
-
1
,
},
true
);
}
};
GameView
.
prototype
.
setWitchFace
=
function
(
type
)
{
this
.
player
.
switchFace
(
type
);
};
return
GameView
;
}(
engine
.
Container
));
exports
.
default
=
GameView
;
dist/zeroing-libs/src/custom/walking-cat/src/game/GameWrapper.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
GameView_1
=
require
(
"./GameView"
);
var
props_1
=
require
(
"../props"
);
var
GameWrapper
=
(
function
(
_super
)
{
__extends
(
GameWrapper
,
_super
);
function
GameWrapper
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
engine
.
globalEvent
.
addEventListener
(
'walking-cat-start'
,
_this
.
start
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'walking-cat-revive'
,
_this
.
revive
,
_this
);
engine
.
globalEvent
.
addEventListener
(
'walking-cat-showScore'
,
_this
.
revive
,
_this
);
var
gameView
=
_this
.
_gameView
=
new
GameView_1
.
default
();
_this
.
addChild
(
gameView
);
return
_this
;
}
GameWrapper
.
prototype
.
start
=
function
(
event
)
{
props_1
.
injectProps
(
event
.
data
);
this
.
_gameView
.
eventStart
();
};
GameWrapper
.
prototype
.
revive
=
function
()
{
console
.
log
(
'复活'
);
this
.
_gameView
.
reset
(
true
);
this
.
_gameView
.
start
(
true
);
};
return
GameWrapper
;
}(
engine
.
Container
));
exports
.
GameWrapper
=
GameWrapper
;
dist/zeroing-libs/src/custom/walking-cat/src/game/LoopComponent.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
utils_1
=
require
(
"./utils"
);
var
LoopComponent
=
(
function
(
_super
)
{
__extends
(
LoopComponent
,
_super
);
function
LoopComponent
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
onceInfo
=
{
width
:
0
,
height
:
0
,
count
:
0
};
_this
.
loopInfo
=
{
width
:
0
,
height
:
0
,
count
:
0
};
_this
.
parts
=
[];
return
_this
;
}
LoopComponent
.
prototype
.
setup
=
function
(
parts
,
info
)
{
var
_this
=
this
;
parts
.
forEach
(
function
(
item
,
index
)
{
var
part
;
if
(
typeof
item
==
'string'
)
{
part
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
item
));
}
else
if
(
item
instanceof
engine
.
Texture
)
{
part
=
new
engine
.
Sprite
(
item
);
}
else
{
part
=
item
;
}
_this
.
addChild
(
part
);
_this
.
parts
.
push
(
part
);
if
(
index
==
0
)
{
info
.
width
=
part
.
width
;
info
.
height
=
part
.
height
;
}
});
info
.
count
=
parts
.
length
;
this
.
setViewport
(
0
,
0
);
};
LoopComponent
.
prototype
.
setupOnce
=
function
(
resArr
)
{
this
.
setup
(
resArr
,
this
.
onceInfo
);
};
LoopComponent
.
prototype
.
setupLoop
=
function
(
resArr
)
{
this
.
setup
(
resArr
,
this
.
loopInfo
);
};
LoopComponent
.
prototype
.
setViewport
=
function
(
x
,
y
)
{
if
(
y
===
void
0
)
{
y
=
0
;
}
var
sizeField
=
y
==
0
?
'width'
:
'height'
;
var
posField
=
y
==
0
?
'x'
:
'y'
;
var
pos
=
y
==
0
?
x
:
y
;
var
index
;
var
onceSize
=
this
.
onceInfo
[
sizeField
];
var
onceCount
=
this
.
onceInfo
.
count
;
var
loopCount
=
this
.
loopInfo
.
count
;
var
loopSize
=
this
.
loopInfo
[
sizeField
];
index
=
onceSize
==
0
?
-
1
:
Math
.
floor
(
pos
/
onceSize
);
if
(
index
<
0
||
index
>=
onceCount
)
{
var
loopIndex
=
Math
.
floor
((
pos
-
onceCount
*
onceSize
)
/
this
.
loopInfo
[
sizeField
]);
index
=
onceCount
+
loopIndex
;
}
var
formerIndex
=
index
<
onceCount
?
index
:
(
index
)
%
loopCount
+
onceCount
;
var
latterIndex
=
index
<
onceCount
?
index
+
1
:
(
index
-
onceCount
+
1
)
%
loopCount
+
onceCount
;
var
former
=
this
.
parts
[
formerIndex
];
var
latter
=
this
.
parts
[
latterIndex
];
if
(
!
former
||
!
latter
)
{
console
.
log
(
formerIndex
,
latterIndex
);
}
former
[
posField
]
=
-
(
pos
-
loopSize
*
(
index
<
onceCount
?
index
:
index
-
onceCount
)
-
(
index
<
onceCount
?
0
:
onceCount
*
onceSize
));
latter
[
posField
]
=
former
.
x
+
(
index
<
onceCount
?
onceSize
:
loopSize
);
};
return
LoopComponent
;
}(
engine
.
Container
));
exports
.
LoopComponent
=
LoopComponent
;
dist/zeroing-libs/src/custom/walking-cat/src/game/PlayGame.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
utils_1
=
require
(
"./utils"
);
var
props_1
=
require
(
"../props"
);
var
ScoreLabel_1
=
require
(
"./ScoreLabel"
);
var
PlayGame
=
(
function
(
_super
)
{
__extends
(
PlayGame
,
_super
);
function
PlayGame
()
{
var
_this
=
_super
!==
null
&&
_super
.
apply
(
this
,
arguments
)
||
this
;
_this
.
addlabelScore
=
null
;
_this
.
formatScore
=
function
(
s
)
{
var
t
=
(
Math
.
ceil
(
s
*
10
)
/
10
).
toString
();
t
+=
t
.
indexOf
(
'.'
)
<
0
?
'.0'
:
''
;
return
t
;
};
return
_this
;
}
Object
.
defineProperty
(
PlayGame
,
"instance"
,
{
get
:
function
()
{
if
(
this
.
_instance
==
undefined
)
{
this
.
_instance
=
new
PlayGame
();
}
return
this
.
_instance
;
},
enumerable
:
true
,
configurable
:
true
});
PlayGame
.
prototype
.
start
=
function
(
revive
)
{
if
(
revive
===
void
0
)
{
revive
=
false
;
}
if
(
!
revive
)
{
this
.
normalScore
=
0
;
this
.
rewardScore
=
0
;
this
.
lastDialogTs
=
0
;
this
.
initTouch
();
this
.
initLabScore
();
this
.
initAddlabel
();
this
.
initDialog
();
}
this
.
registerEvent
();
};
PlayGame
.
prototype
.
registerEvent
=
function
()
{
this
.
touchLayer
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_DOWN
,
this
.
onMouseDown
,
this
);
this
.
touchLayer
.
addEventListener
(
engine
.
MouseEvent
.
MOUSE_UP
,
this
.
onMouseUp
,
this
);
this
.
GameView
.
addEventListener
(
engine
.
Event
.
COMPLETE
,
this
.
onGameComplete
,
this
);
this
.
GameView
.
addEventListener
(
'scoreChange'
,
this
.
onScoreChange
,
this
);
};
PlayGame
.
prototype
.
initTouch
=
function
()
{
this
.
touchLayer
=
new
engine
.
Rect
();
this
.
addChild
(
this
.
touchLayer
);
this
.
touchLayer
.
width
=
utils_1
.
getStage
().
width
;
this
.
touchLayer
.
height
=
utils_1
.
getStage
().
height
;
this
.
touchLayer
.
x
=
0
;
this
.
touchLayer
.
y
=
0
;
this
.
touchLayer
.
alpha
=
0
;
};
PlayGame
.
prototype
.
removeListener
=
function
()
{
this
.
touchLayer
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_DOWN
,
this
.
onMouseDown
,
this
);
this
.
touchLayer
.
removeEventListener
(
engine
.
MouseEvent
.
MOUSE_UP
,
this
.
onMouseUp
,
this
);
this
.
GameView
.
removeEventListener
(
engine
.
Event
.
COMPLETE
,
this
.
onGameComplete
,
this
);
this
.
GameView
.
removeEventListener
(
'scoreChange'
,
this
.
onScoreChange
,
this
);
};
PlayGame
.
prototype
.
initLabScore
=
function
()
{
this
.
labScore
=
new
ScoreLabel_1
.
ScoreLabel
();
this
.
labScore
.
visible
=
props_1
.
props
.
showScore
;
this
.
labScore
.
updateScore
(
0
,
this
.
formatScore
,
false
);
this
.
labScore
.
fillColor
=
'yellow'
;
this
.
labScore
.
size
=
46
;
this
.
labScore
.
x
=
610
;
engine
.
Tween
.
get
(
this
.
labScore
,
{
loop
:
false
})
.
set
({
y
:
-
100
})
.
wait
(
300
)
.
to
({
y
:
40
},
200
,
engine
.
Ease
.
backOut
);
this
.
addChild
(
this
.
labScore
);
};
PlayGame
.
prototype
.
initAddlabel
=
function
()
{
this
.
addlabelScore
=
new
engine
.
Label
();
this
.
addlabelScore
.
fillColor
=
'yellow'
;
this
.
addlabelScore
.
size
=
40
;
this
.
addlabelScore
.
text
=
''
;
this
.
addlabelScore
.
x
=
378
;
this
.
addlabelScore
.
y
=
582
;
this
.
addlabelScore
.
visible
=
false
;
this
.
addChild
(
this
.
addlabelScore
);
};
PlayGame
.
prototype
.
initDialog
=
function
()
{
this
.
dialog
=
new
engine
.
Image
();
this
.
dialog
.
x
=
390
;
this
.
dialog
.
y
=
323
;
this
.
addChild
(
this
.
dialog
);
};
PlayGame
.
prototype
.
onMouseDown
=
function
()
{
this
.
GameView
.
down
();
};
PlayGame
.
prototype
.
onMouseUp
=
function
()
{
this
.
GameView
.
up
();
};
PlayGame
.
prototype
.
onGameComplete
=
function
()
{
console
.
log
(
'死亡'
);
this
.
removeListener
();
var
score
=
this
.
getScore
();
engine
.
globalEvent
.
dispatchEvent
(
'walking-cat-game-end'
,
{
score
:
score
});
};
PlayGame
.
prototype
.
getScore
=
function
(
round
)
{
if
(
round
===
void
0
)
{
round
=
false
;
}
var
score
=
(
this
.
normalScore
+
this
.
rewardScore
)
/
10
;
score
*=
(
props_1
.
props
.
scoreTimes
||
1
);
if
(
round
)
{
return
Math
.
round
(
score
);
}
return
score
;
};
PlayGame
.
prototype
.
onScoreChange
=
function
(
event
)
{
var
_a
=
event
.
data
,
score
=
_a
.
score
,
passType
=
_a
.
passType
,
rewardScore
=
_a
.
rewardScore
;
var
scoreAdd
;
if
(
rewardScore
)
{
this
.
rewardScore
+=
rewardScore
;
scoreAdd
=
rewardScore
;
}
else
{
scoreAdd
=
score
-
this
.
normalScore
;
this
.
normalScore
=
score
;
}
var
curScore
=
this
.
getScore
();
this
.
labScore
.
updateScore
(
curScore
,
this
.
formatScore
);
if
(
passType
>
0
&&
passType
<=
4
)
{
var
now
=
Date
.
now
();
if
(
now
-
this
.
lastDialogTs
>
15000
)
{
this
.
play
(
1
);
this
.
lastDialogTs
=
now
;
}
}
else
if
(
passType
==
10
)
{
this
.
play
(
0
);
this
.
lastDialogTs
=
Date
.
now
();
this
.
GameView
.
setWitchFace
(
'happy'
);
}
if
(
scoreAdd
>
0
)
{
var
labScoreAdd_1
=
this
.
addlabelScore
;
labScoreAdd_1
.
visible
=
props_1
.
props
.
showScore
;
labScoreAdd_1
.
alpha
=
0
;
labScoreAdd_1
.
verticalCenter
=
0
;
labScoreAdd_1
.
text
=
'+'
+
(
scoreAdd
/
10
*
(
props_1
.
props
.
scoreTimes
||
1
));
engine
.
Tween
.
get
(
labScoreAdd_1
,
null
,
null
,
true
)
.
to
({
verticalCenter
:
-
50
,
alpha
:
1
,
},
200
,
engine
.
Ease
.
cubicIn
)
.
wait
(
300
)
.
to
({
verticalCenter
:
-
100
,
alpha
:
0
,
},
100
,
engine
.
Ease
.
cubicOut
)
.
call
(
function
()
{
labScoreAdd_1
.
visible
=
false
;
},
this
);
}
engine
.
globalEvent
.
dispatchEvent
(
'walking-cat-game-changScore'
,
{
score
:
curScore
});
};
PlayGame
.
prototype
.
play
=
function
(
id
)
{
var
img
=
this
.
dialog
;
img
.
texture
=
utils_1
.
getTextureByName
(
'dialog_'
+
id
);
img
.
scaleX
=
img
.
scaleY
=
0
;
img
.
alpha
=
1
;
img
.
visible
=
true
;
engine
.
Tween
.
get
(
img
,
null
,
null
,
true
)
.
to
({
scaleX
:
1
,
scaleY
:
1
},
500
,
engine
.
Ease
.
backOut
)
.
wait
(
500
)
.
to
({
alpha
:
0
,
},
300
)
.
call
(
function
()
{
img
.
visible
=
false
;
});
};
PlayGame
.
prototype
.
revive
=
function
()
{
this
.
GameView
.
reset
(
true
);
this
.
GameView
.
start
(
true
);
};
return
PlayGame
;
}(
engine
.
Container
));
exports
.
PlayGame
=
PlayGame
;
dist/zeroing-libs/src/custom/walking-cat/src/game/Road.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
localWave_1
=
require
(
"./../localWave"
);
var
ObjectPool
=
engine
.
ObjectPool
;
var
utils_1
=
require
(
"./utils"
);
var
utils_2
=
require
(
"./utils"
);
var
props_1
=
require
(
"../props"
);
var
Block_1
=
require
(
"./Block"
);
var
Road
=
(
function
(
_super
)
{
__extends
(
Road
,
_super
);
function
Road
()
{
var
_this
=
_super
!==
null
&&
_super
.
apply
(
this
,
arguments
)
||
this
;
_this
.
dustIndex
=
0
;
_this
.
index
=
0
;
_this
.
minDistance
=
parseInt
(
props_1
.
props
.
blockMinDistance
)
||
100
;
_this
.
maxDistance
=
parseInt
(
props_1
.
props
.
blockMaxDistance
)
||
300
;
_this
.
basePos
=
utils_1
.
getStage
().
width
/
2
-
100
;
_this
.
padding
=
500
;
return
_this
;
}
Road
.
prototype
.
preSetup
=
function
()
{
this
.
addChild
(
this
.
container
=
new
engine
.
Container
());
var
flag
=
this
.
flag
=
new
engine
.
Sprite
(
utils_2
.
getTextureByName
(
'flag_record'
));
this
.
anchorRate
(
flag
,
0.5
,
1
);
flag
.
y
=
-
230
;
flag
.
x
=
this
.
transScoreToFlagPos
();
flag
.
visible
=
flag
.
x
>
0
;
this
.
addChild
(
flag
);
};
Road
.
prototype
.
setup
=
function
()
{
this
.
dustNode
=
new
engine
.
Container
();
this
.
dustSprite
=
new
engine
.
Sprite
();
this
.
dustSprite
.
visible
=
false
;
this
.
dustNode
.
y
=
-
1000
;
this
.
dustNode
.
x
=
-
450
;
this
.
dustNode
.
addChild
(
this
.
dustSprite
);
this
.
addChild
(
this
.
dustNode
);
var
reward
=
this
.
reward
=
new
engine
.
Sprite
();
reward
.
visible
=
false
;
reward
.
y
=
-
500
;
this
.
addChild
(
reward
);
this
.
aniReward
=
new
localWave_1
.
localWave
();
this
.
aniReward
.
init
(
reward
,
2000
,
localWave_1
.
localWave
.
sin
.
bind
(
null
,
10
));
};
Road
.
prototype
.
start
=
function
(
revive
)
{
if
(
revive
===
void
0
)
{
revive
=
false
;
}
if
(
revive
)
{
}
else
{
this
.
rewardIndex
=
0
;
this
.
showReward
();
}
};
Road
.
prototype
.
reset
=
function
(
revive
)
{
if
(
revive
===
void
0
)
{
revive
=
false
;
}
if
(
!
revive
)
{
this
.
index
=
0
;
this
.
lastPos
=
0
;
this
.
clear
();
this
.
fill
();
this
.
flag
.
x
=
this
.
transScoreToFlagPos
();
this
.
flag
.
visible
=
this
.
flag
.
x
>
0
;
}
};
Road
.
prototype
.
anchorRate
=
function
(
target
,
rx
,
ry
,
width
,
height
,
resetPos
)
{
if
(
width
===
void
0
)
{
width
=
0
;
}
if
(
height
===
void
0
)
{
height
=
0
;
}
if
(
resetPos
===
void
0
)
{
resetPos
=
true
;
}
if
(
width
==
0
)
{
width
=
target
.
width
;
}
if
(
height
==
0
)
{
height
=
target
.
height
;
}
if
(
resetPos
)
{
if
(
rx
==
0
)
{
target
.
x
-=
target
.
anchorOffsetX
;
}
if
(
ry
==
0
)
{
target
.
y
-=
target
.
anchorOffsetY
;
}
}
target
.
anchorOffsetX
=
width
*
rx
;
target
.
anchorOffsetY
=
height
*
ry
;
if
(
resetPos
)
{
if
(
rx
>
0
)
{
target
.
x
+=
target
.
anchorOffsetX
;
}
if
(
ry
>
0
)
{
target
.
y
+=
target
.
anchorOffsetY
;
}
}
};
Road
.
prototype
.
transScoreToFlagPos
=
function
()
{
return
-
1
;
};
Road
.
prototype
.
clear
=
function
()
{
while
(
this
.
container
.
children
.
length
>
0
)
{
this
.
removeBlockAt
(
0
);
}
};
Road
.
prototype
.
addBlock
=
function
()
{
var
type
=
0
,
v
;
if
(
this
.
index
>
10
)
{
do
{
var
rv
=
Math
.
random
();
v
=
0
;
for
(
var
i
=
0
;
i
<
5
;
i
++
)
{
v
+=
Block_1
.
Block
.
configs
[
i
].
ratio
;
if
(
rv
<
v
)
{
type
=
i
;
break
;
}
}
}
while
(
this
.
lastBlockType
==
type
);
this
.
lastBlockType
=
type
;
}
var
block
=
ObjectPool
.
getObject
(
'block'
,
{
type
:
type
});
var
width
=
Block_1
.
Block
.
configs
[
type
].
width
;
var
distance
=
this
.
index
==
0
?
this
.
maxDistance
:
this
.
makeRandomFloat
(
this
.
maxDistance
,
this
.
minDistance
);
var
pos
=
this
.
lastPos
+
distance
;
block
.
x
=
pos
;
this
.
container
.
addChild
(
block
);
this
.
lastPos
=
pos
+
width
;
this
.
index
++
;
};
Road
.
prototype
.
removeBlockAt
=
function
(
index
)
{
var
block
=
this
.
container
.
removeChildAt
(
index
);
ObjectPool
.
recycleObject
(
'block'
,
block
);
};
Road
.
prototype
.
removeBlock
=
function
(
block
)
{
this
.
container
.
removeChild
(
block
);
ObjectPool
.
recycleObject
(
'block'
,
block
);
};
Road
.
prototype
.
fill
=
function
()
{
if
(
isNaN
(
this
.
lastPos
))
{
return
;
}
while
(
true
)
{
if
(
this
.
lastPos
+
this
.
x
>
utils_1
.
getStage
().
width
+
this
.
padding
)
{
break
;
}
this
.
addBlock
();
}
};
Road
.
prototype
.
makeRandomFloat
=
function
(
max
,
min
)
{
if
(
min
===
void
0
)
{
min
=
0
;
}
return
Math
.
random
()
*
(
max
-
min
)
+
min
;
};
Road
.
prototype
.
setViewport
=
function
(
pos
)
{
this
.
x
=
this
.
basePos
-
pos
;
while
(
this
.
container
.
children
.
length
>
0
)
{
if
(
this
.
container
.
getChildAt
(
0
).
x
>=
pos
-
this
.
padding
)
{
break
;
}
this
.
removeBlockAt
(
0
);
}
this
.
fill
();
};
Road
.
prototype
.
showReward
=
function
(
type
)
{
if
(
type
===
void
0
)
{
type
=
10
;
}
this
.
rewardIndex
++
;
var
pos
=
this
.
rewardIndex
*
utils_1
.
getStage
().
width
*
3
;
var
reward
=
this
.
reward
;
reward
.
visible
=
true
;
reward
.
alpha
=
1
;
reward
.
texture
=
utils_2
.
getTextureByName
(
'menu_block_10'
);
reward
.
x
=
pos
;
this
.
aniReward
.
updateRegisterPos
();
};
Road
.
prototype
.
hideReward
=
function
()
{
var
_this
=
this
;
var
reward
=
this
.
reward
;
this
.
tweenReward
=
engine
.
Tween
.
get
(
reward
)
.
to
({
alpha
:
0
},
200
)
.
call
(
function
()
{
_this
.
tweenReward
=
null
;
_this
.
showReward
();
});
};
Road
.
prototype
.
hitReward
=
function
(
pos
)
{
if
(
this
.
reward
.
visible
&&
pos
>=
this
.
reward
.
x
&&
!
this
.
tweenReward
)
{
this
.
hideReward
();
return
true
;
}
};
Road
.
prototype
.
playDust
=
function
(
pos
)
{
this
.
dustSprite
.
x
=
pos
;
this
.
dustSprite
.
visible
=
true
;
this
.
addEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
);
};
Road
.
prototype
.
onEnterFrame
=
function
()
{
if
(
this
.
dustIndex
<
12
)
{
this
.
dustSprite
.
texture
=
utils_2
.
getTextureByName
(
'dust_'
+
this
.
dustIndex
);
this
.
dustIndex
++
;
}
else
{
this
.
dustIndex
=
0
;
this
.
dustSprite
.
visible
=
false
;
this
.
removeEventListener
(
engine
.
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
);
}
};
Road
.
prototype
.
hitBlock
=
function
(
pos
)
{
var
_this
=
this
;
var
target
,
lastTarget
;
var
foot
=
{
a
:
pos
-
84
/
2
,
b
:
pos
+
84
/
2
};
this
.
container
.
children
.
some
(
function
(
block
,
i
)
{
var
width
=
Block_1
.
Block
.
configs
[
block
.
type
].
width
;
var
line
=
{
a
:
block
.
x
-
width
/
2
,
b
:
block
.
x
+
width
/
2
};
if
(
_this
.
lineHitTest
(
foot
,
line
))
{
target
=
block
;
return
true
;
}
});
if
(
!
target
)
{
for
(
var
i
=
this
.
container
.
children
.
length
;
i
>
0
;
i
--
)
{
var
block
=
this
.
container
.
getChildAt
(
i
-
1
);
if
(
block
.
x
<
pos
)
{
lastTarget
=
block
;
break
;
}
}
}
return
{
target
:
target
,
lastTarget
:
lastTarget
,
};
};
Road
.
prototype
.
lineHitTest
=
function
(
l0
,
l1
)
{
return
l0
.
a
<
l1
.
b
&&
l0
.
b
>
l1
.
a
;
};
return
Road
;
}(
engine
.
Container
));
exports
.
Road
=
Road
;
dist/zeroing-libs/src/custom/walking-cat/src/game/ScoreLabel.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
ScoreLabel
=
(
function
(
_super
)
{
__extends
(
ScoreLabel
,
_super
);
function
ScoreLabel
()
{
return
_super
!==
null
&&
_super
.
apply
(
this
,
arguments
)
||
this
;
}
ScoreLabel
.
prototype
.
updateScore
=
function
(
score
,
formatFun
,
animation
)
{
if
(
formatFun
===
void
0
)
{
formatFun
=
null
;
}
if
(
animation
===
void
0
)
{
animation
=
true
;
}
this
.
formatFun
=
formatFun
;
this
.
_value
=
score
;
if
(
animation
)
{
engine
.
Tween
.
get
(
this
,
null
,
null
,
true
)
.
to
({
temp
:
score
},
300
);
}
else
{
this
.
updateLocal
(
score
);
}
};
Object
.
defineProperty
(
ScoreLabel
.
prototype
,
"score"
,
{
get
:
function
()
{
return
this
.
_value
;
},
enumerable
:
true
,
configurable
:
true
});
Object
.
defineProperty
(
ScoreLabel
.
prototype
,
"temp"
,
{
get
:
function
()
{
return
this
.
_temp
;
},
set
:
function
(
v
)
{
this
.
_temp
=
v
;
this
.
updateLocal
(
v
);
},
enumerable
:
true
,
configurable
:
true
});
ScoreLabel
.
prototype
.
updateLocal
=
function
(
v
)
{
this
.
text
=
this
.
formatFun
&&
this
.
formatFun
(
v
)
||
v
;
};
return
ScoreLabel
;
}(
engine
.
Label
));
exports
.
ScoreLabel
=
ScoreLabel
;
dist/zeroing-libs/src/custom/walking-cat/src/game/object-pool-init.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
Block_1
=
require
(
"./Block"
);
var
ObjectPool
=
engine
.
ObjectPool
;
exports
.
PoolName
=
'block'
;
ObjectPool
.
registerPool
(
exports
.
PoolName
,
function
()
{
return
new
Block_1
.
Block
();
},
function
(
item
,
data
)
{
item
.
reset
(
data
);
});
dist/zeroing-libs/src/custom/walking-cat/src/game/player/Head.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
utils_1
=
require
(
"../utils"
);
var
factor
=
10
;
var
Head
=
(
function
(
_super
)
{
__extends
(
Head
,
_super
);
function
Head
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
imgFace
=
new
engine
.
Sprite
(
utils_1
.
getTextureByName
(
'head_0'
));
_this
.
addChild
(
_this
.
imgFace
);
_this
.
imgFace
.
anchorTexture
.
set
(
107
/
_this
.
imgFace
.
width
,
155
/
_this
.
imgFace
.
height
);
_this
.
imgFace
.
y
=
65
;
_this
.
_headType
=
''
;
return
_this
;
}
Head
.
prototype
.
localUpdate
=
function
(
x
,
y
,
rotation
,
sleeping
)
{
this
.
x
=
x
;
this
.
y
=
y
;
this
.
rotation
=
rotation
;
};
Object
.
defineProperty
(
Head
.
prototype
,
"fWidth"
,
{
get
:
function
()
{
return
this
.
width
/
factor
;
},
enumerable
:
true
,
configurable
:
true
});
Object
.
defineProperty
(
Head
.
prototype
,
"fHeight"
,
{
get
:
function
()
{
return
this
.
height
/
factor
;
},
enumerable
:
true
,
configurable
:
true
});
Head
.
prototype
.
switchFace
=
function
(
type
,
playAni
)
{
if
(
type
==
this
.
_headType
)
{
return
;
}
var
headName
=
''
;
if
(
type
==
'normal'
)
{
headName
=
'head_0'
;
}
else
if
(
type
==
'happy'
)
{
headName
=
'head_1'
;
}
else
if
(
type
==
1
||
type
==
0
||
type
==
2
)
{
headName
=
'head_2'
;
}
else
if
(
type
==
3
)
{
headName
=
'head_3'
;
}
else
if
(
type
==
4
)
{
headName
=
'head_4'
;
}
this
.
_headType
=
type
;
this
.
imgFace
.
texture
=
utils_1
.
getTextureByName
(
headName
);
};
return
Head
;
}(
engine
.
Container
));
exports
.
Head
=
Head
;
dist/zeroing-libs/src/custom/walking-cat/src/game/player/IPlayerPart.js
0 → 100644
View file @
ca76151e
dist/zeroing-libs/src/custom/walking-cat/src/game/player/Player.js
0 → 100644
View file @
ca76151e
This diff is collapsed.
Click to expand it.
dist/zeroing-libs/src/custom/walking-cat/src/game/player/PlayerPart.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
utils_1
=
require
(
"../utils"
);
var
PlayerPart
=
(
function
(
_super
)
{
__extends
(
PlayerPart
,
_super
);
function
PlayerPart
(
name
)
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
changeRes
(
name
);
return
_this
;
}
PlayerPart
.
prototype
.
changeRes
=
function
(
name
)
{
this
.
name
=
name
;
this
.
texture
=
utils_1
.
getTextureByName
(
'body_normal_'
+
name
);
};
;
PlayerPart
.
prototype
.
setSkin
=
function
(
name
)
{
this
.
texture
=
utils_1
.
getTextureByName
(
'body_'
+
name
+
'_'
+
this
.
name
);
};
PlayerPart
.
prototype
.
localUpdate
=
function
(
x
,
y
,
rotation
,
sleeping
)
{
this
.
x
=
x
;
this
.
y
=
y
;
this
.
rotation
=
rotation
;
};
Object
.
defineProperty
(
PlayerPart
.
prototype
,
"fSize"
,
{
get
:
function
()
{
return
{
width
:
this
.
fWidth
,
height
:
this
.
fHeight
};
},
enumerable
:
true
,
configurable
:
true
});
Object
.
defineProperty
(
PlayerPart
.
prototype
,
"fWidth"
,
{
get
:
function
()
{
return
this
.
width
/
utils_1
.
getfactor
();
},
enumerable
:
true
,
configurable
:
true
});
Object
.
defineProperty
(
PlayerPart
.
prototype
,
"fHeight"
,
{
get
:
function
()
{
return
this
.
height
/
utils_1
.
getfactor
();
},
enumerable
:
true
,
configurable
:
true
});
PlayerPart
.
prototype
.
reset
=
function
()
{
};
return
PlayerPart
;
}(
engine
.
Sprite
));
exports
.
PlayerPart
=
PlayerPart
;
dist/zeroing-libs/src/custom/walking-cat/src/game/utils.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
exports
.
getTexture
=
getTexture
;
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
exports
.
getTextureByName
=
getTextureByName
;
function
playSound
(
name
)
{
engine
.
playSound
(
engine
.
getAssetByName
(
name
).
uuid
,
{
keep
:
true
});
}
exports
.
playSound
=
playSound
;
function
getStage
()
{
return
engine
.
gameStage
.
stage
;
}
exports
.
getStage
=
getStage
;
function
getfactor
()
{
return
10
;
}
exports
.
getfactor
=
getfactor
;
dist/zeroing-libs/src/custom/walking-cat/src/index.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
GameWrapper_1
=
require
(
"./game/GameWrapper"
);
var
props_1
=
require
(
"./props"
);
function
default_1
(
props
)
{
props_1
.
prepareProps
();
props_1
.
injectProps
(
props
);
var
instance
=
new
GameWrapper_1
.
GameWrapper
();
return
instance
;
}
exports
.
default
=
default_1
;
dist/zeroing-libs/src/custom/walking-cat/src/localWave.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
localWave
=
(
function
()
{
function
localWave
()
{
this
.
_oldProperties
=
{};
this
.
_t
=
0
;
}
localWave
.
prototype
.
init
=
function
(
target
,
duration
,
calProps
,
loop
,
autoPlay
,
reverse
,
delay
,
offset
)
{
if
(
calProps
===
void
0
)
{
calProps
=
null
;
}
if
(
loop
===
void
0
)
{
loop
=
0
;
}
if
(
autoPlay
===
void
0
)
{
autoPlay
=
true
;
}
if
(
reverse
===
void
0
)
{
reverse
=
false
;
}
if
(
delay
===
void
0
)
{
delay
=
0
;
}
if
(
offset
===
void
0
)
{
offset
=
0
;
}
this
.
target
=
target
;
this
.
_calProps
=
calProps
?
calProps
:
localWave
.
round
;
this
.
duration
=
duration
;
this
.
loop
=
loop
;
this
.
reverse
=
reverse
;
this
.
delay
=
delay
;
this
.
offset
=
offset
;
this
.
updateRegisterPos
();
if
(
autoPlay
)
{
this
.
play
();
}
};
localWave
.
prototype
.
updateRegisterPos
=
function
()
{
this
.
_oldProperties
.
x
=
this
.
target
.
x
;
this
.
_oldProperties
.
y
=
this
.
target
.
y
;
this
.
_oldProperties
.
scaleX
=
this
.
target
.
scaleX
;
this
.
_oldProperties
.
scaleY
=
this
.
target
.
scaleY
;
this
.
_oldProperties
.
skewX
=
this
.
target
.
skewX
;
this
.
_oldProperties
.
skewY
=
this
.
target
.
skewY
;
this
.
_oldProperties
.
rotation
=
this
.
target
.
rotation
;
this
.
_oldProperties
.
alpha
=
this
.
target
.
alpha
;
};
localWave
.
prototype
.
play
=
function
()
{
if
(
this
.
_tween
)
{
return
this
.
_tween
;
}
this
.
_count
=
0
;
return
this
.
_playStep
();
};
localWave
.
prototype
.
_playStep
=
function
()
{
if
(
this
.
loop
>
0
&&
this
.
_count
>=
this
.
loop
)
{
this
.
stop
();
return
;
}
this
.
_count
++
;
this
.
t
=
this
.
reverse
?
Math
.
PI
*
2
:
0
;
this
.
_tween
=
engine
.
Tween
.
get
(
this
);
this
.
_tween
.
wait
(
this
.
delay
).
to
({
t
:
this
.
reverse
?
0
:
Math
.
PI
*
2
},
this
.
duration
).
call
(
this
.
_playStep
,
this
);
return
this
.
_tween
;
};
Object
.
defineProperty
(
localWave
.
prototype
,
"t"
,
{
get
:
function
()
{
return
this
.
_t
;
},
set
:
function
(
value
)
{
if
(
!
this
.
target
.
stage
)
{
return
;
}
this
.
_t
=
value
;
var
props
=
this
.
_calProps
.
call
(
this
,
this
.
_t
+
this
.
offset
);
if
(
props
.
hasOwnProperty
(
'x'
))
{
this
.
target
.
x
=
(
props
.
x
||
0
)
+
this
.
_oldProperties
.
x
;
}
if
(
props
.
hasOwnProperty
(
'y'
))
{
this
.
target
.
y
=
(
props
.
y
||
0
)
+
this
.
_oldProperties
.
y
;
}
if
(
props
.
hasOwnProperty
(
'sx'
))
{
this
.
target
.
scaleX
=
props
.
sx
;
}
if
(
props
.
hasOwnProperty
(
'sy'
))
{
this
.
target
.
scaleY
=
props
.
sy
;
}
if
(
props
.
hasOwnProperty
(
'skewX'
))
{
this
.
target
.
skewX
=
props
.
skewX
;
}
if
(
props
.
hasOwnProperty
(
'skewY'
))
{
this
.
target
.
skewY
=
props
.
skewY
;
}
if
(
props
.
hasOwnProperty
(
'r'
))
{
this
.
target
.
rotation
=
props
.
r
;
}
if
(
props
.
hasOwnProperty
(
'alpha'
))
{
this
.
target
.
alpha
=
props
.
alpha
;
}
},
enumerable
:
true
,
configurable
:
true
});
localWave
.
prototype
.
stop
=
function
(
recovery
,
animation
,
duration
)
{
if
(
recovery
===
void
0
)
{
recovery
=
false
;
}
if
(
animation
===
void
0
)
{
animation
=
false
;
}
if
(
duration
===
void
0
)
{
duration
=
1000
;
}
if
(
!
this
.
_tween
)
{
return
;
}
engine
.
Tween
.
removeTweens
(
this
);
if
(
recovery
)
{
engine
.
Tween
.
get
(
this
.
target
).
to
(
this
.
_oldProperties
,
duration
);
}
this
.
_tween
=
null
;
};
Object
.
defineProperty
(
localWave
.
prototype
,
"playing"
,
{
get
:
function
()
{
return
this
.
_tween
!=
null
;
},
enumerable
:
true
,
configurable
:
true
});
localWave
.
round
=
function
(
h
,
t
)
{
return
{
x
:
Math
.
cos
(
t
)
*
h
,
y
:
Math
.
sin
(
t
)
*
h
};
};
localWave
.
cos
=
function
(
h
,
t
)
{
return
{
x
:
Math
.
cos
(
t
)
*
h
,
y
:
0
};
};
localWave
.
sin
=
function
(
h
,
t
)
{
h
=
h
||
1
;
return
{
x
:
0
,
y
:
Math
.
sin
(
t
)
*
h
};
};
localWave
.
rotate
=
function
(
t
)
{
return
{
r
:
360
*
t
/
Math
.
PI
/
2
};
};
localWave
.
shake
=
function
(
angle
,
count
,
t
)
{
return
{
r
:
Math
.
sin
(
t
*
count
)
*
angle
};
};
localWave
.
breath
=
function
(
scale
,
t
)
{
return
{
sx
:
Math
.
sin
(
t
)
*
scale
+
1
,
sy
:
-
Math
.
sin
(
t
+
Math
.
PI
/
4
)
*
scale
+
1
};
};
localWave
.
zoom
=
function
(
scale
,
t
)
{
scale
=
scale
||
0.1
;
return
{
sx
:
Math
.
sin
(
t
)
*
scale
+
1
,
sy
:
Math
.
sin
(
t
)
*
scale
+
1
};
};
localWave
.
fade
=
function
(
base
,
t
)
{
return
{
alpha
:
(
Math
.
sin
(
t
)
+
1
)
*
0.5
+
base
};
};
return
localWave
;
}());
exports
.
localWave
=
localWave
;
dist/zeroing-libs/src/custom/walking-cat/src/props.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
exports
.
props
=
{};
function
prepareProps
()
{
var
metaProps
=
getProps
();
engine
.
injectProp
(
exports
.
props
,
metaProps
);
}
exports
.
prepareProps
=
prepareProps
;
function
injectProps
(
p
)
{
engine
.
injectProp
(
exports
.
props
,
p
);
}
exports
.
injectProps
=
injectProps
;
dist/zeroing-libs/src/process/base/compare/index2.js
0 → 100644
View file @
ca76151e
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
function
prop
(
key
,
meta
)
{
return
function
(
target
,
propertyKey
,
descriptor
)
{
};
}
var
default_1
=
(
function
()
{
function
default_1
()
{
}
default_1
.
process
=
function
()
{
var
leftValue
=
engine
.
findVariable
(
'left'
,
args
,
props
);
var
rightValue
=
engine
.
findVariable
(
'right'
,
args
,
props
);
var
operator
=
engine
.
findVariable
(
'operator'
,
args
,
props
);
var
result
;
if
(
operator
===
'exist'
)
{
result
=
!!
leftValue
;
}
else
{
switch
(
props
.
type
)
{
case
'string'
:
leftValue
=
'"'
+
leftValue
+
'"'
;
rightValue
=
'"'
+
rightValue
+
'"'
;
break
;
case
'number'
:
leftValue
=
typeof
leftValue
===
'number'
?
leftValue
:
parseFloat
(
leftValue
);
rightValue
=
typeof
rightValue
===
'number'
?
rightValue
:
parseFloat
(
rightValue
);
break
;
case
'boolean'
:
leftValue
=
typeof
leftValue
===
'boolean'
?
leftValue
:
(
leftValue
===
'true'
?
true
:
(
leftValue
===
'false'
?
false
:
!!
leftValue
));
rightValue
=
typeof
rightValue
===
'boolean'
?
rightValue
:
(
rightValue
===
'true'
?
true
:
(
rightValue
===
'false'
?
false
:
!!
rightValue
));
break
;
}
var
func
=
new
Function
(
'return '
+
leftValue
+
operator
+
rightValue
);
result
=
func
();
}
next
(
result
?
'true'
:
'false'
);
};
__decorate
([
prop
(
'left'
,
{
"alias"
:
"左值"
,
"type"
:
"dynamic"
,
"default"
:
""
})
],
default_1
,
"process"
,
null
);
return
default_1
;
}());
exports
.
default
=
default_1
;
libs/process-context.v8.d.ts
View file @
ca76151e
...
...
@@ -10,7 +10,7 @@ declare type NodeClass =
declare
const
args
:
any
;
declare
const
scope
:
any
;
declare
const
props
:
ProcessProps
;
declare
const
props
:
ProcessProps
|
any
;
declare
const
target
:
NodeClass
;
declare
const
global
:
{
gameStage
:
engine
.
GameStage
,
...
...
src/process/base/compare/meta.json
View file @
ca76151e
...
...
@@ -14,4 +14,5 @@
"output"
:
[
"true"
,
"false"
]
}
\ No newline at end of file
}
src/process/base/put-data/index.ts
View file @
ca76151e
/**
* Created by rockyl on 2019-11-16.
*/
*/
engine
.
gameStage
.
dataCenter
.
mutate
(
props
.
name
,
args
,
props
.
path
);
next
(
'success'
,
args
);
src/process/base/wait/index.ts
View file @
ca76151e
...
...
@@ -5,5 +5,5 @@
const
duration
=
engine
.
findVariable
(
'duration'
,
args
,
props
);
setTimeout
(
function
(){
next
(
'complete'
)
next
(
'complete'
,
args
)
},
duration
);
src/process/other/pick-image/index.ts
0 → 100644
View file @
ca76151e
/**
* Created by rockyl on 2019-11-16.
*/
let
input
=
document
.
createElement
(
'input'
);
input
.
type
=
'file'
;
input
.
onchange
=
function
(
e
)
{
processImage
(
input
.
files
[
0
],
(
imgData
)
=>
{
next
(
'success'
,
imgData
);
})
};
input
.
click
();
function
processImage
(
file
,
callback
)
{
let
reader
=
new
FileReader
();
reader
.
readAsDataURL
(
file
);
reader
.
onload
=
function
(
e
)
{
callback
(
reader
.
result
)
}
}
src/process/other/pick-image/meta.json
0 → 100644
View file @
ca76151e
{
"name"
:
"选择图片"
,
"desc"
:
"选择一个图片文件"
,
"props"
:
{
},
"output"
:
[
"success"
]
}
src/process/other/resize-image/index.ts
0 → 100644
View file @
ca76151e
/**
* Created by rockyl on 2019-11-16.
*/
const
width
=
engine
.
findVariable
(
'width'
,
args
,
props
);
const
height
=
engine
.
findVariable
(
'height'
,
args
,
props
);
const
cutType
=
engine
.
findVariable
(
'cutType'
,
args
,
props
);
const
type
=
engine
.
findVariable
(
'type'
,
args
,
props
);
const
quality
=
engine
.
findVariable
(
'quality'
,
args
,
props
);
let
img
=
args
;
if
(
typeof
args
===
'string'
)
{
img
=
new
Image
();
img
.
onload
=
function
()
{
deal
();
};
img
.
onerror
=
function
(
e
)
{
console
.
log
(
e
);
};
img
.
src
=
args
;
}
else
{
deal
();
}
function
getExif
(
callback
)
{
EXIF
.
getData
(
img
,
function
()
{
var
allMetaData
=
EXIF
.
getAllTags
(
this
);
callback
(
allMetaData
)
});
}
function
deal
()
{
getExif
((
allMetaData
)
=>
{
let
m
=
cutType
===
'inner'
?
Math
.
min
:
Math
.
max
;
let
r
=
m
(
width
/
img
.
width
,
height
/
img
.
height
);
let
imgWidth
=
img
.
width
*
r
;
let
imgHeight
=
img
.
height
*
r
;
let
x
=
(
width
-
imgWidth
)
/
2
;
let
y
=
(
height
-
imgHeight
)
/
2
;
let
canvas
=
document
.
createElement
(
'canvas'
);
canvas
.
width
=
width
;
canvas
.
height
=
height
;
let
ctx
=
canvas
.
getContext
(
'2d'
);
//ctx.strokeStyle = 'blue';
//ctx.strokeRect(0, 0, width, height);
ctx
.
translate
(
x
,
y
);
ctx
.
scale
(
r
,
r
);
allMetaData
.
Orientation
=
1
;
if
(
allMetaData
.
Orientation
)
{
let
orientation
=
allMetaData
.
Orientation
;
switch
(
orientation
)
{
case
2
:
//水平翻转
ctx
.
translate
(
img
.
width
,
0
);
ctx
.
scale
(
-
1
,
1
);
break
;
case
3
:
//180°
ctx
.
translate
(
img
.
width
,
img
.
height
);
ctx
.
rotate
(
Math
.
PI
);
break
;
case
4
:
//垂直翻转
ctx
.
translate
(
0
,
img
.
height
);
ctx
.
scale
(
1
,
-
1
);
break
;
case
5
:
//逆时针90°+水平翻转
ctx
.
rotate
(
-
0.5
*
Math
.
PI
);
ctx
.
scale
(
-
1
,
1
);
ctx
.
translate
(
x
/
r
-
y
/
r
,
y
/
r
-
x
/
r
);
break
;
case
6
:
//逆时针90°
ctx
.
rotate
(
-
0.5
*
Math
.
PI
);
ctx
.
translate
(
-
img
.
width
+
y
/
r
-
x
/
r
,
y
/
r
-
x
/
r
);
break
;
case
7
:
//顺时针90°+垂直翻转
ctx
.
rotate
(
0.5
*
Math
.
PI
);
ctx
.
scale
(
-
1
,
1
);
ctx
.
translate
(
-
img
.
width
+
y
/
r
-
x
/
r
,
-
img
.
height
+
x
/
r
-
y
/
r
);
break
;
case
8
:
//顺时针90°
ctx
.
rotate
(
-
0.5
*
Math
.
PI
);
ctx
.
translate
(
-
img
.
width
+
y
/
r
-
x
/
r
,
-
x
/
r
+
y
/
r
);
break
;
}
}
ctx
.
drawImage
(
img
,
0
,
0
);
let
dataUrl
=
canvas
.
toDataURL
(
'image/'
+
type
,
quality
);
next
(
'success'
,
dataUrl
);
})
}
src/process/other/resize-image/meta.json
0 → 100644
View file @
ca76151e
{
"name"
:
"缩放图片"
,
"desc"
:
"缩放图片"
,
"props"
:
{
"width"
:
{
"type"
:
"number"
,
"alias"
:
"目标宽度"
},
"height"
:
{
"type"
:
"number"
,
"alias"
:
"目标高度"
},
"cutType"
:
{
"type"
:
"enum"
,
"enum"
:
[
"inner"
,
"outer"
],
"alias"
:
"裁剪类型"
,
"default"
:
"inner"
},
"type"
:
{
"type"
:
"enum"
,
"enum"
:
[
"png"
,
"jpeg"
],
"alias"
:
"输出类型"
,
"default"
:
"png"
},
"quality"
:
{
"type"
:
"number"
,
"alias"
:
"图片质量"
,
"default"
:
0.7
}
},
"output"
:
[
"success"
]
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment