Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
babycare_xiaoxiao
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
翁阳
babycare_xiaoxiao
Commits
d4537668
Commit
d4537668
authored
Feb 19, 2021
by
邱旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
m
parent
74bcd904
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
277 deletions
+15
-277
workspace.xml
.idea/workspace.xml
+10
-14
SuccessNoPrizePanel.ts
src/panels/SuccessNoPrizePanel.ts
+2
-3
SuccessPrizePanel.ts
src/panels/SuccessPrizePanel.ts
+0
-1
LoadingScene.ts
src/scene/LoadingScene.ts
+3
-3
LotteryScene.ts
src/scene/LotteryScene.ts
+0
-256
No files found.
.idea/workspace.xml
View file @
d4537668
...
...
@@ -3,21 +3,10 @@
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"0d3cb18d-e144-41a0-bc8b-4877c2e1fef1"
name=
"默认的"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/index.html"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/index.html"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/output.js"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/output.js"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/output.js.map"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/output.js.map"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/resource/res.json"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/resource/res.json"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/ResJson.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/ResJson.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/TaoBaoNet.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/TaoBaoNet.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/Tools.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/Tools.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/panels/LotteryPanel.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/panels/LotteryPanel.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/panels/StartPanel.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/panels/StartPanel.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/panels/SuccessNoPrizePanel.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/panels/SuccessNoPrizePanel.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/panels/SuccessPrizePanel.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/panels/SuccessPrizePanel.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/scene/LoadingScene.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/scene/LoadingScene.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/scene/LotteryScene.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/scene/LotteryScene.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/scene/map/CheckBtn.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/scene/map/CheckBtn.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/scene/map/MapScene.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/scene/map/MapScene.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/scene/LotteryScene.ts"
beforeDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
...
@@ -148,7 +137,7 @@
<workItem
from=
"1612576979459"
duration=
"13000"
/>
<workItem
from=
"1612577003915"
duration=
"21094000"
/>
<workItem
from=
"1612662929222"
duration=
"40609000"
/>
<workItem
from=
"1613698993022"
duration=
"
3958
000"
/>
<workItem
from=
"1613698993022"
duration=
"
4067
000"
/>
</task>
<task
id=
"LOCAL-00001"
summary=
"斐乐消消乐"
>
<created>
1612581213298
</created>
...
...
@@ -255,7 +244,14 @@
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1612775497616
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"16"
/>
<task
id=
"LOCAL-00016"
summary=
"m"
>
<created>
1613703361421
</created>
<option
name=
"number"
value=
"00016"
/>
<option
name=
"presentableId"
value=
"LOCAL-00016"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1613703361421
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"17"
/>
<servers
/>
</component>
<component
name=
"TypeScriptGeneratedFilesManager"
>
...
...
src/panels/SuccessNoPrizePanel.ts
View file @
d4537668
...
...
@@ -9,7 +9,7 @@ import Tween = FYGE.Tween;
import
Ease
=
FYGE
.
Ease
;
import
MouseEvent
=
FYGE
.
MouseEvent
;
import
Button
=
FYGE
.
Button
;
import
{
Lottery
Scene
}
from
"../scene/LotteryScene
"
;
import
{
Lottery
Panel
}
from
"./LotteryPanel
"
;
export
class
SuccessNoPrizePanel
extends
Panel
{
get
groupNames
()
{
...
...
@@ -83,8 +83,7 @@ export class SuccessNoPrizePanel extends Panel {
public
goPrize
()
{
// 去抽奖
showPanel
(
LotteryScene
,
{
level
:
this
.
data
.
level
})
// changeScene(LotteryScene, { level: this.data.level });
showPanel
(
LotteryPanel
);
super
.
hidePanel
();
}
...
...
src/panels/SuccessPrizePanel.ts
View file @
d4537668
...
...
@@ -3,7 +3,6 @@ import { SuccessStarGroup } from "./SuccessNoPrizePanel";
import
{
RES
}
from
"../../module/RES"
;
import
{
changeScene
}
from
"../../module/ctrls"
;
import
{
MapScene
}
from
"../scene/map/MapScene"
;
import
{
LotteryScene
}
from
"../scene/LotteryScene"
;
import
{
Tools
}
from
"../Tools"
;
import
{
PropType
}
from
"../something/enum/PropType"
;
import
Tween
=
FYGE
.
Tween
;
...
...
src/scene/LoadingScene.ts
View file @
d4537668
...
...
@@ -5,8 +5,8 @@ import { RES } from "../../module/RES";
import
{
sendTbNet
,
TbNetName
}
from
"../TaoBaoNet"
;
import
{
layers
}
from
"../../module/views/layers"
;
import
{
changeScene
,
showPanel
,
showToast
}
from
"../../module/ctrls"
;
import
{
LotteryScene
}
from
"./LotteryScene"
;
import
{
LotteryPanel
}
from
"../panels/LotteryPanel"
;
import
{
MapScene
}
from
"./map/MapScene"
;
export
class
LoadingScene
extends
Scene
{
get
groupNames
()
{
...
...
@@ -69,8 +69,8 @@ export class LoadingScene extends Scene {
.
call
(()
=>
{
if
(
pro
>=
1
)
{
this
.
removeEventListener
(
FYGE
.
Event
.
PROGRESS
,
this
.
progressEvent
,
this
);
//
changeScene(MapScene, {from: "loading"})
showPanel
(
LotteryPanel
);
changeScene
(
MapScene
,
{
from
:
"loading"
})
//
showPanel(LotteryPanel);
// changeScene(PlayScene, { chapter: 1 });
// changeScene(LotteryScene,{level:1});
}
...
...
src/scene/LotteryScene.ts
deleted
100644 → 0
View file @
74bcd904
import
{
Scene
}
from
"../../module/views/Scene"
;
import
{
RES
}
from
"../../module/RES"
;
import
{
layers
}
from
"../../module/views/layers"
;
import
{
Tools
}
from
"../Tools"
;
import
{
showWaiting
,
wait
,
changeScene
,
hideWaiting
,
showPanel
}
from
"../../module/ctrls"
;
import
{
sendTbNet
,
TbNetName
}
from
"../TaoBaoNet"
;
import
{
GTool
}
from
"../../module/tools/GTool"
;
import
{
MapScene
}
from
"./map/MapScene"
;
import
{
PrizePanel
}
from
"../panels/PrizePanel"
;
import
{
NoPrizePanel
}
from
"../panels/NoPrizePanel"
;
import
{
Panel
}
from
"../../module/views/Panel"
;
/**
* 摇奖机弹框
*/
export
class
LotteryScene
extends
Panel
{
get
groupNames
()
{
return
[
"lotteryScene"
]
}
lotScroll
:
LotteryScroll
;
data
:
{
level
:
number
,
}
initUi
()
{
//适配
this
.
y
=
-
layers
.
stageOffsetY
;
//背景
this
.
addChild
(
new
FYGE
.
Sprite
(
RES
.
getRes
(
"lotteryMachineBg.png"
)))
Tools
.
gameData
.
prizeLevels
.
sort
((
a
,
b
)
=>
{
return
a
-
b
})
//抽奖按钮
this
.
addChild
(
new
FYGE
.
Button
(
RES
.
getRes
(
"lotteryBtn.png"
)))
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
lottery
,
this
)
.
position
.
set
(
192
,
1232
);
//返回按钮,回到地图页
this
.
addChild
(
new
FYGE
.
Button
(
RES
.
getRes
(
"lotteryReturnBtn.png"
)))
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
()
=>
{
changeScene
(
MapScene
)
},
this
)
.
position
.
set
(
0
,
300
)
//刷新奖品列表和摇奖列表
this
.
updatePrizes
();
}
async
updatePrizes
()
{
showWaiting
();
const
{
data
:
prizeList
}
=
await
sendTbNet
(
TbNetName
.
getPrizesByLevel
);
//去掉type为5的谢谢参与
var
list
=
prizeList
.
slice
().
filter
((
e
)
=>
{
return
e
.
type
!=
5
});
//摇奖部分
var
p
=
[
80
,
645
]
this
.
lotScroll
=
this
.
addChild
(
new
LotteryScroll
(
list
))
this
.
lotScroll
.
position
.
set
(
p
[
0
],
p
[
1
]);
}
lottery
()
{
showWaiting
()
sendTbNet
(
TbNetName
.
luckyDraw
)
.
then
((
res
)
=>
{
hideWaiting
();
//如果是失败
if
(
!
res
.
success
)
return
;
let
id
;
//待考虑,谢谢参与要进哪?是否进列表,下面id不存在时当作无奖励,(如果谢谢参与不进列表)
if
(
res
.
data
&&
res
.
data
.
prizeId
)
id
=
res
.
data
.
prizeId
;
this
.
enableMouseEvt
(
false
);
console
.
log
(
id
)
this
.
lotScroll
.
lot
(
id
,
()
=>
{
this
.
enableMouseEvt
(
true
)
//无奖
if
(
!
id
||
res
.
data
.
type
==
5
)
{
showPanel
(
NoPrizePanel
);
}
else
{
showPanel
(
PrizePanel
,
res
.
data
)
}
// showPanel(id ? PrizePanel : NoPrizePanel, id ? res.data : null)
})
})
}
}
interface
PrizeInt
{
image
:
string
,
name
:
string
,
_id
:
string
}
class
LotteryItem
extends
FYGE
.
Container
{
private
showImage
:
FYGE
.
Sprite
;
id
:
string
constructor
(
data
:
PrizeInt
)
{
super
();
this
.
id
=
data
.
_id
;
// this.addChild(new FYGE.Sprite(RES.getRes("lotteryItemBg.png")));
this
.
showImage
=
this
.
addChild
(
new
FYGE
.
Sprite
(
FYGE
.
Texture
.
from
(
data
.
image
)));
this
.
showImage
.
width
=
this
.
showImage
.
height
=
160
;
this
.
showImage
.
position
.
set
(
15
,
6
);
const
mask
=
this
.
addChild
(
new
FYGE
.
Shape
());
mask
.
beginFill
(
0
);
mask
.
drawRoundedRect
(
15
,
6
,
160
,
160
,
10
);
mask
.
endFill
();
this
.
showImage
.
mask
=
mask
}
reset
(
data
:
PrizeInt
)
{
this
.
showImage
.
texture
=
FYGE
.
Texture
.
from
(
data
.
image
);
this
.
id
=
data
.
_id
;
}
}
const
HEIGHT
=
180
;
/**
* 滚动条
* 功能可以滚动到指定的图
*/
class
LotteryScrollItem
extends
FYGE
.
Container
{
/**
* 当前childre的中位索引
*/
get
currentIndex
():
number
{
var
a
=
1
-
this
.
cusP
;
var
l
=
this
.
children
.
length
return
a
<
0
?
a
%
l
+
l
:
a
%
l
};
private
cusP
:
number
constructor
(
datas
:
PrizeInt
[])
{
super
();
datas
.
forEach
((
d
)
=>
{
this
.
addChild
(
new
LotteryItem
(
d
))
})
this
.
cusP
=
0
;
this
.
updatePosition
();
//修改位置
this
.
addEventListener
(
FYGE
.
Event
.
ENTER_FRAME
,
this
.
updatePosition
,
this
)
}
scrollTo
(
id
:
string
,
callback
:
()
=>
void
)
{
//找出目标图
let
child
,
curIndex
;
for
(
var
i
=
0
;
i
<
this
.
children
.
length
;
i
++
)
{
// @ts-ignore
if
(
this
.
children
[
i
].
id
==
id
)
{
child
=
this
.
children
[
i
];
curIndex
=
i
;
break
}
}
var
delta
=
this
.
currentIndex
-
curIndex
;
if
(
delta
<
0
)
delta
+=
this
.
children
.
length
;
//目标图的位置必须是,多加几圈
var
cusP
=
this
.
cusP
+
delta
+
10
*
this
.
children
.
length
;
FYGE
.
Tween
.
get
(
this
)
.
to
({
cusP
},
5000
,
FYGE
.
Ease
.
quadInOut
)
.
call
(()
=>
{
callback
&&
callback
();
})
}
reset
()
{
}
updatePosition
()
{
this
.
children
.
forEach
((
c
:
LotteryItem
,
j
)
=>
{
c
.
y
=
((
this
.
cusP
+
j
)
%
this
.
children
.
length
)
*
HEIGHT
-
HEIGHT
;
//超过一定距离,移到上面
if
(
c
.
y
>
HEIGHT
*
1.5
)
{
c
.
y
=
c
.
y
-
this
.
children
.
length
*
HEIGHT
}
});
}
// 0 0- 10 21 1
// 1 00 11 2- 0
// 2 01 1- 20 2
// 3 0- 10 21 1
destroy
()
{
FYGE
.
Tween
.
removeTweens
(
this
);
super
.
destroy
()
}
}
/**
* 暂时固定3列,宽高
*/
class
LotteryScroll
extends
FYGE
.
Container
{
ids
:
string
[]
scrollItems
:
LotteryScrollItem
[];
constructor
(
datas
:
PrizeInt
[])
{
super
();
this
.
scrollItems
=
[]
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
const
s
=
this
.
addChild
(
new
LotteryScrollItem
(
GTool
.
disturbArr
(
datas
.
slice
())));
s
.
position
.
set
(
205
*
i
,
80
);
this
.
scrollItems
.
push
(
s
)
}
this
.
ids
=
[];
datas
.
forEach
((
d
)
=>
{
this
.
ids
.
push
(
d
.
_id
)
});
const
h
=
-
45
;
//遮罩
const
mask
=
this
.
addChild
(
new
FYGE
.
Shape
());
mask
.
beginFill
(
0
)
mask
.
drawRect
(
0
,
h
,
592
,
424
)
mask
.
endFill
();
this
.
mask
=
mask
;
// 蒙层
this
.
addChild
(
new
FYGE
.
Sprite
(
RES
.
getRes
(
"shadowMask.png"
)))
.
position
.
set
(
0
,
h
)
}
lot
(
id
?:
string
,
callback
?:
()
=>
void
)
{
//有id且在中奖列表里
if
(
id
&&
this
.
ids
.
indexOf
(
id
)
!=
-
1
)
{
//确保得是ids里的id。否则无效
// if (this.ids.indexOf(id) == -1) {
// console.error("中奖id不存在")
// return;
// }
let
count
=
0
;
let
countAll
=
this
.
scrollItems
.
length
;
this
.
scrollItems
.
forEach
((
c
:
LotteryScrollItem
,
i
)
=>
{
wait
(()
=>
{
c
.
scrollTo
(
id
,
()
=>
{
if
(
++
count
==
countAll
&&
callback
)
callback
();
})
},
400
*
i
)
})
}
else
{
//保证几个id不能一致
var
ids
=
[
GTool
.
randomT
(
this
.
ids
),
GTool
.
randomT
(
this
.
ids
),
];
//如果都相同
// if(!ids.some(function (value, index) { return value !== ids[0];})){
// ids.push()
// }
//才两个,直接判断
ids
[
0
]
===
ids
[
1
]
?
ids
.
push
(
GTool
.
randomT
((()
=>
{
var
arr
=
this
.
ids
.
slice
();
arr
.
splice
(
this
.
ids
.
indexOf
(
ids
[
0
]),
1
)
return
arr
})())
)
:
ids
.
push
(
GTool
.
randomT
(
this
.
ids
));
// console.log(ids)
let
count
=
0
;
let
countAll
=
this
.
scrollItems
.
length
;
this
.
scrollItems
.
forEach
((
c
:
LotteryScrollItem
,
i
)
=>
{
wait
(()
=>
{
c
.
scrollTo
(
ids
[
i
],
()
=>
{
if
(
++
count
==
countAll
&&
callback
)
callback
();
})
},
400
*
i
)
})
}
}
}
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