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
Show 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 {
...
@@ -67,8 +67,8 @@ export class Main {
showWaiting
();
showWaiting
();
sendTbNet
(
TbNetName
.
getAppData
,
{},
(
s
,
res
)
=>
{
sendTbNet
(
TbNetName
.
getAppData
,
{},
(
s
,
res
)
=>
{
Tool
.
globalData
=
res
.
data
;
Tool
.
globalData
=
res
.
data
;
//
changeScene(PlayScene,Tool.globalData.gameObj);
changeScene
(
PlayScene
,
Tool
.
globalData
.
gameObj
);
changeScene
(
StartScene
);
//
changeScene(StartScene);
})
})
...
...
src/TaoBaoNet.ts
View file @
37966fde
...
@@ -281,6 +281,10 @@ const mockData = {
...
@@ -281,6 +281,10 @@ const mockData = {
"data"
:
{
"data"
:
{
"inviteSuccessCount"
:
2
"inviteSuccessCount"
:
2
}
}
},
//消耗道具
"useTools"
:
{
"success"
:
true
,
}
}
}
}
...
...
src/Tools.ts
View file @
37966fde
...
@@ -112,7 +112,7 @@ export class Tool {
...
@@ -112,7 +112,7 @@ export class Tool {
activityId
:
string
,
activityId
:
string
,
nickName
:
string
,
nickName
:
string
,
avatar
:
string
,
avatar
:
string
,
gameObj
:
{
gameObj
:
{
//注意这里面只有id是确定要用的,其他别用
maxScore
:
number
,
maxScore
:
number
,
bombCount
:
number
,
bombCount
:
number
,
exchangeCount
:
number
,
exchangeCount
:
number
,
...
...
src/commonNet.ts
View file @
37966fde
...
@@ -8,6 +8,14 @@ export enum TaskType {
...
@@ -8,6 +8,14 @@ export enum TaskType {
doCollect
=
"doCollect"
,
doCollect
=
"doCollect"
,
doOrder
=
"doOrder"
doOrder
=
"doOrder"
}
}
/**
* 和消耗道具接口保持一致
*/
export
enum
PropType
{
boom
=
1
,
exchange
=
2
,
net
=
3
,
}
/**
/**
*
*
* @param callback
* @param callback
...
@@ -16,7 +24,7 @@ export enum TaskType {
...
@@ -16,7 +24,7 @@ export enum TaskType {
* @param id
* @param id
* @param isFinal 是否最终提交,默认是的
* @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
(
sendTbNet
(
TbNetName
.
submit
,
TbNetName
.
submit
,
{
{
...
@@ -24,7 +32,7 @@ export function submit(callback: (s: boolean, res?: any) => void, score: number,
...
@@ -24,7 +32,7 @@ export function submit(callback: (s: boolean, res?: any) => void, score: number,
grade
:
grade
,
grade
:
grade
,
score
:
score
,
score
:
score
,
type
:
isFinal
?
1
:
0
,
type
:
isFinal
?
1
:
0
,
playId
:
id
playId
:
Tool
.
globalData
.
gameObj
.
id
},
},
(
s
,
res
)
=>
{
(
s
,
res
)
=>
{
callback
(
s
,
res
)
callback
(
s
,
res
)
...
@@ -48,3 +56,20 @@ export function getTools() {
...
@@ -48,3 +56,20 @@ export function getTools() {
true
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 {
...
@@ -130,14 +130,14 @@ export class GameOverPanel extends Panel {
desTxt
.
text
=
"("
+
levelDes
[
this
.
data
.
grade
]
+
")"
;
desTxt
.
text
=
"("
+
levelDes
[
this
.
data
.
grade
]
+
")"
;
// this.addChild(desTxt);//貌似不用显示了
// 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
.
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
.
position
.
set
(
383
,
959
);
this
.
againBtn
.
visible
=
false
;
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
.
position
.
set
(
383
,
959
);
this
.
goEarnBtn
.
visible
=
false
;
this
.
goEarnBtn
.
visible
=
false
;
//积分/次文案
//积分/次文案
...
@@ -186,11 +186,13 @@ export class GameOverPanel extends Panel {
...
@@ -186,11 +186,13 @@ export class GameOverPanel extends Panel {
sendTbNet
(
sendTbNet
(
TbNetName
.
startGame
,
TbNetName
.
startGame
,
{
activityId
:
Tool
.
globalData
.
activityId
,
nickName
:
Tool
.
globalData
.
nickName
},
{
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
();
hideWaiting
();
this
.
hidePanel
();
this
.
hidePanel
();
if
(
s
)
{
if
(
s
)
{
var
data
=
res
.
data
var
data
=
res
.
data
;
// 修改Tool里的数据
Tool
.
globalData
.
gameObj
=
data
;
var
playScene
:
PlayScene
=
getCurrentScene
();
var
playScene
:
PlayScene
=
getCurrentScene
();
// playScene.resetGame(res.unlockGrade)//代加参数,方法
// playScene.resetGame(res.unlockGrade)//代加参数,方法
//修改道具数量
//修改道具数量
...
...
src/panels/PropPanel.ts
View file @
37966fde
...
@@ -66,7 +66,7 @@ export class PropPanel extends Panel {
...
@@ -66,7 +66,7 @@ export class PropPanel extends Panel {
netCount
:
number
,
netCount
:
number
,
grade
:
number
,
grade
:
number
,
score
:
number
,
score
:
number
,
id
:
string
;
//
id: string;
}
}
initUi
()
{
initUi
()
{
...
@@ -121,7 +121,7 @@ export class PropPanel extends Panel {
...
@@ -121,7 +121,7 @@ export class PropPanel extends Panel {
//显示结束弹框
//显示结束弹框
showPanel
(
GameOverPanel
,
res
.
data
)
showPanel
(
GameOverPanel
,
res
.
data
)
}
}
},
this
.
data
.
score
,
this
.
data
.
grade
,
this
.
data
.
id
)
},
this
.
data
.
score
,
this
.
data
.
grade
)
}
}
onClick_getPropBtn
()
{
onClick_getPropBtn
()
{
showPanel
(
TaskPanel
)
showPanel
(
TaskPanel
)
...
...
src/panels/QuitPanel.ts
View file @
37966fde
...
@@ -22,7 +22,7 @@ export class QuitPanel extends Panel {
...
@@ -22,7 +22,7 @@ export class QuitPanel extends Panel {
data
:
{
data
:
{
grade
:
number
,
grade
:
number
,
score
:
number
,
score
:
number
,
id
:
string
//订单id
//
id: string//订单id
}
}
initUi
()
{
initUi
()
{
...
@@ -47,7 +47,7 @@ export class QuitPanel extends Panel {
...
@@ -47,7 +47,7 @@ export class QuitPanel extends Panel {
this
.
hidePanel
();
this
.
hidePanel
();
//显示结束弹框
//显示结束弹框
showPanel
(
GameOverPanel
,
res
.
data
)
showPanel
(
GameOverPanel
,
res
.
data
)
},
this
.
data
.
score
,
this
.
data
.
grade
,
this
.
data
.
id
)
},
this
.
data
.
score
,
this
.
data
.
grade
)
},
this
)
},
this
)
.
position
.
set
(
134
,
750
)
.
position
.
set
(
134
,
750
)
}
}
...
...
src/scenes/StartScene.ts
View file @
37966fde
...
@@ -51,12 +51,10 @@ export class StartScene extends Scene {
...
@@ -51,12 +51,10 @@ export class StartScene extends Scene {
// netCount: 33,
// netCount: 33,
// score: 22,
// score: 22,
// grade: 1024,
// grade: 1024,
// id:"223"
// })
// })
// showPanel(QuitPanel, {
// showPanel(QuitPanel, {
// score: 22,
// score: 22,
// grade: 1024,
// grade: 1024,
// id:"223"
// })
// })
// showPanel(GameOverPanel, {
// showPanel(GameOverPanel, {
// score: 4444,
// 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