Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
db-game-template
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
崔立强
db-game-template
Commits
839b1d1e
Commit
839b1d1e
authored
Oct 15, 2018
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
fee0effd
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
268 additions
and
101 deletions
+268
-101
.DS_Store
egret/.DS_Store
+0
-0
index.html
egret/index.html
+18
-16
config.d.ts
egret/libs/config.d.ts
+5
-0
doStart.ts
egret/libs/new_tw/ctrls/doStart.ts
+42
-0
submit.ts
egret/libs/new_tw/ctrls/submit.ts
+54
-0
submitAfterDostart.ts
egret/libs/new_tw/ctrls/submitAfterDostart.ts
+10
-0
ABDataManager.ts
egret/libs/tc/manager/ABDataManager.ts
+1
-1
MainBase.ts
egret/libs/tl/MainBase.ts
+6
-12
DataManager.ts
egret/libs/tw/manager/DataManager.ts
+36
-35
NetManager.ts
egret/libs/tw/manager/NetManager.ts
+1
-1
preload_5.tmproject
egret/resource/TextureMerger/preload_5.tmproject
+1
-0
thumb_pb.png
egret/resource/assets/ProgressBar/thumb_pb.png
+0
-0
track_pb.png
egret/resource/assets/ProgressBar/track_pb.png
+0
-0
default.res.json
egret/resource/default.res.json
+14
-0
StartSkin.exml
egret/resource/skins/StartSkin.exml
+1
-1
Main.ts
egret/src/Main.ts
+6
-1
Box.ts
egret/src/startScene/Box.ts
+6
-3
GuideCtrl.ts
egret/src/startScene/GuideCtrl.ts
+7
-5
StartScene.ts
egret/src/startScene/StartScene.ts
+57
-25
BoxOpenState.ts
egret/src/startScene/view/BoxOpenState.ts
+3
-1
No files found.
egret/.DS_Store
View file @
839b1d1e
No preview for this file type
egret/index.html
View file @
839b1d1e
...
...
@@ -25,7 +25,7 @@
<body>
<div
style=
"margin: auto;width: 100%;height: 100%;"
class=
"egret-player"
data-entry-class=
"Main"
data-orientation=
"auto"
data-scale-mode=
"showAll"
data-frame-rate=
"60"
data-content-width=
"750"
data-content-height=
"1624"
data-multi-fingered=
"2"
data-show-fps=
"
tru
e"
data-show-log=
"false"
data-show-fps-style=
"x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9"
>
data-multi-fingered=
"2"
data-show-fps=
"
fals
e"
data-show-log=
"false"
data-show-fps-style=
"x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9"
>
</div>
<script
src=
"libs/modules/egret/egret.js"
></script>
...
...
@@ -42,21 +42,23 @@
<script
src=
"output.js"
></script>
<script>
// localStorage.clear();
var
__t0__
=
Date
.
now
();
var
__debug__
=
1
;
var
__monkeyHandSize__
=
30
;
var
__boxMoveSpeed__
=
3
;
var
__BOX_CREATE_INTERVAL__
=
60
*
4
;
var
__boxOpenState__
=
'resource/assets/startScene/openstate.json'
;
var
__boxmap__
=
{
coin
:{
award
:
0
,
skin
:
'resource/assets/startScene/coin.json'
,
offset
:
[
117
,
68
]
},
gift
:{
award
:
0
,
skin
:
'resource/assets/startScene/gift.json'
,
offset
:
[
119
,
103
]
},
gift2
:
{
award
:
1
,
skin
:
'resource/assets/startScene/gift2.json'
,
offset
:
[
122
,
87
]
},
woodbox
:
{
award
:
1
,
skin
:
'resource/assets/startScene/woodbox.json'
,
offset
:
[
115
,
80
]
},
silverbox
:
{
award
:
3
,
skin
:
'resource/assets/startScene/silverbox.json'
,
offset
:
[
147
,
77
]
},
goldenbox
:
{
award
:
5
,
skin
:
'resource/assets/startScene/goldenbox.json'
,
offset
:
[
130
,
88
]
}
};
var
__bgUrl__
=
'resource/assets/startScene/bg.jpg'
;
var
__t0__
=
Date
.
now
();
var
__debug__
=
1
;
var
__mode__
=
2
;
var
__award_thanks_score__
=
0
;
var
__monkeyHandSize__
=
30
;
var
__boxMoveSpeed__
=
3
;
var
__BOX_CREATE_INTERVAL__
=
60
*
4
;
var
__boxOpenState__
=
'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/openstate.json'
;
var
__boxmap__
=
{
coin
:
{
award
:
0
,
skin
:
'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/coin.json'
,
offset
:
[
117
,
68
]
},
gift
:
{
award
:
0
,
skin
:
'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/gift.json'
,
offset
:
[
119
,
103
]
},
gift2
:
{
award
:
1
,
skin
:
'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/gift2.json'
,
offset
:
[
122
,
87
]
},
woodbox
:
{
award
:
1
,
skin
:
'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/woodbox.json'
,
offset
:
[
115
,
80
]
},
silverbox
:
{
award
:
3
,
skin
:
'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/silverbox.json'
,
offset
:
[
147
,
77
]
},
goldenbox
:
{
award
:
5
,
skin
:
'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/goldenbox.json'
,
offset
:
[
130
,
88
]
}
};
var
__bgUrl__
=
'https://yun.duiba.com.cn/db_games/activity/fishing/1539596765/resource/assets/startScene/bg.jpg'
;
var
gameId
=
1
;
var
CFG
=
{
...
...
egret/libs/config.d.ts
View file @
839b1d1e
...
...
@@ -11,6 +11,11 @@ declare interface IBoxItem {
}
/**
* 1.捞一次扣一次积分,不管捞没捞到宝箱,不管宝箱是否被猴子抢走;2.只有捞到宝箱,参与了一次抽奖才扣积分
*/
declare
var
__mode__
:
number
;
declare
var
__award_thanks_score__
:
number
;
declare
var
__boxmap__
:
{
[
key
:
string
]:
IBoxItem
};
declare
var
__bgUrl__
:
string
;
declare
var
__monkeyHandSize__
:
number
;
...
...
egret/
src/ctrls/net
/doStart.ts
→
egret/
libs/new_tw/ctrls
/doStart.ts
View file @
839b1d1e
import
Loading
from
"../../loading/Loading"
;
import
{
NetManager
}
from
"../../../libs/tw/manager/NetManager"
;
import
{
DataManager
}
from
"../../../libs/tw/manager/DataManager"
;
/**
* 开始游戏
* @param callback
* @param isAgain
* @param credits
* @param customizedType
*/
const
doStart
=
(
callback
:
Function
,
isAgain
=
false
,
credits
?:
number
,
customizedType
?:
number
)
=>
{
if
(
window
[
'requirelogin'
])
{
window
[
'requirelogin'
]();
return
;
}
NetManager
.
ins
.
doStart
((
success
:
boolean
)
=>
{
if
(
success
)
{
getStartOrderStatus
(
callback
,
customizedType
);
}
else
{
callback
(
success
);
}
},
isAgain
,
credits
,
customizedType
);
}
/**
* 查询订单结果
* @param callback
* @param ticketId
* @param customizedType
*/
const
getStartOrderStatus
=
(
callback
:
Function
,
customizedType
?:
number
)
=>
{
NetManager
.
ins
.
getStartStatus
(
callback
,
...
...
@@ -11,31 +39,4 @@ const getStartOrderStatus = (callback: Function, customizedType?: number) => {
5
,
customizedType
);
}
/**
* 开始游戏
* @param {string} isAgain 是否是再来一次
* @param {number} credits 主动要求花费多少积分玩游戏
* @param {number} customizedType xx类型
*/
export
default
(
isAgain
=
false
,
credits
?:
number
,
customizedType
?:
number
)
=>
new
Promise
((
resolve
)
=>
{
if
(
requirelogin
)
{
requirelogin
();
return
;
}
const
callback
=
(
data
)
=>
{
Loading
.
instace
.
hide
();
resolve
(
data
);
}
Loading
.
instace
.
show
();
NetManager
.
ins
.
doStart
((
success
:
boolean
)
=>
{
if
(
success
)
{
getStartOrderStatus
(
callback
,
customizedType
);
}
else
{
callback
(
success
);
}
},
isAgain
,
credits
,
customizedType
);
});
\ No newline at end of file
export
default
doStart
;
\ No newline at end of file
egret/libs/new_tw/ctrls/submit.ts
0 → 100644
View file @
839b1d1e
import
{
IDynamicData
}
from
"../../tw/data/game/datapash/IDynamicData"
;
import
{
NetManager
}
from
"../../tw/manager/NetManager"
;
import
{
DataManager
}
from
"../../tw/manager/DataManager"
;
/**
* 提交游戏成绩
* @param callback
* @param score 得分
* @param checkScore 是否校验得分
* @param customizedType 定制类型 1推币机
*/
const
submit
=
(
callback
:
Function
,
score
:
number
,
checkScore
?:
boolean
,
customizedType
?:
number
)
=>
{
const
allDynamics
=
[];
gameSubmitData
(
callback
,
score
,
allDynamics
,
checkScore
,
customizedType
);
}
/**
* 提交游戏成绩
* @param callback
* @param score 得分
* @param allDynamics 防作弊数据
* @param checkScore 是否校验得分
* @param customizedType 定制类型 1推币机
*/
const
gameSubmitData
=
(
callback
:
Function
,
score
:
number
,
allDynamics
:
IDynamicData
[][],
checkScore
?:
boolean
,
customizedType
?:
number
)
=>
{
NetManager
.
ins
.
gameSubmit
(
(
success
:
boolean
)
=>
{
if
(
success
)
{
getSubmitResult
(
callback
,
DataManager
.
ins
.
gameSubmitData
.
orderId
);
}
else
{
callback
(
success
);
}
},
DataManager
.
ins
.
doStartData
.
ticketId
,
score
,
'[]'
,
DataManager
.
ins
.
doStartData
.
submitToken
,
JSON
.
stringify
(
allDynamics
),
checkScore
,
customizedType
);
}
/**
* 查询提交结果
* @param callback
* @param orderId
*/
const
getSubmitResult
=
(
callback
:
Function
,
orderId
:
number
)
=>
{
NetManager
.
ins
.
getSubmitResult
(
callback
,
orderId
,
()
=>
{
return
DataManager
.
ins
.
gameGetSubmitResultData
.
flag
;
});
}
export
default
submit
;
\ No newline at end of file
egret/libs/new_tw/ctrls/submitAfterDostart.ts
0 → 100644
View file @
839b1d1e
import
doStart
from
"./doStart"
;
import
submit
from
"./submit"
;
const
submitAfterDostart
=
(
cb
,
score
)
=>
{
doStart
(
()
=>
submit
(
cb
,
score
)
)
}
export
default
submitAfterDostart
\ No newline at end of file
egret/libs/tc/manager/ABDataManager.ts
View file @
839b1d1e
...
...
@@ -2,7 +2,7 @@
*Created by cuiliqiang on 2018/3/8
* 数据管理
*/
export
abstract
class
ABDataManager
{
export
abstract
class
ABDataManager
extends
egret
.
EventDispatcher
{
/**
* 更新数据
* @param {number} name 接口名字
...
...
egret/libs/tl/MainBase.ts
View file @
839b1d1e
...
...
@@ -79,11 +79,16 @@ export default class MainBase extends eui.UILayer {
this
.
registerModules
();
this
.
getData
();
this
.
runGame
().
catch
(
e
=>
{
console
.
log
(
e
);
})
}
protected
getData
()
{
}
protected
registerModules
()
{
}
private
async
runGame
()
{
...
...
@@ -120,17 +125,6 @@ export default class MainBase extends eui.UILayer {
* Create scene interface
*/
protected
createGameScene
()
{
NetManager
.
ins
.
getInfo
(()
=>
{
// 等待开奖 ↓
if
(
DataManager
.
ins
.
getInfoData
.
status
.
code
==
4
)
{
// 已开奖 ↓
}
else
if
(
DataManager
.
ins
.
getInfoData
.
status
.
code
==
5
)
{
// 正常游戏 ↓
}
else
{
}
});
}
}
\ No newline at end of file
egret/libs/tw/manager/DataManager.ts
View file @
839b1d1e
...
...
@@ -148,28 +148,28 @@ export class DataManager extends ABDataManager {
private
_signInfoData
:
SignInfoData
;
//签到信息
private
_getRankListData
:
GetRankListData
;
//群内喂食排行榜
private
_getFoodPilesData
:
GetFoodPilesData
;
//查询待领取粮食
/**
* 外来宠物养成
*/
public
petsIndexData
:
PetsIndexData
=
new
PetsIndexData
();
//外来宠物活动主页
private
_getHomeInfoData
:
GetHomeInfoData
;
//活动主信息接口
private
_getActToysListData
:
any
=
[];
//商店道具接口
private
_toyExchangesData
:
ToyExchangesData
;
//道具兑换
private
_useToyData
:
UseToyData
;
//道具使用
private
_getUserToysListData
:
GetUserToysListData
;
//已购买的道具
private
_batchollectFoodData
:
Data
;
//粮食收取返回
private
_toyExchangesData
:
ToyExchangesData
;
//道具兑换
private
_useToyData
:
UseToyData
;
//道具使用
private
_getUserToysListData
:
GetUserToysListData
;
//已购买的道具
private
_batchollectFoodData
:
Data
;
//粮食收取返回
private
_visitStatisticsData
:
VisitStatisticsData
;
//来访统计
private
_getVisitInfoData
:
GetVisitInfoData
;
//来访统计
private
_getVisitInfoData
:
GetVisitInfoData
;
//来访统计
private
_visitDetailData
:
VisitDetailData
;
//到访记录详情
private
_collectGiftRecord
:
Data
;
//礼物收取
private
_collectGiftRecord
:
Data
;
//礼物收取
/**
* 插件信息列表
*/
private
_getPrizeInfoList
:
any
=
{};
private
_getRecordData
:
GetRecordData
;
private
_getRecordData
:
GetRecordData
;
/**
* 更新数据
...
...
@@ -510,7 +510,7 @@ export class DataManager extends ABDataManager {
data
.
update
(
result
);
break
;
case
NetName
.
PETS_GET_HOME_INFO
:
//外来宠物养成---活动主信息接口
if
(
!
this
.
_getHomeInfoData
)
{
if
(
!
this
.
_getHomeInfoData
)
{
this
.
_getHomeInfoData
=
new
GetHomeInfoData
();
}
this
.
_getHomeInfoData
.
update
(
result
);
...
...
@@ -518,35 +518,35 @@ export class DataManager extends ABDataManager {
break
;
case
NetName
.
PETS_GET_ACT_TOYS
:
//外来宠物养成---商店道具接口
const
toyType
=
param
.
toyType
;
if
(
!
this
.
_getActToysListData
[
toyType
])
{
if
(
!
this
.
_getActToysListData
[
toyType
])
{
this
.
_getActToysListData
[
toyType
]
=
new
GetActToysListData
();
}
this
.
_getActToysListData
[
toyType
].
update
(
result
);
data
=
this
.
_getActToysListData
[
toyType
];
break
;
case
NetName
.
PETS_TOY_EXCHANGE
:
//外来宠物养成---道具兑换
if
(
!
this
.
_toyExchangesData
)
{
if
(
!
this
.
_toyExchangesData
)
{
this
.
_toyExchangesData
=
new
ToyExchangesData
();
}
this
.
_toyExchangesData
.
update
(
result
);
data
=
this
.
_toyExchangesData
;
break
;
case
NetName
.
PETS_USE_TOYS
:
//外来宠物养成---道具使用
if
(
!
this
.
_useToyData
)
{
if
(
!
this
.
_useToyData
)
{
this
.
_useToyData
=
new
UseToyData
();
}
this
.
_useToyData
.
update
(
result
);
data
=
this
.
_useToyData
;
break
;
case
NetName
.
PETS_GET_USER_TOYS
:
//外来宠物养成---已购买的道具
if
(
!
this
.
_getUserToysListData
)
{
if
(
!
this
.
_getUserToysListData
)
{
this
.
_getUserToysListData
=
new
GetUserToysListData
();
}
this
.
_getUserToysListData
.
update
(
result
);
data
=
this
.
_getUserToysListData
;
break
;
case
NetName
.
PETS_BATCHOLLECT_FOOD
:
//外来宠物养成---收取猫草
if
(
!
this
.
_batchollectFoodData
)
{
if
(
!
this
.
_batchollectFoodData
)
{
this
.
_batchollectFoodData
=
new
Data
();
}
...
...
@@ -554,14 +554,14 @@ export class DataManager extends ABDataManager {
data
=
this
.
_batchollectFoodData
;
break
;
case
NetName
.
PETS_VISI_STATISTICS
:
//外来宠物养成---来访统计
if
(
!
this
.
_visitStatisticsData
)
{
if
(
!
this
.
_visitStatisticsData
)
{
this
.
_visitStatisticsData
=
new
VisitStatisticsData
();
}
this
.
_visitStatisticsData
.
update
(
result
);
data
=
this
.
_visitStatisticsData
;
break
;
case
NetName
.
PETS_GET_VISIT_INFO
:
//未来宠物养成---动态信息列表
if
(
!
this
.
_getVisitInfoData
)
{
if
(
!
this
.
_getVisitInfoData
)
{
this
.
_getVisitInfoData
=
new
GetVisitInfoData
();
}
...
...
@@ -569,14 +569,14 @@ export class DataManager extends ABDataManager {
data
=
this
.
_getVisitInfoData
;
break
;
case
NetName
.
PETS_VISIT_DETAIL
:
//外来宠物养成---到访记录详情
if
(
!
this
.
_visitDetailData
)
{
if
(
!
this
.
_visitDetailData
)
{
this
.
_visitDetailData
=
new
VisitDetailData
();
}
this
.
_visitDetailData
.
update
(
result
);
data
=
this
.
_visitDetailData
;
break
;
case
NetName
.
PETS_COLLECT_GIFT_RECORD
:
if
(
!
this
.
_collectGiftRecord
)
{
if
(
!
this
.
_collectGiftRecord
)
{
this
.
_collectGiftRecord
=
new
Data
();
}
this
.
_collectGiftRecord
.
update
(
result
);
...
...
@@ -609,22 +609,23 @@ export class DataManager extends ABDataManager {
data
=
result
;
break
;
case
NetName
.
GET_RECORD
:
//查询我的奖品记录
if
(
!
this
.
_getRecordData
)
{
if
(
!
this
.
_getRecordData
)
{
this
.
_getRecordData
=
new
GetRecordData
();
}
this
.
_getRecordData
.
update
(
result
);
data
=
this
.
_getRecordData
;
default
:
this
[
this
.
getKey
(
name
)]
=
result
;
this
[
this
.
getKey
(
name
)]
=
result
;
}
this
.
dispatchEvent
(
new
egret
.
Event
(
'dataUpdate'
,
false
,
false
,
name
));
return
data
||
result
;
}
getData
(
name
){
getData
(
name
)
{
return
this
[
this
.
getKey
(
name
)]
}
private
getKey
(
name
){
private
getKey
(
name
)
{
return
`_tw_data_
${
name
}
_`
}
...
...
@@ -915,24 +916,24 @@ export class DataManager extends ABDataManager {
/**
* 查询我的奖品记录
*/
public
get
getRecordData
():
GetRecordData
{
public
get
getRecordData
():
GetRecordData
{
return
this
.
_getRecordData
;
}
/**
* 外来宠物养成--活动主信息接口
*/
public
get
getHomeInfoData
():
GetHomeInfoData
{
public
get
getHomeInfoData
():
GetHomeInfoData
{
return
this
.
_getHomeInfoData
;
}
public
set
getHomeInfoData
(
d
:
GetHomeInfoData
)
{
public
set
getHomeInfoData
(
d
:
GetHomeInfoData
)
{
this
.
_getHomeInfoData
=
d
;
}
/**
* 收取猫草回调数据
*/
public
get
gtBatchollectFoodData
():
Data
{
public
get
gtBatchollectFoodData
():
Data
{
return
this
.
_batchollectFoodData
;
}
...
...
@@ -940,52 +941,52 @@ export class DataManager extends ABDataManager {
/**
* 外来宠物养成--商店道具接口
*/
public
get
getActToysListData
():
GetActToysListData
[]
{
public
get
getActToysListData
():
GetActToysListData
[]
{
return
this
.
_getActToysListData
;
}
public
set
getActToysListData
(
d
:
GetActToysListData
[])
{
public
set
getActToysListData
(
d
:
GetActToysListData
[])
{
this
.
_getActToysListData
=
d
;
}
/**
* 外来宠物养成--商店道具接口
*/
public
get
getUserToysListData
():
GetUserToysListData
{
public
get
getUserToysListData
():
GetUserToysListData
{
return
this
.
_getUserToysListData
;
}
public
set
getUserToysListData
(
d
:
GetUserToysListData
)
{
public
set
getUserToysListData
(
d
:
GetUserToysListData
)
{
this
.
_getUserToysListData
=
d
;
}
/**
* 外来宠物养成--来访统计
*/
public
get
visitStatisticsData
():
VisitStatisticsData
{
public
get
visitStatisticsData
():
VisitStatisticsData
{
return
this
.
_visitStatisticsData
;
}
/**
* 外来宠物养成--动态信息列表
*/
public
get
getVisitInfoData
():
GetVisitInfoData
{
public
get
getVisitInfoData
():
GetVisitInfoData
{
return
this
.
_getVisitInfoData
;
}
/**
* 外来宠物养成--到访记录详情
*/
public
get
visitDetailData
():
VisitDetailData
{
public
get
visitDetailData
():
VisitDetailData
{
return
this
.
_visitDetailData
;
}
/**
* 外来宠物养成--礼物收取
*/
public
get
collectGiftRecord
():
Data
{
public
get
collectGiftRecord
():
Data
{
return
this
.
_collectGiftRecord
;
}
// tslint:disable-next-line:max-file-line-count
}
\ No newline at end of file
egret/libs/tw/manager/NetManager.ts
View file @
839b1d1e
...
...
@@ -171,7 +171,7 @@ export class NetManager extends ABNetManager {
/**
* 游戏基础信息
*/
public
getInfo
(
callback
:
Function
):
void
{
public
getInfo
(
callback
?
:
Function
):
void
{
const
net
:
INetData
=
{
name
:
NetName
.
GAME_INFO
,
uri
:
'/ngame/new/getInfo'
,
...
...
egret/resource/TextureMerger/preload_5.tmproject
0 → 100644
View file @
839b1d1e
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"preload_5","version":5,"files":["../assets/ProgressBar/thumb_pb.png","../assets/ProgressBar/track_pb.png"]}
\ No newline at end of file
egret/resource/assets/ProgressBar/thumb_pb.png
0 → 100644
View file @
839b1d1e
976 Bytes
egret/resource/assets/ProgressBar/track_pb.png
0 → 100644
View file @
839b1d1e
970 Bytes
egret/resource/default.res.json
View file @
839b1d1e
...
...
@@ -19,6 +19,10 @@
{
"keys"
:
"guide_tips_png,guide_hand_png,guide_dialog_png"
,
"name"
:
"guide"
},
{
"name"
:
"preload"
,
"keys"
:
"thumb_pb_png,track_pb_png"
}
],
"resources"
:
[
...
...
@@ -133,6 +137,16 @@
"url"
:
"assets/startScene/guide/guide_dialog.png"
,
"type"
:
"image"
,
"name"
:
"guide_dialog_png"
},
{
"name"
:
"thumb_pb_png"
,
"type"
:
"image"
,
"url"
:
"assets/ProgressBar/thumb_pb.png"
},
{
"name"
:
"track_pb_png"
,
"type"
:
"image"
,
"url"
:
"assets/ProgressBar/track_pb.png"
}
]
}
\ No newline at end of file
egret/resource/skins/StartSkin.exml
View file @
839b1d1e
<?xml version="1.0" encoding="utf-8"?>
<e:Skin
class=
"StartSkin"
width=
"
400"
height=
"300
"
xmlns:e=
"http://ns.egret.com/eui"
>
<e:Skin
class=
"StartSkin"
width=
"
750"
height=
"1206
"
xmlns:e=
"http://ns.egret.com/eui"
>
</e:Skin>
\ No newline at end of file
egret/src/Main.ts
View file @
839b1d1e
...
...
@@ -3,8 +3,9 @@ import Msg from "./alert/Msg";
import
PanelCtrl
from
"./ctrls/panelCtrl"
;
import
SceneCtrl
from
"./ctrls/sceneCtrl"
;
import
RulePanel
from
"./rulePanel/RulePanel"
;
import
{
ModuleTypes
}
from
"./types/sceneTypes"
;
import
StartScene
from
"./startScene/StartScene"
;
import
{
ModuleTypes
}
from
"./types/sceneTypes"
;
import
{
NetManager
}
from
"../libs/tw/manager/NetManager"
;
class
Main
extends
MainBase
{
protected
registerModules
()
{
...
...
@@ -13,6 +14,10 @@ class Main extends MainBase {
SceneCtrl
.
instance
.
registerSceneClass
(
ModuleTypes
.
START_SCENE
,
StartScene
);
}
protected
getData
()
{
super
.
getData
();
NetManager
.
ins
.
getInfo
();
}
protected
async
createGameScene
()
{
SceneCtrl
.
instance
.
change
(
ModuleTypes
.
START_SCENE
);
}
...
...
egret/src/startScene/Box.ts
View file @
839b1d1e
...
...
@@ -8,8 +8,11 @@ export default class Box extends egret.Sprite {
private
END_Y
=
1100
;
static
MIDDLE_Y
=
800
;
speed
=
0
;
static
hashCounter
=
0
hash
;
constructor
(
type
)
{
super
();
this
.
hash
=
Box
.
hashCounter
++
;
this
.
_type
=
type
;
this
.
_pic
=
new
SheetAnimation
();
this
.
addChild
(
this
.
_pic
);
...
...
@@ -73,7 +76,7 @@ export default class Box extends egret.Sprite {
this
.
_pic
.
fps
=
10
;
egret
.
Tween
.
get
(
this
)
.
set
({
alpha
:
0
,
scaleX
:
0
,
scaleY
:
0
,
x
:
this
.
START_X
,
y
:
this
.
START_Y
})
.
to
({
alpha
:
1
,
scaleX
:
this
.
START_SCALE
,
scaleY
:
this
.
START_SCALE
},
1
500
,
egret
.
Ease
.
getBackInOut
(
2
))
.
to
({
alpha
:
1
,
scaleX
:
this
.
START_SCALE
,
scaleY
:
this
.
START_SCALE
},
500
,
egret
.
Ease
.
getBackInOut
(
2
))
.
call
(
this
.
move
,
this
);
this
.
anchorOffsetX
=
this
.
boxData
.
offset
[
0
];
this
.
anchorOffsetY
=
this
.
boxData
.
offset
[
1
];
...
...
@@ -87,14 +90,14 @@ export default class Box extends egret.Sprite {
private
_gy
:
number
;
private
_throwStartVY
:
number
;
private
_scaleMax
=
2
;
onThrowTick
()
:
any
{
onThrowTick
()
{
this
.
_vy
+=
this
.
_gy
;
this
.
y
+=
this
.
_vy
;
const
scale
=
(
this
.
_vyStart
*
this
.
_scaleMax
-
Math
.
abs
(
this
.
_vy
))
/
this
.
_vyStart
;
this
.
scaleX
=
this
.
scaleY
=
scale
;
}
doThrow
()
:
any
{
doThrow
()
{
this
.
_pic
.
stopAtIdleFrame
();
this
.
_throwStartVY
=
this
.
_vy
;
this
.
_vy
=
-
this
.
_vyStart
;
...
...
egret/src/startScene/GuideCtrl.ts
View file @
839b1d1e
...
...
@@ -37,7 +37,7 @@ export default class GuideCtrl {
await
this
.
showtipsAni
(
tips
);
await
this
.
showhandAni
(
hand
);
await
this
.
showguideAni
(
guide_dialog
);
this
.
_main
.
once
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
onTouch
,
this
);
this
.
_main
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
onTouch
,
this
);
}
async
showtipsAni
(
texture
)
{
...
...
@@ -47,7 +47,7 @@ export default class GuideCtrl {
this
.
_guideTop
.
addChild
(
pic
);
return
new
Promise
((
r
)
=>
{
egret
.
Tween
.
get
(
pic
).
set
({
x
:
0
,
y
:
700
+
10
})
.
to
({
x
:
750
/
2
},
200
,
egret
.
Ease
.
getBackOut
(
3
))
.
to
({
x
:
750
/
2
},
200
,
egret
.
Ease
.
getBackOut
(
3
))
.
wait
(
200
)
.
call
(()
=>
r
(
pic
));
});
}
...
...
@@ -59,7 +59,7 @@ export default class GuideCtrl {
this
.
_guideTop
.
addChild
(
pic
);
return
new
Promise
((
r
)
=>
{
egret
.
Tween
.
get
(
pic
).
set
({
x
:
750
,
y
:
700
+
230
}).
to
({
x
:
750
/
2
},
200
,
egret
.
Ease
.
getBackOut
(
3
))
.
call
(()
=>
r
(
pic
));
.
wait
(
200
).
call
(()
=>
r
(
pic
));
});
}
...
...
@@ -70,12 +70,14 @@ export default class GuideCtrl {
this
.
_guideTop
.
addChild
(
pic
);
return
new
Promise
((
r
)
=>
{
egret
.
Tween
.
get
(
pic
).
set
({
x
:
750
,
y
:
200
}).
to
({
x
:
200
},
200
,
egret
.
Ease
.
getBackOut
(
3
))
.
call
(()
=>
r
(
pic
));
.
wait
(
200
).
call
(()
=>
r
(
pic
));
});
}
onTouch
()
{
if
(
!
this
.
_main
.
checkCanDoAtion
())
return
;
this
.
_main
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_BEGIN
,
this
.
onTouch
,
this
);
this
.
_main
.
boxListCtrl
.
updateSpeed
(
__boxMoveSpeed__
);
this
.
setTag
();
this
.
_main
.
guideView
.
destroy
();
...
...
@@ -83,7 +85,7 @@ export default class GuideCtrl {
this
.
_main
.
topLay
.
removeChild
(
this
.
_guideTop
);
this
.
_guideTop
=
null
;
},
this
);
this
.
_main
.
onTouch
();
this
.
_main
.
doAction
();
this
.
_main
.
addTouchEvent
();
}
...
...
egret/src/startScene/StartScene.ts
View file @
839b1d1e
...
...
@@ -9,6 +9,9 @@ import GuideCtrl from "./GuideCtrl";
import
Monkey
from
"./Monkey"
;
import
Net
from
"./Net"
;
import
BoxOpenState
from
"./view/BoxOpenState"
;
import
{
NetManager
}
from
"../../libs/tw/manager/NetManager"
;
import
{
DataManager
}
from
"../../libs/tw/manager/DataManager"
;
import
submitAfterDostart
from
"../../libs/new_tw/ctrls/submitAfterDostart"
;
const
{
TouchEvent
}
=
egret
;
export
default
class
StartScene
extends
Scene
{
...
...
@@ -52,20 +55,6 @@ export default class StartScene extends Scene {
if
(
__debug__
)
{
this
.
_debug
=
new
debug
(
this
.
getLayer
(
LayerTypes
.
top
));
}
const
model
=
new
GamePlayModel
();
model
.
update
();
// box.touchEnabled = true;
// box.addEventListener(egret.TouchEvent.TOUCH_BEGIN, () => {
// NetManager.ins.getInfo(() => {
// model.doStart(() => {
// model.submit(() => { }, box.boxData.award)
// }, false);
// });
// PanelCtrl.instance.show(ModuleTypes.RULE_PANEL);
// }, this);
}
addTouchEvent
()
{
...
...
@@ -78,7 +67,13 @@ export default class StartScene extends Scene {
private
_catchedBox
:
Box
;
private
_cathchedBoxOpenState
:
BoxOpenState
;
async
onTouch
()
{
onTouch
()
{
if
(
!
this
.
checkCanDoAtion
())
return
;
this
.
doAction
();
}
_isBoxFlying
:
boolean
;
doAction
()
{
this
.
_net
.
doAction
();
const
catchedBoxs
=
this
.
_boxListCtrl
.
boxs
.
filter
(
box
=>
Math
.
abs
(
box
.
y
-
Box
.
MIDDLE_Y
)
<
StartScene
.
NET_RANGE
);
...
...
@@ -89,10 +84,50 @@ export default class StartScene extends Scene {
this
.
_boxListCtrl
.
removeBoxFromList
(
catchedBox
);
this
.
_catchedBox
=
catchedBox
;
catchedBox
.
doThrow
();
this
.
_isBoxFlying
=
true
;
this
.
addThrowTick
();
}
else
{
//没有抓住,不需要处理,如果过网了就会自动消失。如果没有过网,下次还能抓。
this
.
checkmode1
();
}
}
private
_mode1DostartTag
=
true
;
private
checkmode1
()
{
if
(
__mode__
==
1
)
{
//发一个空的
this
.
_mode1DostartTag
=
false
;
submitAfterDostart
(()
=>
{
NetManager
.
ins
.
getInfo
(()
=>
{
this
.
_mode1DostartTag
=
true
;
console
.
log
(
'小孩儿休息完毕.'
)
});
},
__award_thanks_score__
);
}
}
openBoxMode
()
{
submitAfterDostart
(()
=>
{
this
.
_cathchedBoxOpenState
.
destroy
();
this
.
_cathchedBoxOpenState
=
null
;
this
.
_isBoxFlying
=
false
;
setTimeout
(()
=>
{
this
.
boxListCtrl
.
resume
();
this
.
_monkey
.
startShaking
();
},
2000
);
NetManager
.
ins
.
getInfo
(()
=>
{
this
.
_mode1DostartTag
=
true
;
console
.
log
(
'小孩儿休息完毕.'
)
});
},
this
.
_cathchedBoxOpenState
.
boxData
.
award
);
}
checkCanDoAtion
()
{
if
(
!
DataManager
.
ins
.
getInfoData
)
{
console
.
log
(
'getinfo接口没有返回'
);
return
false
;
}
if
(
this
.
_isBoxFlying
)
{
console
.
log
(
'box还在飞呢'
);
return
false
;
}
if
(
!
this
.
_mode1DostartTag
&&
__mode__
==
1
)
{
console
.
log
(
'mode1,submitAfterDostart没有执行完成'
);
return
false
;
}
return
true
;
}
addThrowTick
()
{
...
...
@@ -120,6 +155,9 @@ export default class StartScene extends Scene {
this
.
removeThrowTick
();
this
.
_catchedBoxByMoneky
=
this
.
_catchedBox
;
this
.
_catchedBox
=
null
;
this
.
checkmode1
();
this
.
_isBoxFlying
=
false
;
egret
.
Tween
.
get
(
this
.
_catchedBoxByMoneky
)
.
to
({
scaleX
:
1
,
scaleY
:
1
},
500
)
.
wait
(
500
)
...
...
@@ -127,6 +165,7 @@ export default class StartScene extends Scene {
this
.
_catchedBoxByMoneky
.
destroy
();
this
.
_catchedBoxByMoneky
=
null
;
this
.
boxListCtrl
.
resume
();
},
this
);
}
...
...
@@ -136,17 +175,10 @@ export default class StartScene extends Scene {
this
.
_cathchedBoxOpenState
.
x
=
this
.
_catchedBox
.
x
;
this
.
_cathchedBoxOpenState
.
y
=
this
.
_catchedBox
.
y
;
this
.
topLay
.
addChild
(
this
.
_cathchedBoxOpenState
);
this
.
_cathchedBoxOpenState
.
onReady
=
()
=>
{
egret
.
Tween
.
get
(
this
.
_catchedBox
).
to
({
alpha
:
0
},
500
);
this
.
_catchedBox
=
null
;
}
egret
.
Tween
.
get
(
this
.
_catchedBox
).
to
({
alpha
:
0
},
500
);
this
.
_catchedBox
=
null
;
this
.
_cathchedBoxOpenState
.
start
();
setTimeout
(()
=>
{
this
.
_cathchedBoxOpenState
.
destroy
();
this
.
_cathchedBoxOpenState
=
null
;
this
.
boxListCtrl
.
resume
();
},
1000
);
this
.
openBoxMode
();
}
private
_handX
:
number
;
...
...
egret/src/startScene/view/BoxOpenState.ts
View file @
839b1d1e
...
...
@@ -17,12 +17,14 @@ export default class BoxOpenState extends egret.Bitmap {
.
set
({
alpha
:
0
})
.
to
({
alpha
:
1
},
200
)
.
call
(()
=>
{
this
.
onReady
();
//
this.onReady();
this
.
shake
();
})
},
this
,
RES
.
ResourceItem
.
TYPE_SHEET
);
}
get
boxData
()
{
return
__boxmap__
[
this
.
_type
]
}
destroy
()
{
egret
.
Tween
.
removeTweens
(
this
);
egret
.
Tween
.
get
(
this
).
to
({
alpha
:
0
},
500
).
call
(()
=>
{
...
...
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