Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
game2048
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
王剑峰
game2048
Commits
37966fde
Commit
37966fde
authored
Apr 24, 2020
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
937969c1
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
46 additions
and
16 deletions
+46
-16
output.js
output.js
+1
-0
Main.ts
src/Main.ts
+2
-2
TaoBaoNet.ts
src/TaoBaoNet.ts
+4
-0
Tools.ts
src/Tools.ts
+1
-1
commonNet.ts
src/commonNet.ts
+27
-2
GameOverPanel.ts
src/panels/GameOverPanel.ts
+7
-5
PropPanel.ts
src/panels/PropPanel.ts
+2
-2
QuitPanel.ts
src/panels/QuitPanel.ts
+2
-2
StartScene.ts
src/scenes/StartScene.ts
+0
-2
No files found.
output.js
0 → 100644
View file @
37966fde
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/Main.ts
View file @
37966fde
...
...
@@ -67,8 +67,8 @@ export class Main {
showWaiting
();
sendTbNet
(
TbNetName
.
getAppData
,
{},
(
s
,
res
)
=>
{
Tool
.
globalData
=
res
.
data
;
//
changeScene(PlayScene,Tool.globalData.gameObj);
changeScene
(
StartScene
);
changeScene
(
PlayScene
,
Tool
.
globalData
.
gameObj
);
//
changeScene(StartScene);
})
...
...
src/TaoBaoNet.ts
View file @
37966fde
...
...
@@ -281,6 +281,10 @@ const mockData = {
"data"
:
{
"inviteSuccessCount"
:
2
}
},
//消耗道具
"useTools"
:
{
"success"
:
true
,
}
}
...
...
src/Tools.ts
View file @
37966fde
...
...
@@ -112,7 +112,7 @@ export class Tool {
activityId
:
string
,
nickName
:
string
,
avatar
:
string
,
gameObj
:
{
gameObj
:
{
//注意这里面只有id是确定要用的,其他别用
maxScore
:
number
,
bombCount
:
number
,
exchangeCount
:
number
,
...
...
src/commonNet.ts
View file @
37966fde
...
...
@@ -8,6 +8,14 @@ export enum TaskType {
doCollect
=
"doCollect"
,
doOrder
=
"doOrder"
}
/**
* 和消耗道具接口保持一致
*/
export
enum
PropType
{
boom
=
1
,
exchange
=
2
,
net
=
3
,
}
/**
*
* @param callback
...
...
@@ -16,7 +24,7 @@ export enum TaskType {
* @param id
* @param isFinal 是否最终提交,默认是的
*/
export
function
submit
(
callback
:
(
s
:
boolean
,
res
?:
any
)
=>
void
,
score
:
number
,
grade
:
number
,
i
d
:
string
,
i
sFinal
:
boolean
=
true
)
{
export
function
submit
(
callback
:
(
s
:
boolean
,
res
?:
any
)
=>
void
,
score
:
number
,
grade
:
number
,
isFinal
:
boolean
=
true
)
{
sendTbNet
(
TbNetName
.
submit
,
{
...
...
@@ -24,7 +32,7 @@ export function submit(callback: (s: boolean, res?: any) => void, score: number,
grade
:
grade
,
score
:
score
,
type
:
isFinal
?
1
:
0
,
playId
:
id
playId
:
Tool
.
globalData
.
gameObj
.
id
},
(
s
,
res
)
=>
{
callback
(
s
,
res
)
...
...
@@ -48,3 +56,20 @@ export function getTools() {
true
)
}
/**
*
* @param callback 回调
* @param type 道具类型
*/
export
function
useTools
(
callback
:
(
s
:
boolean
)
=>
void
,
type
:
PropType
)
{
sendTbNet
(
TbNetName
.
useTools
,
{
activityId
:
Tool
.
globalData
.
activityId
,
type
:
type
,
playId
:
Tool
.
globalData
.
gameObj
.
id
},
(
s
)
=>
{
callback
(
s
);
}
)
}
src/panels/GameOverPanel.ts
View file @
37966fde
...
...
@@ -130,14 +130,14 @@ export class GameOverPanel extends Panel {
desTxt
.
text
=
"("
+
levelDes
[
this
.
data
.
grade
]
+
")"
;
// this.addChild(desTxt);//貌似不用显示了
//返回首页按钮
this
.
returnBtn
=
this
.
addChild
(
new
Button
(
RES
.
getRes
(
"fanhuishouye.png"
)))
as
Button
;
this
.
returnBtn
=
this
.
addChild
(
new
Button
(
RES
.
getRes
(
"fanhuishouye.png"
)));
this
.
returnBtn
.
position
.
set
(
117
,
959
);
//再来一次按钮
this
.
againBtn
=
this
.
addChild
(
new
Button
(
RES
.
getRes
(
"zailaiyiju.png"
)))
as
Button
;
this
.
againBtn
=
this
.
addChild
(
new
Button
(
RES
.
getRes
(
"zailaiyiju.png"
)));
this
.
againBtn
.
position
.
set
(
383
,
959
);
this
.
againBtn
.
visible
=
false
;
//去赚积分按钮
this
.
goEarnBtn
=
this
.
addChild
(
new
Button
(
RES
.
getRes
(
"quzhuanjifen.png"
)))
as
Button
;
this
.
goEarnBtn
=
this
.
addChild
(
new
Button
(
RES
.
getRes
(
"quzhuanjifen.png"
)));
this
.
goEarnBtn
.
position
.
set
(
383
,
959
);
this
.
goEarnBtn
.
visible
=
false
;
//积分/次文案
...
...
@@ -186,11 +186,13 @@ export class GameOverPanel extends Panel {
sendTbNet
(
TbNetName
.
startGame
,
{
activityId
:
Tool
.
globalData
.
activityId
,
nickName
:
Tool
.
globalData
.
nickName
},
(
s
,
res
:
{
data
:
{
maxScore
:
number
,
unlockGrade
:
number
,
bombCount
:
number
,
exchangeCount
:
number
,
netCount
:
number
}
})
=>
{
(
s
,
res
:
{
data
:
{
maxScore
:
number
,
unlockGrade
:
number
,
bombCount
:
number
,
exchangeCount
:
number
,
netCount
:
number
,
id
:
string
}
})
=>
{
hideWaiting
();
this
.
hidePanel
();
if
(
s
)
{
var
data
=
res
.
data
var
data
=
res
.
data
;
// 修改Tool里的数据
Tool
.
globalData
.
gameObj
=
data
;
var
playScene
:
PlayScene
=
getCurrentScene
();
// playScene.resetGame(res.unlockGrade)//代加参数,方法
//修改道具数量
...
...
src/panels/PropPanel.ts
View file @
37966fde
...
...
@@ -66,7 +66,7 @@ export class PropPanel extends Panel {
netCount
:
number
,
grade
:
number
,
score
:
number
,
id
:
string
;
//
id: string;
}
initUi
()
{
...
...
@@ -121,7 +121,7 @@ export class PropPanel extends Panel {
//显示结束弹框
showPanel
(
GameOverPanel
,
res
.
data
)
}
},
this
.
data
.
score
,
this
.
data
.
grade
,
this
.
data
.
id
)
},
this
.
data
.
score
,
this
.
data
.
grade
)
}
onClick_getPropBtn
()
{
showPanel
(
TaskPanel
)
...
...
src/panels/QuitPanel.ts
View file @
37966fde
...
...
@@ -22,7 +22,7 @@ export class QuitPanel extends Panel {
data
:
{
grade
:
number
,
score
:
number
,
id
:
string
//订单id
//
id: string//订单id
}
initUi
()
{
...
...
@@ -47,7 +47,7 @@ export class QuitPanel extends Panel {
this
.
hidePanel
();
//显示结束弹框
showPanel
(
GameOverPanel
,
res
.
data
)
},
this
.
data
.
score
,
this
.
data
.
grade
,
this
.
data
.
id
)
},
this
.
data
.
score
,
this
.
data
.
grade
)
},
this
)
.
position
.
set
(
134
,
750
)
}
...
...
src/scenes/StartScene.ts
View file @
37966fde
...
...
@@ -51,12 +51,10 @@ export class StartScene extends Scene {
// netCount: 33,
// score: 22,
// grade: 1024,
// id:"223"
// })
// showPanel(QuitPanel, {
// score: 22,
// grade: 1024,
// id:"223"
// })
// showPanel(GameOverPanel, {
// score: 4444,
...
...
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