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
a9c7ec84
Commit
a9c7ec84
authored
Jul 02, 2020
by
lujinlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
-a
parent
e87cb514
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1147 additions
and
0 deletions
+1147
-0
jiugong-turntable-change.json
dist/customs/jiugong-turntable-change.json
+126
-0
app.js
src/custom/jiugong-turntable-change/debug/app.js
+159
-0
index.html
src/custom/jiugong-turntable-change/debug/index.html
+49
-0
load-assets.js
src/custom/jiugong-turntable-change/debug/load-assets.js
+10
-0
main.js
src/custom/jiugong-turntable-change/debug/main.js
+299
-0
main.js.map
src/custom/jiugong-turntable-change/debug/main.js.map
+1
-0
props.js
src/custom/jiugong-turntable-change/debug/props.js
+7
-0
meta.json
src/custom/jiugong-turntable-change/meta.json
+133
-0
GameView.ts
src/custom/jiugong-turntable-change/src/game/GameView.ts
+45
-0
GameWrapper.ts
src/custom/jiugong-turntable-change/src/game/GameWrapper.ts
+57
-0
Turntable.ts
src/custom/jiugong-turntable-change/src/game/Turntable.ts
+213
-0
utils.ts
src/custom/jiugong-turntable-change/src/game/utils.ts
+19
-0
index.ts
src/custom/jiugong-turntable-change/src/index.ts
+14
-0
props.ts
src/custom/jiugong-turntable-change/src/props.ts
+15
-0
No files found.
dist/customs/jiugong-turntable-change.json
0 → 100644
View file @
a9c7ec84
This diff is collapsed.
Click to expand it.
src/custom/jiugong-turntable-change/debug/app.js
0 → 100644
View file @
a9c7ec84
/**
* Created by rockyl on 2019-12-16.
*/
const
customId
=
'jiugong-turntable-change'
;
(
async
function
()
{
let
customModule
=
await
fetch
(
`../meta.json`
);
customModule
=
await
customModule
.
json
();
console
.
log
(
customModule
);
await
loadAssets
(
customModule
.
assets
);
launchWithCustomModule
(
customModule
);
})();
function
launchWithCustomModule
(
customModule
)
{
//engine.registerCustomCodeModule(customModule);
engine
.
registerCustomModule
(
customId
,
window
[
customId
]);
const
{
props
:
propsOption
,
assets
}
=
customModule
;
let
props
=
engine
.
computeProps
(
customModuleProps
,
propsOption
);
const
customModuleIns
=
{
id
:
customId
,
props
,
assets
,
};
engine
.
registerCustomModules
([
customModuleIns
]);
engine
.
launchWithConfig
({
options
:
{
entrySceneView
:
'entry'
,
},
assets
:
[],
views
:
[{
name
:
'entry'
,
type
:
'node'
,
properties
:
{
x
:
0
,
y
:
0
,
}
}],
},
null
,
function
()
{
setTimeout
(()
=>
{
engine
.
addCustomModule
(
customId
,
engine
.
gameStage
.
sceneContainer
.
getChildAt
(
0
));
},
100
);
let
pram
=
[
{
id
:
1
,
name
:
'奖品1奖品1'
,
img
:
'//yun.dui88.com/images/201907/ui83og75fr.png'
},
{
id
:
2
,
name
:
'奖品2奖品2奖品2'
,
img
:
'//yun.dui88.com/images/201907/ui83og75fr.png'
},
{
id
:
3
,
name
:
'奖品333333'
,
img
:
'//yun.dui88.com/images/201907/ui83og75fr.png'
},
{
id
:
4
,
name
:
'奖品4545545454'
,
img
:
'//yun.dui88.com/images/201907/ui83og75fr.png'
},
{
id
:
5
,
name
:
'奖奖品5奖品5奖品5品5'
,
img
:
'//yun.dui88.com/images/201907/ui83og75fr.png'
},
{
id
:
6
,
name
:
'奖品6'
,
img
:
'//yun.dui88.com/images/201907/ui83og75fr.png'
},
{
id
:
7
,
name
:
'奖品7'
,
img
:
'//yun.dui88.com/images/201907/ui83og75fr.png'
},
{
id
:
8
,
name
:
'奖品奖品5奖品5奖品58'
,
img
:
'//yun.dui88.com/images/201907/ui83og75fr.png'
}
]
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'jiugong-turntable-change-init'
)
},
1000
);
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'jiugong-turntable-change-prizeData'
,{
resources
:
pram
})
},
1500
);
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'jiugong-turntable-change-start'
)
},
4000
);
let
pram1
=
[
{
id
:
1
,
name
:
'奖品1'
,
img
:
'//yun.dui88.com/images/201907/ui83og75fr.png'
},
{
id
:
2
,
name
:
'奖品2'
,
img
:
'//yun.dui88.com/images/201907/ui83og75fr.png'
},
{
id
:
3
,
name
:
'奖品3'
,
img
:
'//yun.dui88.com/images/201907/ui83og75fr.png'
},
{
id
:
4
,
name
:
'奖品4'
,
img
:
'//yun.dui88.com/images/201907/ui83og75fr.png'
},
{
id
:
5
,
name
:
'奖品5'
,
img
:
'//yun.dui88.com/images/201907/ui83og75fr.png'
},
{
id
:
6
,
name
:
'奖品6'
,
img
:
'//yun.dui88.com/images/201907/ui83og75fr.png'
},
{
id
:
7
,
name
:
'奖品7'
,
img
:
'//yun.dui88.com/images/201907/ui83og75fr.png'
},
{
id
:
8
,
name
:
'奖品8'
,
img
:
'//yun.dui88.com/images/201907/ui83og75fr.png'
}
]
setTimeout
(()
=>
{
engine
.
globalEvent
.
dispatchEvent
(
'jiugong-turntable-change-winPrize'
,{
prizeID
:
4
})
},
6000
);
// setTimeout(() => {
// engine.globalEvent.dispatchEvent('jiugong-turntable-change-prizeData',{resources:pram1})
// }, 10000);
});
}
function
getAssetByUUID
(
uuid
)
{
return
engine
.
resolveCustomAsset
(
customId
,
uuid
);
}
function
getProps
()
{
return
engine
.
getProps
(
customId
);
}
src/custom/jiugong-turntable-change/debug/index.html
0 → 100644
View file @
a9c7ec84
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
九宫格答题-更换奖池
</title>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"
/>
<meta
name=
"apple-mobile-web-app-capable"
content=
"yes"
/>
<meta
name=
"full-screen"
content=
"true"
/>
<meta
name=
"screen-orientation"
content=
"portrait"
/>
<meta
name=
"x5-fullscreen"
content=
"true"
/>
<meta
name=
"360-fullscreen"
content=
"true"
/>
<style>
html
,
body
{
padding
:
0
;
margin
:
0
;
border
:
0
;
width
:
100%
;
height
:
100%
;
overflow
:
hidden
;
position
:
absolute
;
background-color
:
#000000
;
}
</style>
</head>
<body>
<div
id=
"game-container"
style=
"line-height:0;font-size:0"
></div>
<script
src=
"//yun.duiba.com.cn/editor/zeroing/libs/engine.ebc906f6b50b8da0a669f77027981d5f3cb560ce.js"
></script>
<!--<script src="http://localhost:4002/debug/engine.js"></script>
<script src="http://localhost:4003/debug/engine-svga.js"></script>-->
<!--//yun.duiba.com.cn/aurora/assets/6a63b68a1fd87eaf60a515968f91a0b1014fe640.ttf-->
<script
src=
"//yun.duiba.com.cn/editor/zeroing/libs/svga.fd3923ae6e664251ca7981801a65809cc5f36bc3.js"
>
</script>
<!--<script src="//yun.duiba.com.cn/editor/zeroing/libs/engine.9a9dbfda4cb2dd5508ecddfe3d95dfd88063f7b5.js"></script>-->
<script
src=
"app.js"
></script>
<script
src=
"props.js"
></script>
<script
src=
"load-assets.js"
></script>
<script
src=
"main.js"
></script>
<script>
</script>
</body>
\ No newline at end of file
src/custom/jiugong-turntable-change/debug/load-assets.js
0 → 100644
View file @
a9c7ec84
/**
* Created by rockyl on 2020-01-21.
*/
const
assets
=
[
];
function
loadAssets
(
customModuleAssets
,
onProgress
,
onComplete
){
return
engine
.
loadAssets
(
assets
.
concat
(...
customModuleAssets
),
onProgress
,
onComplete
);
}
src/custom/jiugong-turntable-change/debug/main.js
0 → 100644
View file @
a9c7ec84
This diff is collapsed.
Click to expand it.
src/custom/jiugong-turntable-change/debug/main.js.map
0 → 100644
View file @
a9c7ec84
This diff is collapsed.
Click to expand it.
src/custom/jiugong-turntable-change/debug/props.js
0 → 100644
View file @
a9c7ec84
/**
* Created by rockyl on 2020-01-21.
*/
let
customModuleProps
=
{
};
src/custom/jiugong-turntable-change/meta.json
0 → 100644
View file @
a9c7ec84
{
"name"
:
"九宫格抽奖-更换奖池"
,
"desc"
:
"九宫格抽奖模块-更换奖池"
,
"props"
:
{
"horizontal"
:
{
"alias"
:
"横向间距"
,
"type"
:
"number"
,
"default"
:
1
},
"vertical"
:
{
"alias"
:
"纵向间距"
,
"type"
:
"number"
,
"default"
:
1
},
"circleNumber"
:
{
"alias"
:
"至少转的圈数"
,
"type"
:
"number"
,
"default"
:
3
},
"tweenTime"
:
{
"alias"
:
"单个奖品节点动画时间(毫秒)"
,
"type"
:
"number"
,
"default"
:
200
},
"slowTweenTime"
:
{
"alias"
:
"中奖后缓速递增时长"
,
"type"
:
"number"
,
"default"
:
200
},
"icon_width"
:
{
"alias"
:
"奖品图宽度"
,
"type"
:
"number"
,
"default"
:
110
},
"icon_height"
:
{
"alias"
:
"奖品图高度"
,
"type"
:
"number"
,
"default"
:
110
},
"icon_X"
:
{
"alias"
:
"奖品X轴偏移量(底框背景有透明)"
,
"type"
:
"number"
,
"default"
:
0
},
"icon_Y"
:
{
"alias"
:
"奖品Y轴偏移量(底框背景有透明)"
,
"type"
:
"number"
,
"default"
:
-20
},
"prizeName_size"
:
{
"alias"
:
"奖品名字字号"
,
"type"
:
"number"
,
"default"
:
30
},
"prizeName_Ypos"
:
{
"alias"
:
"奖品名字相对于底框的高度"
,
"type"
:
"number"
,
"default"
:
50
},
"prizeName_color"
:
{
"alias"
:
"奖品名字颜色值"
,
"type"
:
"string"
,
"default"
:
"#e8805d"
},
"prizeName_maxLength"
:
{
"alias"
:
"奖品名字最长显示长度"
,
"type"
:
"number"
,
"default"
:
8
},
"prizeName_retainLength"
:
{
"alias"
:
"奖品名字超过长度保留多少字数"
,
"type"
:
"number"
,
"default"
:
5
}
},
"assets"
:
[
{
"name"
:
"unchecked"
,
"url"
:
"//yun.duiba.com.cn/aurora/assets/3351a20f982fea1fbcbbb3b85bc03f6b547c8bbc.png"
,
"uuid"
:
"48dc9c00-92c3-4926-8d6b-9eb3e0d0668d"
,
"ext"
:
".png"
},
{
"name"
:
"checked"
,
"url"
:
" //yun.duiba.com.cn/aurora/assets/2a9f9ecc43eb912db553fa4685c1987a937f0198.png"
,
"uuid"
:
"1d7bc84d-689d-4a6a-a023-e4a7b9659083"
,
"ext"
:
".png"
}
],
"events"
:
{
"in"
:
{
"jiugong-turntable-change-init"
:
{
"alias"
:
"初始化"
,
"data"
:
{
}
},
"jiugong-turntable-change-prizeData"
:
{
"alias"
:
"奖品数据"
,
"data"
:
{
}
},
"jiugong-turntable-change-start"
:
{
"alias"
:
"开始"
,
"data"
:
{
}
},
"jiugong-turntable-change-winPrize"
:
{
"alias"
:
"中奖"
,
"data"
:
{
}
},
"jiugong-turntable-change-abnormal"
:
{
"alias"
:
"异常"
,
"data"
:
{
}
},
"jiugong-turntable-change-reset"
:
{
"alias"
:
"重置"
,
"data"
:
{
}
}
},
"out"
:
{
"jiugong-turntable-change-over"
:
{
"alias"
:
"结束"
,
"data"
:
{
}
}
}
}
}
\ No newline at end of file
src/custom/jiugong-turntable-change/src/game/GameView.ts
0 → 100644
View file @
a9c7ec84
/**
* Created by rockyl on 2018/8/16.
*/
import
{
props
}
from
"../props"
;
import
{
Turntable
}
from
"./turntable"
;
export
default
class
GameView
extends
engine
.
Container
{
private
_hasSetup
;
private
_turntable
:
Turntable
;
constructor
()
{
super
();
}
setup
(){
if
(
this
.
_hasSetup
)
{
return
;
}
this
.
_hasSetup
=
true
;
let
turntable
=
this
.
_turntable
=
new
Turntable
();
this
.
addChild
(
turntable
);
}
setPrizeData
(
res
){
this
.
_turntable
.
initData
(
res
);
}
startDraw
(){
this
.
_turntable
.
startDraw
();
}
setRecordID
(
prizeID
){
this
.
_turntable
.
setRecordID
(
prizeID
)
}
reset
(){
this
.
_turntable
.
reset
();
}
setSetup
(){
this
.
_hasSetup
=
false
;
}
}
src/custom/jiugong-turntable-change/src/game/GameWrapper.ts
0 → 100644
View file @
a9c7ec84
import
{
props
}
from
'../props'
;
/**
* Created by rockyl on 2020-01-09.
*/
import
GameView
from
"./GameView"
;
export
class
GameWrapper
extends
engine
.
Container
{
private
_gameView
:
GameView
;
constructor
()
{
super
();
engine
.
globalEvent
.
addEventListener
(
'jiugong-turntable-change-init'
,
this
.
init
,
this
);
engine
.
globalEvent
.
addEventListener
(
'jiugong-turntable-change-prizeData'
,
this
.
initPrizeData
,
this
);
engine
.
globalEvent
.
addEventListener
(
'jiugong-turntable-change-start'
,
this
.
start
,
this
);
engine
.
globalEvent
.
addEventListener
(
'jiugong-turntable-change-winPrize'
,
this
.
winPrize
,
this
);
engine
.
globalEvent
.
addEventListener
(
'jiugong-turntable-change-reset'
,
this
.
reset
,
this
);
engine
.
globalEvent
.
addEventListener
(
'jiugong-turntable-change-abnormal'
,
this
.
reset
,
this
);
}
init
(
event
:
engine
.
Event
)
{
//初始化场景
let
gameView
=
this
.
_gameView
=
new
GameView
();
this
.
addChild
(
gameView
);
this
.
_gameView
.
setup
();
}
initPrizeData
(
event
:
engine
.
Event
){
this
.
_gameView
.
setSetup
();
this
.
_gameView
.
setPrizeData
(
event
.
data
.
resources
);
}
//开始抽奖
start
(
event
:
engine
.
Event
){
this
.
_gameView
.
startDraw
();
}
winPrize
(
event
:
engine
.
Event
){
this
.
_gameView
.
setRecordID
(
event
.
data
.
prizeID
)
}
reset
(){
this
.
_gameView
.
reset
();
}
// private visibilitychange(){
// document.addEventListener('visibilitychange', function () {
// if (document.visibilityState === 'hidden') {
// console.log('放置后台');
// engine.globalEvent.dispatchEvent('answer-game-visibilitychange',{hidden:true});
// }
// });
// }
}
src/custom/jiugong-turntable-change/src/game/Turntable.ts
0 → 100644
View file @
a9c7ec84
import
{
getTextureByName
}
from
"./utils"
;
import
{
getStage
}
from
"./utils"
;
import
{
props
}
from
'../props'
;
export
class
Turntable
extends
engine
.
Container
{
private
_turnTableNode
:
engine
.
Container
;
private
_vertical_Y
=
props
.
vertical
||
20
;
//纵向间距
private
_horizontal_X
=
props
.
horizontal
||
20
;
//横向间距
private
_prizeIndex
=
0
;
private
_boxArray
=
[];
private
_boxIndex
=
0
;
//当前下标
private
tweenTime
=
props
.
tweenTime
||
200
;
//单个动画时间(毫秒)
private
slowTweenTime
=
props
.
slowTweenTime
||
200
;
private
circleNumber
=
0
;
//圈数
private
turntableOrder
=
[
1
,
2
,
3
,
5
,
8
,
7
,
6
,
4
];
private
recordID
=
-
1
;
//中奖奖品ID
private
boxPrizeIndex
=
-
1
;
//中奖奖品节点下标
private
slowDown
=
false
;
//是否开始缓速
private
isStop
=
false
;
private
_singleNodeWidth
;
//单个节点宽度
constructor
(){
super
()
}
public
initData
(
res
){
this
.
initTurntable
(
res
);
this
.
setNodeOrder
();
}
initTurntable
(
res
){
let
turnTableNode
=
null
;
if
(
this
.
_turnTableNode
){
this
.
removeChild
(
this
.
_turnTableNode
);
this
.
_turnTableNode
=
null
;
this
.
_boxArray
=
[];
this
.
_prizeIndex
=
0
;
this
.
_boxIndex
=
0
;
}
turnTableNode
=
this
.
_turnTableNode
=
new
engine
.
Container
();
//turnTableNode.y = 50;
this
.
addChild
(
turnTableNode
);
for
(
let
index_Y
=
0
;
index_Y
<
3
;
index_Y
++
)
{
for
(
let
index_X
=
0
;
index_X
<
3
;
index_X
++
)
{
if
(
index_X
==
1
&&
index_Y
==
1
)
continue
;
let
tmpNode
:
any
=
new
engine
.
Container
()
let
unchecked
=
this
.
getImage
(
'unchecked'
,
1
);
let
checked
=
this
.
getImage
(
'checked'
,
0
);
tmpNode
.
width
=
Math
.
max
(
unchecked
.
width
,
checked
.
width
);
this
.
_singleNodeWidth
=
this
.
_singleNodeWidth
?
this
.
_singleNodeWidth
:
tmpNode
.
width
;
tmpNode
.
height
=
Math
.
max
(
unchecked
.
height
,
checked
.
height
);
tmpNode
.
x
=
index_X
*
(
tmpNode
.
width
+
this
.
_horizontal_X
);
tmpNode
.
y
=
index_Y
*
(
tmpNode
.
height
+
this
.
_vertical_Y
);
tmpNode
.
addChild
(
unchecked
);
tmpNode
.
addChild
(
checked
);
let
prize
=
new
engine
.
Sprite
(
engine
.
Texture
.
fromImage
(
res
[
this
.
_prizeIndex
].
img
))
;
let
prizeID
=
res
[
this
.
_prizeIndex
].
id
;
prize
.
width
=
props
.
icon_width
;
prize
.
height
=
props
.
icon_height
;
prize
.
x
=
(
tmpNode
.
width
-
prize
.
width
)
/
2
+
props
.
icon_X
;
prize
.
y
=
(
tmpNode
.
height
-
prize
.
height
)
/
2
+
props
.
icon_Y
;
tmpNode
.
prizeID
=
prizeID
;
tmpNode
.
addChild
(
prize
);
let
titleLabel
=
new
engine
.
Label
();
titleLabel
.
fillColor
=
props
.
prizeName_color
;
titleLabel
.
size
=
props
.
prizeName_size
;
titleLabel
.
width
=
unchecked
.
width
;
titleLabel
.
textAlign
=
engine
.
TEXT_ALIGN
.
CENTER
;
titleLabel
.
x
=
0
;
titleLabel
.
y
=
props
.
prizeName_Ypos
;
titleLabel
.
text
=
this
.
fixTitle
(
res
[
this
.
_prizeIndex
].
name
);
tmpNode
.
addChild
(
titleLabel
)
this
.
_prizeIndex
++
;
this
.
_boxArray
.
push
(
tmpNode
);
turnTableNode
.
addChild
(
tmpNode
);
}
}
turnTableNode
.
x
=
(
750
-
(
this
.
_singleNodeWidth
*
3
+
this
.
_horizontal_X
*
2
))
/
2
;
}
setNodeOrder
(){
let
tmpNodeArray
=
[];
for
(
let
index
=
0
;
index
<
this
.
turntableOrder
.
length
;
index
++
)
{
let
order
=
this
.
turntableOrder
[
index
];
tmpNodeArray
.
push
(
this
.
_boxArray
[
order
-
1
]);
}
this
.
_boxArray
=
tmpNodeArray
;
}
fixTitle
(
name
){
if
(
!
name
){
return
""
}
if
(
name
.
split
(
""
).
length
<
props
.
prizeName_maxLength
){
return
name
}
let
n
=
""
for
(
let
i
=
0
;
i
<
props
.
prizeName_retainLength
;
i
++
){
n
+=
name
.
split
(
""
)[
i
]
}
n
+=
"..."
return
n
}
getImage
(
resName
,
alpha
){
let
tmpImage
=
new
engine
.
Sprite
(
getTextureByName
(
resName
));
tmpImage
.
x
=
0
tmpImage
.
y
=
0
tmpImage
.
alpha
=
alpha
;
tmpImage
.
name
=
resName
;
return
tmpImage
;
}
startDraw
(){
let
tmpCheckNode
=
this
.
_boxArray
[
this
.
_boxIndex
].
getChildByName
(
'checked'
);
if
(
this
.
isStop
){
engine
.
Tween
.
removeTweens
(
tmpCheckNode
);
return
}
if
(
this
.
slowDown
)
{
if
(
this
.
_boxIndex
!=
this
.
getNodeIndexOFprize
()){
this
.
tweenTime
+=
this
.
slowTweenTime
;
}
else
{
this
.
isStop
=
true
;
this
.
twinkle
(
tmpCheckNode
);
}
}
engine
.
Tween
.
get
(
tmpCheckNode
)
.
to
({
alpha
:
1
},
this
.
tweenTime
/
2
)
.
to
({
alpha
:
0
},
this
.
tweenTime
/
2
)
.
call
(()
=>
{
if
(
this
.
circleNumber
>=
props
.
circleNumber
&&
this
.
getSlowStart
()
==
this
.
_boxIndex
){
this
.
slowDown
=
true
;
}
this
.
_boxIndex
++
;
if
(
this
.
_boxIndex
>=
this
.
_boxArray
.
length
){
this
.
_boxIndex
=
0
;
this
.
circleNumber
++
;
}
this
.
startDraw
();
})
}
//获取开始减速的下标
private
getSlowStart
(){
if
(
this
.
recordID
<
0
)
return
-
1
;
let
tmpIndex
=
this
.
getNodeIndexOFprize
();
if
(
tmpIndex
<
4
){
return
tmpIndex
+
4
;
}
else
{
return
tmpIndex
-
4
}
}
//获取奖品节点下标
getNodeIndexOFprize
(){
if
(
this
.
recordID
<
0
)
return
-
1
;
for
(
let
index
=
0
;
index
<
this
.
_boxArray
.
length
;
index
++
)
{
let
element
=
this
.
_boxArray
[
index
];
if
(
element
.
prizeID
===
this
.
recordID
){
return
index
;
}
}
return
-
1
;
}
//中奖节点闪烁
twinkle
(
tmpNode
){
engine
.
Tween
.
removeTweens
(
tmpNode
)
let
twinkleTime
=
1
;
engine
.
Tween
.
get
(
tmpNode
,
{
loop
:
true
})
.
to
({
alpha
:
0
},
30
)
.
to
({
alpha
:
1
},
30
)
.
call
(()
=>
{
if
(
twinkleTime
>
5
){
engine
.
Tween
.
removeTweens
(
tmpNode
);
engine
.
globalEvent
.
dispatchEvent
(
'jiugong-turntable-change-over'
)
return
;
}
else
{
twinkleTime
++
;
}
})
}
setRecordID
(
prizeID
){
this
.
recordID
=
prizeID
;
}
reset
(){
this
.
_boxArray
.
forEach
(
element
=>
{
engine
.
Tween
.
removeTweens
(
element
.
getChildByName
(
'checked'
));
});
this
.
_boxIndex
=
0
;
//当前下标
this
.
tweenTime
=
props
.
tweenTime
||
200
;
//单个动画时间(毫秒)
this
.
slowTweenTime
=
props
.
slowTweenTime
||
200
;
this
.
circleNumber
=
0
;
//圈数
this
.
recordID
=
-
1
;
//中奖奖品ID
this
.
boxPrizeIndex
=
-
1
;
//中奖奖品节点下标
this
.
slowDown
=
false
;
//是否开始缓速
this
.
isStop
=
false
;
for
(
let
index
=
0
;
index
<
this
.
_boxArray
.
length
;
index
++
)
{
let
element
=
this
.
_boxArray
[
index
];
element
.
getChildByName
(
'checked'
).
alpha
=
0
;
}
}
}
\ No newline at end of file
src/custom/jiugong-turntable-change/src/game/utils.ts
0 → 100644
View file @
a9c7ec84
/**
* Created by rockyl on 2020-01-21.
*/
export
function
getTexture
(
uuid
)
{
return
engine
.
Texture
.
from
(
getAssetByUUID
(
uuid
).
uuid
);
}
export
function
getTextureByName
(
name
)
{
return
getTexture
(
engine
.
getAssetByName
(
name
).
uuid
);
}
export
function
playSound
(
name
)
{
engine
.
playSound
(
engine
.
getAssetByName
(
name
).
uuid
,
{
keep
:
true
});
}
export
function
getStage
(){
return
engine
.
gameStage
.
stage
;
}
\ No newline at end of file
src/custom/jiugong-turntable-change/src/index.ts
0 → 100644
View file @
a9c7ec84
/**
* Created by rockyl on 2019-11-20.
*/
import
{
GameWrapper
}
from
"./game/GameWrapper"
;
import
{
injectProps
,
prepareProps
}
from
"./props"
;
export
default
function
(
props
)
{
prepareProps
();
injectProps
(
props
);
let
instance
=
new
GameWrapper
();
return
instance
;
}
src/custom/jiugong-turntable-change/src/props.ts
0 → 100644
View file @
a9c7ec84
/**
* Created by rockyl on 2020-01-21.
*/
export
let
props
:
any
=
{};
export
function
prepareProps
()
{
let
metaProps
=
getProps
();
engine
.
injectProp
(
props
,
metaProps
);
}
export
function
injectProps
(
p
)
{
engine
.
injectProp
(
props
,
p
);
}
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