Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
new_taobao
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
new_taobao
Commits
b973aeff
Commit
b973aeff
authored
Oct 01, 2020
by
spc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modified: project/src/canvas/game/src/com/FailedPanel.ts
parent
9299fc02
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
160 additions
and
14 deletions
+160
-14
mine.getPrizeInfo.json
project/src/canvas/game/mock/miniTb/mine.getPrizeInfo.json
+4
-1
mine.getUserInfo.json
project/src/canvas/game/mock/miniTb/mine.getUserInfo.json
+2
-2
TaoBaoNet.ts
project/src/canvas/game/src/TaoBaoNet.ts
+5
-2
FailedPanel.ts
project/src/canvas/game/src/com/FailedPanel.ts
+32
-0
SuccessNoAwardPanel.ts
project/src/canvas/game/src/com/SuccessNoAwardPanel.ts
+39
-0
SuccessPanel.ts
project/src/canvas/game/src/com/SuccessPanel.ts
+57
-0
Robot.ts
project/src/canvas/game/src/xiaoxiaole/Robot.ts
+5
-3
XxlScene.ts
project/src/canvas/game/src/xiaoxiaole/XxlScene.ts
+16
-6
No files found.
project/src/canvas/game/mock/miniTb/mine.getPrizeInfo.json
View file @
b973aeff
{
{
"code"
:
"000000"
,
"code"
:
"000000"
,
"data"
:
{
"data"
:
{
"name"
:
"一碗热翔"
,
"image"
:
"//yun.duiba.com.cn/spark/assets/赚门票.21d8c2fd01dffd454116bb6c1189ba6bb74306f4.png"
,
"type"
:
1
},
},
"success"
:
true
,
"success"
:
true
,
"message"
:
"成功"
"message"
:
"成功"
...
...
project/src/canvas/game/mock/miniTb/mine.getUserInfo.json
View file @
b973aeff
...
@@ -3,10 +3,10 @@
...
@@ -3,10 +3,10 @@
"data"
:
{
"data"
:
{
"fakeUserName"
:
"cccccccccc"
,
"fakeUserName"
:
"cccccccccc"
,
"fakeUserImgUrl"
:
"https://yun.duiba.com.cn/spark-dev/assets/白色.41dae4fd01f4750aea58f694b40d97a9da8f23ca.png"
,
"fakeUserImgUrl"
:
"https://yun.duiba.com.cn/spark-dev/assets/白色.41dae4fd01f4750aea58f694b40d97a9da8f23ca.png"
,
"win"
:
tru
e
,
"win"
:
fals
e
,
"userName"
:
"xxxxxxxxxxx"
,
"userName"
:
"xxxxxxxxxxx"
,
"userImgUrl"
:
"https://yun.duiba.com.cn/spark-dev/assets/白色.41dae4fd01f4750aea58f694b40d97a9da8f23ca.png"
,
"userImgUrl"
:
"https://yun.duiba.com.cn/spark-dev/assets/白色.41dae4fd01f4750aea58f694b40d97a9da8f23ca.png"
,
"isNewUser"
:
tru
e
"isNewUser"
:
fals
e
},
},
"success"
:
true
,
"success"
:
true
,
"message"
:
"成功"
"message"
:
"成功"
...
...
project/src/canvas/game/src/TaoBaoNet.ts
View file @
b973aeff
...
@@ -82,7 +82,10 @@ export enum TbNetName {
...
@@ -82,7 +82,10 @@ export enum TbNetName {
getUserInfo
=
"mine.getUserInfo"
,
getUserInfo
=
"mine.getUserInfo"
,
// 获取奖品信息
// 获取奖品信息
getPrizeInfo
=
"mine.getPrizeInfo"
getPrizeInfo
=
"mine.getPrizeInfo"
,
//查看奖品
seePrize
=
"mine.seePrize"
}
}
//返回数据类型,到时再调整
//返回数据类型,到时再调整
...
@@ -164,7 +167,7 @@ export function sendTbNet(
...
@@ -164,7 +167,7 @@ export function sendTbNet(
//记录数据
//记录数据
dataRecord
[
netName
]
=
d
;
dataRecord
[
netName
]
=
d
;
//统一错误信息提示,d.data为了区分网络超时
//统一错误信息提示,d.data为了区分网络超时
if
(
!
hideMsg
&&
!
d
.
success
)
showToast
(
d
.
message
||
"网络超时"
)
if
(
!
hideMsg
&&
!
d
.
success
&&
netName
!=
"mine.getPrizeInfo"
&&
netName
!=
"mine.getUserInfo"
)
showToast
(
d
.
message
||
"网络超时"
)
//执行回调
//执行回调
callback
&&
callback
(
d
.
success
,
d
);
callback
&&
callback
(
d
.
success
,
d
);
resolve
(
d
)
resolve
(
d
)
...
...
project/src/canvas/game/src/com/FailedPanel.ts
View file @
b973aeff
import
{
layers
}
from
"../../module/views/layers"
;
import
{
Panel
}
from
"../../module/views/Panel"
;
import
{
Ins
}
from
"../Ins"
;
import
{
sendTbNet
,
TbNetName
}
from
"../TaoBaoNet"
;
export
class
FailedPanel
extends
Panel
{
initUi
()
{
let
bg
=
Ins
.
initSprite
(
"f45dff96-8004-4fc8-bb74-20af177cd5f3"
)
this
.
addChild
(
bg
)
this
.
x
=
Ins
.
stageW
-
this
.
width
>>
1
this
.
y
=
(
Ins
.
stageH
-
this
.
height
>>
1
)
+
layers
.
stageOffsetY
//不显示动画
this
.
isShowing
=
true
let
closeBtn
=
Ins
.
initSprite
(
"5b61fddb-b1f8-4e24-bc2a-e356b540d70c"
)
closeBtn
.
x
=
this
.
width
-
closeBtn
.
width
+
20
closeBtn
.
y
=
-
20
this
.
addChild
(
closeBtn
)
closeBtn
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
back
,
this
)
let
playAgainBtn
=
Ins
.
initSprite
(
"77c6c9c9-5855-4b90-977e-27a2ffb8cd66"
)
playAgainBtn
.
x
=
bg
.
width
-
playAgainBtn
.
width
>>
1
playAgainBtn
.
y
=
350
this
.
addChild
(
playAgainBtn
)
playAgainBtn
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
back
,
this
)
}
// 退出游戏 返回主页
back
()
{
sendTbNet
(
TbNetName
.
backToPage
,
{},
(
s
,
res
)
=>
{
console
.
log
(
'backToPage'
)
})
}
}
\ No newline at end of file
project/src/canvas/game/src/com/SuccessNoAwardPanel.ts
View file @
b973aeff
import
{
layers
}
from
"../../module/views/layers"
;
import
{
Panel
}
from
"../../module/views/Panel"
;
import
{
Ins
}
from
"../Ins"
;
import
{
sendTbNet
,
TbNetName
}
from
"../TaoBaoNet"
;
import
{
Tools
}
from
"../Tools"
;
export
class
SuccessNoAwardPanel
extends
Panel
{
initUi
()
{
let
bg
=
Ins
.
initSprite
(
"1b34f12b-ba72-41ec-848f-9e0de49403ee"
)
this
.
addChild
(
bg
)
this
.
x
=
Ins
.
stageW
-
this
.
width
>>
1
this
.
y
=
(
Ins
.
stageH
-
this
.
height
>>
1
)
+
layers
.
stageOffsetY
//不显示动画
this
.
isShowing
=
true
let
closeBtn
=
Ins
.
initSprite
(
"647ae09a-7d11-4e03-96a2-ec8355e44a04"
)
closeBtn
.
x
=
this
.
width
-
closeBtn
.
width
+
20
closeBtn
.
y
=
-
20
this
.
addChild
(
closeBtn
)
closeBtn
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
back
,
this
)
let
text
=
Tools
.
getText
(
this
.
data
&&
this
.
data
.
type
==
6
?
"抽奖次数+1"
:
"奖品与你擦肩而过,
\n
再接再励哦~"
,
30
,
"#fff"
,
FYGE
.
TEXT_ALIGN
.
CENTER
)
text
.
x
=
bg
.
width
-
text
.
textWidth
>>
1
text
.
y
=
bg
.
height
-
text
.
textHeight
>>
1
this
.
addChild
(
text
)
let
playAgainBtn
=
Ins
.
initSprite
(
"77c6c9c9-5855-4b90-977e-27a2ffb8cd66"
)
playAgainBtn
.
x
=
bg
.
width
-
playAgainBtn
.
width
>>
1
playAgainBtn
.
y
=
350
this
.
addChild
(
playAgainBtn
)
playAgainBtn
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
back
,
this
)
}
// 退出游戏 返回主页
back
()
{
sendTbNet
(
TbNetName
.
backToPage
,
{},
(
s
,
res
)
=>
{
console
.
log
(
'backToPage'
)
})
}
}
\ No newline at end of file
project/src/canvas/game/src/com/SuccessPanel.ts
View file @
b973aeff
import
{
layers
}
from
"../../module/views/layers"
;
import
{
Panel
}
from
"../../module/views/Panel"
;
import
{
Ins
}
from
"../Ins"
;
import
{
sendTbNet
,
TbNetName
}
from
"../TaoBaoNet"
;
import
{
Tools
}
from
"../Tools"
;
export
class
SuccessPanel
extends
Panel
{
initUi
()
{
let
bg
=
Ins
.
initSprite
(
"024b1ca1-1da7-4279-8bfd-1826e440525d"
)
this
.
addChild
(
bg
)
this
.
x
=
Ins
.
stageW
-
this
.
width
>>
1
this
.
y
=
(
Ins
.
stageH
-
this
.
height
>>
1
)
+
layers
.
stageOffsetY
//不显示动画
this
.
isShowing
=
true
let
closeBtn
=
Ins
.
initSprite
(
"647ae09a-7d11-4e03-96a2-ec8355e44a04"
)
closeBtn
.
x
=
this
.
width
-
closeBtn
.
width
+
20
closeBtn
.
y
=
-
20
this
.
addChild
(
closeBtn
)
closeBtn
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
back
,
this
)
let
text
=
Tools
.
getText
(
this
.
data
.
name
,
30
,
"#fff"
,
FYGE
.
TEXT_ALIGN
.
CENTER
)
text
.
x
=
bg
.
width
-
text
.
textWidth
>>
1
text
.
y
=
(
bg
.
height
-
text
.
textHeight
>>
1
)
-
90
this
.
addChild
(
text
)
let
awardImg
=
this
.
data
.
image
?
FYGE
.
Sprite
.
fromUrl
(
this
.
data
.
image
)
:
Ins
.
initSprite
(
"652675b5-b20f-4069-9568-f4ae633a0b7d"
)
awardImg
.
width
=
awardImg
.
height
=
200
awardImg
.
x
=
bg
.
width
-
awardImg
.
width
>>
1
awardImg
.
y
=
(
bg
.
height
-
awardImg
.
height
>>
1
)
+
40
this
.
addChild
(
awardImg
)
let
playAgainBtn
=
Ins
.
initSprite
(
"5c1a2887-809b-4443-80cd-6f5526ebb540"
)
playAgainBtn
.
x
=
(
bg
.
width
-
playAgainBtn
.
width
>>
1
)
+
bg
.
width
/
4
playAgainBtn
.
y
=
490
this
.
addChild
(
playAgainBtn
)
playAgainBtn
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
back
,
this
)
let
seePrizeBtn
=
Ins
.
initSprite
(
"9152efa4-2647-4354-9aec-7e23eb02bc22"
)
seePrizeBtn
.
x
=
(
bg
.
width
-
seePrizeBtn
.
width
>>
1
)
-
bg
.
width
/
4
seePrizeBtn
.
y
=
490
this
.
addChild
(
seePrizeBtn
)
seePrizeBtn
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
seePrize
,
this
)
}
// 退出游戏 返回主页
back
()
{
sendTbNet
(
TbNetName
.
backToPage
,
{},
(
s
,
res
)
=>
{
console
.
log
(
'backToPage'
)
})
}
// 查看奖品
seePrize
()
{
sendTbNet
(
TbNetName
.
seePrize
,
{},
(
s
,
res
)
=>
{
console
.
log
(
'backToPage'
)
})
}
}
\ No newline at end of file
project/src/canvas/game/src/xiaoxiaole/Robot.ts
View file @
b973aeff
import
{
config
}
from
"./XxlConfig"
export
class
Robot
{
export
class
Robot
{
...
@@ -10,12 +11,13 @@ export class Robot {
...
@@ -10,12 +11,13 @@ export class Robot {
getScore
(
userScore
:
number
,
gameLeftTime
:
number
):
number
{
getScore
(
userScore
:
number
,
gameLeftTime
:
number
):
number
{
if
(
this
.
_time
<
0
)
{
if
(
this
.
_time
<
0
)
{
this
.
_time
=
120
+
Math
.
random
()
*
60
if
(
this
.
_needWin
)
{
if
(
this
.
_needWin
)
{
//机器人赢
//机器人赢
if
(
userScore
>
2600
)
{
if
(
userScore
>
2600
)
{
this
.
_score
=
3000
+
(
Math
.
floor
(
Math
.
random
()
*
8
)
+
2
)
*
10
this
.
_score
=
3000
+
(
Math
.
floor
(
Math
.
random
()
*
8
)
+
2
)
*
10
}
else
{
}
else
{
if
(
gameLeftTime
>
60
)
{
if
(
gameLeftTime
>
config
.
time
/
2
)
{
if
(
this
.
_score
>
userScore
)
{
if
(
this
.
_score
>
userScore
)
{
this
.
_score
+=
(
Math
.
floor
(
Math
.
random
()
*
6
)
+
2
)
*
10
this
.
_score
+=
(
Math
.
floor
(
Math
.
random
()
*
6
)
+
2
)
*
10
}
else
{
}
else
{
...
@@ -32,19 +34,19 @@ export class Robot {
...
@@ -32,19 +34,19 @@ export class Robot {
}
else
{
}
else
{
//机器人输
//机器人输
console
.
log
(
"進來了"
)
if
(
this
.
_score
>=
userScore
)
{
if
(
this
.
_score
>=
userScore
)
{
return
this
.
_score
return
this
.
_score
}
else
{
}
else
{
//应该的分数
//应该的分数
let
gapScore
=
userScore
-
this
.
_score
let
gapScore
=
userScore
-
this
.
_score
let
randomScore
=
(
Math
.
floor
(
Math
.
random
()
*
3
)
+
2
)
*
10
let
randomScore
=
(
Math
.
floor
(
Math
.
random
()
*
2
)
+
2
)
*
10
if
(
randomScore
<
gapScore
)
{
if
(
randomScore
<
gapScore
)
{
this
.
_score
+=
randomScore
this
.
_score
+=
randomScore
return
this
.
_score
return
this
.
_score
}
}
}
}
}
}
this
.
_time
=
120
+
Math
.
random
()
*
60
}
}
this
.
_time
--
this
.
_time
--
return
this
.
_score
return
this
.
_score
...
...
project/src/canvas/game/src/xiaoxiaole/XxlScene.ts
View file @
b973aeff
...
@@ -14,6 +14,9 @@ import { config } from "./XxlConfig";
...
@@ -14,6 +14,9 @@ import { config } from "./XxlConfig";
import
{
MatchingPanel
}
from
"../com/MatchingPanel"
;
import
{
MatchingPanel
}
from
"../com/MatchingPanel"
;
import
{
GDispatcher
}
from
"../Main"
;
import
{
GDispatcher
}
from
"../Main"
;
import
{
Robot
}
from
"./Robot"
;
import
{
Robot
}
from
"./Robot"
;
import
{
FailedPanel
}
from
"../com/FailedPanel"
;
import
{
SuccessNoAwardPanel
}
from
"../com/SuccessNoAwardPanel"
;
import
{
SuccessPanel
}
from
"../com/SuccessPanel"
;
declare
interface
point
{
declare
interface
point
{
x
:
number
;
x
:
number
;
...
@@ -210,6 +213,8 @@ export class XxlScene extends Scene {
...
@@ -210,6 +213,8 @@ export class XxlScene extends Scene {
userInfo
:
UserInfo
userInfo
:
UserInfo
async
initUi
()
{
async
initUi
()
{
this
.
objectPool
=
new
ObjectPool
()
this
.
objectPool
=
new
ObjectPool
()
let
that
=
this
;
let
that
=
this
;
...
@@ -331,7 +336,6 @@ export class XxlScene extends Scene {
...
@@ -331,7 +336,6 @@ export class XxlScene extends Scene {
this
.
topContainer
.
addChild
(
leftUserContainer
)
this
.
topContainer
.
addChild
(
leftUserContainer
)
console
.
log
(
this
.
width
,)
//右边用户信息
//右边用户信息
...
@@ -667,20 +671,26 @@ export class XxlScene extends Scene {
...
@@ -667,20 +671,26 @@ export class XxlScene extends Scene {
}).
to
({
scaleX
:
1.5
,
scaleY
:
1.5
},
200
).
to
({
scaleX
:
1
,
scaleY
:
1
},
200
)
}).
to
({
scaleX
:
1.5
,
scaleY
:
1.5
},
200
).
to
({
scaleX
:
1
,
scaleY
:
1
},
200
)
}
}
gameOver
()
{
async
gameOver
()
{
this
.
isGameEnd
=
true
this
.
isGameEnd
=
true
if
(
this
.
userInfo
.
win
)
{
if
(
this
.
userInfo
.
win
)
{
//胜利
//胜利
const
prizeInfo
=
await
sendTbNet
(
TbNetName
.
getPrizeInfo
)
const
prize
=
prizeInfo
.
data
if
(
prize
.
type
>
3
)
{
showPanel
(
SuccessPanel
,
prize
)
}
else
{
showPanel
(
SuccessNoAwardPanel
,
prize
)
}
}
else
{
}
else
{
//失败
//失败
showPanel
(
FailedPanel
)
}
}
}
}
// 退出游戏 返回主页
backToPage
()
{
sendTbNet
(
TbNetName
.
backToPage
,
{},
(
s
,
res
)
=>
{
console
.
log
(
'backToPage'
)
})
}
updateProgress
(
per
:
number
)
{
updateProgress
(
per
:
number
)
{
...
...
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