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
8b42bb0e
Commit
8b42bb0e
authored
May 13, 2020
by
王梦佳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
娃娃机
parent
d1566d32
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
87 additions
and
42 deletions
+87
-42
.DS_Store
.DS_Store
+0
-0
doll-machine2.json
dist/customs/doll-machine2.json
+21
-7
main.js
src/custom/doll-machine2/debug/main.js
+20
-12
main.js.map
src/custom/doll-machine2/debug/main.js.map
+1
-1
meta.json
src/custom/doll-machine2/meta.json
+20
-6
GameView.ts
src/custom/doll-machine2/src/game/GameView.ts
+2
-2
Zhuazi.ts
src/custom/doll-machine2/src/game/Zhuazi.ts
+5
-5
frontBox.ts
src/custom/doll-machine2/src/game/frontBox.ts
+18
-9
No files found.
.DS_Store
0 → 100644
View file @
8b42bb0e
File added
dist/customs/doll-machine2.json
View file @
8b42bb0e
This diff is collapsed.
Click to expand it.
src/custom/doll-machine2/debug/main.js
View file @
8b42bb0e
...
...
@@ -31,7 +31,7 @@
}
FrontBoxs
.
prototype
.
setup
=
function
()
{
var
initX
,
initY
=
0
;
for
(
var
i
=
0
;
i
<
+
props
.
dollNum
+
1
;
i
++
)
{
for
(
var
i
=
0
;
i
<
props
.
dollNum
;
i
++
)
{
if
(
!
new
engine
.
Sprite
(
getTextureByName
(
'frontbox_'
+
i
)))
{
return
;
}
...
...
@@ -40,6 +40,9 @@
initY
=
this
.
frontBoxs
[
0
].
y
=
props
.
frontInitY
;
this
.
frontBoxs
[
i
][
'npcType'
]
=
'box'
+
i
;
}
this
.
frontBoxs
[
props
.
dollNum
]
=
new
engine
.
Sprite
(
getTextureByName
(
'frontbox_0'
));
this
.
frontBoxs
[
props
.
dollNum
][
'npcType'
]
=
'box'
+
props
.
dollNum
;
console
.
log
(
this
.
frontBoxs
);
for
(
var
i
=
0
;
i
<
this
.
frontBoxs
.
length
;
i
++
)
{
if
(
i
==
0
)
{
this
.
frontBoxs
[
i
].
x
=
initX
;
...
...
@@ -62,13 +65,18 @@
item
.
visible
=
true
;
}
if
(
item
.
x
>=
750
)
{
var
lastitem
=
_this
.
frontBoxs
.
shift
();
lastitem
.
x
=
_this
.
frontBoxs
[
_this
.
frontBoxs
.
length
-
1
].
x
-
_this
.
frontBoxs
[
0
].
width
-
props
.
frontmargin
;
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
.
frontmargin
;
if
(
!
_this
.
GameView
.
getMoveX
()
&&
item
.
x
<=
0
&&
_this
.
GameView
.
startstatus
)
{
_this
.
GameView
.
setMoveX
((
370
-
item
.
x
-
13
)
/
props
.
moveSpeed
,
item
);
_this
.
hideBox
=
item
;
}
_this
.
frontBoxs
.
push
(
lastitem
);
}
});
};
...
...
@@ -79,6 +87,7 @@
};
return
FrontBoxs
;
}(
engine
.
Container
));
//# sourceMappingURL=frontBox.js.map
var
BackBoxs
=
(
function
(
_super
)
{
tslib
.
__extends
(
BackBoxs
,
_super
);
...
...
@@ -150,13 +159,13 @@
this
.
connect
.
x
=
18
;
this
.
connect
.
y
=
-
5
;
this
.
left_zhuazi
=
new
engine
.
Sprite
(
getTextureByName
(
"左爪"
));
this
.
left_zhuazi
.
x
=
-
15
;
this
.
left_zhuazi
.
y
=
60
;
this
.
left_zhuazi
.
x
=
props
.
leftLocX
;
this
.
left_zhuazi
.
y
=
props
.
leftLocY
;
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
this
.
left_zhuazi
.
anchorY
=
0
;
this
.
right_zhuazi
=
new
engine
.
Sprite
(
getTextureByName
(
"右爪"
));
this
.
right_zhuazi
.
x
=
98
;
this
.
right_zhuazi
.
y
=
60
;
this
.
right_zhuazi
.
x
=
props
.
rightLocX
;
this
.
right_zhuazi
.
y
=
props
.
rightLocY
;
this
.
ganNode
.
addChild
(
this
.
left_zhuazi
);
this
.
ganNode
.
addChild
(
this
.
right_zhuazi
);
this
.
ganNode
.
addChild
(
this
.
connect
);
...
...
@@ -232,7 +241,7 @@
};
Zhuazi
.
prototype
.
getLong
=
function
()
{
var
_this
=
this
;
var
droptime
=
Number
((
this
.
GameView
.
getMoveX
()
/
60
-
1
).
toFixed
(
2
))
*
1000
;
var
droptime
=
Number
((
this
.
GameView
.
getMoveX
()
/
60
-
1
).
toFixed
(
2
))
*
1000
-
130
;
console
.
log
(
'dr'
,
droptime
);
var
times
=
(
props
.
ganMoveEndY
-
this
.
ganzi
.
y
)
/
this
.
ganzi
.
height
;
console
.
log
(
Number
(
times
.
toFixed
(
2
)));
...
...
@@ -267,8 +276,8 @@
tslib
.
__extends
(
GameView
,
_super
);
function
GameView
()
{
var
_this
=
_super
.
call
(
this
)
||
this
;
_this
.
startstatus
=
tru
e
;
_this
.
ifPrize
=
tru
e
;
_this
.
startstatus
=
fals
e
;
_this
.
ifPrize
=
fals
e
;
_this
.
goodsItems
=
[];
_this
.
once
(
engine
.
Event
.
ADDED_TO_STAGE
,
_this
.
setup
,
_this
);
return
_this
;
...
...
@@ -376,7 +385,6 @@
};
return
GameView
;
}(
engine
.
Container
));
//# sourceMappingURL=GameView.js.map
var
GameWrapper
=
(
function
(
_super
)
{
tslib
.
__extends
(
GameWrapper
,
_super
);
...
...
src/custom/doll-machine2/debug/main.js.map
View file @
8b42bb0e
This diff is collapsed.
Click to expand it.
src/custom/doll-machine2/meta.json
View file @
8b42bb0e
...
...
@@ -102,11 +102,31 @@
"type"
:
"number"
,
"default"
:
20
},
"leftLocX"
:
{
"alias"
:
"左边爪子X位置"
,
"type"
:
"number"
,
"default"
:
-15
},
"leftLocY"
:
{
"alias"
:
"左边爪子Y位置"
,
"type"
:
"number"
,
"default"
:
60
},
"rightRotation"
:
{
"alias"
:
"右边爪子旋转角度"
,
"type"
:
"number"
,
"default"
:
-20
},
"rightLocX"
:
{
"alias"
:
"右边爪子X位置"
,
"type"
:
"number"
,
"default"
:
98
},
"rightLocY"
:
{
"alias"
:
"右边爪子Y位置"
,
"type"
:
"number"
,
"default"
:
60
},
"prizeBoxInitX"
:
{
"alias"
:
"中奖娃娃的x位置"
,
"type"
:
"number"
,
...
...
@@ -148,12 +168,6 @@
"url"
:
"//yun.duiba.com.cn/aurora/assets/fde8c60981791e5136c7914274c2a2d0936626cd.png"
,
"uuid"
:
"aa30ee7c-a6ad-4e10-9b6a-13b139664ab1"
,
"ext"
:
".png"
},
{
"name"
:
"frontbox_4"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/fde8c60981791e5136c7914274c2a2d0936626cd.png"
,
"uuid"
:
"aa30ee7c-a6ad-4e10-9b6a-13b139664ab2"
,
"ext"
:
".png"
},
{
"name"
:
"backbox_0"
,
...
...
src/custom/doll-machine2/src/game/GameView.ts
View file @
8b42bb0e
...
...
@@ -51,9 +51,9 @@ export default class GameView extends engine.Container {
//游戏状态
private
gameIng
;
//是否已获取位移值
public
startstatus
=
tru
e
;
public
startstatus
=
fals
e
;
//是否中奖
public
ifPrize
=
tru
e
;
public
ifPrize
=
fals
e
;
//npc出身计时器
private
timer
;
//倒计时计时器
...
...
src/custom/doll-machine2/src/game/Zhuazi.ts
View file @
8b42bb0e
...
...
@@ -36,13 +36,13 @@ export class Zhuazi extends engine.Container {
this
.
connect
.
x
=
18
;
this
.
connect
.
y
=
-
5
;
this
.
left_zhuazi
=
new
engine
.
Sprite
(
getTextureByName
(
"左爪"
));
this
.
left_zhuazi
.
x
=
-
15
;
this
.
left_zhuazi
.
y
=
60
;
this
.
left_zhuazi
.
x
=
props
.
leftLocX
;
this
.
left_zhuazi
.
y
=
props
.
leftLocY
;
this
.
left_zhuazi
.
anchorX
=
this
.
left_zhuazi
.
width
;
this
.
left_zhuazi
.
anchorY
=
0
;
this
.
right_zhuazi
=
new
engine
.
Sprite
(
getTextureByName
(
"右爪"
));
this
.
right_zhuazi
.
x
=
98
;
this
.
right_zhuazi
.
y
=
60
;
this
.
right_zhuazi
.
x
=
props
.
rightLocX
;
this
.
right_zhuazi
.
y
=
props
.
rightLocY
;
this
.
ganNode
.
addChild
(
this
.
left_zhuazi
);
this
.
ganNode
.
addChild
(
this
.
right_zhuazi
);
this
.
ganNode
.
addChild
(
this
.
connect
);
...
...
@@ -115,7 +115,7 @@ export class Zhuazi extends engine.Container {
},
500
);
}
getLong
()
{
let
droptime
=
Number
((
this
.
GameView
.
getMoveX
()
/
60
-
1
).
toFixed
(
2
))
*
1000
;
let
droptime
=
Number
((
this
.
GameView
.
getMoveX
()
/
60
-
1
).
toFixed
(
2
))
*
1000
-
130
;
console
.
log
(
'dr'
,
droptime
);
let
times
=
(
props
.
ganMoveEndY
-
this
.
ganzi
.
y
)
/
this
.
ganzi
.
height
;
console
.
log
(
Number
(
times
.
toFixed
(
2
))
);
...
...
src/custom/doll-machine2/src/game/frontBox.ts
View file @
8b42bb0e
...
...
@@ -21,17 +21,19 @@ export class FrontBoxs extends engine.Container {
}
setup
()
{
let
initX
,
initY
=
0
;
for
(
let
i
=
0
;
i
<
+
props
.
dollNum
+
1
;
i
++
)
{
for
(
let
i
=
0
;
i
<
props
.
dollNum
;
i
++
)
{
if
(
!
new
engine
.
Sprite
(
getTextureByName
(
'frontbox_'
+
i
)))
{
return
;
}
this
.
frontBoxs
[
i
]
=
new
engine
.
Sprite
(
getTextureByName
(
'frontbox_'
+
i
));
initX
=
this
.
frontBoxs
[
0
].
x
=
props
.
frontInitX
;
initY
=
this
.
frontBoxs
[
0
].
y
=
props
.
frontInitY
;
this
.
frontBoxs
[
i
][
'npcType'
]
=
'box'
+
i
;
}
// this.frontBoxs[props.dollNum] = new engine.Sprite(getTextureByName('frontbox_0'));
// this.frontBoxs[props.dollNum]['npcType'] = 'box' + props.dollNum;
this
.
frontBoxs
[
props
.
dollNum
]
=
new
engine
.
Sprite
(
getTextureByName
(
'frontbox_0'
));
this
.
frontBoxs
[
props
.
dollNum
][
'npcType'
]
=
'box'
+
props
.
dollNum
;
console
.
log
(
this
.
frontBoxs
);
for
(
let
i
=
0
;
i
<
this
.
frontBoxs
.
length
;
i
++
)
{
if
(
i
==
0
)
{
...
...
@@ -50,18 +52,25 @@ export class FrontBoxs extends engine.Container {
frameMove
()
{
this
.
frontBoxs
.
forEach
((
item
,
index
)
=>
{
item
.
x
+=
props
.
moveSpeed
;
if
(
item
.
x
<=
0
&&
!
item
.
visible
)
{
if
(
item
.
x
<=
0
&&
!
item
.
visible
)
{
item
.
visible
=
true
;
}
if
(
item
.
x
>=
750
)
{
let
lastitem
=
this
.
frontBoxs
.
shift
();
lastitem
.
x
=
this
.
frontBoxs
[
this
.
frontBoxs
.
length
-
1
].
x
-
this
.
frontBoxs
[
0
].
width
-
props
.
frontmargin
;
if
(
item
.
x
>=
750
)
{
//let lastitem = this.frontBoxs.shift();
let
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
.
frontmargin
;
if
(
!
this
.
GameView
.
getMoveX
()
&&
item
.
x
<=
0
&&
this
.
GameView
.
startstatus
)
{
this
.
GameView
.
setMoveX
((
370
-
item
.
x
-
13
)
/
props
.
moveSpeed
,
item
);
this
.
hideBox
=
item
;
}
this
.
frontBoxs
.
push
(
lastitem
);
//
this.frontBoxs.push(lastitem);
}
})
}
...
...
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