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
caeebf03
Commit
caeebf03
authored
Nov 23, 2019
by
任建锋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--
parent
cd3f33b2
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
352 additions
and
3673 deletions
+352
-3673
StartScene_20191022115928.ts
.history/egret/src/startScene/StartScene_20191022115928.ts
+0
-894
StartScene_20191022115938.ts
.history/egret/src/startScene/StartScene_20191022115938.ts
+0
-894
StartScene_20191022120008.ts
.history/egret/src/startScene/StartScene_20191022120008.ts
+0
-846
StartScene_20191022120134.ts
.history/egret/src/startScene/StartScene_20191022120134.ts
+0
-73
StartScene_20191022120145.ts
.history/egret/src/startScene/StartScene_20191022120145.ts
+0
-71
StartScene_20191022120150.ts
.history/egret/src/startScene/StartScene_20191022120150.ts
+0
-70
StartScene_20191022120705.ts
.history/egret/src/startScene/StartScene_20191022120705.ts
+0
-76
StartScene_20191022140350.ts
.history/egret/src/startScene/StartScene_20191022140350.ts
+0
-81
StartScene_20191022140448.ts
.history/egret/src/startScene/StartScene_20191022140448.ts
+0
-83
StartScene_20191022140639.ts
.history/egret/src/startScene/StartScene_20191022140639.ts
+0
-85
StartScene_20191022151306.ts
.history/egret/src/startScene/StartScene_20191022151306.ts
+0
-87
StartScene_20191022151431.ts
.history/egret/src/startScene/StartScene_20191022151431.ts
+0
-93
StartScene_20191022202721.ts
.history/egret/src/startScene/StartScene_20191022202721.ts
+0
-99
StartScene_20191023164245.ts
.history/egret/src/startScene/StartScene_20191023164245.ts
+0
-101
StartScene_20191023164417.ts
.history/egret/src/startScene/StartScene_20191023164417.ts
+0
-114
StartScene_20191122175332.ts
.history/egret/src/startScene/StartScene_20191122175332.ts
+174
-0
StartScene_20191123102818.ts
.history/egret/src/startScene/StartScene_20191123102818.ts
+172
-0
PubPanelSkin.exml
egret/resource/skins/PubPanelSkin.exml
+3
-3
StartScene.ts
egret/src/startScene/StartScene.ts
+3
-3
No files found.
.history/egret/src/startScene/StartScene_20191022115928.ts
deleted
100644 → 0
View file @
cd3f33b2
import
{
IDynamicData
}
from
'./../../libs/tw/data/game/datapash/IDynamicData'
;
import
{
GamePlayModel
}
from
'./../../libs/tw/model/game/GamePlayModel'
;
import
{
ModuleTypes
}
from
'./../types/sceneTypes'
;
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
Scene
from
"../views/Scene"
;
import
Loading
from
"../loading/Loading"
;
import
PanelCtrl
from
'../ctrls/panelCtrl'
;
import
{
DataManager
}
from
'../../libs/tw/manager/DataManager'
;
import
{
GTime
}
from
'../../libs/tc/util/GTime'
;
import
{
Buried
}
from
'../../libs/tw/util/Buried'
;
import
SceneCtrl
from
'../ctrls/sceneCtrl'
;
export
default
class
GameScene
extends
Scene
{
public
startBtn
:
eui
.
Button
;
public
turnGroup
:
eui
.
Group
;
public
goodActBg
:
eui
.
Image
;
public
clickGroup
:
eui
.
Group
;
public
goNextLevel
:
eui
.
Group
;
public
goodActHand
:
eui
.
Image
;
public
turnTbBgImg
:
eui
.
Image
;
public
countDownLb
:
eui
.
Label
;
public
goodActGroup
:
eui
.
Group
;
public
passActGroup
:
eui
.
Group
;
public
levelTitleImg
:
eui
.
Image
;
public
bulletCountLb
:
eui
.
Label
;
public
shootActGroup
:
eui
.
Group
;
public
shootBulletImg
:
eui
.
Group
;
private
bEndY
:
number
;
private
isOver
:
boolean
;
private
bStartY
:
number
;
private
isFail
:
boolean
;
private
isRevived
:
boolean
;
private
currLevel
:
number
;
private
timeoutId
:
number
;
private
canShoot
:
boolean
;
private
timer
:
egret
.
Timer
;
private
bulletCount
:
number
;
private
timeDownNum
:
number
;
private
levelCountArr
:
number
[];
private
timeDownNumArr
:
number
[];
private
gPlayModel
:
GamePlayModel
;
private
xinxingAct
:
egret
.
MovieClip
;
private
score
:
number
=
1
;
private
circleImg0
:
eui
.
Image
;
private
circleImg1
:
eui
.
Image
;
private
circleImg2
:
eui
.
Image
;
private
circleImg3
:
eui
.
Image
;
private
circleImg4
:
eui
.
Image
;
private
turnTableBg00
:
eui
.
Image
;
private
turnTableBg01
:
eui
.
Image
;
private
turnTableBg02
:
eui
.
Image
;
public
get
skinKey
()
{
return
'GameScene'
}
public
get
groupName
()
{
return
'game_scene'
}
constructor
(
data
?)
{
super
(
data
);
}
initEvents
()
{
this
.
timer
.
addEventListener
(
egret
.
TimerEvent
.
TIMER
,
this
.
ontimer
,
this
);
this
.
startBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
ontap_startBtn
,
this
);
this
.
clickGroup
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onMainTap
,
this
);
}
removeEvents
()
{
super
.
removeEvents
();
this
.
startBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
ontap_startBtn
,
this
);
this
.
clickGroup
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onMainTap
,
this
);
this
.
timer
.
removeEventListener
(
egret
.
TimerEvent
.
TIMER
,
this
.
ontimer
,
this
);
this
.
timer
.
stop
();
//停止倒计时
}
protected
onSkinComplete
():
void
{
super
.
onSkinComplete
();
// this.mainbg.texture = this.bgtexture;
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
if
(
this
.
stage
)
{
this
.
onLoad
();
}
}
private
bgtexture
:
egret
.
Texture
;
protected
async
preLoadRes
()
{
//加载背景并设置背景图片
// this.bgtexture = await RES.getResAsync('gameBg_jpg');
// console.log('载背景并设置背景图片mainscene');
var
mcJson
=
await
RES
.
getResAsync
(
'xinxingAct_json'
);
var
mcImg
=
await
RES
.
getResAsync
(
'xinxingAct_png'
);
var
mcFactory
=
new
egret
.
MovieClipDataFactory
(
mcJson
,
mcImg
);
this
.
xinxingAct
=
new
egret
.
MovieClip
(
mcFactory
.
generateMovieClipData
());
return
new
Promise
(
function
(
resolve
,
reject
)
{
resolve
();
});
}
start
(
data
?)
{
super
.
start
(
data
);
this
.
timer
=
new
egret
.
Timer
(
1000
);
this
.
percentHeight
=
100
;
}
private
onLoad
():
void
{
//游戏页曝光
// let startDpmOut = Buried.connectDpm(110, 3, 1); // 点击埋点
// let startDcmOut = Buried.connectDcm(202, 0, 0); // 曝光埋点
// let exposure = Buried.createExposure(startDpmOut, startDcmOut);
// NetManager.ins.showLog(exposure);
this
.
showAct
();
this
.
initUI
();
}
private
initUI
():
void
{
this
.
initSceneData
();
this
.
refreshLevelIcon
();
this
.
createCircleImg
();
this
.
showLevelTitleAct
(
true
);
this
.
clickGroup
.
addChild
(
this
.
xinxingAct
);
this
.
xinxingAct
.
y
=
100
;
this
.
xinxingAct
.
visible
=
false
;
// this.onloopReturn();
// this.timer.start();
}
private
canStart
:
boolean
;
private
ontap_beforeStartBtn
()
{
PanelCtrl
.
instance
.
btnDelay
(
this
.
startBtn
);
if
(
!
this
.
canStart
)
return
;
let
data
=
{
scene
:
this
}
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
WARNING_PANEL
,
data
);
}
private
ontap_startBtn
():
void
{
PanelCtrl
.
instance
.
btnDelay
(
this
.
startBtn
);
if
(
!
this
.
canStart
)
return
;
this
.
isOver
=
false
;
//第一关点击
// let startDpmOut = Buried.connectDpm(110, 13, 1); // 点击埋点
// let startDcmOut = Buried.connectDcm(202, 0, 0); // 曝光埋点
// let exposure = Buried.createExposure(startDpmOut, startDcmOut);
// NetManager.ins.clickLog(exposure);
if
(
DataManager
.
ins
.
getInfoData
.
status
.
code
==
3
)
{
// 参与次数已用完
if
(
this
.
isMPBank
())
{
// 端内
PanelCtrl
.
instance
.
showMsg
(
'okBtn'
,
6
,
null
,
null
,
()
=>
{
window
.
location
.
href
=
`
${
window
[
'appIndexLink'
]}
`
},
()
=>
{
window
.
location
.
href
=
`
${
window
[
'appIndexLink'
]}
`
});
}
else
{
// 端外
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
OUTNOTIMES_PANEL
)
}
return
;
}
else
if
(
DataManager
.
ins
.
getInfoData
.
status
.
code
==
2
)
{
// 积分不足
if
(
this
.
isMPBank
())
{
// 端内
PanelCtrl
.
instance
.
showMsg
(
'okBtn'
,
6
,
null
,
null
,
()
=>
{
window
.
location
.
href
=
`
${
window
[
'appIndexLink'
]}
`
},
()
=>
{
window
.
location
.
href
=
`
${
window
[
'appIndexLink'
]}
`
});
}
else
{
// 端外
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
OUTNOTIMES_PANEL
)
}
return
;
}
else
if
(
DataManager
.
ins
.
getInfoData
.
status
.
code
==
1
)
{
// 未登录
PanelCtrl
.
instance
.
showMsg
(
'loginBtn'
,
2
,
null
,
null
,
function
()
{
});
return
;
}
else
{
this
.
dostart
();
}
}
//显示切换关卡页面
private
showLevelTitleAct
(
isshowBtn
:
boolean
=
false
):
void
{
if
(
this
.
currLevel
==
0
)
{
//第一关曝光
let
startDpmOut
=
Buried
.
connectDpm
(
110
,
13
,
1
);
// 点击埋点
let
startDcmOut
=
Buried
.
connectDcm
(
202
,
0
,
0
);
// 曝光埋点
let
exposure
=
Buried
.
createExposure
(
startDpmOut
,
startDcmOut
);
NetManager
.
ins
.
showLog
(
exposure
);
}
else
if
(
this
.
currLevel
==
1
)
{
//第二关曝光
let
startDpmOut
=
Buried
.
connectDpm
(
110
,
13
,
2
);
// 点击埋点
let
startDcmOut
=
Buried
.
connectDcm
(
202
,
0
,
0
);
// 曝光埋点
let
exposure
=
Buried
.
createExposure
(
startDpmOut
,
startDcmOut
);
NetManager
.
ins
.
showLog
(
exposure
);
}
else
if
(
this
.
currLevel
==
2
)
{
//第三关曝光
let
startDpmOut
=
Buried
.
connectDpm
(
110
,
13
,
3
);
// 点击埋点
let
startDcmOut
=
Buried
.
connectDcm
(
202
,
0
,
0
);
// 曝光埋点
let
exposure
=
Buried
.
createExposure
(
startDpmOut
,
startDcmOut
);
NetManager
.
ins
.
showLog
(
exposure
);
}
this
.
levelTitleImg
.
source
=
'gtitle'
+
this
.
currLevel
+
'_png'
;
this
.
startBtn
.
visible
=
isshowBtn
;
this
.
goNextLevel
.
alpha
=
0
;
this
.
goNextLevel
.
visible
=
true
;
egret
.
Tween
.
get
(
this
.
goNextLevel
).
to
({
alpha
:
1
},
300
).
call
(
function
()
{
this
.
canStart
=
true
;
if
(
!
isshowBtn
)
{
setTimeout
(()
=>
{
this
.
xinxingAct
.
visible
=
false
;
this
.
hideLevelTitleAct
();
},
500
);
}
},
this
);
this
.
refreshTurnImg
();
}
private
refreshTurnImg
():
void
{
this
.
turnTableBg00
.
source
=
'turnTableBg'
+
this
.
currLevel
+
'0_png'
;
this
.
turnTableBg01
.
source
=
'turnTableBg'
+
this
.
currLevel
+
'1_png'
;
this
.
turnTableBg02
.
source
=
'turnTableBg'
+
this
.
currLevel
+
'2_png'
;
this
.
turnTbBgImg
.
source
=
'turnTableBg'
+
this
.
currLevel
+
'_png'
;
}
//隐藏切换关卡页面
private
hideLevelTitleAct
():
void
{
egret
.
Tween
.
get
(
this
.
goNextLevel
).
to
({
alpha
:
0
},
300
).
call
(
function
()
{
this
.
canStart
=
false
;
this
.
goNextLevel
.
visible
=
false
;
this
.
onloopReturn
();
if
(
!
this
.
isFail
)
{
// this.onloopReturn();
}
else
{
// egret.Tween.resumeTweens(this.turnGroup);
this
.
shootBulletImg
.
rotation
=
0
;
}
this
.
isFail
=
false
;
this
.
timer
.
start
();
},
this
);
}
//初始化界面数据
private
initSceneData
():
void
{
this
.
levelCountArr
=
window
[
'bulletNum'
]
?
window
[
'bulletNum'
]
:
[
5
,
8
,
12
];
this
.
timeDownNumArr
=
[
12
,
18
,
25
];
this
.
bEndY
=
174.5
+
401
+
441
-
(
750
*
0.5
)
-
20
+
107
;
//this.turnTbBgImg.y + this.turnTbBgImg.height + this.turnGroup.y - 20 + 107;
this
.
bStartY
=
this
.
shootBulletImg
.
y
;
this
.
canShoot
=
true
;
this
.
currLevel
=
0
;
this
.
gPlayModel
=
new
GamePlayModel
();
this
.
bulletCount
=
this
.
levelCountArr
[
this
.
currLevel
];
this
.
timeDownNum
=
this
.
timeDownNumArr
[
this
.
currLevel
];
this
.
countDownLb
.
text
=
this
.
timeDownNum
+
'S'
;
this
.
goodActGroup
.
alpha
=
0
;
this
.
bulletCountLb
.
text
=
'X'
+
this
.
bulletCount
;
this
.
passActGroup
.
visible
=
false
;
this
.
gPlayModel
.
update
();
}
//初始当前关数提示
private
refreshLevelIcon
():
void
{
for
(
let
i
=
1
;
i
<
3
;
i
++
)
{
if
(
i
<=
this
.
currLevel
)
{
const
icon1
=
this
[
'gkIconImg'
+
i
+
1
];
icon1
.
visible
=
true
;
// const icon2 = this['gkIconImg' + i + 2];
// if (icon2) {
// icon2.visible = false;
// }
}
else
{
const
icon1
=
this
[
'gkIconImg'
+
i
+
1
];
icon1
.
visible
=
false
;
// const icon2 = this['gkIconImg' + i + 2];
// if (icon2) {
// icon2.visible = true;
// }
}
}
}
private
onMainTap
(
e
:
egret
.
TouchEvent
):
void
{
if
(
!
this
.
canShoot
)
return
;
console
.
log
(
'onMainTap'
);
console
.
log
(
"this.bEndY="
+
this
.
bEndY
);
//防作弊
const
dynamic
:
IDynamicData
=
{
a
:
'tap'
,
t
:
GTime
.
getTimestamp
(),
x
:
e
.
stageY
,
y
:
e
.
stageY
};
this
.
gPlayModel
.
addDynamic
(
dynamic
);
this
.
canShoot
=
false
;
egret
.
Tween
.
get
(
this
.
shootBulletImg
).
to
({
y
:
this
.
bEndY
},
200
,
egret
.
Ease
.
sineIn
).
call
(
function
()
{
//减少口红数量
this
.
bulletCount
--
;
this
.
bulletCountLb
.
text
=
'X'
+
this
.
bulletCount
;
//插入口红
this
.
intoBullet
();
// egret.Tween.pauseTweens(this.turnGroup);
// setTimeout(() => {
// // this.turnGroup.rotation += 360 / 33;
// egret.Tween.resumeTweens(this.turnGroup);
// }, 1000);
},
this
);
}
//插入口红
private
intoBullet
():
void
{
console
.
log
(
'this.turnGroup.rotation='
+
this
.
turnGroup
.
rotation
);
let
angle
=
this
.
turnGroup
.
rotation
;
if
(
angle
<
0
)
{
angle
=
360
+
angle
;
}
console
.
log
(
'angle='
+
angle
);
// let idx = Math.ceil(Math.floor(angle / (360 / 33) * 100) * 0.01) - 1;
let
idx
=
Math
.
floor
(
angle
/
(
360
/
33
));
console
.
log
(
'idx1='
+
idx
);
if
(
idx
==
0
)
{
idx
=
0
;
//矫正圆盘角度,插中的位置保持正对最下方
this
.
turnGroup
.
rotation
=
0
;
}
else
{
//矫正圆盘角度,插中的位置保持正对最下方
this
.
turnGroup
.
rotation
=
idx
*
(
360
/
33
);
idx
=
33
-
idx
;
}
console
.
log
(
'idx='
+
idx
);
const
img
=
new
eui
.
Image
();
img
.
source
=
'bulletImg_png'
;
const
key
=
'bulletBoxGroup'
+
idx
;
if
(
this
[
key
].
numChildren
>
0
)
{
if
(
this
.
isOver
)
return
;
this
.
isOver
=
true
;
PanelCtrl
.
instance
.
isLoseCoin
=
false
;
this
.
timer
.
stop
();
// egret.Tween.pauseTweens(this.turnGroup);
clearTimeout
(
this
.
timeoutId
);
egret
.
Tween
.
removeTweens
(
this
.
turnGroup
);
console
.
log
(
'游戏结束!'
);
this
.
isFail
=
true
;
egret
.
Tween
.
get
(
this
.
shootBulletImg
).
to
({
rotation
:
50
,
y
:
this
.
shootBulletImg
.
y
+
400
},
300
,
egret
.
Ease
.
cubicOut
).
call
(
function
()
{
this
.
gameOver
()
// NetManager.ins.gameSubmit(function(){},
// DataManager.ins.doStartData.ticketId,
// 0,'[]',DataManager.ins.doStartData.submitToken,""
// );
},
this
);
}
else
{
//判断是否成功插入
if
(
this
.
bulletCount
<=
0
)
{
//进入下一关
this
.
bulletCount
=
0
;
this
.
canShoot
=
false
;
this
.
showCicleDownAct
();
this
.
timer
.
stop
();
}
//圆盘震动
egret
.
Tween
.
get
(
this
.
shootActGroup
).
to
({
y
:
-
10
},
100
,
egret
.
Ease
.
sineIn
).
call
(
function
()
{
egret
.
Tween
.
get
(
this
.
shootActGroup
).
to
({
y
:
0
},
100
,
egret
.
Ease
.
sineIn
).
call
(
function
()
{
},
this
);
},
this
);
//初始化子弹位置
this
.
shootBulletImg
.
alpha
=
0
;
this
.
shootBulletImg
.
y
=
this
.
bStartY
+
this
.
shootBulletImg
.
height
;
//子弹装弹动画
egret
.
Tween
.
get
(
this
.
shootBulletImg
).
to
({
alpha
:
1
,
y
:
this
.
bStartY
},
200
,
egret
.
Ease
.
sineIn
).
call
(
function
()
{
if
(
this
.
bulletCount
>
0
)
{
this
.
canShoot
=
true
;
}
//可以继续发射了
},
this
);
//子弹尾部动画
this
.
showCircleAct
();
this
[
key
].
addChild
(
img
);
//good动画
this
.
showGoodAct
();
}
}
private
direct
:
number
=
1
;
//Math.random() > 0.5 ? 1 : -1
//随机转动
private
onloopReturn
():
void
{
this
.
shootActGroup
.
visible
=
true
;
let
offAngle
=
0
;
let
r
=
Math
.
random
();
if
(
r
<
0.2
)
{
offAngle
=
10
;
}
else
if
(
r
>=
0.2
&&
r
<
0.6
)
{
offAngle
=
100
;
}
else
{
offAngle
=
40
;
}
let
endAngle
=
offAngle
+
Math
.
floor
(
100
*
Math
.
random
());
let
time
=
1000
;
// if (this.isMPBank()) {
// time = 1000;
// } else {
// time = 600;
// }
//100 + 1500 * Math.random(); //endAngle * (5 + 10 * Math.random());
const
endRot
=
this
.
turnGroup
.
rotation
+
endAngle
*
this
.
direct
;
//有时候会连续两次,给turngroup添加转动,到时候转动闪动
egret
.
Tween
.
removeTweens
(
this
.
turnGroup
);
// const endRot = this.turnGroup.rotation + 200 * this.direct;
egret
.
Tween
.
get
(
this
.
turnGroup
).
to
({
rotation
:
endRot
},
time
,
egret
.
Ease
.
getPowOut
(
0.9
)).
call
(
function
()
{
if
(
this
.
direct
>
0
)
{
this
.
direct
=
-
1
;
}
else
{
this
.
direct
=
1
;
}
this
.
timeoutId
=
setTimeout
(()
=>
{
this
.
onloopReturn
();
},
100
);
},
this
);
}
//创建子弹尾部动画元素
private
createCircleImg
():
void
{
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
this
[
'circleImg'
+
i
]
=
new
eui
.
Image
();
this
[
'circleImg'
+
i
].
source
=
'khAct'
+
i
+
'_png'
;
this
[
'circleImg'
+
i
].
alpha
=
0
;
this
.
addChild
(
this
[
'circleImg'
+
i
]);
}
}
//播放子弹尾部圆圈动画
private
showCircleAct
():
void
{
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
this
[
'circleImg'
+
i
].
alpha
=
1
;
this
[
'circleImg'
+
i
].
scaleX
=
1
;
this
[
'circleImg'
+
i
].
scaleY
=
1
;
this
[
'circleImg'
+
i
].
y
=
this
.
bEndY
+
50
;
this
[
'circleImg'
+
i
].
x
=
(
750
-
this
[
'circleImg'
+
i
].
width
)
*
0.5
;
egret
.
Tween
.
removeTweens
(
this
[
'circleImg'
+
i
]);
egret
.
Tween
.
get
(
this
[
'circleImg'
+
i
]).
wait
(
300
).
to
({
alpha
:
0
},
100
);
}
this
.
circleImg0
.
x
+=
20
;
this
.
circleImg1
.
x
-=
5
;
this
.
circleImg2
.
x
-=
10
;
this
.
circleImg3
.
x
+=
10
;
this
.
circleImg2
.
x
-=
20
;
const
time
=
400
;
egret
.
Tween
.
get
(
this
.
circleImg0
).
to
({
alpha
:
0
,
scaleX
:
1.2
,
scaleY
:
1.2
,
x
:
this
.
circleImg0
.
x
+
100
,
y
:
this
.
circleImg0
.
y
+
350
},
time
,
egret
.
Ease
.
cubicOut
);
egret
.
Tween
.
get
(
this
.
circleImg1
).
to
({
alpha
:
0
,
scaleX
:
1.2
,
scaleY
:
1.2
,
x
:
this
.
circleImg1
.
x
-
25
,
y
:
this
.
circleImg1
.
y
+
400
},
time
,
egret
.
Ease
.
cubicOut
);
egret
.
Tween
.
get
(
this
.
circleImg2
).
to
({
alpha
:
0
,
scaleX
:
1.2
,
scaleY
:
1.2
,
x
:
this
.
circleImg2
.
x
-
50
,
y
:
this
.
circleImg2
.
y
+
350
},
time
,
egret
.
Ease
.
cubicOut
);
egret
.
Tween
.
get
(
this
.
circleImg3
).
to
({
alpha
:
0
,
scaleX
:
1.2
,
scaleY
:
1.2
,
x
:
this
.
circleImg3
.
x
+
50
,
y
:
this
.
circleImg3
.
y
+
400
},
time
,
egret
.
Ease
.
cubicOut
);
egret
.
Tween
.
get
(
this
.
circleImg4
).
to
({
alpha
:
0
,
scaleX
:
1.2
,
scaleY
:
1.2
,
x
:
this
.
circleImg4
.
x
-
100
,
y
:
this
.
circleImg4
.
y
+
380
},
time
,
egret
.
Ease
.
cubicOut
);
}
//good动效
private
showGoodAct
():
void
{
egret
.
Tween
.
removeTweens
(
this
.
goodActGroup
);
egret
.
Tween
.
removeTweens
(
this
.
goodActHand
);
this
.
goodActGroup
.
scaleX
=
0
;
this
.
goodActGroup
.
scaleY
=
0
;
this
.
goodActGroup
.
alpha
=
1
;
this
.
goodActGroup
.
rotation
=
0
;
this
.
goodActGroup
.
y
=
247
;
this
.
goodActHand
.
y
=
59
;
//手,位移
egret
.
Tween
.
get
(
this
.
goodActHand
).
wait
(
470
).
to
({
y
:
this
.
goodActHand
.
y
+
25
},
90
).
to
({
y
:
this
.
goodActHand
.
y
+
15
},
120
);
//缩放
egret
.
Tween
.
get
(
this
.
goodActGroup
).
wait
(
60
).
to
({
scaleX
:
1
,
scaleY
:
1
},
190
,
egret
.
Ease
.
cubicOut
).
wait
(
710
).
to
({
scaleX
:
0.7
,
scaleY
:
0.7
},
100
,
egret
.
Ease
.
cubicOut
);
//旋转
egret
.
Tween
.
get
(
this
.
goodActGroup
).
to
({
rotation
:
1120
},
150
,
egret
.
Ease
.
cubicOut
).
to
({
rotation
:
1066
},
90
,
egret
.
Ease
.
cubicOut
).
to
({
rotation
:
1080
},
60
,
egret
.
Ease
.
cubicOut
).
wait
(
560
).
to
({
rotation
:
1063
},
100
,
egret
.
Ease
.
cubicOut
).
to
({
rotation
:
1108
},
100
,
egret
.
Ease
.
cubicOut
);
//透明度
egret
.
Tween
.
get
(
this
.
goodActGroup
).
wait
(
990
).
to
({
alpha
:
0
},
70
);
//位移
egret
.
Tween
.
get
(
this
.
goodActGroup
).
wait
(
910
).
to
({
y
:
this
.
goodActGroup
.
y
-
50
},
150
);
}
private
showCicleDownAct
():
void
{
this
.
shootActGroup
.
visible
=
false
;
clearTimeout
(
this
.
timeoutId
);
egret
.
Tween
.
removeTweens
(
this
.
turnGroup
);
this
.
turnTableBg00
.
x
=
202
;
this
.
turnTableBg01
.
x
=
201
;
this
.
turnTableBg02
.
x
=
201
;
this
.
turnTableBg00
.
y
=
202
;
this
.
turnTableBg01
.
y
=
201
;
this
.
turnTableBg02
.
y
=
201
;
this
.
turnTableBg00
.
rotation
=
0
;
this
.
turnTableBg01
.
rotation
=
0
;
this
.
turnTableBg02
.
rotation
=
0
;
this
.
passActGroup
.
visible
=
true
;
const
time
=
550
;
// this.xinxingAct.play(0);
this
.
xinxingAct
.
gotoAndPlay
(
0
);
this
.
xinxingAct
.
x
=
750
*
0.5
;
this
.
xinxingAct
.
y
=
100
+
714
*
0.5
;
this
.
xinxingAct
.
anchorOffsetX
=
750
*
0.5
;
this
.
xinxingAct
.
anchorOffsetY
=
714
*
0.5
;
this
.
xinxingAct
.
scaleX
=
1
;
this
.
xinxingAct
.
scaleY
=
1
;
this
.
xinxingAct
.
visible
=
true
;
egret
.
Tween
.
get
(
this
.
xinxingAct
).
to
({
scaleX
:
1.4
,
scaleY
:
1.4
,
y
:
this
.
xinxingAct
.
y
+
600
},
time
);
egret
.
Tween
.
get
(
this
.
turnTableBg00
).
to
({
x
:
120
,
rotation
:
-
90
},
time
);
egret
.
Tween
.
get
(
this
.
turnTableBg00
).
to
({
y
:
this
.
turnTableBg00
.
y
+
1250
},
time
,
egret
.
Ease
.
cubicIn
);
egret
.
Tween
.
get
(
this
.
turnTableBg01
).
to
({
x
:
360
,
rotation
:
90
},
time
);
egret
.
Tween
.
get
(
this
.
turnTableBg01
).
to
({
y
:
this
.
turnTableBg00
.
y
+
1250
},
time
,
egret
.
Ease
.
cubicIn
);
egret
.
Tween
.
get
(
this
.
turnTableBg02
).
to
({
x
:
280
,
rotation
:
50
},
time
);
egret
.
Tween
.
get
(
this
.
turnTableBg02
).
to
({
y
:
this
.
turnTableBg00
.
y
+
1250
},
time
,
egret
.
Ease
.
cubicIn
).
call
(
function
()
{
this
.
xinxingAct
.
visible
=
false
;
if
(
this
.
currLevel
==
2
)
{
// 闯关成功
this
.
xinxingAct
.
visible
=
false
;
if
(
this
.
isMPBank
())
{
// 端内
this
.
score
=
20
;
// 分数为20出奖
}
else
{
// 端外
this
.
score
=
1
;
// 分数为1不出奖
}
this
.
gameSubmit
();
}
else
{
//刷新下一关信息
this
.
canShoot
=
true
;
this
.
currLevel
++
;
this
.
bulletCount
=
this
.
levelCountArr
[
this
.
currLevel
];
this
.
timeDownNum
=
this
.
timeDownNumArr
[
this
.
currLevel
];
this
.
countDownLb
.
text
=
this
.
timeDownNum
+
'S'
;
this
.
bulletCountLb
.
text
=
'X'
+
this
.
bulletCount
;
this
.
refreshLevelIcon
();
// this.onloopReturn();
this
.
clearAllBulletGroup
();
this
.
showLevelTitleAct
();
//防作弊
// if (this.gPlayModel.checkDatapash(this.currLevel)) {
// this.gPlayModel.datapash();
// }
}
},
this
);
// egret.Tween.get(this.turnTableBg01).to({y:this.turnTableBg00.y + 1200}, 500, egret.Ease.cubicIn);
// egret.Tween.get(this.turnTableBg02).to({y:this.turnTableBg00.y + 1200}, 500, egret.Ease.cubicIn);
}
//清理所有已经插上的口红
private
clearAllBulletGroup
():
void
{
for
(
let
i
=
0
;
i
<
33
;
i
++
)
{
this
[
'bulletBoxGroup'
+
i
].
removeChildren
();
}
}
private
ontimer
():
void
{
// console.log('this.turnGroup.rotation=' + this.turnGroup.rotation);
//预览图片倒计时
if
(
this
.
timeDownNum
>
0
)
{
this
.
timeDownNum
--
;
this
.
countDownLb
.
text
=
this
.
timeDownNum
+
'S'
;
if
(
this
.
timeDownNum
<=
0
)
{
if
(
this
.
isOver
)
return
;
this
.
isOver
=
true
;
PanelCtrl
.
instance
.
isLoseCoin
=
false
;
this
.
gameOver
();
}
}
}
//游戏失败处理
private
gameOver
():
void
{
this
.
timer
.
stop
();
// egret.Tween.pauseTweens(this.turnGroup);
clearTimeout
(
this
.
timeoutId
);
egret
.
Tween
.
removeTweens
(
this
.
turnGroup
);
console
.
log
(
'游戏结束!'
);
this
.
isFail
=
true
;
if
(
!
this
.
isRevived
)
{
this
.
isRevived
=
true
;
// 本局没有复活过出复活弹窗
let
data
=
{
scene
:
this
};
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
REVIVE_PANEL
,
data
);
}
else
{
// 本局已经复活出再来一次弹窗
NetManager
.
ins
.
gameSubmit
((
success
)
=>
{
// if (!success) {
// // 提交没成功调用一次getinfo
// NetManager.ins.getInfo(() => {
// })
// }
let
data
=
{
scene
:
this
}
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
OVER_PANEL
,
data
)
},
DataManager
.
ins
.
doStartData
.
ticketId
,
1
,
'[]'
,
DataManager
.
ins
.
doStartData
.
submitToken
,
""
);
}
}
//游戏失败弹窗
private
callBack_gameover
():
void
{
this
.
shootActGroup
.
visible
=
true
;
this
.
canShoot
=
true
;
this
.
currLevel
=
0
;
this
.
bulletCount
=
this
.
levelCountArr
[
this
.
currLevel
];
this
.
timeDownNum
=
this
.
timeDownNumArr
[
this
.
currLevel
];
this
.
countDownLb
.
text
=
this
.
timeDownNum
+
'S'
;
this
.
bulletCountLb
.
text
=
'X'
+
this
.
bulletCount
;
this
.
refreshLevelIcon
();
this
.
clearAllBulletGroup
();
this
.
showLevelTitleAct
(
true
);
}
private
dostart
():
void
{
Loading
.
instace
.
show
();
NetManager
.
ins
.
doStart
((
success
:
boolean
)
=>
{
if
(
success
)
{
NetManager
.
ins
.
getStartStatus
(
(
data
)
=>
{
console
.
log
(
'data轮询失败='
+
data
);
Loading
.
instace
.
hide
();
if
(
data
==
'pollingFaild'
||
!
data
)
{
//统一处理异常???????
PanelCtrl
.
instance
.
showMsg
(
'okBtn'
,
4
,
null
,
null
,
null
,
null
,
'请刷新重试~'
);
// Loading.instace.show();
return
}
else
{
//开始游戏
// PanelCtrl.instance.removeImmediately();
this
.
gPlayModel
.
datapash
();
this
.
isRevived
=
false
;
PanelCtrl
.
instance
.
isLoseCoin
=
true
;
this
.
hideLevelTitleAct
();
// this.currLevel = 0;
// this.revive();
}
},
DataManager
.
ins
.
doStartData
.
ticketId
,
()
=>
{
return
DataManager
.
ins
.
getStartStatusData
.
code
==
0
;
},
10
);
}
else
{
Loading
.
instace
.
hide
();
console
.
log
(
'dostart失败'
);
//统一处理异常???????
if
(
DataManager
.
ins
.
doStartData
.
message
.
indexOf
(
"次数已用完"
)
>
-
1
)
{
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
OUTNOTIMES_PANEL
)
}
else
{
PanelCtrl
.
instance
.
showMsg
(
'okBtn'
,
4
,
null
,
null
,
null
,
null
,
'请刷新重试!'
);
}
}
},
false
);
}
private
gameSubmit
()
{
Loading
.
instace
.
show
();
NetManager
.
ins
.
gameSubmit
((
success
:
boolean
)
=>
{
if
(
this
.
isMPBank
())
{
// 端内 判断接口是否成功
if
(
!
success
)
{
// 接口失败
Loading
.
instace
.
hide
();
// 显示未中奖弹窗
let
data
=
{
scene
:
this
}
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
NOPRIZE_PANEL
,
data
);
return
}
//回调捞结果
NetManager
.
ins
.
getSubmitResult
((
data
)
=>
{
if
(
data
==
'pollingFaild'
||
!
data
)
{
//轮询失败 弹错误弹窗
PanelCtrl
.
instance
.
showMsg
(
'okBtn'
,
4
,
null
,
null
,
()
=>
{
// SceneCtrl.instance.change(ModuleTypes.GAME_SCENE)
// 端内 活动首页
window
.
location
.
href
=
`
${
window
[
'appIndexLink'
]}
`
},
()
=>
{
// SceneCtrl.instance.change(ModuleTypes.GAME_SCENE)
// 端内 活动首页
window
.
location
.
href
=
`
${
window
[
'appIndexLink'
]}
`
},
'请去【我的奖品】查看是否中奖~'
);
}
else
{
// 轮询成功 展示奖品
this
.
showPrizePanel
();
PanelCtrl
.
instance
.
isLoseCoin
=
false
;
}
Loading
.
instace
.
hide
();
},
DataManager
.
ins
.
gameSubmitData
.
orderId
,
//轮询
()
=>
{
return
DataManager
.
ins
.
gameGetSubmitResultData
.
flag
;
});
}
else
{
// 端外 不管捞结果 直接进调起app弹窗
Loading
.
instace
.
hide
();
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
OUTWIN_PANEL
);
}
},
DataManager
.
ins
.
doStartData
.
ticketId
,
this
.
score
,
'[]'
,
DataManager
.
ins
.
doStartData
.
submitToken
,
JSON
.
stringify
(
this
.
gPlayModel
.
allDynamicsData
),
true
)
}
private
showPrizePanel
():
void
{
//处理中奖情况
if
(
DataManager
.
ins
.
gameGetSubmitResultData
&&
DataManager
.
ins
.
gameGetSubmitResultData
.
lottery
)
{
//中奖了
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
PRIZE_PANEL
,
this
.
callBack_gameover
.
bind
(
this
));
}
else
{
//未中奖,(必中活动未中奖要做容错处理)
let
data
=
{
scene
:
this
};
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
NOPRIZE_PANEL
,
data
);
}
}
private
errMsgCallBack
()
{
if
(
!
this
.
timer
)
{
alert
(
'网络开小差了
\
n请刷新重试!'
);
return
;
}
this
.
timer
.
stop
();
// egret.Tween.pauseTweens(this.turnGroup);
console
.
log
(
'游戏结束!'
);
this
.
isFail
=
true
;
this
.
callBack_gameover
();
}
// 复活
public
revive
()
{
this
.
canShoot
=
true
;
this
.
isOver
=
false
;
this
.
bulletCount
=
this
.
levelCountArr
[
this
.
currLevel
];
this
.
timeDownNum
=
this
.
timeDownNumArr
[
this
.
currLevel
];
this
.
countDownLb
.
text
=
this
.
timeDownNum
+
'S'
;
this
.
bulletCountLb
.
text
=
'X'
+
this
.
bulletCount
;
console
.
log
(
this
.
timeDownNum
)
this
.
refreshLevelIcon
();
// this.onloopReturn();
this
.
clearAllBulletGroup
();
this
.
showLevelTitleAct
();
//防作弊
if
(
this
.
gPlayModel
.
checkDatapash
(
this
.
currLevel
))
{
this
.
gPlayModel
.
datapash
();
}
this
.
timer
.
start
();
}
private
isMPBank
()
{
var
ua
=
navigator
.
userAgent
;
// var ua = 'MPBank'
if
(
ua
.
indexOf
(
'MPBank'
)
>
-
1
)
return
true
;
else
return
false
;
}
}
\ No newline at end of file
.history/egret/src/startScene/StartScene_20191022115938.ts
deleted
100644 → 0
View file @
cd3f33b2
import
{
IDynamicData
}
from
'./../../libs/tw/data/game/datapash/IDynamicData'
;
import
{
GamePlayModel
}
from
'./../../libs/tw/model/game/GamePlayModel'
;
import
{
ModuleTypes
}
from
'./../types/sceneTypes'
;
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
Scene
from
"../views/Scene"
;
import
Loading
from
"../loading/Loading"
;
import
PanelCtrl
from
'../ctrls/panelCtrl'
;
import
{
DataManager
}
from
'../../libs/tw/manager/DataManager'
;
import
{
GTime
}
from
'../../libs/tc/util/GTime'
;
import
{
Buried
}
from
'../../libs/tw/util/Buried'
;
import
SceneCtrl
from
'../ctrls/sceneCtrl'
;
export
default
class
StartScene
extends
Scene
{
public
startBtn
:
eui
.
Button
;
public
turnGroup
:
eui
.
Group
;
public
goodActBg
:
eui
.
Image
;
public
clickGroup
:
eui
.
Group
;
public
goNextLevel
:
eui
.
Group
;
public
goodActHand
:
eui
.
Image
;
public
turnTbBgImg
:
eui
.
Image
;
public
countDownLb
:
eui
.
Label
;
public
goodActGroup
:
eui
.
Group
;
public
passActGroup
:
eui
.
Group
;
public
levelTitleImg
:
eui
.
Image
;
public
bulletCountLb
:
eui
.
Label
;
public
shootActGroup
:
eui
.
Group
;
public
shootBulletImg
:
eui
.
Group
;
private
bEndY
:
number
;
private
isOver
:
boolean
;
private
bStartY
:
number
;
private
isFail
:
boolean
;
private
isRevived
:
boolean
;
private
currLevel
:
number
;
private
timeoutId
:
number
;
private
canShoot
:
boolean
;
private
timer
:
egret
.
Timer
;
private
bulletCount
:
number
;
private
timeDownNum
:
number
;
private
levelCountArr
:
number
[];
private
timeDownNumArr
:
number
[];
private
gPlayModel
:
GamePlayModel
;
private
xinxingAct
:
egret
.
MovieClip
;
private
score
:
number
=
1
;
private
circleImg0
:
eui
.
Image
;
private
circleImg1
:
eui
.
Image
;
private
circleImg2
:
eui
.
Image
;
private
circleImg3
:
eui
.
Image
;
private
circleImg4
:
eui
.
Image
;
private
turnTableBg00
:
eui
.
Image
;
private
turnTableBg01
:
eui
.
Image
;
private
turnTableBg02
:
eui
.
Image
;
public
get
skinKey
()
{
return
'GameScene'
}
public
get
groupName
()
{
return
'game_scene'
}
constructor
(
data
?)
{
super
(
data
);
}
initEvents
()
{
this
.
timer
.
addEventListener
(
egret
.
TimerEvent
.
TIMER
,
this
.
ontimer
,
this
);
this
.
startBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
ontap_startBtn
,
this
);
this
.
clickGroup
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onMainTap
,
this
);
}
removeEvents
()
{
super
.
removeEvents
();
this
.
startBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
ontap_startBtn
,
this
);
this
.
clickGroup
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onMainTap
,
this
);
this
.
timer
.
removeEventListener
(
egret
.
TimerEvent
.
TIMER
,
this
.
ontimer
,
this
);
this
.
timer
.
stop
();
//停止倒计时
}
protected
onSkinComplete
():
void
{
super
.
onSkinComplete
();
// this.mainbg.texture = this.bgtexture;
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
if
(
this
.
stage
)
{
this
.
onLoad
();
}
}
private
bgtexture
:
egret
.
Texture
;
protected
async
preLoadRes
()
{
//加载背景并设置背景图片
// this.bgtexture = await RES.getResAsync('gameBg_jpg');
// console.log('载背景并设置背景图片mainscene');
var
mcJson
=
await
RES
.
getResAsync
(
'xinxingAct_json'
);
var
mcImg
=
await
RES
.
getResAsync
(
'xinxingAct_png'
);
var
mcFactory
=
new
egret
.
MovieClipDataFactory
(
mcJson
,
mcImg
);
this
.
xinxingAct
=
new
egret
.
MovieClip
(
mcFactory
.
generateMovieClipData
());
return
new
Promise
(
function
(
resolve
,
reject
)
{
resolve
();
});
}
start
(
data
?)
{
super
.
start
(
data
);
this
.
timer
=
new
egret
.
Timer
(
1000
);
this
.
percentHeight
=
100
;
}
private
onLoad
():
void
{
//游戏页曝光
// let startDpmOut = Buried.connectDpm(110, 3, 1); // 点击埋点
// let startDcmOut = Buried.connectDcm(202, 0, 0); // 曝光埋点
// let exposure = Buried.createExposure(startDpmOut, startDcmOut);
// NetManager.ins.showLog(exposure);
this
.
showAct
();
this
.
initUI
();
}
private
initUI
():
void
{
this
.
initSceneData
();
this
.
refreshLevelIcon
();
this
.
createCircleImg
();
this
.
showLevelTitleAct
(
true
);
this
.
clickGroup
.
addChild
(
this
.
xinxingAct
);
this
.
xinxingAct
.
y
=
100
;
this
.
xinxingAct
.
visible
=
false
;
// this.onloopReturn();
// this.timer.start();
}
private
canStart
:
boolean
;
private
ontap_beforeStartBtn
()
{
PanelCtrl
.
instance
.
btnDelay
(
this
.
startBtn
);
if
(
!
this
.
canStart
)
return
;
let
data
=
{
scene
:
this
}
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
WARNING_PANEL
,
data
);
}
private
ontap_startBtn
():
void
{
PanelCtrl
.
instance
.
btnDelay
(
this
.
startBtn
);
if
(
!
this
.
canStart
)
return
;
this
.
isOver
=
false
;
//第一关点击
// let startDpmOut = Buried.connectDpm(110, 13, 1); // 点击埋点
// let startDcmOut = Buried.connectDcm(202, 0, 0); // 曝光埋点
// let exposure = Buried.createExposure(startDpmOut, startDcmOut);
// NetManager.ins.clickLog(exposure);
if
(
DataManager
.
ins
.
getInfoData
.
status
.
code
==
3
)
{
// 参与次数已用完
if
(
this
.
isMPBank
())
{
// 端内
PanelCtrl
.
instance
.
showMsg
(
'okBtn'
,
6
,
null
,
null
,
()
=>
{
window
.
location
.
href
=
`
${
window
[
'appIndexLink'
]}
`
},
()
=>
{
window
.
location
.
href
=
`
${
window
[
'appIndexLink'
]}
`
});
}
else
{
// 端外
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
OUTNOTIMES_PANEL
)
}
return
;
}
else
if
(
DataManager
.
ins
.
getInfoData
.
status
.
code
==
2
)
{
// 积分不足
if
(
this
.
isMPBank
())
{
// 端内
PanelCtrl
.
instance
.
showMsg
(
'okBtn'
,
6
,
null
,
null
,
()
=>
{
window
.
location
.
href
=
`
${
window
[
'appIndexLink'
]}
`
},
()
=>
{
window
.
location
.
href
=
`
${
window
[
'appIndexLink'
]}
`
});
}
else
{
// 端外
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
OUTNOTIMES_PANEL
)
}
return
;
}
else
if
(
DataManager
.
ins
.
getInfoData
.
status
.
code
==
1
)
{
// 未登录
PanelCtrl
.
instance
.
showMsg
(
'loginBtn'
,
2
,
null
,
null
,
function
()
{
});
return
;
}
else
{
this
.
dostart
();
}
}
//显示切换关卡页面
private
showLevelTitleAct
(
isshowBtn
:
boolean
=
false
):
void
{
if
(
this
.
currLevel
==
0
)
{
//第一关曝光
let
startDpmOut
=
Buried
.
connectDpm
(
110
,
13
,
1
);
// 点击埋点
let
startDcmOut
=
Buried
.
connectDcm
(
202
,
0
,
0
);
// 曝光埋点
let
exposure
=
Buried
.
createExposure
(
startDpmOut
,
startDcmOut
);
NetManager
.
ins
.
showLog
(
exposure
);
}
else
if
(
this
.
currLevel
==
1
)
{
//第二关曝光
let
startDpmOut
=
Buried
.
connectDpm
(
110
,
13
,
2
);
// 点击埋点
let
startDcmOut
=
Buried
.
connectDcm
(
202
,
0
,
0
);
// 曝光埋点
let
exposure
=
Buried
.
createExposure
(
startDpmOut
,
startDcmOut
);
NetManager
.
ins
.
showLog
(
exposure
);
}
else
if
(
this
.
currLevel
==
2
)
{
//第三关曝光
let
startDpmOut
=
Buried
.
connectDpm
(
110
,
13
,
3
);
// 点击埋点
let
startDcmOut
=
Buried
.
connectDcm
(
202
,
0
,
0
);
// 曝光埋点
let
exposure
=
Buried
.
createExposure
(
startDpmOut
,
startDcmOut
);
NetManager
.
ins
.
showLog
(
exposure
);
}
this
.
levelTitleImg
.
source
=
'gtitle'
+
this
.
currLevel
+
'_png'
;
this
.
startBtn
.
visible
=
isshowBtn
;
this
.
goNextLevel
.
alpha
=
0
;
this
.
goNextLevel
.
visible
=
true
;
egret
.
Tween
.
get
(
this
.
goNextLevel
).
to
({
alpha
:
1
},
300
).
call
(
function
()
{
this
.
canStart
=
true
;
if
(
!
isshowBtn
)
{
setTimeout
(()
=>
{
this
.
xinxingAct
.
visible
=
false
;
this
.
hideLevelTitleAct
();
},
500
);
}
},
this
);
this
.
refreshTurnImg
();
}
private
refreshTurnImg
():
void
{
this
.
turnTableBg00
.
source
=
'turnTableBg'
+
this
.
currLevel
+
'0_png'
;
this
.
turnTableBg01
.
source
=
'turnTableBg'
+
this
.
currLevel
+
'1_png'
;
this
.
turnTableBg02
.
source
=
'turnTableBg'
+
this
.
currLevel
+
'2_png'
;
this
.
turnTbBgImg
.
source
=
'turnTableBg'
+
this
.
currLevel
+
'_png'
;
}
//隐藏切换关卡页面
private
hideLevelTitleAct
():
void
{
egret
.
Tween
.
get
(
this
.
goNextLevel
).
to
({
alpha
:
0
},
300
).
call
(
function
()
{
this
.
canStart
=
false
;
this
.
goNextLevel
.
visible
=
false
;
this
.
onloopReturn
();
if
(
!
this
.
isFail
)
{
// this.onloopReturn();
}
else
{
// egret.Tween.resumeTweens(this.turnGroup);
this
.
shootBulletImg
.
rotation
=
0
;
}
this
.
isFail
=
false
;
this
.
timer
.
start
();
},
this
);
}
//初始化界面数据
private
initSceneData
():
void
{
this
.
levelCountArr
=
window
[
'bulletNum'
]
?
window
[
'bulletNum'
]
:
[
5
,
8
,
12
];
this
.
timeDownNumArr
=
[
12
,
18
,
25
];
this
.
bEndY
=
174.5
+
401
+
441
-
(
750
*
0.5
)
-
20
+
107
;
//this.turnTbBgImg.y + this.turnTbBgImg.height + this.turnGroup.y - 20 + 107;
this
.
bStartY
=
this
.
shootBulletImg
.
y
;
this
.
canShoot
=
true
;
this
.
currLevel
=
0
;
this
.
gPlayModel
=
new
GamePlayModel
();
this
.
bulletCount
=
this
.
levelCountArr
[
this
.
currLevel
];
this
.
timeDownNum
=
this
.
timeDownNumArr
[
this
.
currLevel
];
this
.
countDownLb
.
text
=
this
.
timeDownNum
+
'S'
;
this
.
goodActGroup
.
alpha
=
0
;
this
.
bulletCountLb
.
text
=
'X'
+
this
.
bulletCount
;
this
.
passActGroup
.
visible
=
false
;
this
.
gPlayModel
.
update
();
}
//初始当前关数提示
private
refreshLevelIcon
():
void
{
for
(
let
i
=
1
;
i
<
3
;
i
++
)
{
if
(
i
<=
this
.
currLevel
)
{
const
icon1
=
this
[
'gkIconImg'
+
i
+
1
];
icon1
.
visible
=
true
;
// const icon2 = this['gkIconImg' + i + 2];
// if (icon2) {
// icon2.visible = false;
// }
}
else
{
const
icon1
=
this
[
'gkIconImg'
+
i
+
1
];
icon1
.
visible
=
false
;
// const icon2 = this['gkIconImg' + i + 2];
// if (icon2) {
// icon2.visible = true;
// }
}
}
}
private
onMainTap
(
e
:
egret
.
TouchEvent
):
void
{
if
(
!
this
.
canShoot
)
return
;
console
.
log
(
'onMainTap'
);
console
.
log
(
"this.bEndY="
+
this
.
bEndY
);
//防作弊
const
dynamic
:
IDynamicData
=
{
a
:
'tap'
,
t
:
GTime
.
getTimestamp
(),
x
:
e
.
stageY
,
y
:
e
.
stageY
};
this
.
gPlayModel
.
addDynamic
(
dynamic
);
this
.
canShoot
=
false
;
egret
.
Tween
.
get
(
this
.
shootBulletImg
).
to
({
y
:
this
.
bEndY
},
200
,
egret
.
Ease
.
sineIn
).
call
(
function
()
{
//减少口红数量
this
.
bulletCount
--
;
this
.
bulletCountLb
.
text
=
'X'
+
this
.
bulletCount
;
//插入口红
this
.
intoBullet
();
// egret.Tween.pauseTweens(this.turnGroup);
// setTimeout(() => {
// // this.turnGroup.rotation += 360 / 33;
// egret.Tween.resumeTweens(this.turnGroup);
// }, 1000);
},
this
);
}
//插入口红
private
intoBullet
():
void
{
console
.
log
(
'this.turnGroup.rotation='
+
this
.
turnGroup
.
rotation
);
let
angle
=
this
.
turnGroup
.
rotation
;
if
(
angle
<
0
)
{
angle
=
360
+
angle
;
}
console
.
log
(
'angle='
+
angle
);
// let idx = Math.ceil(Math.floor(angle / (360 / 33) * 100) * 0.01) - 1;
let
idx
=
Math
.
floor
(
angle
/
(
360
/
33
));
console
.
log
(
'idx1='
+
idx
);
if
(
idx
==
0
)
{
idx
=
0
;
//矫正圆盘角度,插中的位置保持正对最下方
this
.
turnGroup
.
rotation
=
0
;
}
else
{
//矫正圆盘角度,插中的位置保持正对最下方
this
.
turnGroup
.
rotation
=
idx
*
(
360
/
33
);
idx
=
33
-
idx
;
}
console
.
log
(
'idx='
+
idx
);
const
img
=
new
eui
.
Image
();
img
.
source
=
'bulletImg_png'
;
const
key
=
'bulletBoxGroup'
+
idx
;
if
(
this
[
key
].
numChildren
>
0
)
{
if
(
this
.
isOver
)
return
;
this
.
isOver
=
true
;
PanelCtrl
.
instance
.
isLoseCoin
=
false
;
this
.
timer
.
stop
();
// egret.Tween.pauseTweens(this.turnGroup);
clearTimeout
(
this
.
timeoutId
);
egret
.
Tween
.
removeTweens
(
this
.
turnGroup
);
console
.
log
(
'游戏结束!'
);
this
.
isFail
=
true
;
egret
.
Tween
.
get
(
this
.
shootBulletImg
).
to
({
rotation
:
50
,
y
:
this
.
shootBulletImg
.
y
+
400
},
300
,
egret
.
Ease
.
cubicOut
).
call
(
function
()
{
this
.
gameOver
()
// NetManager.ins.gameSubmit(function(){},
// DataManager.ins.doStartData.ticketId,
// 0,'[]',DataManager.ins.doStartData.submitToken,""
// );
},
this
);
}
else
{
//判断是否成功插入
if
(
this
.
bulletCount
<=
0
)
{
//进入下一关
this
.
bulletCount
=
0
;
this
.
canShoot
=
false
;
this
.
showCicleDownAct
();
this
.
timer
.
stop
();
}
//圆盘震动
egret
.
Tween
.
get
(
this
.
shootActGroup
).
to
({
y
:
-
10
},
100
,
egret
.
Ease
.
sineIn
).
call
(
function
()
{
egret
.
Tween
.
get
(
this
.
shootActGroup
).
to
({
y
:
0
},
100
,
egret
.
Ease
.
sineIn
).
call
(
function
()
{
},
this
);
},
this
);
//初始化子弹位置
this
.
shootBulletImg
.
alpha
=
0
;
this
.
shootBulletImg
.
y
=
this
.
bStartY
+
this
.
shootBulletImg
.
height
;
//子弹装弹动画
egret
.
Tween
.
get
(
this
.
shootBulletImg
).
to
({
alpha
:
1
,
y
:
this
.
bStartY
},
200
,
egret
.
Ease
.
sineIn
).
call
(
function
()
{
if
(
this
.
bulletCount
>
0
)
{
this
.
canShoot
=
true
;
}
//可以继续发射了
},
this
);
//子弹尾部动画
this
.
showCircleAct
();
this
[
key
].
addChild
(
img
);
//good动画
this
.
showGoodAct
();
}
}
private
direct
:
number
=
1
;
//Math.random() > 0.5 ? 1 : -1
//随机转动
private
onloopReturn
():
void
{
this
.
shootActGroup
.
visible
=
true
;
let
offAngle
=
0
;
let
r
=
Math
.
random
();
if
(
r
<
0.2
)
{
offAngle
=
10
;
}
else
if
(
r
>=
0.2
&&
r
<
0.6
)
{
offAngle
=
100
;
}
else
{
offAngle
=
40
;
}
let
endAngle
=
offAngle
+
Math
.
floor
(
100
*
Math
.
random
());
let
time
=
1000
;
// if (this.isMPBank()) {
// time = 1000;
// } else {
// time = 600;
// }
//100 + 1500 * Math.random(); //endAngle * (5 + 10 * Math.random());
const
endRot
=
this
.
turnGroup
.
rotation
+
endAngle
*
this
.
direct
;
//有时候会连续两次,给turngroup添加转动,到时候转动闪动
egret
.
Tween
.
removeTweens
(
this
.
turnGroup
);
// const endRot = this.turnGroup.rotation + 200 * this.direct;
egret
.
Tween
.
get
(
this
.
turnGroup
).
to
({
rotation
:
endRot
},
time
,
egret
.
Ease
.
getPowOut
(
0.9
)).
call
(
function
()
{
if
(
this
.
direct
>
0
)
{
this
.
direct
=
-
1
;
}
else
{
this
.
direct
=
1
;
}
this
.
timeoutId
=
setTimeout
(()
=>
{
this
.
onloopReturn
();
},
100
);
},
this
);
}
//创建子弹尾部动画元素
private
createCircleImg
():
void
{
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
this
[
'circleImg'
+
i
]
=
new
eui
.
Image
();
this
[
'circleImg'
+
i
].
source
=
'khAct'
+
i
+
'_png'
;
this
[
'circleImg'
+
i
].
alpha
=
0
;
this
.
addChild
(
this
[
'circleImg'
+
i
]);
}
}
//播放子弹尾部圆圈动画
private
showCircleAct
():
void
{
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
this
[
'circleImg'
+
i
].
alpha
=
1
;
this
[
'circleImg'
+
i
].
scaleX
=
1
;
this
[
'circleImg'
+
i
].
scaleY
=
1
;
this
[
'circleImg'
+
i
].
y
=
this
.
bEndY
+
50
;
this
[
'circleImg'
+
i
].
x
=
(
750
-
this
[
'circleImg'
+
i
].
width
)
*
0.5
;
egret
.
Tween
.
removeTweens
(
this
[
'circleImg'
+
i
]);
egret
.
Tween
.
get
(
this
[
'circleImg'
+
i
]).
wait
(
300
).
to
({
alpha
:
0
},
100
);
}
this
.
circleImg0
.
x
+=
20
;
this
.
circleImg1
.
x
-=
5
;
this
.
circleImg2
.
x
-=
10
;
this
.
circleImg3
.
x
+=
10
;
this
.
circleImg2
.
x
-=
20
;
const
time
=
400
;
egret
.
Tween
.
get
(
this
.
circleImg0
).
to
({
alpha
:
0
,
scaleX
:
1.2
,
scaleY
:
1.2
,
x
:
this
.
circleImg0
.
x
+
100
,
y
:
this
.
circleImg0
.
y
+
350
},
time
,
egret
.
Ease
.
cubicOut
);
egret
.
Tween
.
get
(
this
.
circleImg1
).
to
({
alpha
:
0
,
scaleX
:
1.2
,
scaleY
:
1.2
,
x
:
this
.
circleImg1
.
x
-
25
,
y
:
this
.
circleImg1
.
y
+
400
},
time
,
egret
.
Ease
.
cubicOut
);
egret
.
Tween
.
get
(
this
.
circleImg2
).
to
({
alpha
:
0
,
scaleX
:
1.2
,
scaleY
:
1.2
,
x
:
this
.
circleImg2
.
x
-
50
,
y
:
this
.
circleImg2
.
y
+
350
},
time
,
egret
.
Ease
.
cubicOut
);
egret
.
Tween
.
get
(
this
.
circleImg3
).
to
({
alpha
:
0
,
scaleX
:
1.2
,
scaleY
:
1.2
,
x
:
this
.
circleImg3
.
x
+
50
,
y
:
this
.
circleImg3
.
y
+
400
},
time
,
egret
.
Ease
.
cubicOut
);
egret
.
Tween
.
get
(
this
.
circleImg4
).
to
({
alpha
:
0
,
scaleX
:
1.2
,
scaleY
:
1.2
,
x
:
this
.
circleImg4
.
x
-
100
,
y
:
this
.
circleImg4
.
y
+
380
},
time
,
egret
.
Ease
.
cubicOut
);
}
//good动效
private
showGoodAct
():
void
{
egret
.
Tween
.
removeTweens
(
this
.
goodActGroup
);
egret
.
Tween
.
removeTweens
(
this
.
goodActHand
);
this
.
goodActGroup
.
scaleX
=
0
;
this
.
goodActGroup
.
scaleY
=
0
;
this
.
goodActGroup
.
alpha
=
1
;
this
.
goodActGroup
.
rotation
=
0
;
this
.
goodActGroup
.
y
=
247
;
this
.
goodActHand
.
y
=
59
;
//手,位移
egret
.
Tween
.
get
(
this
.
goodActHand
).
wait
(
470
).
to
({
y
:
this
.
goodActHand
.
y
+
25
},
90
).
to
({
y
:
this
.
goodActHand
.
y
+
15
},
120
);
//缩放
egret
.
Tween
.
get
(
this
.
goodActGroup
).
wait
(
60
).
to
({
scaleX
:
1
,
scaleY
:
1
},
190
,
egret
.
Ease
.
cubicOut
).
wait
(
710
).
to
({
scaleX
:
0.7
,
scaleY
:
0.7
},
100
,
egret
.
Ease
.
cubicOut
);
//旋转
egret
.
Tween
.
get
(
this
.
goodActGroup
).
to
({
rotation
:
1120
},
150
,
egret
.
Ease
.
cubicOut
).
to
({
rotation
:
1066
},
90
,
egret
.
Ease
.
cubicOut
).
to
({
rotation
:
1080
},
60
,
egret
.
Ease
.
cubicOut
).
wait
(
560
).
to
({
rotation
:
1063
},
100
,
egret
.
Ease
.
cubicOut
).
to
({
rotation
:
1108
},
100
,
egret
.
Ease
.
cubicOut
);
//透明度
egret
.
Tween
.
get
(
this
.
goodActGroup
).
wait
(
990
).
to
({
alpha
:
0
},
70
);
//位移
egret
.
Tween
.
get
(
this
.
goodActGroup
).
wait
(
910
).
to
({
y
:
this
.
goodActGroup
.
y
-
50
},
150
);
}
private
showCicleDownAct
():
void
{
this
.
shootActGroup
.
visible
=
false
;
clearTimeout
(
this
.
timeoutId
);
egret
.
Tween
.
removeTweens
(
this
.
turnGroup
);
this
.
turnTableBg00
.
x
=
202
;
this
.
turnTableBg01
.
x
=
201
;
this
.
turnTableBg02
.
x
=
201
;
this
.
turnTableBg00
.
y
=
202
;
this
.
turnTableBg01
.
y
=
201
;
this
.
turnTableBg02
.
y
=
201
;
this
.
turnTableBg00
.
rotation
=
0
;
this
.
turnTableBg01
.
rotation
=
0
;
this
.
turnTableBg02
.
rotation
=
0
;
this
.
passActGroup
.
visible
=
true
;
const
time
=
550
;
// this.xinxingAct.play(0);
this
.
xinxingAct
.
gotoAndPlay
(
0
);
this
.
xinxingAct
.
x
=
750
*
0.5
;
this
.
xinxingAct
.
y
=
100
+
714
*
0.5
;
this
.
xinxingAct
.
anchorOffsetX
=
750
*
0.5
;
this
.
xinxingAct
.
anchorOffsetY
=
714
*
0.5
;
this
.
xinxingAct
.
scaleX
=
1
;
this
.
xinxingAct
.
scaleY
=
1
;
this
.
xinxingAct
.
visible
=
true
;
egret
.
Tween
.
get
(
this
.
xinxingAct
).
to
({
scaleX
:
1.4
,
scaleY
:
1.4
,
y
:
this
.
xinxingAct
.
y
+
600
},
time
);
egret
.
Tween
.
get
(
this
.
turnTableBg00
).
to
({
x
:
120
,
rotation
:
-
90
},
time
);
egret
.
Tween
.
get
(
this
.
turnTableBg00
).
to
({
y
:
this
.
turnTableBg00
.
y
+
1250
},
time
,
egret
.
Ease
.
cubicIn
);
egret
.
Tween
.
get
(
this
.
turnTableBg01
).
to
({
x
:
360
,
rotation
:
90
},
time
);
egret
.
Tween
.
get
(
this
.
turnTableBg01
).
to
({
y
:
this
.
turnTableBg00
.
y
+
1250
},
time
,
egret
.
Ease
.
cubicIn
);
egret
.
Tween
.
get
(
this
.
turnTableBg02
).
to
({
x
:
280
,
rotation
:
50
},
time
);
egret
.
Tween
.
get
(
this
.
turnTableBg02
).
to
({
y
:
this
.
turnTableBg00
.
y
+
1250
},
time
,
egret
.
Ease
.
cubicIn
).
call
(
function
()
{
this
.
xinxingAct
.
visible
=
false
;
if
(
this
.
currLevel
==
2
)
{
// 闯关成功
this
.
xinxingAct
.
visible
=
false
;
if
(
this
.
isMPBank
())
{
// 端内
this
.
score
=
20
;
// 分数为20出奖
}
else
{
// 端外
this
.
score
=
1
;
// 分数为1不出奖
}
this
.
gameSubmit
();
}
else
{
//刷新下一关信息
this
.
canShoot
=
true
;
this
.
currLevel
++
;
this
.
bulletCount
=
this
.
levelCountArr
[
this
.
currLevel
];
this
.
timeDownNum
=
this
.
timeDownNumArr
[
this
.
currLevel
];
this
.
countDownLb
.
text
=
this
.
timeDownNum
+
'S'
;
this
.
bulletCountLb
.
text
=
'X'
+
this
.
bulletCount
;
this
.
refreshLevelIcon
();
// this.onloopReturn();
this
.
clearAllBulletGroup
();
this
.
showLevelTitleAct
();
//防作弊
// if (this.gPlayModel.checkDatapash(this.currLevel)) {
// this.gPlayModel.datapash();
// }
}
},
this
);
// egret.Tween.get(this.turnTableBg01).to({y:this.turnTableBg00.y + 1200}, 500, egret.Ease.cubicIn);
// egret.Tween.get(this.turnTableBg02).to({y:this.turnTableBg00.y + 1200}, 500, egret.Ease.cubicIn);
}
//清理所有已经插上的口红
private
clearAllBulletGroup
():
void
{
for
(
let
i
=
0
;
i
<
33
;
i
++
)
{
this
[
'bulletBoxGroup'
+
i
].
removeChildren
();
}
}
private
ontimer
():
void
{
// console.log('this.turnGroup.rotation=' + this.turnGroup.rotation);
//预览图片倒计时
if
(
this
.
timeDownNum
>
0
)
{
this
.
timeDownNum
--
;
this
.
countDownLb
.
text
=
this
.
timeDownNum
+
'S'
;
if
(
this
.
timeDownNum
<=
0
)
{
if
(
this
.
isOver
)
return
;
this
.
isOver
=
true
;
PanelCtrl
.
instance
.
isLoseCoin
=
false
;
this
.
gameOver
();
}
}
}
//游戏失败处理
private
gameOver
():
void
{
this
.
timer
.
stop
();
// egret.Tween.pauseTweens(this.turnGroup);
clearTimeout
(
this
.
timeoutId
);
egret
.
Tween
.
removeTweens
(
this
.
turnGroup
);
console
.
log
(
'游戏结束!'
);
this
.
isFail
=
true
;
if
(
!
this
.
isRevived
)
{
this
.
isRevived
=
true
;
// 本局没有复活过出复活弹窗
let
data
=
{
scene
:
this
};
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
REVIVE_PANEL
,
data
);
}
else
{
// 本局已经复活出再来一次弹窗
NetManager
.
ins
.
gameSubmit
((
success
)
=>
{
// if (!success) {
// // 提交没成功调用一次getinfo
// NetManager.ins.getInfo(() => {
// })
// }
let
data
=
{
scene
:
this
}
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
OVER_PANEL
,
data
)
},
DataManager
.
ins
.
doStartData
.
ticketId
,
1
,
'[]'
,
DataManager
.
ins
.
doStartData
.
submitToken
,
""
);
}
}
//游戏失败弹窗
private
callBack_gameover
():
void
{
this
.
shootActGroup
.
visible
=
true
;
this
.
canShoot
=
true
;
this
.
currLevel
=
0
;
this
.
bulletCount
=
this
.
levelCountArr
[
this
.
currLevel
];
this
.
timeDownNum
=
this
.
timeDownNumArr
[
this
.
currLevel
];
this
.
countDownLb
.
text
=
this
.
timeDownNum
+
'S'
;
this
.
bulletCountLb
.
text
=
'X'
+
this
.
bulletCount
;
this
.
refreshLevelIcon
();
this
.
clearAllBulletGroup
();
this
.
showLevelTitleAct
(
true
);
}
private
dostart
():
void
{
Loading
.
instace
.
show
();
NetManager
.
ins
.
doStart
((
success
:
boolean
)
=>
{
if
(
success
)
{
NetManager
.
ins
.
getStartStatus
(
(
data
)
=>
{
console
.
log
(
'data轮询失败='
+
data
);
Loading
.
instace
.
hide
();
if
(
data
==
'pollingFaild'
||
!
data
)
{
//统一处理异常???????
PanelCtrl
.
instance
.
showMsg
(
'okBtn'
,
4
,
null
,
null
,
null
,
null
,
'请刷新重试~'
);
// Loading.instace.show();
return
}
else
{
//开始游戏
// PanelCtrl.instance.removeImmediately();
this
.
gPlayModel
.
datapash
();
this
.
isRevived
=
false
;
PanelCtrl
.
instance
.
isLoseCoin
=
true
;
this
.
hideLevelTitleAct
();
// this.currLevel = 0;
// this.revive();
}
},
DataManager
.
ins
.
doStartData
.
ticketId
,
()
=>
{
return
DataManager
.
ins
.
getStartStatusData
.
code
==
0
;
},
10
);
}
else
{
Loading
.
instace
.
hide
();
console
.
log
(
'dostart失败'
);
//统一处理异常???????
if
(
DataManager
.
ins
.
doStartData
.
message
.
indexOf
(
"次数已用完"
)
>
-
1
)
{
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
OUTNOTIMES_PANEL
)
}
else
{
PanelCtrl
.
instance
.
showMsg
(
'okBtn'
,
4
,
null
,
null
,
null
,
null
,
'请刷新重试!'
);
}
}
},
false
);
}
private
gameSubmit
()
{
Loading
.
instace
.
show
();
NetManager
.
ins
.
gameSubmit
((
success
:
boolean
)
=>
{
if
(
this
.
isMPBank
())
{
// 端内 判断接口是否成功
if
(
!
success
)
{
// 接口失败
Loading
.
instace
.
hide
();
// 显示未中奖弹窗
let
data
=
{
scene
:
this
}
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
NOPRIZE_PANEL
,
data
);
return
}
//回调捞结果
NetManager
.
ins
.
getSubmitResult
((
data
)
=>
{
if
(
data
==
'pollingFaild'
||
!
data
)
{
//轮询失败 弹错误弹窗
PanelCtrl
.
instance
.
showMsg
(
'okBtn'
,
4
,
null
,
null
,
()
=>
{
// SceneCtrl.instance.change(ModuleTypes.GAME_SCENE)
// 端内 活动首页
window
.
location
.
href
=
`
${
window
[
'appIndexLink'
]}
`
},
()
=>
{
// SceneCtrl.instance.change(ModuleTypes.GAME_SCENE)
// 端内 活动首页
window
.
location
.
href
=
`
${
window
[
'appIndexLink'
]}
`
},
'请去【我的奖品】查看是否中奖~'
);
}
else
{
// 轮询成功 展示奖品
this
.
showPrizePanel
();
PanelCtrl
.
instance
.
isLoseCoin
=
false
;
}
Loading
.
instace
.
hide
();
},
DataManager
.
ins
.
gameSubmitData
.
orderId
,
//轮询
()
=>
{
return
DataManager
.
ins
.
gameGetSubmitResultData
.
flag
;
});
}
else
{
// 端外 不管捞结果 直接进调起app弹窗
Loading
.
instace
.
hide
();
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
OUTWIN_PANEL
);
}
},
DataManager
.
ins
.
doStartData
.
ticketId
,
this
.
score
,
'[]'
,
DataManager
.
ins
.
doStartData
.
submitToken
,
JSON
.
stringify
(
this
.
gPlayModel
.
allDynamicsData
),
true
)
}
private
showPrizePanel
():
void
{
//处理中奖情况
if
(
DataManager
.
ins
.
gameGetSubmitResultData
&&
DataManager
.
ins
.
gameGetSubmitResultData
.
lottery
)
{
//中奖了
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
PRIZE_PANEL
,
this
.
callBack_gameover
.
bind
(
this
));
}
else
{
//未中奖,(必中活动未中奖要做容错处理)
let
data
=
{
scene
:
this
};
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
NOPRIZE_PANEL
,
data
);
}
}
private
errMsgCallBack
()
{
if
(
!
this
.
timer
)
{
alert
(
'网络开小差了
\
n请刷新重试!'
);
return
;
}
this
.
timer
.
stop
();
// egret.Tween.pauseTweens(this.turnGroup);
console
.
log
(
'游戏结束!'
);
this
.
isFail
=
true
;
this
.
callBack_gameover
();
}
// 复活
public
revive
()
{
this
.
canShoot
=
true
;
this
.
isOver
=
false
;
this
.
bulletCount
=
this
.
levelCountArr
[
this
.
currLevel
];
this
.
timeDownNum
=
this
.
timeDownNumArr
[
this
.
currLevel
];
this
.
countDownLb
.
text
=
this
.
timeDownNum
+
'S'
;
this
.
bulletCountLb
.
text
=
'X'
+
this
.
bulletCount
;
console
.
log
(
this
.
timeDownNum
)
this
.
refreshLevelIcon
();
// this.onloopReturn();
this
.
clearAllBulletGroup
();
this
.
showLevelTitleAct
();
//防作弊
if
(
this
.
gPlayModel
.
checkDatapash
(
this
.
currLevel
))
{
this
.
gPlayModel
.
datapash
();
}
this
.
timer
.
start
();
}
private
isMPBank
()
{
var
ua
=
navigator
.
userAgent
;
// var ua = 'MPBank'
if
(
ua
.
indexOf
(
'MPBank'
)
>
-
1
)
return
true
;
else
return
false
;
}
}
\ No newline at end of file
.history/egret/src/startScene/StartScene_20191022120008.ts
deleted
100644 → 0
View file @
cd3f33b2
import
{
IDynamicData
}
from
'./../../libs/tw/data/game/datapash/IDynamicData'
;
import
{
GamePlayModel
}
from
'./../../libs/tw/model/game/GamePlayModel'
;
import
{
ModuleTypes
}
from
'./../types/sceneTypes'
;
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
Scene
from
"../views/Scene"
;
import
Loading
from
"../loading/Loading"
;
import
PanelCtrl
from
'../ctrls/panelCtrl'
;
import
{
DataManager
}
from
'../../libs/tw/manager/DataManager'
;
import
{
GTime
}
from
'../../libs/tc/util/GTime'
;
import
{
Buried
}
from
'../../libs/tw/util/Buried'
;
import
SceneCtrl
from
'../ctrls/sceneCtrl'
;
export
default
class
StartScene
extends
Scene
{
public
get
skinKey
()
{
return
'GameScene'
}
public
get
groupName
()
{
return
'game_scene'
}
constructor
(
data
?)
{
super
(
data
);
}
initEvents
()
{
super
.
initEvents
();
}
removeEvents
()
{
super
.
removeEvents
();
}
protected
onSkinComplete
():
void
{
super
.
onSkinComplete
();
// this.mainbg.texture = this.bgtexture;
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
if
(
this
.
stage
)
{
this
.
onLoad
();
}
}
private
bgtexture
:
egret
.
Texture
;
protected
async
preLoadRes
()
{
//加载背景并设置背景图片
// this.bgtexture = await RES.getResAsync('gameBg_jpg');
// console.log('载背景并设置背景图片mainscene');
var
mcJson
=
await
RES
.
getResAsync
(
'xinxingAct_json'
);
var
mcImg
=
await
RES
.
getResAsync
(
'xinxingAct_png'
);
var
mcFactory
=
new
egret
.
MovieClipDataFactory
(
mcJson
,
mcImg
);
this
.
xinxingAct
=
new
egret
.
MovieClip
(
mcFactory
.
generateMovieClipData
());
return
new
Promise
(
function
(
resolve
,
reject
)
{
resolve
();
});
}
start
(
data
?)
{
super
.
start
(
data
);
this
.
timer
=
new
egret
.
Timer
(
1000
);
this
.
percentHeight
=
100
;
}
private
onLoad
():
void
{
//游戏页曝光
// let startDpmOut = Buried.connectDpm(110, 3, 1); // 点击埋点
// let startDcmOut = Buried.connectDcm(202, 0, 0); // 曝光埋点
// let exposure = Buried.createExposure(startDpmOut, startDcmOut);
// NetManager.ins.showLog(exposure);
this
.
showAct
();
this
.
initUI
();
}
private
initUI
():
void
{
this
.
initSceneData
();
this
.
refreshLevelIcon
();
this
.
createCircleImg
();
this
.
showLevelTitleAct
(
true
);
this
.
clickGroup
.
addChild
(
this
.
xinxingAct
);
this
.
xinxingAct
.
y
=
100
;
this
.
xinxingAct
.
visible
=
false
;
// this.onloopReturn();
// this.timer.start();
}
private
canStart
:
boolean
;
private
ontap_beforeStartBtn
()
{
PanelCtrl
.
instance
.
btnDelay
(
this
.
startBtn
);
if
(
!
this
.
canStart
)
return
;
let
data
=
{
scene
:
this
}
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
WARNING_PANEL
,
data
);
}
private
ontap_startBtn
():
void
{
PanelCtrl
.
instance
.
btnDelay
(
this
.
startBtn
);
if
(
!
this
.
canStart
)
return
;
this
.
isOver
=
false
;
//第一关点击
// let startDpmOut = Buried.connectDpm(110, 13, 1); // 点击埋点
// let startDcmOut = Buried.connectDcm(202, 0, 0); // 曝光埋点
// let exposure = Buried.createExposure(startDpmOut, startDcmOut);
// NetManager.ins.clickLog(exposure);
if
(
DataManager
.
ins
.
getInfoData
.
status
.
code
==
3
)
{
// 参与次数已用完
if
(
this
.
isMPBank
())
{
// 端内
PanelCtrl
.
instance
.
showMsg
(
'okBtn'
,
6
,
null
,
null
,
()
=>
{
window
.
location
.
href
=
`
${
window
[
'appIndexLink'
]}
`
},
()
=>
{
window
.
location
.
href
=
`
${
window
[
'appIndexLink'
]}
`
});
}
else
{
// 端外
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
OUTNOTIMES_PANEL
)
}
return
;
}
else
if
(
DataManager
.
ins
.
getInfoData
.
status
.
code
==
2
)
{
// 积分不足
if
(
this
.
isMPBank
())
{
// 端内
PanelCtrl
.
instance
.
showMsg
(
'okBtn'
,
6
,
null
,
null
,
()
=>
{
window
.
location
.
href
=
`
${
window
[
'appIndexLink'
]}
`
},
()
=>
{
window
.
location
.
href
=
`
${
window
[
'appIndexLink'
]}
`
});
}
else
{
// 端外
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
OUTNOTIMES_PANEL
)
}
return
;
}
else
if
(
DataManager
.
ins
.
getInfoData
.
status
.
code
==
1
)
{
// 未登录
PanelCtrl
.
instance
.
showMsg
(
'loginBtn'
,
2
,
null
,
null
,
function
()
{
});
return
;
}
else
{
this
.
dostart
();
}
}
//显示切换关卡页面
private
showLevelTitleAct
(
isshowBtn
:
boolean
=
false
):
void
{
if
(
this
.
currLevel
==
0
)
{
//第一关曝光
let
startDpmOut
=
Buried
.
connectDpm
(
110
,
13
,
1
);
// 点击埋点
let
startDcmOut
=
Buried
.
connectDcm
(
202
,
0
,
0
);
// 曝光埋点
let
exposure
=
Buried
.
createExposure
(
startDpmOut
,
startDcmOut
);
NetManager
.
ins
.
showLog
(
exposure
);
}
else
if
(
this
.
currLevel
==
1
)
{
//第二关曝光
let
startDpmOut
=
Buried
.
connectDpm
(
110
,
13
,
2
);
// 点击埋点
let
startDcmOut
=
Buried
.
connectDcm
(
202
,
0
,
0
);
// 曝光埋点
let
exposure
=
Buried
.
createExposure
(
startDpmOut
,
startDcmOut
);
NetManager
.
ins
.
showLog
(
exposure
);
}
else
if
(
this
.
currLevel
==
2
)
{
//第三关曝光
let
startDpmOut
=
Buried
.
connectDpm
(
110
,
13
,
3
);
// 点击埋点
let
startDcmOut
=
Buried
.
connectDcm
(
202
,
0
,
0
);
// 曝光埋点
let
exposure
=
Buried
.
createExposure
(
startDpmOut
,
startDcmOut
);
NetManager
.
ins
.
showLog
(
exposure
);
}
this
.
levelTitleImg
.
source
=
'gtitle'
+
this
.
currLevel
+
'_png'
;
this
.
startBtn
.
visible
=
isshowBtn
;
this
.
goNextLevel
.
alpha
=
0
;
this
.
goNextLevel
.
visible
=
true
;
egret
.
Tween
.
get
(
this
.
goNextLevel
).
to
({
alpha
:
1
},
300
).
call
(
function
()
{
this
.
canStart
=
true
;
if
(
!
isshowBtn
)
{
setTimeout
(()
=>
{
this
.
xinxingAct
.
visible
=
false
;
this
.
hideLevelTitleAct
();
},
500
);
}
},
this
);
this
.
refreshTurnImg
();
}
private
refreshTurnImg
():
void
{
this
.
turnTableBg00
.
source
=
'turnTableBg'
+
this
.
currLevel
+
'0_png'
;
this
.
turnTableBg01
.
source
=
'turnTableBg'
+
this
.
currLevel
+
'1_png'
;
this
.
turnTableBg02
.
source
=
'turnTableBg'
+
this
.
currLevel
+
'2_png'
;
this
.
turnTbBgImg
.
source
=
'turnTableBg'
+
this
.
currLevel
+
'_png'
;
}
//隐藏切换关卡页面
private
hideLevelTitleAct
():
void
{
egret
.
Tween
.
get
(
this
.
goNextLevel
).
to
({
alpha
:
0
},
300
).
call
(
function
()
{
this
.
canStart
=
false
;
this
.
goNextLevel
.
visible
=
false
;
this
.
onloopReturn
();
if
(
!
this
.
isFail
)
{
// this.onloopReturn();
}
else
{
// egret.Tween.resumeTweens(this.turnGroup);
this
.
shootBulletImg
.
rotation
=
0
;
}
this
.
isFail
=
false
;
this
.
timer
.
start
();
},
this
);
}
//初始化界面数据
private
initSceneData
():
void
{
this
.
levelCountArr
=
window
[
'bulletNum'
]
?
window
[
'bulletNum'
]
:
[
5
,
8
,
12
];
this
.
timeDownNumArr
=
[
12
,
18
,
25
];
this
.
bEndY
=
174.5
+
401
+
441
-
(
750
*
0.5
)
-
20
+
107
;
//this.turnTbBgImg.y + this.turnTbBgImg.height + this.turnGroup.y - 20 + 107;
this
.
bStartY
=
this
.
shootBulletImg
.
y
;
this
.
canShoot
=
true
;
this
.
currLevel
=
0
;
this
.
gPlayModel
=
new
GamePlayModel
();
this
.
bulletCount
=
this
.
levelCountArr
[
this
.
currLevel
];
this
.
timeDownNum
=
this
.
timeDownNumArr
[
this
.
currLevel
];
this
.
countDownLb
.
text
=
this
.
timeDownNum
+
'S'
;
this
.
goodActGroup
.
alpha
=
0
;
this
.
bulletCountLb
.
text
=
'X'
+
this
.
bulletCount
;
this
.
passActGroup
.
visible
=
false
;
this
.
gPlayModel
.
update
();
}
//初始当前关数提示
private
refreshLevelIcon
():
void
{
for
(
let
i
=
1
;
i
<
3
;
i
++
)
{
if
(
i
<=
this
.
currLevel
)
{
const
icon1
=
this
[
'gkIconImg'
+
i
+
1
];
icon1
.
visible
=
true
;
// const icon2 = this['gkIconImg' + i + 2];
// if (icon2) {
// icon2.visible = false;
// }
}
else
{
const
icon1
=
this
[
'gkIconImg'
+
i
+
1
];
icon1
.
visible
=
false
;
// const icon2 = this['gkIconImg' + i + 2];
// if (icon2) {
// icon2.visible = true;
// }
}
}
}
private
onMainTap
(
e
:
egret
.
TouchEvent
):
void
{
if
(
!
this
.
canShoot
)
return
;
console
.
log
(
'onMainTap'
);
console
.
log
(
"this.bEndY="
+
this
.
bEndY
);
//防作弊
const
dynamic
:
IDynamicData
=
{
a
:
'tap'
,
t
:
GTime
.
getTimestamp
(),
x
:
e
.
stageY
,
y
:
e
.
stageY
};
this
.
gPlayModel
.
addDynamic
(
dynamic
);
this
.
canShoot
=
false
;
egret
.
Tween
.
get
(
this
.
shootBulletImg
).
to
({
y
:
this
.
bEndY
},
200
,
egret
.
Ease
.
sineIn
).
call
(
function
()
{
//减少口红数量
this
.
bulletCount
--
;
this
.
bulletCountLb
.
text
=
'X'
+
this
.
bulletCount
;
//插入口红
this
.
intoBullet
();
// egret.Tween.pauseTweens(this.turnGroup);
// setTimeout(() => {
// // this.turnGroup.rotation += 360 / 33;
// egret.Tween.resumeTweens(this.turnGroup);
// }, 1000);
},
this
);
}
//插入口红
private
intoBullet
():
void
{
console
.
log
(
'this.turnGroup.rotation='
+
this
.
turnGroup
.
rotation
);
let
angle
=
this
.
turnGroup
.
rotation
;
if
(
angle
<
0
)
{
angle
=
360
+
angle
;
}
console
.
log
(
'angle='
+
angle
);
// let idx = Math.ceil(Math.floor(angle / (360 / 33) * 100) * 0.01) - 1;
let
idx
=
Math
.
floor
(
angle
/
(
360
/
33
));
console
.
log
(
'idx1='
+
idx
);
if
(
idx
==
0
)
{
idx
=
0
;
//矫正圆盘角度,插中的位置保持正对最下方
this
.
turnGroup
.
rotation
=
0
;
}
else
{
//矫正圆盘角度,插中的位置保持正对最下方
this
.
turnGroup
.
rotation
=
idx
*
(
360
/
33
);
idx
=
33
-
idx
;
}
console
.
log
(
'idx='
+
idx
);
const
img
=
new
eui
.
Image
();
img
.
source
=
'bulletImg_png'
;
const
key
=
'bulletBoxGroup'
+
idx
;
if
(
this
[
key
].
numChildren
>
0
)
{
if
(
this
.
isOver
)
return
;
this
.
isOver
=
true
;
PanelCtrl
.
instance
.
isLoseCoin
=
false
;
this
.
timer
.
stop
();
// egret.Tween.pauseTweens(this.turnGroup);
clearTimeout
(
this
.
timeoutId
);
egret
.
Tween
.
removeTweens
(
this
.
turnGroup
);
console
.
log
(
'游戏结束!'
);
this
.
isFail
=
true
;
egret
.
Tween
.
get
(
this
.
shootBulletImg
).
to
({
rotation
:
50
,
y
:
this
.
shootBulletImg
.
y
+
400
},
300
,
egret
.
Ease
.
cubicOut
).
call
(
function
()
{
this
.
gameOver
()
// NetManager.ins.gameSubmit(function(){},
// DataManager.ins.doStartData.ticketId,
// 0,'[]',DataManager.ins.doStartData.submitToken,""
// );
},
this
);
}
else
{
//判断是否成功插入
if
(
this
.
bulletCount
<=
0
)
{
//进入下一关
this
.
bulletCount
=
0
;
this
.
canShoot
=
false
;
this
.
showCicleDownAct
();
this
.
timer
.
stop
();
}
//圆盘震动
egret
.
Tween
.
get
(
this
.
shootActGroup
).
to
({
y
:
-
10
},
100
,
egret
.
Ease
.
sineIn
).
call
(
function
()
{
egret
.
Tween
.
get
(
this
.
shootActGroup
).
to
({
y
:
0
},
100
,
egret
.
Ease
.
sineIn
).
call
(
function
()
{
},
this
);
},
this
);
//初始化子弹位置
this
.
shootBulletImg
.
alpha
=
0
;
this
.
shootBulletImg
.
y
=
this
.
bStartY
+
this
.
shootBulletImg
.
height
;
//子弹装弹动画
egret
.
Tween
.
get
(
this
.
shootBulletImg
).
to
({
alpha
:
1
,
y
:
this
.
bStartY
},
200
,
egret
.
Ease
.
sineIn
).
call
(
function
()
{
if
(
this
.
bulletCount
>
0
)
{
this
.
canShoot
=
true
;
}
//可以继续发射了
},
this
);
//子弹尾部动画
this
.
showCircleAct
();
this
[
key
].
addChild
(
img
);
//good动画
this
.
showGoodAct
();
}
}
private
direct
:
number
=
1
;
//Math.random() > 0.5 ? 1 : -1
//随机转动
private
onloopReturn
():
void
{
this
.
shootActGroup
.
visible
=
true
;
let
offAngle
=
0
;
let
r
=
Math
.
random
();
if
(
r
<
0.2
)
{
offAngle
=
10
;
}
else
if
(
r
>=
0.2
&&
r
<
0.6
)
{
offAngle
=
100
;
}
else
{
offAngle
=
40
;
}
let
endAngle
=
offAngle
+
Math
.
floor
(
100
*
Math
.
random
());
let
time
=
1000
;
// if (this.isMPBank()) {
// time = 1000;
// } else {
// time = 600;
// }
//100 + 1500 * Math.random(); //endAngle * (5 + 10 * Math.random());
const
endRot
=
this
.
turnGroup
.
rotation
+
endAngle
*
this
.
direct
;
//有时候会连续两次,给turngroup添加转动,到时候转动闪动
egret
.
Tween
.
removeTweens
(
this
.
turnGroup
);
// const endRot = this.turnGroup.rotation + 200 * this.direct;
egret
.
Tween
.
get
(
this
.
turnGroup
).
to
({
rotation
:
endRot
},
time
,
egret
.
Ease
.
getPowOut
(
0.9
)).
call
(
function
()
{
if
(
this
.
direct
>
0
)
{
this
.
direct
=
-
1
;
}
else
{
this
.
direct
=
1
;
}
this
.
timeoutId
=
setTimeout
(()
=>
{
this
.
onloopReturn
();
},
100
);
},
this
);
}
//创建子弹尾部动画元素
private
createCircleImg
():
void
{
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
this
[
'circleImg'
+
i
]
=
new
eui
.
Image
();
this
[
'circleImg'
+
i
].
source
=
'khAct'
+
i
+
'_png'
;
this
[
'circleImg'
+
i
].
alpha
=
0
;
this
.
addChild
(
this
[
'circleImg'
+
i
]);
}
}
//播放子弹尾部圆圈动画
private
showCircleAct
():
void
{
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
this
[
'circleImg'
+
i
].
alpha
=
1
;
this
[
'circleImg'
+
i
].
scaleX
=
1
;
this
[
'circleImg'
+
i
].
scaleY
=
1
;
this
[
'circleImg'
+
i
].
y
=
this
.
bEndY
+
50
;
this
[
'circleImg'
+
i
].
x
=
(
750
-
this
[
'circleImg'
+
i
].
width
)
*
0.5
;
egret
.
Tween
.
removeTweens
(
this
[
'circleImg'
+
i
]);
egret
.
Tween
.
get
(
this
[
'circleImg'
+
i
]).
wait
(
300
).
to
({
alpha
:
0
},
100
);
}
this
.
circleImg0
.
x
+=
20
;
this
.
circleImg1
.
x
-=
5
;
this
.
circleImg2
.
x
-=
10
;
this
.
circleImg3
.
x
+=
10
;
this
.
circleImg2
.
x
-=
20
;
const
time
=
400
;
egret
.
Tween
.
get
(
this
.
circleImg0
).
to
({
alpha
:
0
,
scaleX
:
1.2
,
scaleY
:
1.2
,
x
:
this
.
circleImg0
.
x
+
100
,
y
:
this
.
circleImg0
.
y
+
350
},
time
,
egret
.
Ease
.
cubicOut
);
egret
.
Tween
.
get
(
this
.
circleImg1
).
to
({
alpha
:
0
,
scaleX
:
1.2
,
scaleY
:
1.2
,
x
:
this
.
circleImg1
.
x
-
25
,
y
:
this
.
circleImg1
.
y
+
400
},
time
,
egret
.
Ease
.
cubicOut
);
egret
.
Tween
.
get
(
this
.
circleImg2
).
to
({
alpha
:
0
,
scaleX
:
1.2
,
scaleY
:
1.2
,
x
:
this
.
circleImg2
.
x
-
50
,
y
:
this
.
circleImg2
.
y
+
350
},
time
,
egret
.
Ease
.
cubicOut
);
egret
.
Tween
.
get
(
this
.
circleImg3
).
to
({
alpha
:
0
,
scaleX
:
1.2
,
scaleY
:
1.2
,
x
:
this
.
circleImg3
.
x
+
50
,
y
:
this
.
circleImg3
.
y
+
400
},
time
,
egret
.
Ease
.
cubicOut
);
egret
.
Tween
.
get
(
this
.
circleImg4
).
to
({
alpha
:
0
,
scaleX
:
1.2
,
scaleY
:
1.2
,
x
:
this
.
circleImg4
.
x
-
100
,
y
:
this
.
circleImg4
.
y
+
380
},
time
,
egret
.
Ease
.
cubicOut
);
}
//good动效
private
showGoodAct
():
void
{
egret
.
Tween
.
removeTweens
(
this
.
goodActGroup
);
egret
.
Tween
.
removeTweens
(
this
.
goodActHand
);
this
.
goodActGroup
.
scaleX
=
0
;
this
.
goodActGroup
.
scaleY
=
0
;
this
.
goodActGroup
.
alpha
=
1
;
this
.
goodActGroup
.
rotation
=
0
;
this
.
goodActGroup
.
y
=
247
;
this
.
goodActHand
.
y
=
59
;
//手,位移
egret
.
Tween
.
get
(
this
.
goodActHand
).
wait
(
470
).
to
({
y
:
this
.
goodActHand
.
y
+
25
},
90
).
to
({
y
:
this
.
goodActHand
.
y
+
15
},
120
);
//缩放
egret
.
Tween
.
get
(
this
.
goodActGroup
).
wait
(
60
).
to
({
scaleX
:
1
,
scaleY
:
1
},
190
,
egret
.
Ease
.
cubicOut
).
wait
(
710
).
to
({
scaleX
:
0.7
,
scaleY
:
0.7
},
100
,
egret
.
Ease
.
cubicOut
);
//旋转
egret
.
Tween
.
get
(
this
.
goodActGroup
).
to
({
rotation
:
1120
},
150
,
egret
.
Ease
.
cubicOut
).
to
({
rotation
:
1066
},
90
,
egret
.
Ease
.
cubicOut
).
to
({
rotation
:
1080
},
60
,
egret
.
Ease
.
cubicOut
).
wait
(
560
).
to
({
rotation
:
1063
},
100
,
egret
.
Ease
.
cubicOut
).
to
({
rotation
:
1108
},
100
,
egret
.
Ease
.
cubicOut
);
//透明度
egret
.
Tween
.
get
(
this
.
goodActGroup
).
wait
(
990
).
to
({
alpha
:
0
},
70
);
//位移
egret
.
Tween
.
get
(
this
.
goodActGroup
).
wait
(
910
).
to
({
y
:
this
.
goodActGroup
.
y
-
50
},
150
);
}
private
showCicleDownAct
():
void
{
this
.
shootActGroup
.
visible
=
false
;
clearTimeout
(
this
.
timeoutId
);
egret
.
Tween
.
removeTweens
(
this
.
turnGroup
);
this
.
turnTableBg00
.
x
=
202
;
this
.
turnTableBg01
.
x
=
201
;
this
.
turnTableBg02
.
x
=
201
;
this
.
turnTableBg00
.
y
=
202
;
this
.
turnTableBg01
.
y
=
201
;
this
.
turnTableBg02
.
y
=
201
;
this
.
turnTableBg00
.
rotation
=
0
;
this
.
turnTableBg01
.
rotation
=
0
;
this
.
turnTableBg02
.
rotation
=
0
;
this
.
passActGroup
.
visible
=
true
;
const
time
=
550
;
// this.xinxingAct.play(0);
this
.
xinxingAct
.
gotoAndPlay
(
0
);
this
.
xinxingAct
.
x
=
750
*
0.5
;
this
.
xinxingAct
.
y
=
100
+
714
*
0.5
;
this
.
xinxingAct
.
anchorOffsetX
=
750
*
0.5
;
this
.
xinxingAct
.
anchorOffsetY
=
714
*
0.5
;
this
.
xinxingAct
.
scaleX
=
1
;
this
.
xinxingAct
.
scaleY
=
1
;
this
.
xinxingAct
.
visible
=
true
;
egret
.
Tween
.
get
(
this
.
xinxingAct
).
to
({
scaleX
:
1.4
,
scaleY
:
1.4
,
y
:
this
.
xinxingAct
.
y
+
600
},
time
);
egret
.
Tween
.
get
(
this
.
turnTableBg00
).
to
({
x
:
120
,
rotation
:
-
90
},
time
);
egret
.
Tween
.
get
(
this
.
turnTableBg00
).
to
({
y
:
this
.
turnTableBg00
.
y
+
1250
},
time
,
egret
.
Ease
.
cubicIn
);
egret
.
Tween
.
get
(
this
.
turnTableBg01
).
to
({
x
:
360
,
rotation
:
90
},
time
);
egret
.
Tween
.
get
(
this
.
turnTableBg01
).
to
({
y
:
this
.
turnTableBg00
.
y
+
1250
},
time
,
egret
.
Ease
.
cubicIn
);
egret
.
Tween
.
get
(
this
.
turnTableBg02
).
to
({
x
:
280
,
rotation
:
50
},
time
);
egret
.
Tween
.
get
(
this
.
turnTableBg02
).
to
({
y
:
this
.
turnTableBg00
.
y
+
1250
},
time
,
egret
.
Ease
.
cubicIn
).
call
(
function
()
{
this
.
xinxingAct
.
visible
=
false
;
if
(
this
.
currLevel
==
2
)
{
// 闯关成功
this
.
xinxingAct
.
visible
=
false
;
if
(
this
.
isMPBank
())
{
// 端内
this
.
score
=
20
;
// 分数为20出奖
}
else
{
// 端外
this
.
score
=
1
;
// 分数为1不出奖
}
this
.
gameSubmit
();
}
else
{
//刷新下一关信息
this
.
canShoot
=
true
;
this
.
currLevel
++
;
this
.
bulletCount
=
this
.
levelCountArr
[
this
.
currLevel
];
this
.
timeDownNum
=
this
.
timeDownNumArr
[
this
.
currLevel
];
this
.
countDownLb
.
text
=
this
.
timeDownNum
+
'S'
;
this
.
bulletCountLb
.
text
=
'X'
+
this
.
bulletCount
;
this
.
refreshLevelIcon
();
// this.onloopReturn();
this
.
clearAllBulletGroup
();
this
.
showLevelTitleAct
();
//防作弊
// if (this.gPlayModel.checkDatapash(this.currLevel)) {
// this.gPlayModel.datapash();
// }
}
},
this
);
// egret.Tween.get(this.turnTableBg01).to({y:this.turnTableBg00.y + 1200}, 500, egret.Ease.cubicIn);
// egret.Tween.get(this.turnTableBg02).to({y:this.turnTableBg00.y + 1200}, 500, egret.Ease.cubicIn);
}
//清理所有已经插上的口红
private
clearAllBulletGroup
():
void
{
for
(
let
i
=
0
;
i
<
33
;
i
++
)
{
this
[
'bulletBoxGroup'
+
i
].
removeChildren
();
}
}
private
ontimer
():
void
{
// console.log('this.turnGroup.rotation=' + this.turnGroup.rotation);
//预览图片倒计时
if
(
this
.
timeDownNum
>
0
)
{
this
.
timeDownNum
--
;
this
.
countDownLb
.
text
=
this
.
timeDownNum
+
'S'
;
if
(
this
.
timeDownNum
<=
0
)
{
if
(
this
.
isOver
)
return
;
this
.
isOver
=
true
;
PanelCtrl
.
instance
.
isLoseCoin
=
false
;
this
.
gameOver
();
}
}
}
//游戏失败处理
private
gameOver
():
void
{
this
.
timer
.
stop
();
// egret.Tween.pauseTweens(this.turnGroup);
clearTimeout
(
this
.
timeoutId
);
egret
.
Tween
.
removeTweens
(
this
.
turnGroup
);
console
.
log
(
'游戏结束!'
);
this
.
isFail
=
true
;
if
(
!
this
.
isRevived
)
{
this
.
isRevived
=
true
;
// 本局没有复活过出复活弹窗
let
data
=
{
scene
:
this
};
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
REVIVE_PANEL
,
data
);
}
else
{
// 本局已经复活出再来一次弹窗
NetManager
.
ins
.
gameSubmit
((
success
)
=>
{
// if (!success) {
// // 提交没成功调用一次getinfo
// NetManager.ins.getInfo(() => {
// })
// }
let
data
=
{
scene
:
this
}
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
OVER_PANEL
,
data
)
},
DataManager
.
ins
.
doStartData
.
ticketId
,
1
,
'[]'
,
DataManager
.
ins
.
doStartData
.
submitToken
,
""
);
}
}
//游戏失败弹窗
private
callBack_gameover
():
void
{
this
.
shootActGroup
.
visible
=
true
;
this
.
canShoot
=
true
;
this
.
currLevel
=
0
;
this
.
bulletCount
=
this
.
levelCountArr
[
this
.
currLevel
];
this
.
timeDownNum
=
this
.
timeDownNumArr
[
this
.
currLevel
];
this
.
countDownLb
.
text
=
this
.
timeDownNum
+
'S'
;
this
.
bulletCountLb
.
text
=
'X'
+
this
.
bulletCount
;
this
.
refreshLevelIcon
();
this
.
clearAllBulletGroup
();
this
.
showLevelTitleAct
(
true
);
}
private
dostart
():
void
{
Loading
.
instace
.
show
();
NetManager
.
ins
.
doStart
((
success
:
boolean
)
=>
{
if
(
success
)
{
NetManager
.
ins
.
getStartStatus
(
(
data
)
=>
{
console
.
log
(
'data轮询失败='
+
data
);
Loading
.
instace
.
hide
();
if
(
data
==
'pollingFaild'
||
!
data
)
{
//统一处理异常???????
PanelCtrl
.
instance
.
showMsg
(
'okBtn'
,
4
,
null
,
null
,
null
,
null
,
'请刷新重试~'
);
// Loading.instace.show();
return
}
else
{
//开始游戏
// PanelCtrl.instance.removeImmediately();
this
.
gPlayModel
.
datapash
();
this
.
isRevived
=
false
;
PanelCtrl
.
instance
.
isLoseCoin
=
true
;
this
.
hideLevelTitleAct
();
// this.currLevel = 0;
// this.revive();
}
},
DataManager
.
ins
.
doStartData
.
ticketId
,
()
=>
{
return
DataManager
.
ins
.
getStartStatusData
.
code
==
0
;
},
10
);
}
else
{
Loading
.
instace
.
hide
();
console
.
log
(
'dostart失败'
);
//统一处理异常???????
if
(
DataManager
.
ins
.
doStartData
.
message
.
indexOf
(
"次数已用完"
)
>
-
1
)
{
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
OUTNOTIMES_PANEL
)
}
else
{
PanelCtrl
.
instance
.
showMsg
(
'okBtn'
,
4
,
null
,
null
,
null
,
null
,
'请刷新重试!'
);
}
}
},
false
);
}
private
gameSubmit
()
{
Loading
.
instace
.
show
();
NetManager
.
ins
.
gameSubmit
((
success
:
boolean
)
=>
{
if
(
this
.
isMPBank
())
{
// 端内 判断接口是否成功
if
(
!
success
)
{
// 接口失败
Loading
.
instace
.
hide
();
// 显示未中奖弹窗
let
data
=
{
scene
:
this
}
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
NOPRIZE_PANEL
,
data
);
return
}
//回调捞结果
NetManager
.
ins
.
getSubmitResult
((
data
)
=>
{
if
(
data
==
'pollingFaild'
||
!
data
)
{
//轮询失败 弹错误弹窗
PanelCtrl
.
instance
.
showMsg
(
'okBtn'
,
4
,
null
,
null
,
()
=>
{
// SceneCtrl.instance.change(ModuleTypes.GAME_SCENE)
// 端内 活动首页
window
.
location
.
href
=
`
${
window
[
'appIndexLink'
]}
`
},
()
=>
{
// SceneCtrl.instance.change(ModuleTypes.GAME_SCENE)
// 端内 活动首页
window
.
location
.
href
=
`
${
window
[
'appIndexLink'
]}
`
},
'请去【我的奖品】查看是否中奖~'
);
}
else
{
// 轮询成功 展示奖品
this
.
showPrizePanel
();
PanelCtrl
.
instance
.
isLoseCoin
=
false
;
}
Loading
.
instace
.
hide
();
},
DataManager
.
ins
.
gameSubmitData
.
orderId
,
//轮询
()
=>
{
return
DataManager
.
ins
.
gameGetSubmitResultData
.
flag
;
});
}
else
{
// 端外 不管捞结果 直接进调起app弹窗
Loading
.
instace
.
hide
();
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
OUTWIN_PANEL
);
}
},
DataManager
.
ins
.
doStartData
.
ticketId
,
this
.
score
,
'[]'
,
DataManager
.
ins
.
doStartData
.
submitToken
,
JSON
.
stringify
(
this
.
gPlayModel
.
allDynamicsData
),
true
)
}
private
showPrizePanel
():
void
{
//处理中奖情况
if
(
DataManager
.
ins
.
gameGetSubmitResultData
&&
DataManager
.
ins
.
gameGetSubmitResultData
.
lottery
)
{
//中奖了
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
PRIZE_PANEL
,
this
.
callBack_gameover
.
bind
(
this
));
}
else
{
//未中奖,(必中活动未中奖要做容错处理)
let
data
=
{
scene
:
this
};
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
NOPRIZE_PANEL
,
data
);
}
}
private
errMsgCallBack
()
{
if
(
!
this
.
timer
)
{
alert
(
'网络开小差了
\
n请刷新重试!'
);
return
;
}
this
.
timer
.
stop
();
// egret.Tween.pauseTweens(this.turnGroup);
console
.
log
(
'游戏结束!'
);
this
.
isFail
=
true
;
this
.
callBack_gameover
();
}
// 复活
public
revive
()
{
this
.
canShoot
=
true
;
this
.
isOver
=
false
;
this
.
bulletCount
=
this
.
levelCountArr
[
this
.
currLevel
];
this
.
timeDownNum
=
this
.
timeDownNumArr
[
this
.
currLevel
];
this
.
countDownLb
.
text
=
this
.
timeDownNum
+
'S'
;
this
.
bulletCountLb
.
text
=
'X'
+
this
.
bulletCount
;
console
.
log
(
this
.
timeDownNum
)
this
.
refreshLevelIcon
();
// this.onloopReturn();
this
.
clearAllBulletGroup
();
this
.
showLevelTitleAct
();
//防作弊
if
(
this
.
gPlayModel
.
checkDatapash
(
this
.
currLevel
))
{
this
.
gPlayModel
.
datapash
();
}
this
.
timer
.
start
();
}
private
isMPBank
()
{
var
ua
=
navigator
.
userAgent
;
// var ua = 'MPBank'
if
(
ua
.
indexOf
(
'MPBank'
)
>
-
1
)
return
true
;
else
return
false
;
}
}
\ No newline at end of file
.history/egret/src/startScene/StartScene_20191022120134.ts
deleted
100644 → 0
View file @
cd3f33b2
import
{
IDynamicData
}
from
'./../../libs/tw/data/game/datapash/IDynamicData'
;
import
{
GamePlayModel
}
from
'./../../libs/tw/model/game/GamePlayModel'
;
import
{
ModuleTypes
}
from
'./../types/sceneTypes'
;
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
Scene
from
"../views/Scene"
;
import
Loading
from
"../loading/Loading"
;
import
PanelCtrl
from
'../ctrls/panelCtrl'
;
import
{
DataManager
}
from
'../../libs/tw/manager/DataManager'
;
import
{
GTime
}
from
'../../libs/tc/util/GTime'
;
import
{
Buried
}
from
'../../libs/tw/util/Buried'
;
import
SceneCtrl
from
'../ctrls/sceneCtrl'
;
export
default
class
StartScene
extends
Scene
{
public
get
skinKey
()
{
return
'StartScene'
}
public
get
groupName
()
{
return
'start_scene'
}
constructor
(
data
?)
{
super
(
data
);
}
initEvents
()
{
super
.
initEvents
();
}
removeEvents
()
{
super
.
removeEvents
();
}
protected
onSkinComplete
():
void
{
super
.
onSkinComplete
();
// this.mainbg.texture = this.bgtexture;
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
if
(
this
.
stage
)
{
this
.
onLoad
();
}
}
private
bgtexture
:
egret
.
Texture
;
protected
async
preLoadRes
()
{
//加载背景并设置背景图片
// this.bgtexture = await RES.getResAsync('gameBg_jpg');
// console.log('载背景并设置背景图片mainscene');
return
new
Promise
(
function
(
resolve
,
reject
)
{
resolve
();
});
}
timer
start
(
data
?)
{
super
.
start
(
data
);
this
.
timer
=
new
egret
.
Timer
(
1000
);
this
.
percentHeight
=
100
;
}
private
onLoad
():
void
{
this
.
initUI
();
}
private
initUI
():
void
{
}
private
canStart
:
boolean
;
}
\ No newline at end of file
.history/egret/src/startScene/StartScene_20191022120145.ts
deleted
100644 → 0
View file @
cd3f33b2
import
{
IDynamicData
}
from
'./../../libs/tw/data/game/datapash/IDynamicData'
;
import
{
GamePlayModel
}
from
'./../../libs/tw/model/game/GamePlayModel'
;
import
{
ModuleTypes
}
from
'./../types/sceneTypes'
;
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
Scene
from
"../views/Scene"
;
import
Loading
from
"../loading/Loading"
;
import
PanelCtrl
from
'../ctrls/panelCtrl'
;
import
{
DataManager
}
from
'../../libs/tw/manager/DataManager'
;
import
{
GTime
}
from
'../../libs/tc/util/GTime'
;
import
{
Buried
}
from
'../../libs/tw/util/Buried'
;
import
SceneCtrl
from
'../ctrls/sceneCtrl'
;
export
default
class
StartScene
extends
Scene
{
public
get
skinKey
()
{
return
'StartScene'
}
public
get
groupName
()
{
return
'start_scene'
}
constructor
(
data
?)
{
super
(
data
);
}
initEvents
()
{
super
.
initEvents
();
}
removeEvents
()
{
super
.
removeEvents
();
}
protected
onSkinComplete
():
void
{
super
.
onSkinComplete
();
// this.mainbg.texture = this.bgtexture;
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
if
(
this
.
stage
)
{
this
.
onLoad
();
}
}
private
bgtexture
:
egret
.
Texture
;
protected
async
preLoadRes
()
{
//加载背景并设置背景图片
// this.bgtexture = await RES.getResAsync('gameBg_jpg');
// console.log('载背景并设置背景图片mainscene');
return
new
Promise
(
function
(
resolve
,
reject
)
{
resolve
();
});
}
timer
start
(
data
?)
{
super
.
start
(
data
);
this
.
timer
=
new
egret
.
Timer
(
1000
);
this
.
percentHeight
=
100
;
}
private
onLoad
():
void
{
this
.
initUI
();
}
private
initUI
():
void
{
}
private
canStart
:
boolean
;
}
\ No newline at end of file
.history/egret/src/startScene/StartScene_20191022120150.ts
deleted
100644 → 0
View file @
cd3f33b2
import
{
IDynamicData
}
from
'./../../libs/tw/data/game/datapash/IDynamicData'
;
import
{
GamePlayModel
}
from
'./../../libs/tw/model/game/GamePlayModel'
;
import
{
ModuleTypes
}
from
'./../types/sceneTypes'
;
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
Scene
from
"../views/Scene"
;
import
Loading
from
"../loading/Loading"
;
import
PanelCtrl
from
'../ctrls/panelCtrl'
;
import
{
DataManager
}
from
'../../libs/tw/manager/DataManager'
;
import
{
GTime
}
from
'../../libs/tc/util/GTime'
;
import
{
Buried
}
from
'../../libs/tw/util/Buried'
;
import
SceneCtrl
from
'../ctrls/sceneCtrl'
;
export
default
class
StartScene
extends
Scene
{
public
get
skinKey
()
{
return
'StartScene'
}
public
get
groupName
()
{
return
'start_scene'
}
constructor
(
data
?)
{
super
(
data
);
}
initEvents
()
{
super
.
initEvents
();
}
removeEvents
()
{
super
.
removeEvents
();
}
protected
onSkinComplete
():
void
{
super
.
onSkinComplete
();
// this.mainbg.texture = this.bgtexture;
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
if
(
this
.
stage
)
{
this
.
onLoad
();
}
}
private
bgtexture
:
egret
.
Texture
;
protected
async
preLoadRes
()
{
//加载背景并设置背景图片
// this.bgtexture = await RES.getResAsync('gameBg_jpg');
// console.log('载背景并设置背景图片mainscene');
return
new
Promise
(
function
(
resolve
,
reject
)
{
resolve
();
});
}
timer
start
(
data
?)
{
super
.
start
(
data
);
this
.
timer
=
new
egret
.
Timer
(
1000
);
this
.
percentHeight
=
100
;
}
private
onLoad
():
void
{
this
.
initUI
();
}
private
initUI
():
void
{
}
private
canStart
:
boolean
;
}
\ No newline at end of file
.history/egret/src/startScene/StartScene_20191022120705.ts
deleted
100644 → 0
View file @
cd3f33b2
import
{
IDynamicData
}
from
'./../../libs/tw/data/game/datapash/IDynamicData'
;
import
{
GamePlayModel
}
from
'./../../libs/tw/model/game/GamePlayModel'
;
import
{
ModuleTypes
}
from
'./../types/sceneTypes'
;
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
Scene
from
"../views/Scene"
;
import
Loading
from
"../loading/Loading"
;
import
PanelCtrl
from
'../ctrls/panelCtrl'
;
import
{
DataManager
}
from
'../../libs/tw/manager/DataManager'
;
import
{
GTime
}
from
'../../libs/tc/util/GTime'
;
import
{
Buried
}
from
'../../libs/tw/util/Buried'
;
import
SceneCtrl
from
'../ctrls/sceneCtrl'
;
export
default
class
StartScene
extends
Scene
{
public
scroller_body
:
eui
.
Scroller
;
public
bg
:
eui
.
Image
;
public
topBtn
:
eui
.
Group
;
public
startBtn
:
eui
.
Button
;
public
get
skinKey
()
{
return
'StartScene'
}
public
get
groupName
()
{
return
'start_scene'
}
constructor
(
data
?)
{
super
(
data
);
}
initEvents
()
{
super
.
initEvents
();
}
removeEvents
()
{
super
.
removeEvents
();
}
protected
onSkinComplete
():
void
{
super
.
onSkinComplete
();
// this.mainbg.texture = this.bgtexture;
let
stageHeight
=
750
/
window
.
innerWidth
*
window
.
innerHeight
;
this
.
scroller_body
.
height
=
stageHeight
;
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
if
(
this
.
stage
)
{
this
.
onLoad
();
}
}
private
bgtexture
:
egret
.
Texture
;
protected
async
preLoadRes
()
{
//加载背景并设置背景图片
// this.bgtexture = await RES.getResAsync('gameBg_jpg');
// console.log('载背景并设置背景图片mainscene');
return
new
Promise
(
function
(
resolve
,
reject
)
{
resolve
();
});
}
timer
start
(
data
?)
{
super
.
start
(
data
);
this
.
timer
=
new
egret
.
Timer
(
1000
);
this
.
percentHeight
=
100
;
}
private
onLoad
():
void
{
this
.
initUI
();
}
private
initUI
():
void
{
}
private
canStart
:
boolean
;
}
\ No newline at end of file
.history/egret/src/startScene/StartScene_20191022140350.ts
deleted
100644 → 0
View file @
cd3f33b2
import
{
IDynamicData
}
from
'./../../libs/tw/data/game/datapash/IDynamicData'
;
import
{
GamePlayModel
}
from
'./../../libs/tw/model/game/GamePlayModel'
;
import
{
ModuleTypes
}
from
'./../types/sceneTypes'
;
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
Scene
from
"../views/Scene"
;
import
Loading
from
"../loading/Loading"
;
import
PanelCtrl
from
'../ctrls/panelCtrl'
;
import
{
DataManager
}
from
'../../libs/tw/manager/DataManager'
;
import
{
GTime
}
from
'../../libs/tc/util/GTime'
;
import
{
Buried
}
from
'../../libs/tw/util/Buried'
;
import
SceneCtrl
from
'../ctrls/sceneCtrl'
;
export
default
class
StartScene
extends
Scene
{
public
scroller_body
:
eui
.
Scroller
;
public
bg
:
eui
.
Image
;
public
topBtn
:
eui
.
Group
;
public
startBtn
:
eui
.
Button
;
public
get
skinKey
()
{
return
'StartScene'
}
public
get
groupName
()
{
return
'start_scene'
}
constructor
(
data
?)
{
super
(
data
);
}
initEvents
()
{
super
.
initEvents
();
}
removeEvents
()
{
super
.
removeEvents
();
}
protected
onSkinComplete
():
void
{
super
.
onSkinComplete
();
// this.mainbg.texture = this.bgtexture;
let
stageHeight
=
750
/
window
.
innerWidth
*
window
.
innerHeight
;
this
.
scroller_body
.
height
=
stageHeight
;
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
if
(
this
.
stage
)
{
this
.
onLoad
();
}
}
animation
(){
this
[
"disc_loop"
].
play
(
0
)
}
private
bgtexture
:
egret
.
Texture
;
protected
async
preLoadRes
()
{
//加载背景并设置背景图片
// this.bgtexture = await RES.getResAsync('gameBg_jpg');
// console.log('载背景并设置背景图片mainscene');
return
new
Promise
(
function
(
resolve
,
reject
)
{
resolve
();
});
}
timer
start
(
data
?)
{
super
.
start
(
data
);
this
.
timer
=
new
egret
.
Timer
(
1000
);
this
.
percentHeight
=
100
;
}
private
onLoad
():
void
{
this
.
initUI
();
}
private
initUI
():
void
{
}
private
canStart
:
boolean
;
}
\ No newline at end of file
.history/egret/src/startScene/StartScene_20191022140448.ts
deleted
100644 → 0
View file @
cd3f33b2
import
{
IDynamicData
}
from
'./../../libs/tw/data/game/datapash/IDynamicData'
;
import
{
GamePlayModel
}
from
'./../../libs/tw/model/game/GamePlayModel'
;
import
{
ModuleTypes
}
from
'./../types/sceneTypes'
;
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
Scene
from
"../views/Scene"
;
import
Loading
from
"../loading/Loading"
;
import
PanelCtrl
from
'../ctrls/panelCtrl'
;
import
{
DataManager
}
from
'../../libs/tw/manager/DataManager'
;
import
{
GTime
}
from
'../../libs/tc/util/GTime'
;
import
{
Buried
}
from
'../../libs/tw/util/Buried'
;
import
SceneCtrl
from
'../ctrls/sceneCtrl'
;
export
default
class
StartScene
extends
Scene
{
public
scroller_body
:
eui
.
Scroller
;
public
bg
:
eui
.
Image
;
public
topBtn
:
eui
.
Group
;
public
startBtn
:
eui
.
Button
;
public
get
skinKey
()
{
return
'StartScene'
}
public
get
groupName
()
{
return
'start_scene'
}
constructor
(
data
?)
{
super
(
data
);
}
initEvents
()
{
super
.
initEvents
();
}
removeEvents
()
{
super
.
removeEvents
();
}
protected
onSkinComplete
():
void
{
super
.
onSkinComplete
();
// this.mainbg.texture = this.bgtexture;
let
stageHeight
=
750
/
window
.
innerWidth
*
window
.
innerHeight
;
this
.
scroller_body
.
height
=
stageHeight
;
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
if
(
this
.
stage
)
{
this
.
onLoad
();
}
}
animation
(){
this
[
"disc_loop"
].
play
(
0
)
this
[
"disc_loop"
].
items
.
forEach
((
item
)
=>
{
item
.
tween
.
loop
=
true
;
})
}
private
bgtexture
:
egret
.
Texture
;
protected
async
preLoadRes
()
{
//加载背景并设置背景图片
// this.bgtexture = await RES.getResAsync('gameBg_jpg');
// console.log('载背景并设置背景图片mainscene');
return
new
Promise
(
function
(
resolve
,
reject
)
{
resolve
();
});
}
timer
start
(
data
?)
{
super
.
start
(
data
);
this
.
timer
=
new
egret
.
Timer
(
1000
);
this
.
percentHeight
=
100
;
}
private
onLoad
():
void
{
this
.
initUI
();
}
private
initUI
():
void
{
}
private
canStart
:
boolean
;
}
\ No newline at end of file
.history/egret/src/startScene/StartScene_20191022140639.ts
deleted
100644 → 0
View file @
cd3f33b2
import
{
IDynamicData
}
from
'./../../libs/tw/data/game/datapash/IDynamicData'
;
import
{
GamePlayModel
}
from
'./../../libs/tw/model/game/GamePlayModel'
;
import
{
ModuleTypes
}
from
'./../types/sceneTypes'
;
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
Scene
from
"../views/Scene"
;
import
Loading
from
"../loading/Loading"
;
import
PanelCtrl
from
'../ctrls/panelCtrl'
;
import
{
DataManager
}
from
'../../libs/tw/manager/DataManager'
;
import
{
GTime
}
from
'../../libs/tc/util/GTime'
;
import
{
Buried
}
from
'../../libs/tw/util/Buried'
;
import
SceneCtrl
from
'../ctrls/sceneCtrl'
;
export
default
class
StartScene
extends
Scene
{
public
scroller_body
:
eui
.
Scroller
;
public
bg
:
eui
.
Image
;
public
topBtn
:
eui
.
Group
;
public
startBtn
:
eui
.
Button
;
public
get
skinKey
()
{
return
'StartScene'
}
public
get
groupName
()
{
return
'start_scene'
}
constructor
(
data
?)
{
super
(
data
);
}
initEvents
()
{
super
.
initEvents
();
}
removeEvents
()
{
super
.
removeEvents
();
}
protected
onSkinComplete
():
void
{
super
.
onSkinComplete
();
// this.mainbg.texture = this.bgtexture;
let
stageHeight
=
750
/
window
.
innerWidth
*
window
.
innerHeight
;
this
.
scroller_body
.
height
=
stageHeight
;
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
if
(
this
.
stage
)
{
this
.
onLoad
();
}
this
.
animation
()
}
animation
(){
this
[
"disc_loop"
].
play
(
0
)
this
[
"disc_loop"
].
items
.
forEach
((
item
)
=>
{
item
.
tween
.
loop
=
true
;
})
}
private
bgtexture
:
egret
.
Texture
;
protected
async
preLoadRes
()
{
//加载背景并设置背景图片
// this.bgtexture = await RES.getResAsync('gameBg_jpg');
// console.log('载背景并设置背景图片mainscene');
return
new
Promise
(
function
(
resolve
,
reject
)
{
resolve
();
});
}
timer
start
(
data
?)
{
super
.
start
(
data
);
this
.
timer
=
new
egret
.
Timer
(
1000
);
this
.
percentHeight
=
100
;
}
private
onLoad
():
void
{
this
.
initUI
();
}
private
initUI
():
void
{
}
private
canStart
:
boolean
;
}
\ No newline at end of file
.history/egret/src/startScene/StartScene_20191022151306.ts
deleted
100644 → 0
View file @
cd3f33b2
import
{
IDynamicData
}
from
'./../../libs/tw/data/game/datapash/IDynamicData'
;
import
{
GamePlayModel
}
from
'./../../libs/tw/model/game/GamePlayModel'
;
import
{
ModuleTypes
}
from
'./../types/sceneTypes'
;
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
Scene
from
"../views/Scene"
;
import
Loading
from
"../loading/Loading"
;
import
PanelCtrl
from
'../ctrls/panelCtrl'
;
import
{
DataManager
}
from
'../../libs/tw/manager/DataManager'
;
import
{
GTime
}
from
'../../libs/tc/util/GTime'
;
import
{
Buried
}
from
'../../libs/tw/util/Buried'
;
import
SceneCtrl
from
'../ctrls/sceneCtrl'
;
export
default
class
StartScene
extends
Scene
{
public
scroller_body
:
eui
.
Scroller
;
public
bg
:
eui
.
Image
;
public
topBtn
:
eui
.
Group
;
public
disc_ico
:
eui
.
Image
;
public
startBtn
:
eui
.
Button
;
public
get
skinKey
()
{
return
'StartScene'
}
public
get
groupName
()
{
return
'start_scene'
}
constructor
(
data
?)
{
super
(
data
);
}
initEvents
()
{
super
.
initEvents
();
}
removeEvents
()
{
super
.
removeEvents
();
}
protected
onSkinComplete
():
void
{
super
.
onSkinComplete
();
// this.mainbg.texture = this.bgtexture;
let
stageHeight
=
750
/
window
.
innerWidth
*
window
.
innerHeight
;
this
.
scroller_body
.
height
=
stageHeight
;
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
if
(
this
.
stage
)
{
this
.
onLoad
();
}
this
.
animation
()
}
animation
(){
this
[
"disc_loop"
].
play
(
0
)
this
[
"disc_loop"
].
items
.
forEach
((
item
)
=>
{
item
.
tween
.
loop
=
true
;
})
}
private
bgtexture
:
egret
.
Texture
;
protected
async
preLoadRes
()
{
//加载背景并设置背景图片
// this.bgtexture = await RES.getResAsync('gameBg_jpg');
// console.log('载背景并设置背景图片mainscene');
return
new
Promise
(
function
(
resolve
,
reject
)
{
resolve
();
});
}
timer
start
(
data
?)
{
super
.
start
(
data
);
this
.
timer
=
new
egret
.
Timer
(
1000
);
this
.
percentHeight
=
100
;
}
private
onLoad
():
void
{
this
.
initUI
();
}
private
initUI
():
void
{
}
private
canStart
:
boolean
;
}
\ No newline at end of file
.history/egret/src/startScene/StartScene_20191022151431.ts
deleted
100644 → 0
View file @
cd3f33b2
import
{
IDynamicData
}
from
'./../../libs/tw/data/game/datapash/IDynamicData'
;
import
{
GamePlayModel
}
from
'./../../libs/tw/model/game/GamePlayModel'
;
import
{
ModuleTypes
}
from
'./../types/sceneTypes'
;
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
Scene
from
"../views/Scene"
;
import
Loading
from
"../loading/Loading"
;
import
PanelCtrl
from
'../ctrls/panelCtrl'
;
import
{
DataManager
}
from
'../../libs/tw/manager/DataManager'
;
import
{
GTime
}
from
'../../libs/tc/util/GTime'
;
import
{
Buried
}
from
'../../libs/tw/util/Buried'
;
import
SceneCtrl
from
'../ctrls/sceneCtrl'
;
export
default
class
StartScene
extends
Scene
{
public
scroller_body
:
eui
.
Scroller
;
public
bg
:
eui
.
Image
;
public
topBtn
:
eui
.
Group
;
public
disc_ico
:
eui
.
Image
;
public
startBtn
:
eui
.
Button
;
public
get
skinKey
()
{
return
'StartScene'
}
public
get
groupName
()
{
return
'start_scene'
}
constructor
(
data
?)
{
super
(
data
);
}
initEvents
()
{
super
.
initEvents
();
this
.
startBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_startBtn
,
this
)
}
removeEvents
()
{
super
.
removeEvents
();
this
.
startBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_startBtn
,
this
)
}
onTap_startBtn
(){
SceneCtrl
.
instance
.
change
(
ModuleTypes
.
GAME_SCENE
)
}
protected
onSkinComplete
():
void
{
super
.
onSkinComplete
();
// this.mainbg.texture = this.bgtexture;
let
stageHeight
=
750
/
window
.
innerWidth
*
window
.
innerHeight
;
this
.
scroller_body
.
height
=
stageHeight
;
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
if
(
this
.
stage
)
{
this
.
onLoad
();
}
this
.
animation
()
}
animation
(){
this
[
"disc_loop"
].
play
(
0
)
this
[
"disc_loop"
].
items
.
forEach
((
item
)
=>
{
item
.
tween
.
loop
=
true
;
})
}
private
bgtexture
:
egret
.
Texture
;
protected
async
preLoadRes
()
{
//加载背景并设置背景图片
// this.bgtexture = await RES.getResAsync('gameBg_jpg');
// console.log('载背景并设置背景图片mainscene');
return
new
Promise
(
function
(
resolve
,
reject
)
{
resolve
();
});
}
timer
start
(
data
?)
{
super
.
start
(
data
);
this
.
timer
=
new
egret
.
Timer
(
1000
);
this
.
percentHeight
=
100
;
}
private
onLoad
():
void
{
this
.
initUI
();
}
private
initUI
():
void
{
}
private
canStart
:
boolean
;
}
\ No newline at end of file
.history/egret/src/startScene/StartScene_20191022202721.ts
deleted
100644 → 0
View file @
cd3f33b2
import
{
IDynamicData
}
from
'./../../libs/tw/data/game/datapash/IDynamicData'
;
import
{
GamePlayModel
}
from
'./../../libs/tw/model/game/GamePlayModel'
;
import
{
ModuleTypes
}
from
'./../types/sceneTypes'
;
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
Scene
from
"../views/Scene"
;
import
Loading
from
"../loading/Loading"
;
import
PanelCtrl
from
'../ctrls/panelCtrl'
;
import
{
DataManager
}
from
'../../libs/tw/manager/DataManager'
;
import
{
GTime
}
from
'../../libs/tc/util/GTime'
;
import
{
Buried
}
from
'../../libs/tw/util/Buried'
;
import
SceneCtrl
from
'../ctrls/sceneCtrl'
;
export
default
class
StartScene
extends
Scene
{
public
scroller_body
:
eui
.
Scroller
;
public
bg
:
eui
.
Image
;
public
topBtn
:
eui
.
Group
;
public
disc_ico
:
eui
.
Image
;
public
startBtn
:
eui
.
Button
;
public
get
skinKey
()
{
return
'StartScene'
}
public
get
groupName
()
{
return
'start_scene'
}
constructor
(
data
?)
{
super
(
data
);
}
initEvents
()
{
super
.
initEvents
();
this
.
startBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_startBtn
,
this
)
}
removeEvents
()
{
super
.
removeEvents
();
this
.
startBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_startBtn
,
this
)
}
onTap_startBtn
(){
const
isfirst
=
egret
.
localStorage
.
getItem
(
'showGuide'
);
if
(
!
isfirst
)
{
egret
.
localStorage
.
setItem
(
'showGuide'
,
'true'
);
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
GUIDE_PANEL
);
}
else
{
SceneCtrl
.
instance
.
change
(
ModuleTypes
.
GAME_SCENE
)
}
}
protected
onSkinComplete
():
void
{
super
.
onSkinComplete
();
// this.mainbg.texture = this.bgtexture;
let
stageHeight
=
750
/
window
.
innerWidth
*
window
.
innerHeight
;
this
.
scroller_body
.
height
=
stageHeight
;
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
if
(
this
.
stage
)
{
this
.
onLoad
();
}
this
.
animation
()
}
animation
(){
this
[
"disc_loop"
].
play
(
0
)
this
[
"disc_loop"
].
items
.
forEach
((
item
)
=>
{
item
.
tween
.
loop
=
true
;
})
}
private
bgtexture
:
egret
.
Texture
;
protected
async
preLoadRes
()
{
//加载背景并设置背景图片
// this.bgtexture = await RES.getResAsync('gameBg_jpg');
// console.log('载背景并设置背景图片mainscene');
return
new
Promise
(
function
(
resolve
,
reject
)
{
resolve
();
});
}
timer
start
(
data
?)
{
super
.
start
(
data
);
this
.
timer
=
new
egret
.
Timer
(
1000
);
this
.
percentHeight
=
100
;
}
private
onLoad
():
void
{
this
.
initUI
();
}
private
initUI
():
void
{
}
private
canStart
:
boolean
;
}
\ No newline at end of file
.history/egret/src/startScene/StartScene_20191023164245.ts
deleted
100644 → 0
View file @
cd3f33b2
import
{
IDynamicData
}
from
'./../../libs/tw/data/game/datapash/IDynamicData'
;
import
{
GamePlayModel
}
from
'./../../libs/tw/model/game/GamePlayModel'
;
import
{
ModuleTypes
}
from
'./../types/sceneTypes'
;
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
Scene
from
"../views/Scene"
;
import
Loading
from
"../loading/Loading"
;
import
PanelCtrl
from
'../ctrls/panelCtrl'
;
import
{
DataManager
}
from
'../../libs/tw/manager/DataManager'
;
import
{
GTime
}
from
'../../libs/tc/util/GTime'
;
import
{
Buried
}
from
'../../libs/tw/util/Buried'
;
import
SceneCtrl
from
'../ctrls/sceneCtrl'
;
export
default
class
StartScene
extends
Scene
{
public
scroller_body
:
eui
.
Scroller
;
public
bg
:
eui
.
Image
;
public
topBtn
:
eui
.
Group
;
public
disc_ico
:
eui
.
Image
;
public
startBtn
:
eui
.
Button
;
public
list
:
eui
.
List
;
public
get
skinKey
()
{
return
'StartScene'
}
public
get
groupName
()
{
return
'start_scene'
}
constructor
(
data
?)
{
super
(
data
);
}
initEvents
()
{
super
.
initEvents
();
this
.
startBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_startBtn
,
this
)
}
removeEvents
()
{
super
.
removeEvents
();
this
.
startBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_startBtn
,
this
)
}
onTap_startBtn
(){
const
isfirst
=
egret
.
localStorage
.
getItem
(
'showGuide'
);
if
(
!
isfirst
)
{
egret
.
localStorage
.
setItem
(
'showGuide'
,
'true'
);
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
GUIDE_PANEL
);
}
else
{
SceneCtrl
.
instance
.
change
(
ModuleTypes
.
GAME_SCENE
)
}
}
protected
onSkinComplete
():
void
{
super
.
onSkinComplete
();
// this.mainbg.texture = this.bgtexture;
let
stageHeight
=
750
/
window
.
innerWidth
*
window
.
innerHeight
;
this
.
scroller_body
.
height
=
stageHeight
;
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
if
(
this
.
stage
)
{
this
.
onLoad
();
}
this
.
animation
()
}
animation
(){
this
[
"disc_loop"
].
play
(
0
)
this
[
"disc_loop"
].
items
.
forEach
((
item
)
=>
{
item
.
tween
.
loop
=
true
;
})
}
private
bgtexture
:
egret
.
Texture
;
protected
async
preLoadRes
()
{
//加载背景并设置背景图片
// this.bgtexture = await RES.getResAsync('gameBg_jpg');
// console.log('载背景并设置背景图片mainscene');
return
new
Promise
(
function
(
resolve
,
reject
)
{
resolve
();
});
}
timer
start
(
data
?)
{
super
.
start
(
data
);
this
.
timer
=
new
egret
.
Timer
(
1000
);
this
.
percentHeight
=
100
;
}
private
onLoad
():
void
{
this
.
initUI
();
}
private
initUI
():
void
{
}
private
canStart
:
boolean
;
}
\ No newline at end of file
.history/egret/src/startScene/StartScene_20191023164417.ts
deleted
100644 → 0
View file @
cd3f33b2
import
{
IDynamicData
}
from
'./../../libs/tw/data/game/datapash/IDynamicData'
;
import
{
GamePlayModel
}
from
'./../../libs/tw/model/game/GamePlayModel'
;
import
{
ModuleTypes
}
from
'./../types/sceneTypes'
;
import
{
NetManager
}
from
'./../../libs/tw/manager/NetManager'
;
import
Scene
from
"../views/Scene"
;
import
Loading
from
"../loading/Loading"
;
import
PanelCtrl
from
'../ctrls/panelCtrl'
;
import
{
DataManager
}
from
'../../libs/tw/manager/DataManager'
;
import
{
GTime
}
from
'../../libs/tc/util/GTime'
;
import
{
Buried
}
from
'../../libs/tw/util/Buried'
;
import
SceneCtrl
from
'../ctrls/sceneCtrl'
;
import
TaskItem
from
'./TaskItem'
;
import
{
NetPromise
}
from
'../NetPromise'
;
import
{
NetName
}
from
'../../libs/tw/enum/NetName'
;
export
default
class
StartScene
extends
Scene
{
public
scroller_body
:
eui
.
Scroller
;
public
bg
:
eui
.
Image
;
public
topBtn
:
eui
.
Group
;
public
disc_ico
:
eui
.
Image
;
public
startBtn
:
eui
.
Button
;
public
list
:
eui
.
List
;
public
get
skinKey
()
{
return
'StartScene'
}
public
get
groupName
()
{
return
'start_scene'
}
constructor
(
data
?)
{
super
(
data
);
}
initEvents
()
{
super
.
initEvents
();
this
.
startBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_startBtn
,
this
)
}
removeEvents
()
{
super
.
removeEvents
();
this
.
startBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_startBtn
,
this
)
}
onTap_startBtn
(){
const
isfirst
=
egret
.
localStorage
.
getItem
(
'showGuide'
);
if
(
!
isfirst
)
{
egret
.
localStorage
.
setItem
(
'showGuide'
,
'true'
);
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
GUIDE_PANEL
);
}
else
{
SceneCtrl
.
instance
.
change
(
ModuleTypes
.
GAME_SCENE
)
}
}
protected
onSkinComplete
():
void
{
super
.
onSkinComplete
();
// this.mainbg.texture = this.bgtexture;
let
stageHeight
=
750
/
window
.
innerWidth
*
window
.
innerHeight
;
this
.
scroller_body
.
height
=
stageHeight
;
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
if
(
this
.
stage
)
{
this
.
onLoad
();
}
this
.
animation
()
this
.
list
.
itemRenderer
=
TaskItem
;
NetPromise
.
ins
.
listDo
()
.
then
(()
=>
{
this
.
list
.
dataProvider
=
new
eui
.
ArrayCollection
(
DataManager
.
ins
.
getData
(
NetName
.
listDo
).
data
)
})
.
catch
(()
=>
{
})
}
animation
(){
this
[
"disc_loop"
].
play
(
0
)
this
[
"disc_loop"
].
items
.
forEach
((
item
)
=>
{
item
.
tween
.
loop
=
true
;
})
}
private
bgtexture
:
egret
.
Texture
;
protected
async
preLoadRes
()
{
//加载背景并设置背景图片
// this.bgtexture = await RES.getResAsync('gameBg_jpg');
// console.log('载背景并设置背景图片mainscene');
return
new
Promise
(
function
(
resolve
,
reject
)
{
resolve
();
});
}
timer
start
(
data
?)
{
super
.
start
(
data
);
this
.
timer
=
new
egret
.
Timer
(
1000
);
this
.
percentHeight
=
100
;
}
private
onLoad
():
void
{
this
.
initUI
();
}
private
initUI
():
void
{
}
private
canStart
:
boolean
;
}
\ No newline at end of file
.history/egret/src/startScene/StartScene_20191
02316474
2.ts
→
.history/egret/src/startScene/StartScene_20191
12217533
2.ts
View file @
caeebf03
...
@@ -12,18 +12,21 @@ import SceneCtrl from '../ctrls/sceneCtrl';
...
@@ -12,18 +12,21 @@ import SceneCtrl from '../ctrls/sceneCtrl';
import
TaskItem
from
'./TaskItem'
;
import
TaskItem
from
'./TaskItem'
;
import
{
NetPromise
}
from
'../NetPromise'
;
import
{
NetPromise
}
from
'../NetPromise'
;
import
{
NetName
}
from
'../../libs/tw/enum/NetName'
;
import
{
NetName
}
from
'../../libs/tw/enum/NetName'
;
import
{
NetBuried
}
from
'../NetBuried'
;
export
default
class
StartScene
extends
Scene
{
export
default
class
StartScene
extends
Scene
{
public
scroller_body
:
eui
.
Scroller
;
public
scroller_body
:
eui
.
Scroller
;
public
bg
:
eui
.
Image
;
public
bg
:
eui
.
Image
;
public
topBtn
:
eui
.
Group
;
public
topBtn
:
eui
.
Group
;
public
ruleBtn
:
eui
.
Button
;
public
disc_ico
:
eui
.
Image
;
public
disc_ico
:
eui
.
Image
;
public
startBtn
:
eui
.
Button
;
public
startBtn
:
eui
.
Button
;
public
list
:
eui
.
List
;
public
limitTodyText
:
eui
.
Label
;
public
adList
:
eui
.
Label
;
public
get
skinKey
()
{
return
'StartScene'
}
public
get
skinKey
()
{
return
'StartScene'
}
public
get
groupName
()
{
return
'start_scene'
}
public
get
groupName
()
{
return
'start_scene'
}
...
@@ -33,15 +36,57 @@ export default class StartScene extends Scene {
...
@@ -33,15 +36,57 @@ export default class StartScene extends Scene {
initEvents
()
{
initEvents
()
{
super
.
initEvents
();
super
.
initEvents
();
this
.
startBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_startBtn
,
this
)
this
.
startBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_startBtn
,
this
)
this
.
ruleBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_ruleBtn
,
this
)
}
}
removeEvents
()
{
removeEvents
()
{
super
.
removeEvents
();
super
.
removeEvents
();
this
.
startBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_startBtn
,
this
)
this
.
startBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_startBtn
,
this
)
this
.
ruleBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_ruleBtn
,
this
)
clearInterval
(
this
.
adTime
)
}
onTap_recordBtn
(){
window
.
location
.
href
=
window
[
"recordUrl"
];
}
onTap_ruleBtn
()
{
let
ruleData
=
`1、微信端挑战机会用完后,可前往民生银行App获得更多挑战次数,具体次数以App显示为准。挑战次数当日有效,隔日作废。
2、至民生银行App游戏闯关后,将有机会获得口红大奖、红包等好礼,100%中奖!具体规则以民生银行App的活动规则为准。
3、未下载民生银行App的用户,可在微信端游戏结束后下载App,并返回手机浏览器跳转页面,刷新后将进入民生银行App直接参与活动。
4、非民生银行客户直接下载民生银行App,通过手机号注册并参与活动。
5、本活动仅限2019年11月23日前开户的上海分行客户参加。
6、最终解释权归中国民生银行上海分行所有。`
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
PUB_PANEL
,
{
winType
:
"ruleGroup"
,
ruleData
:
ruleData
})
}
}
onTap_startBtn
(){
onTap_detailBtn
()
{
this
.
enabled
=
false
;
NetPromise
.
ins
.
detailDo
()
.
then
(()
=>
{
this
.
enabled
=
true
;
SceneCtrl
.
instance
.
change
(
ModuleTypes
.
RED_SCENE
)
})
.
catch
(()
=>
{
this
.
enabled
=
true
;
})
}
onTap_startBtn
()
{
PanelCtrl
.
instance
.
btnDelay
(
this
.
startBtn
)
NetBuried
.
ins
.
clickLog
(
2
)
if
(
localStorage
.
times
==
new
Date
().
getDate
()){
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
PUB_PANEL
,{
winType
:
"noTimesGroup"
})
console
.
log
(
"次数已用完弹窗"
)
return
;
}
localStorage
.
times
=
new
Date
().
getDate
()
const
isfirst
=
egret
.
localStorage
.
getItem
(
'showGuide'
);
const
isfirst
=
egret
.
localStorage
.
getItem
(
'showGuide'
);
if
(
!
isfirst
)
{
if
(
!
isfirst
)
{
egret
.
localStorage
.
setItem
(
'showGuide'
,
'true'
);
egret
.
localStorage
.
setItem
(
'showGuide'
,
'true'
);
...
@@ -51,35 +96,50 @@ export default class StartScene extends Scene {
...
@@ -51,35 +96,50 @@ export default class StartScene extends Scene {
}
}
}
}
adTime
protected
onSkinComplete
():
void
{
protected
onSkinComplete
():
void
{
super
.
onSkinComplete
();
super
.
onSkinComplete
();
// this.mainbg.texture = this.bgtexture;
// this.mainbg.texture = this.bgtexture;
let
stageHeight
=
750
/
window
.
innerWidth
*
window
.
innerHeight
;
let
stageHeight
=
750
/
window
.
innerWidth
*
window
.
innerHeight
;
this
.
scroller_body
.
height
=
stageHeight
;
this
.
scroller_body
.
height
=
stageHeight
;
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
if
(
this
.
stage
)
{
if
(
this
.
stage
)
{
this
.
onLoad
();
this
.
onLoad
();
}
}
this
.
animation
()
let
i_a
=
0
this
.
list
.
itemRenderer
=
TaskItem
;
NetBuried
.
ins
.
showLog
(
1
)
NetPromise
.
ins
.
listDo
()
NetBuried
.
ins
.
showLog
(
2
)
.
then
(()
=>
{
this
.
adList
.
text
=
window
[
"adList"
][
i_a
]
this
.
list
.
dataProvider
=
new
eui
.
ArrayCollection
(
DataManager
.
ins
.
getData
(
NetName
.
listDo
).
data
)
this
[
"adlistShow"
].
play
(
0
)
})
i_a
++
.
catch
(()
=>
{
this
.
adTime
=
setInterval
(()
=>
{
this
.
adList
.
text
=
window
[
"adList"
][
i_a
]
})
this
[
"adlistShow"
].
play
(
0
)
if
(
i_a
>=
window
[
"adList"
].
length
-
1
){
i_a
=
0
}
else
{
i_a
++
}
},
2250
)
this
.
animation
()
if
(
localStorage
.
times
==
new
Date
().
getDate
()){
this
.
limitTodyText
.
text
=
`今天剩余次数:0次`
}
else
{
this
.
limitTodyText
.
text
=
`今天剩余次数:1次`
}
}
}
animation
(){
animation
()
{
this
[
"disc_loop"
].
play
(
0
)
this
[
"disc_loop"
].
play
(
0
)
this
[
"disc_loop"
].
items
.
forEach
((
item
)
=>
{
this
[
"disc_loop"
].
items
.
forEach
((
item
)
=>
{
item
.
tween
.
loop
=
true
;
item
.
tween
.
loop
=
true
;
})
})
}
}
...
@@ -107,7 +167,7 @@ export default class StartScene extends Scene {
...
@@ -107,7 +167,7 @@ export default class StartScene extends Scene {
}
}
private
initUI
():
void
{
private
initUI
():
void
{
}
}
private
canStart
:
boolean
;
private
canStart
:
boolean
;
...
...
.history/egret/src/startScene/StartScene_20191
023164736
.ts
→
.history/egret/src/startScene/StartScene_20191
123102818
.ts
View file @
caeebf03
...
@@ -12,18 +12,21 @@ import SceneCtrl from '../ctrls/sceneCtrl';
...
@@ -12,18 +12,21 @@ import SceneCtrl from '../ctrls/sceneCtrl';
import
TaskItem
from
'./TaskItem'
;
import
TaskItem
from
'./TaskItem'
;
import
{
NetPromise
}
from
'../NetPromise'
;
import
{
NetPromise
}
from
'../NetPromise'
;
import
{
NetName
}
from
'../../libs/tw/enum/NetName'
;
import
{
NetName
}
from
'../../libs/tw/enum/NetName'
;
import
{
NetBuried
}
from
'../NetBuried'
;
export
default
class
StartScene
extends
Scene
{
export
default
class
StartScene
extends
Scene
{
public
scroller_body
:
eui
.
Scroller
;
public
scroller_body
:
eui
.
Scroller
;
public
bg
:
eui
.
Image
;
public
bg
:
eui
.
Image
;
public
topBtn
:
eui
.
Group
;
public
topBtn
:
eui
.
Group
;
public
ruleBtn
:
eui
.
Button
;
public
disc_ico
:
eui
.
Image
;
public
disc_ico
:
eui
.
Image
;
public
startBtn
:
eui
.
Button
;
public
startBtn
:
eui
.
Button
;
public
list
:
eui
.
List
;
public
limitTodyText
:
eui
.
Label
;
public
adList
:
eui
.
Label
;
public
get
skinKey
()
{
return
'StartScene'
}
public
get
skinKey
()
{
return
'StartScene'
}
public
get
groupName
()
{
return
'start_scene'
}
public
get
groupName
()
{
return
'start_scene'
}
...
@@ -33,15 +36,55 @@ export default class StartScene extends Scene {
...
@@ -33,15 +36,55 @@ export default class StartScene extends Scene {
initEvents
()
{
initEvents
()
{
super
.
initEvents
();
super
.
initEvents
();
this
.
startBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_startBtn
,
this
)
this
.
startBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_startBtn
,
this
)
this
.
ruleBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_ruleBtn
,
this
)
}
}
removeEvents
()
{
removeEvents
()
{
super
.
removeEvents
();
super
.
removeEvents
();
this
.
startBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_startBtn
,
this
)
this
.
startBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_startBtn
,
this
)
this
.
ruleBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_ruleBtn
,
this
)
clearInterval
(
this
.
adTime
)
}
onTap_recordBtn
(){
window
.
location
.
href
=
window
[
"recordUrl"
];
}
onTap_ruleBtn
()
{
let
ruleData
=
`1、微信端挑战机会用完后,可前往民生银行App获得更多挑战次数,具体次数以App显示为准。挑战次数当日有效,隔日作废。
2、至民生银行App游戏闯关后,将有机会获得口红大奖、红包等好礼,100%中奖!具体规则以民生银行App的活动规则为准。
3、未下载民生银行App的用户,可至各大应用商城搜索下载“民生银行手机银行”App。
5、活动仅限截止2019年11月23日前开户的上海分行客户参加。
6、本次活动最终解释权归中国民生银行上海分行所有。`
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
PUB_PANEL
,
{
winType
:
"ruleGroup"
,
ruleData
:
ruleData
})
}
}
onTap_startBtn
(){
onTap_detailBtn
()
{
this
.
enabled
=
false
;
NetPromise
.
ins
.
detailDo
()
.
then
(()
=>
{
this
.
enabled
=
true
;
SceneCtrl
.
instance
.
change
(
ModuleTypes
.
RED_SCENE
)
})
.
catch
(()
=>
{
this
.
enabled
=
true
;
})
}
onTap_startBtn
()
{
PanelCtrl
.
instance
.
btnDelay
(
this
.
startBtn
)
NetBuried
.
ins
.
clickLog
(
2
)
if
(
localStorage
.
times
==
new
Date
().
getDate
()){
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
PUB_PANEL
,{
winType
:
"noTimesGroup"
})
console
.
log
(
"次数已用完弹窗"
)
return
;
}
localStorage
.
times
=
new
Date
().
getDate
()
const
isfirst
=
egret
.
localStorage
.
getItem
(
'showGuide'
);
const
isfirst
=
egret
.
localStorage
.
getItem
(
'showGuide'
);
if
(
!
isfirst
)
{
if
(
!
isfirst
)
{
egret
.
localStorage
.
setItem
(
'showGuide'
,
'true'
);
egret
.
localStorage
.
setItem
(
'showGuide'
,
'true'
);
...
@@ -51,36 +94,50 @@ export default class StartScene extends Scene {
...
@@ -51,36 +94,50 @@ export default class StartScene extends Scene {
}
}
}
}
adTime
protected
onSkinComplete
():
void
{
protected
onSkinComplete
():
void
{
super
.
onSkinComplete
();
super
.
onSkinComplete
();
// this.mainbg.texture = this.bgtexture;
// this.mainbg.texture = this.bgtexture;
let
stageHeight
=
750
/
window
.
innerWidth
*
window
.
innerHeight
;
let
stageHeight
=
750
/
window
.
innerWidth
*
window
.
innerHeight
;
this
.
scroller_body
.
height
=
stageHeight
;
this
.
scroller_body
.
height
=
stageHeight
;
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
this
.
once
(
egret
.
Event
.
ADDED_TO_STAGE
,
this
.
onLoad
,
this
);
if
(
this
.
stage
)
{
if
(
this
.
stage
)
{
this
.
onLoad
();
this
.
onLoad
();
}
}
this
.
animation
()
let
i_a
=
0
this
.
list
.
itemRenderer
=
TaskItem
;
NetBuried
.
ins
.
showLog
(
1
)
this
.
list
.
dataProvider
=
[]
NetBuried
.
ins
.
showLog
(
2
)
NetPromise
.
ins
.
listDo
()
this
.
adList
.
text
=
window
[
"adList"
][
i_a
]
.
then
(()
=>
{
this
[
"adlistShow"
].
play
(
0
)
this
.
list
.
dataProvider
=
new
eui
.
ArrayCollection
(
DataManager
.
ins
.
getData
(
NetName
.
listDo
).
data
)
i_a
++
})
this
.
adTime
=
setInterval
(()
=>
{
.
catch
(()
=>
{
this
.
adList
.
text
=
window
[
"adList"
][
i_a
]
this
[
"adlistShow"
].
play
(
0
)
})
if
(
i_a
>=
window
[
"adList"
].
length
-
1
){
i_a
=
0
}
else
{
i_a
++
}
},
2250
)
this
.
animation
()
if
(
localStorage
.
times
==
new
Date
().
getDate
()){
this
.
limitTodyText
.
text
=
`今天剩余次数:0次`
}
else
{
this
.
limitTodyText
.
text
=
`今天剩余次数:1次`
}
}
}
animation
(){
animation
()
{
this
[
"disc_loop"
].
play
(
0
)
this
[
"disc_loop"
].
play
(
0
)
this
[
"disc_loop"
].
items
.
forEach
((
item
)
=>
{
this
[
"disc_loop"
].
items
.
forEach
((
item
)
=>
{
item
.
tween
.
loop
=
true
;
item
.
tween
.
loop
=
true
;
})
})
}
}
...
@@ -108,7 +165,7 @@ export default class StartScene extends Scene {
...
@@ -108,7 +165,7 @@ export default class StartScene extends Scene {
}
}
private
initUI
():
void
{
private
initUI
():
void
{
}
}
private
canStart
:
boolean
;
private
canStart
:
boolean
;
...
...
egret/resource/skins/PubPanelSkin.exml
View file @
caeebf03
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<e:Image
id=
"gift_ico"
anchorOffsetX=
"0"
y=
"59.5"
horizontalCenter=
"0.5"
x=
"10"
scaleX=
"1"
scaleY=
"1"
source=
"pub_gift_ico_png"
/>
<e:Image
id=
"gift_ico"
anchorOffsetX=
"0"
y=
"59.5"
horizontalCenter=
"0.5"
x=
"10"
scaleX=
"1"
scaleY=
"1"
source=
"pub_gift_ico_png"
/>
<e:Image
anchorOffsetX=
"0"
y=
"146.5"
horizontalCenter=
"0"
x=
"0"
scaleX=
"1"
scaleY=
"1"
source=
"pub_1_bg_png"
/>
<e:Image
anchorOffsetX=
"0"
y=
"146.5"
horizontalCenter=
"0"
x=
"0"
scaleX=
"1"
scaleY=
"1"
source=
"pub_1_bg_png"
/>
</e:Group>
</e:Group>
<e:Group
id=
"winGroupNoneTitle"
width=
"750"
height=
"887"
x=
"0"
y=
"0"
locked=
"true"
>
<e:Group
id=
"winGroupNoneTitle"
width=
"750"
height=
"887"
x=
"0"
y=
"0"
>
<e:Image
anchorOffsetX=
"0"
y=
"186.5"
horizontalCenter=
"0"
x=
"0"
scaleX=
"1"
scaleY=
"1"
source=
"pub_2_bg_png"
/>
<e:Image
anchorOffsetX=
"0"
y=
"186.5"
horizontalCenter=
"0"
x=
"0"
scaleX=
"1"
scaleY=
"1"
source=
"pub_2_bg_png"
/>
</e:Group>
</e:Group>
<e:Group
id=
"comGroup"
width=
"750"
height=
"887"
x=
"0"
y=
"0"
>
<e:Group
id=
"comGroup"
width=
"750"
height=
"887"
x=
"0"
y=
"0"
>
...
@@ -82,8 +82,8 @@
...
@@ -82,8 +82,8 @@
</e:Group>
</e:Group>
<e:Group
id=
"noTimesGroup"
width=
"750"
height=
"887"
x=
"0"
y=
"0"
scaleX=
"1"
scaleY=
"1"
>
<e:Group
id=
"noTimesGroup"
width=
"750"
height=
"887"
x=
"0"
y=
"0"
scaleX=
"1"
scaleY=
"1"
>
<e:Label
text=
"啊哦~当前免费游戏次数不足"
x=
"96.33"
y=
"249.5"
size=
"32"
textColor=
"0xF5587D"
anchorOffsetX=
"0"
width=
"558.67"
anchorOffsetY=
"0"
height=
"67.33"
textAlign=
"center"
verticalAlign=
"middle"
lineSpacing=
"16"
/>
<e:Label
text=
"啊哦~当前免费游戏次数不足"
x=
"96.33"
y=
"249.5"
size=
"32"
textColor=
"0xF5587D"
anchorOffsetX=
"0"
width=
"558.67"
anchorOffsetY=
"0"
height=
"67.33"
textAlign=
"center"
verticalAlign=
"middle"
lineSpacing=
"16"
/>
<e:Label
text=
"快前往“民生银行”App中\n获得更多免费次数吧!"
x=
"96.33"
y=
"336.5"
size=
"38"
textColor=
"0xF5587D"
anchorOffsetX=
"0"
width=
"558.67"
anchorOffsetY=
"0"
height=
"149.33"
lineSpacing=
"16"
textAlign=
"center"
bold=
"true"
/>
<e:Label
text=
"快前往“民生银行”App中\n获得更多免费次数吧!"
x=
"96.33"
y=
"336.5"
size=
"38"
textColor=
"0xF5587D"
anchorOffsetX=
"0"
width=
"558.67"
anchorOffsetY=
"0"
height=
"149.33"
lineSpacing=
"16"
textAlign=
"center"
bold=
"true"
verticalAlign=
"middle"
/>
<e:Button
id=
"noTimesSureBtn"
label=
"去APP获取次数"
horizontalCenter=
"0.5"
verticalCenter=
"97.5"
>
<e:Button
id=
"noTimesSureBtn"
label=
"去APP获取次数"
horizontalCenter=
"0.5"
verticalCenter=
"97.5"
visible=
"false"
>
<e:skinName>
<e:skinName>
<e:Skin
states=
"up,down,disabled"
>
<e:Skin
states=
"up,down,disabled"
>
<e:Image
width=
"100%"
height=
"100%"
scaleX.down=
"0.95"
scaleY.down=
"0.95"
source=
"pub_btn_png"
source.down=
"pub_btn_png"
source.disabled=
"pub_btn_png"
/>
<e:Image
width=
"100%"
height=
"100%"
scaleX.down=
"0.95"
scaleY.down=
"0.95"
source=
"pub_btn_png"
source.down=
"pub_btn_png"
source.disabled=
"pub_btn_png"
/>
...
...
egret/src/startScene/StartScene.ts
View file @
caeebf03
...
@@ -56,11 +56,11 @@ export default class StartScene extends Scene {
...
@@ -56,11 +56,11 @@ export default class StartScene extends Scene {
2、至民生银行App游戏闯关后,将有机会获得口红大奖、红包等好礼,100%中奖!具体规则以民生银行App的活动规则为准。
2、至民生银行App游戏闯关后,将有机会获得口红大奖、红包等好礼,100%中奖!具体规则以民生银行App的活动规则为准。
3、未下载民生银行App的用户,可
在微信端游戏结束后下载App,并返回手机浏览器跳转页面,刷新后将进入民生银行App直接参与活动
。
3、未下载民生银行App的用户,可
至各大应用商城搜索下载“民生银行手机银行”App
。
4、非民生银行客户直接下载民生银行App,通过手机号注册并参与活动
。
5、活动仅限截止2019年11月23日前开户的上海分行客户参加
。
5、本活动仅限上海地区客户参加,
最终解释权归中国民生银行上海分行所有。`
6、本次活动
最终解释权归中国民生银行上海分行所有。`
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
PUB_PANEL
,
{
winType
:
"ruleGroup"
,
ruleData
:
ruleData
})
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
PUB_PANEL
,
{
winType
:
"ruleGroup"
,
ruleData
:
ruleData
})
}
}
...
...
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