Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wfc13
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
wildfirecode13
wfc13
Commits
b06a2644
Commit
b06a2644
authored
Aug 10, 2021
by
wildfirecode13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
u
parent
73ce2275
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
13 deletions
+59
-13
prize.ts
project/src/panels/prize.ts
+59
-13
No files found.
project/src/panels/prize.ts
View file @
b06a2644
...
...
@@ -4,10 +4,28 @@ import { Panel } from "../../module/views/Panel";
import
getObject
from
"../common/getObject"
;
import
{
ProgressBarS
}
from
"../common/ProgressBarS"
;
import
{
showShareMask
}
from
"../common/ShareMask"
;
import
{
MONEY_PERCENT
}
from
"../datas"
;
import
{
M
AX_MONEY
,
M
ONEY_PERCENT
}
from
"../datas"
;
import
{
IndexScene
}
from
"../scenes/IndexScene"
;
import
updateShareFunc
from
"../share"
;
import
{
getPxTokenSave
,
sendWebNet
,
WebNetName
}
from
"../WebNet"
;
const
createMask
=
(
w
,
h
)
=>
{
const
s
=
new
FYGE
.
Shape
();
s
.
beginFill
(
0
,
1
);
s
.
drawRect
(
0
,
0
,
w
,
h
);
s
.
endFill
();
return
s
}
const
cloneTextField
=
(
prize_tips2
)
=>
{
const
tf
=
new
FYGE
.
TextField
();
tf
.
font
=
prize_tips2
.
font
;
tf
.
size
=
prize_tips2
.
size
;
tf
.
fillColor
=
prize_tips2
.
fillColor
;
tf
.
text
=
prize_tips2
.
text
;
return
tf
;
}
export
class
PrizePanel
extends
Panel
{
amountTxt
:
FYGE
.
TextField
;
percentTxt
:
FYGE
.
TextField
;
...
...
@@ -26,7 +44,7 @@ export class PrizePanel extends Panel {
.
to
({
scaleX
:
1
,
scaleY
:
1
,
x
:
skin
.
x
,
y
:
skin
.
y
},
300
,
FYGE
.
Ease
.
getBackOut
(
2
))
.
call
(()
=>
{
this
.
isShowing
=
false
;
})
})
;
}
initUi
()
{
...
...
@@ -44,6 +62,11 @@ export class PrizePanel extends Panel {
async
start
(
data
)
{
super
.
start
();
const
prize_title2
=
getObject
(
this
,
'prize_title2'
);
prize_title2
.
visible
=
false
const
index
=
this
.
getChildIndex
(
prize_title2
);
const
svga
=
this
.
addChildAt
(
new
FYGE
.
MovieClip
(
RES
.
getRes
(
'prize.svga'
)),
index
);
svga
.
position
.
set
(
598
/
2
-
500
/
2
,
-
100
);
const
prize_tips1
=
getObject
(
this
,
'prize_tips1'
);
const
prize_tips2
=
getObject
(
this
,
'prize_tips2'
);
const
prize_tip3
=
getObject
(
this
,
'prize_tip3'
);
...
...
@@ -55,26 +78,49 @@ export class PrizePanel extends Panel {
prize_tip3
.
textWidth
=
595
;
prize_tip3
.
x
=
0
;
prize_tip3
.
textAlign
=
'center'
;
prize_tip3
.
text
=
`
${
data
}
/
1000000
`
;
prize_tip3
.
text
=
`
${
data
}
/
${
MAX_MONEY
}
`
;
let
percent
=
MONEY_PERCENT
;
if
(
data
/
1000000
>
percent
)
{
percent
=
data
/
1000000
;
if
(
data
/
MAX_MONEY
>
percent
)
{
percent
=
data
/
MAX_MONEY
;
}
const
progressBar
=
new
ProgressBarS
(
getObject
(
this
,
'prize_progress'
));
progressBar
.
value
=
percent
;
// progressBar.value = percent;
const
aniWrapper
=
new
FYGE
.
Sprite
();
aniWrapper
.
position
.
set
(
prize_tips2
.
x
,
prize_tips2
.
y
);
const
mask1
=
createMask
(
prize_tips2
.
textWidth
,
prize_tips2
.
textHeight
);
aniWrapper
.
addChild
(
mask1
);
aniWrapper
.
mask
=
mask1
;
this
.
addChild
(
aniWrapper
);
const
textWrapper
=
new
FYGE
.
Sprite
();
aniWrapper
.
addChild
(
textWrapper
);
for
(
let
i
=
2
;
i
<=
9
;
i
++
)
{
const
tf
=
cloneTextField
(
prize_tips2
);
tf
.
text
=
i
*
Math
.
pow
(
10
,
data
.
toString
().
length
-
1
)
+
''
;
tf
.
y
=
prize_tips2
.
textHeight
*
(
i
-
1
);
console
.
log
(
tf
.
text
)
textWrapper
.
addChild
(
tf
);
}
textWrapper
.
addChild
(
prize_tips2
);
prize_tips2
.
position
.
set
(
0
,
0
);
textWrapper
.
y
=
-
prize_tips2
.
textHeight
*
9
;
FYGE
.
Tween
.
get
(
textWrapper
).
to
({
y
:
0
},
700
,
FYGE
.
Ease
.
quadOut
).
call
(()
=>
{
const
__tmp__
=
{
a
:
0
};
FYGE
.
Tween
.
get
(
__tmp__
,
{
loop
:
false
,
onChange
:
(
param
)
=>
{
progressBar
.
value
=
percent
*
__tmp__
.
a
;
}
}).
to
({
a
:
1
},
300
)
});
getPxTokenSave
().
then
(
token
=>
{
sendWebNet
(
WebNetName
.
createItem
,
{
token
:
token
}).
then
(
createItemResult
=>
{
updateShareFunc
(
'inPrizePanel'
,
createItemResult
.
data
)
});
})
getObject
(
this
,
'prize_close'
).
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
()
=>
{
console
.
log
(
'123'
)
},
this
);
});
}
hidePanel
()
{
...
...
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