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
27bf398f
Commit
27bf398f
authored
Aug 04, 2021
by
wildfirecode13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
bc8119d8
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
260 additions
and
23 deletions
+260
-23
Main.ts
project/src/Main.ts
+6
-9
Group.ts
project/src/common/Group.ts
+23
-0
Marquee.ts
project/src/common/Marquee.ts
+106
-0
Marquee2.ts
project/src/common/Marquee2.ts
+91
-0
TestButton.ts
project/src/common/TestButton.ts
+6
-1
NewbieScene.ts
project/src/scenes/NewbieScene.ts
+28
-13
No files found.
project/src/Main.ts
View file @
27bf398f
...
@@ -60,10 +60,7 @@ export class Main {
...
@@ -60,10 +60,7 @@ export class Main {
}
}
private
async
onAddToStage
()
{
private
async
onAddToStage
()
{
setTimeout
(()
=>
{
const
m
=
new
ShareMask
();
layers
.
shareLayer
.
addChild
(
m
);
},
1500
);
//初始化层级
//初始化层级
layers
.
init
(
this
.
stage
);
layers
.
init
(
this
.
stage
);
console
.
log
(
"初始化层级完成"
)
console
.
log
(
"初始化层级完成"
)
...
@@ -75,23 +72,23 @@ export class Main {
...
@@ -75,23 +72,23 @@ export class Main {
console
.
log
(
"初始化皮肤配置完成"
)
console
.
log
(
"初始化皮肤配置完成"
)
//加载通用资源
//加载通用资源
await
RES
.
loadGroup
(
"common"
);
await
RES
.
loadGroup
(
"common"
);
await
console
.
log
(
"通用资源加载完成"
)
console
.
log
(
"通用资源加载完成"
)
//h5环境时,隐藏加载中
//h5环境时,隐藏加载中
if
(
FYGE
.
getEnv
()
==
"web"
&&
document
.
getElementById
(
"__loading__"
))
document
.
getElementById
(
"__loading__"
).
style
.
display
=
"none"
;
if
(
FYGE
.
getEnv
()
==
"web"
&&
document
.
getElementById
(
"__loading__"
))
document
.
getElementById
(
"__loading__"
).
style
.
display
=
"none"
;
//显示场景
//显示场景
if
(
isShare
())
{
if
(
isShare
())
{
changeScene
(
ShareScene
,
{
query
:
getQueryParams
()
});
changeScene
(
ShareScene
,
{
query
:
getQueryParams
()
});
}
else
{
}
else
{
const
indexResult
=
await
sendWebNet
(
WebNetName
.
index
)
const
indexResult
=
await
sendWebNet
(
WebNetName
.
index
)
if
(
indexResult
&&
indexResult
.
success
&&
indexResult
.
data
)
{
if
(
indexResult
&&
indexResult
.
success
&&
indexResult
.
data
)
{
if
(
indexResult
.
data
.
isNewbie
)
{
if
(
indexResult
.
data
.
isNewbie
)
{
updateShare
(
'inNewbieScene'
,
indexResult
.
data
.
shareCode
,
0
,
0
);
updateShare
(
'inNewbieScene'
,
indexResult
.
data
.
shareCode
,
0
,
0
);
changeScene
(
NewbieScene
,
{
shareCode
:
indexResult
.
data
.
shareCode
});
changeScene
(
NewbieScene
,
{
shareCode
:
indexResult
.
data
.
shareCode
});
}
}
else
{
else
{
updateShare
(
'inIndexScene'
,
indexResult
.
data
.
shareCode
,
indexResult
.
data
.
amount1
,
indexResult
.
data
.
amount2
)
updateShare
(
'inIndexScene'
,
indexResult
.
data
.
shareCode
,
indexResult
.
data
.
amount1
,
indexResult
.
data
.
amount2
)
changeScene
(
IndexScene
)
changeScene
(
IndexScene
)
}
}
}
else
{
}
else
{
...
...
project/src/common/Group.ts
0 → 100644
View file @
27bf398f
export
default
class
Group
extends
FYGE
.
Sprite
{
gap
=
10
;
constructor
()
{
super
();
}
list
:
any
[];
add
(
child
:
FYGE
.
Sprite
)
{
this
.
list
=
this
.
list
||
[];
this
.
list
.
push
(
child
);
this
.
addChild
(
child
);
this
.
updateLayout
();
}
updateLayout
()
{
let
y
=
0
;
for
(
let
i
=
0
;
i
<
this
.
list
.
length
;
i
++
)
{
const
element
=
this
.
list
[
i
];
element
.
y
=
y
;
y
+=
element
.
getRect
()[
1
]
+
this
.
gap
;
}
}
}
\ No newline at end of file
project/src/common/Marquee.ts
0 → 100644
View file @
27bf398f
const
w
=
500
;
const
h
=
50
;
const
gap
=
10
;
export
default
class
Marquee
extends
FYGE
.
Sprite
{
textwrapper
:
FYGE
.
Sprite
;
datas
:
string
[];
buttonTxt1
:
FYGE
.
TextField
;
buttonTxt2
:
FYGE
.
TextField
;
time
:
number
;
constructor
(
datas
:
string
[],
time
:
number
=
1500
)
{
super
();
this
.
datas
=
datas
;
this
.
time
=
time
;
this
.
initUI
();
this
.
start
();
}
start
()
{
const
item1
=
this
.
datas
.
shift
();
this
.
datas
.
push
(
item1
);
const
item2
=
this
.
datas
.
shift
();
this
.
datas
.
push
(
item2
);
this
.
buttonTxt1
.
text
=
item1
;
this
.
buttonTxt2
.
text
=
item2
;
this
.
buttonTxt1
.
y
=
0
;
this
.
buttonTxt2
.
y
=
this
.
buttonTxt1
.
textHeight
;
let
next
;
next
=
()
=>
{
FYGE
.
Tween
.
removeTweens
(
this
.
buttonTxt1
);
FYGE
.
Tween
.
removeTweens
(
this
.
buttonTxt2
);
if
(
this
.
buttonTxt1
.
y
<
0
)
{
const
item
=
this
.
datas
.
shift
();
this
.
datas
.
push
(
item
);
this
.
buttonTxt1
.
text
=
item
;
this
.
buttonTxt1
.
y
=
this
.
buttonTxt1
.
textHeight
;
const
tmp1
=
this
.
buttonTxt1
;
const
tmp2
=
this
.
buttonTxt2
;
this
.
buttonTxt1
=
tmp2
;
this
.
buttonTxt2
=
tmp1
;
}
FYGE
.
Tween
.
get
(
this
.
buttonTxt1
)
.
to
({
y
:
-
this
.
buttonTxt1
.
textHeight
},
this
.
time
)
FYGE
.
Tween
.
get
(
this
.
buttonTxt2
)
.
to
({
y
:
0
},
this
.
time
)
.
wait
(
2000
)
.
call
(
next
);
}
setTimeout
(()
=>
{
next
();
},
1000
);
}
initUI
()
{
const
bg
=
new
FYGE
.
Shape
();
bg
.
beginFill
(
0
,
1
);
bg
.
drawRoundedRect
(
0
,
0
,
w
,
h
,
5
,
5
,
5
,
5
);
bg
.
endFill
();
this
.
addChild
(
bg
);
this
.
textwrapper
=
new
FYGE
.
Sprite
();
this
.
textwrapper
.
x
=
gap
;
this
.
addChild
(
this
.
textwrapper
);
const
mask
=
new
FYGE
.
Shape
();
mask
.
beginFill
(
0
,
1
);
mask
.
drawRoundedRect
(
0
,
0
,
w
-
gap
*
2
,
h
,
5
,
5
,
5
,
5
);
mask
.
endFill
();
this
.
textwrapper
.
addChild
(
mask
);
this
.
textwrapper
.
mask
=
mask
;
const
buttonTxt
=
new
FYGE
.
TextField
;
buttonTxt
.
textHeight
=
h
;
buttonTxt
.
size
=
20
;
buttonTxt
.
verticalAlign
=
FYGE
.
VERTICAL_ALIGN
.
MIDDLE
;
buttonTxt
.
fillColor
=
'0xffffff'
;
this
.
textwrapper
.
addChild
(
buttonTxt
);
this
.
buttonTxt1
=
buttonTxt
;
const
buttonTxt2
=
new
FYGE
.
TextField
;
buttonTxt2
.
textHeight
=
h
;
buttonTxt2
.
size
=
20
;
buttonTxt2
.
verticalAlign
=
FYGE
.
VERTICAL_ALIGN
.
MIDDLE
;
buttonTxt2
.
fillColor
=
'0xffffff'
;
this
.
textwrapper
.
addChild
(
buttonTxt2
);
this
.
buttonTxt2
=
buttonTxt2
;
}
dispose
()
{
}
}
\ No newline at end of file
project/src/common/Marquee2.ts
0 → 100644
View file @
27bf398f
const
w
=
500
;
const
h
=
50
;
const
gap
=
10
;
export
default
class
Marquee2
extends
FYGE
.
Sprite
{
textwrapper
:
FYGE
.
Sprite
;
datas
:
string
[];
buttonTxt1
:
FYGE
.
TextField
;
buttonTxt2
:
FYGE
.
TextField
;
time
:
number
;
constructor
(
datas
:
string
[],
time
:
number
=
5000
,
direction
=
'left'
)
{
super
();
this
.
datas
=
datas
;
this
.
time
=
time
;
this
.
initUI
();
this
.
start
();
}
start
()
{
let
next
;
next
=
()
=>
{
const
item1
=
this
.
datas
.
shift
();
this
.
datas
.
push
(
item1
);
const
item2
=
this
.
datas
.
shift
();
this
.
datas
.
push
(
item2
);
this
.
buttonTxt1
.
text
=
item1
;
this
.
buttonTxt2
.
text
=
item2
;
this
.
buttonTxt1
.
y
=
0
;
this
.
buttonTxt2
.
y
=
this
.
buttonTxt1
.
textHeight
;
FYGE
.
Tween
.
removeTweens
(
this
.
buttonTxt1
);
FYGE
.
Tween
.
removeTweens
(
this
.
buttonTxt2
);
FYGE
.
Tween
.
get
(
this
.
buttonTxt1
)
.
to
({
y
:
-
this
.
buttonTxt1
.
textHeight
},
this
.
time
)
FYGE
.
Tween
.
get
(
this
.
buttonTxt2
)
.
to
({
y
:
-
this
.
buttonTxt2
.
textHeight
},
this
.
time
)
.
wait
(
1000
)
.
call
(
next
);
}
next
();
}
initUI
()
{
const
bg
=
new
FYGE
.
Shape
();
bg
.
beginFill
(
0
,
1
);
bg
.
drawRoundedRect
(
0
,
0
,
w
,
h
,
5
,
5
,
5
,
5
);
bg
.
endFill
();
this
.
addChild
(
bg
);
this
.
textwrapper
=
new
FYGE
.
Sprite
();
this
.
textwrapper
.
x
=
gap
;
this
.
addChild
(
this
.
textwrapper
);
const
mask
=
new
FYGE
.
Shape
();
mask
.
beginFill
(
0
,
1
);
mask
.
drawRoundedRect
(
0
,
0
,
w
-
gap
*
2
,
h
,
5
,
5
,
5
,
5
);
mask
.
endFill
();
this
.
textwrapper
.
addChild
(
mask
);
this
.
textwrapper
.
mask
=
mask
;
const
buttonTxt
=
new
FYGE
.
TextField
;
buttonTxt
.
textHeight
=
h
;
buttonTxt
.
size
=
20
;
buttonTxt
.
verticalAlign
=
FYGE
.
VERTICAL_ALIGN
.
MIDDLE
;
buttonTxt
.
fillColor
=
'0xffffff'
;
this
.
textwrapper
.
addChild
(
buttonTxt
);
this
.
buttonTxt
=
buttonTxt
;
const
buttonTxt2
=
new
FYGE
.
TextField
;
buttonTxt2
.
textHeight
=
h
;
buttonTxt2
.
size
=
20
;
buttonTxt2
.
verticalAlign
=
FYGE
.
VERTICAL_ALIGN
.
MIDDLE
;
buttonTxt2
.
fillColor
=
'0xffffff'
;
this
.
textwrapper
.
addChild
(
buttonTxt2
);
this
.
buttonTxt2
=
buttonTxt2
;
}
dispose
()
{
}
}
\ No newline at end of file
project/src/common/TestButton.ts
View file @
27bf398f
const
w
=
200
;
const
h
=
80
;
export
default
class
TestButton
extends
FYGE
.
Sprite
{
export
default
class
TestButton
extends
FYGE
.
Sprite
{
getRect
(){
return
[
w
,
h
]
}
constructor
(
txt
,
parent
?)
{
constructor
(
txt
,
parent
?)
{
super
();
super
();
const
bg
=
new
FYGE
.
Shape
();
const
bg
=
new
FYGE
.
Shape
();
bg
.
beginFill
(
0
,
1
);
bg
.
beginFill
(
0
,
1
);
bg
.
drawRoundedRect
(
0
,
0
,
200
,
80
,
10
,
10
,
10
,
10
);
bg
.
drawRoundedRect
(
0
,
0
,
w
,
h
,
10
,
10
,
10
,
10
);
bg
.
endFill
();
bg
.
endFill
();
this
.
addChild
(
bg
);
this
.
addChild
(
bg
);
...
...
project/src/scenes/NewbieScene.ts
View file @
27bf398f
import
{
unwatchPageVisibility
,
watchPageVisibility
}
from
"@spark/utils"
;
import
{
unwatchPageVisibility
,
watchPageVisibility
}
from
"@spark/utils"
;
import
{
changeScene
,
closeCurrentPanel
,
showPanel
}
from
"../../module/ctrls"
;
import
{
changeScene
,
closeCurrentPanel
,
showPanel
}
from
"../../module/ctrls"
;
import
{
Scene
}
from
"../../module/views/Scene"
;
import
{
Scene
}
from
"../../module/views/Scene"
;
import
Group
from
"../common/Group"
;
import
Marquee
from
"../common/Marquee"
;
import
TestButton
from
"../common/TestButton"
;
import
TestButton
from
"../common/TestButton"
;
import
getQueryParams
from
"../getQueryParams"
;
import
getQueryParams
from
"../getQueryParams"
;
import
{
PrizePanel
}
from
"../panels/prize"
;
import
{
PrizePanel
}
from
"../panels/prize"
;
import
{
IndexScene
}
from
"./IndexScene"
;
import
{
IndexScene
}
from
"./IndexScene"
;
let
prize
;
let
prize
;
export
class
NewbieScene
extends
Scene
{
export
class
NewbieScene
extends
Scene
{
prizeBtn
:
FYGE
.
Sprite
;
prizeBtn
:
FYGE
.
Sprite
;
ruleBtn
:
FYGE
.
Sprite
;
onPageVisibilityChange
=
async
(
visible
)
=>
{
onPageVisibilityChange
=
async
(
visible
)
=>
{
console
.
log
(
'页面visible'
,
visible
);
console
.
log
(
'页面visible'
,
visible
);
if
(
!
prize
)
{
if
(
!
prize
)
{
console
.
log
(
'没有领体验金'
);
return
;
console
.
log
(
'没有领体验金'
);
return
;
};
};
if
(
visible
)
{
if
(
visible
)
{
closeCurrentPanel
();
closeCurrentPanel
();
changeScene
(
IndexScene
,
{
from
:
'NewbieScene'
,
action
:
'showSharePanel'
});
changeScene
(
IndexScene
,
{
from
:
'NewbieScene'
,
action
:
'showSharePanel'
});
}
}
}
}
...
@@ -24,36 +26,49 @@ export class NewbieScene extends Scene {
...
@@ -24,36 +26,49 @@ export class NewbieScene extends Scene {
super
.
start
();
super
.
start
();
const
query
=
getQueryParams
();
const
query
=
getQueryParams
();
if
(
query
.
autoprize
==
1
)
{
if
(
query
.
autoprize
==
1
)
{
this
.
openPrize
(
data
);
this
.
openPrize
(
data
);
}
}
}
}
openPrize
(
data
){
openPrize
(
data
)
{
prize
=
1
;
prize
=
1
;
showPanel
(
PrizePanel
,
data
);
showPanel
(
PrizePanel
,
data
);
}
}
onClick_prizeBtn
(){
onClick_prizeBtn
()
{
this
.
openPrize
(
this
.
data
);
this
.
openPrize
(
this
.
data
);
}
}
initUi
(){
initUi
()
{
super
.
initUi
();
super
.
initUi
();
this
.
prizeBtn
=
new
TestButton
(
'立即岔开'
,
this
);
const
group
=
new
Group
();
this
.
addChild
(
group
)
this
.
prizeBtn
=
new
TestButton
(
'立即拆开'
);
group
.
add
(
this
.
prizeBtn
);
this
.
ruleBtn
=
new
TestButton
(
'规则按钮'
);
group
.
add
(
this
.
ruleBtn
);
const
q
=
this
.
addChild
(
new
Marquee
(
[
'159****1111邀请了11位好友,获得了yyy体验金'
,
'138****2222邀请了22位好友,获得了xxxx体验金'
,
'189****3333邀请了33位好友,获得了zzzzz体验金'
,
]
));
q
.
y
=
300
;
q
.
x
=
50
;
}
}
initEvents
()
{
initEvents
()
{
super
.
initEvents
();
super
.
initEvents
();
watchPageVisibility
(
this
.
onPageVisibilityChange
);
watchPageVisibility
(
this
.
onPageVisibilityChange
);
this
.
prizeBtn
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
onClick_prizeBtn
,
this
);
this
.
prizeBtn
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
onClick_prizeBtn
,
this
);
}
}
removeEvents
()
{
removeEvents
()
{
super
.
removeEvents
();
super
.
removeEvents
();
unwatchPageVisibility
(
this
.
onPageVisibilityChange
)
unwatchPageVisibility
(
this
.
onPageVisibilityChange
)
this
.
prizeBtn
.
removeEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
onClick_prizeBtn
,
this
);
this
.
prizeBtn
.
removeEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
onClick_prizeBtn
,
this
);
}
}
get
groupNames
()
{
return
[
"newbie"
]
}
get
groupNames
()
{
return
[
"newbie"
]
}
...
...
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