Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaole
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
wildfirecode13
xiaoxiaole
Commits
5319c475
Commit
5319c475
authored
Oct 26, 2019
by
邱旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
d7801716
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
Turntable.ts
egret/src/panels/TurntablePanel/Turntable.ts
+20
-8
No files found.
egret/src/panels/TurntablePanel/Turntable.ts
View file @
5319c475
...
...
@@ -5,16 +5,14 @@ import RotaryData from './RotaryData';
import
Panel
from
"../../../libs/new_wx/components/Panel"
;
import
PanelCtrl
from
"../../../libs/new_wx/ctrls/panelCtrl"
;
import
{
ModuleTypes
}
from
"../../../libs/new_wx/types/sceneTypes"
;
import
hdGameDoDojoin
from
"../../../libs/new_tw/ctrls/hdGameDoDojoin"
;
import
submit
from
"../../../libs/new_tw/ctrls/submit"
;
import
Loading
from
"../../../libs/new_wx/components/Loading"
;
import
{
NetManager
}
from
"../../../libs/tw/manager/NetManager"
;
import
Utils
from
"../../Utils"
;
import
{
loadSvga
}
from
"../../loadSvga"
;
import
getResPath
from
"../../../libs/new_tc/getResPath"
;
import
wait
from
"../../../libs/new_tc/wait"
;
import
tr
=
egret
.
sys
.
tr
;
import
{
showToast
}
from
"../../../libs/new_wx/ctrls/toastCtrl"
;
import
getHomeData
from
"../../getHomeData"
;
// export const loadTurntableSvga = (callback) => {
// loadSvga(getResPath() + 'resource/assets/svgas/turntable.svga').then(async (mv: any) => {
// // await wait(100);
...
...
@@ -26,6 +24,9 @@ export default class Turntable extends Panel {
public
start_btn
:
eui
.
Button
;
public
closeBtn
:
eui
.
Button
;
private
nextTimeNeedCoin
:
number
=
0
;
private
remainTimes
:
number
=
0
;
public
get
skinKey
()
{
return
'Turntable'
}
...
...
@@ -39,11 +40,15 @@ export default class Turntable extends Panel {
async
start
(
data
?)
{
super
.
start
();
console
.
log
(
data
.
onceAgain
)
if
(
data
.
onceAgain
)
{
// 再抽一次
this
.
onTapStart
();
}
this
[
'container'
].
addChild
(
this
.
data
.
mv
);
this
.
hand
=
await
loadSvga
(
getResPath
()
+
'resource/assets/svgas/hand.svga'
,
this
[
'container2'
])
this
[
'container2'
].
touchEnabled
=
false
;
this
[
'container2'
].
touchChildren
=
false
;
this
[
'nums'
].
text
=
`当前可用元宝:
${
getHomeData
().
wealth
}
`
;
this
.
initUI
();
}
...
...
@@ -74,7 +79,9 @@ export default class Turntable extends Panel {
onTapStart
()
{
this
.
setBtnTouch
(
false
);
// 锁定按钮
Loading
.
instace
.
show
();
this
[
'container2'
].
visible
=
false
;
if
(
this
.
remainTimes
<=
0
&&
(
getHomeData
().
wealth
<
this
.
nextTimeNeedCoin
))
{
showToast
(
"元宝不足咯~快去闯关赢元宝吧"
);
}
this
.
queryPrize
();
}
...
...
@@ -85,12 +92,14 @@ export default class Turntable extends Panel {
// 设置全部按钮是否可以点击
private
setBtnTouch
(
touchEnabled
:
boolean
)
{
this
.
start_btn
.
touchEnabled
=
touchEnabled
;
this
[
"closeBtn"
].
touchEnabled
=
touchEnabled
;
}
/**
* 开始抽奖
*/
private
queryPrize
()
{
this
[
'container2'
].
visible
=
false
;
egret
.
Tween
.
removeTweens
(
this
.
panel
);
this
.
doJoin
();
}
...
...
@@ -112,10 +121,10 @@ export default class Turntable extends Panel {
const
data
=
res
.
data
;
const
code
=
res
.
code
;
let
id
=
data
.
option
.
categoryType
;
if
(
data
.
isScratchCard
)
{
id
=
"scratch"
;
}
else
if
(
!
success
||
!
data
.
option
)
{
if
(
!
success
||
!
data
.
option
)
{
id
=
"thanks"
;
}
else
if
(
data
.
isScratchCard
)
{
id
=
"scratch"
;
}
this
.
rotateByPrize
(
id
,
()
=>
{
if
(
!
success
)
{
...
...
@@ -227,6 +236,9 @@ export default class Turntable extends Panel {
this
[
'btnLabel'
].
text
=
`
${
data
.
nextTimeNeedCoin
}
元宝/次`
;
}
this
.
remainTimes
=
data
.
remainTimes
;
this
.
nextTimeNeedCoin
=
data
.
nextTimeNeedCoin
;
// 添加奖品
let
prizeList
=
[];
for
(
let
v
of
data
.
luckyDrawInfo
.
prizeList
)
{
...
...
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