Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaole
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wildfirecode13
xiaoxiaole
Commits
e1f2e312
Commit
e1f2e312
authored
Feb 22, 2020
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
84f09f41
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
474 additions
and
282 deletions
+474
-282
NetManager.ts
egret/libs/tw/manager/NetManager.ts
+100
-56
MapScene.ts
egret/src/mapScene/MapScene.ts
+138
-125
BloodPanel.ts
egret/src/panels/BloodPanel.ts
+78
-28
BloodPanel2.ts
egret/src/panels/BloodPanel2.ts
+78
-29
FriendPanel.ts
egret/src/panels/FriendPanel.ts
+5
-3
InvitePanel.ts
egret/src/panels/InvitePanel.ts
+7
-4
ScratchPanel.ts
egret/src/panels/ScratchPanel.ts
+4
-1
ShareCodePanel.ts
egret/src/panels/ShareCodePanel.ts
+19
-15
StartPanel.ts
egret/src/panels/StartPanel.ts
+45
-21
No files found.
egret/libs/tw/manager/NetManager.ts
View file @
e1f2e312
This diff is collapsed.
Click to expand it.
egret/src/mapScene/MapScene.ts
View file @
e1f2e312
This diff is collapsed.
Click to expand it.
egret/src/panels/BloodPanel.ts
View file @
e1f2e312
...
@@ -13,6 +13,7 @@ import { showShare } from "../shareCtrl";
...
@@ -13,6 +13,7 @@ import { showShare } from "../shareCtrl";
import
{
gotoNextLevel
}
from
"./gotoNextLevel"
;
import
{
gotoNextLevel
}
from
"./gotoNextLevel"
;
import
BloodPanel2
from
"./BloodPanel2"
;
import
BloodPanel2
from
"./BloodPanel2"
;
import
PanelCtrl
from
"../../libs/new_wx/ctrls/panelCtrl"
;
import
PanelCtrl
from
"../../libs/new_wx/ctrls/panelCtrl"
;
import
{
showShareCodePanel
,
CodeChannels
}
from
"./ShareCodePanel"
;
export
default
class
BloodPanel
extends
Panel
{
export
default
class
BloodPanel
extends
Panel
{
start
(
data
)
{
start
(
data
)
{
...
@@ -36,17 +37,17 @@ export default class BloodPanel extends Panel {
...
@@ -36,17 +37,17 @@ export default class BloodPanel extends Panel {
private
_countDown
:
CountDown
;
private
_countDown
:
CountDown
;
private
updateData
()
{
private
updateData
()
{
if
(
this
.
_countDown
==
null
)
{
if
(
this
.
_countDown
==
null
)
{
this
.
_countDown
=
new
CountDown
(
this
[
'countdownTxt'
],
(
str
)
=>
`距离下一次体力补给时间:
${
str
}
`
);
this
.
_countDown
=
new
CountDown
(
this
[
'countdownTxt'
],
(
str
)
=>
`距离下一次体力补给时间:
${
str
}
`
);
}
}
const
homeData
=
getHomeData
();
const
homeData
=
getHomeData
();
this
[
'bloodTxt'
].
text
=
`你的可用体力值为:
${
homeData
.
remainEnargy
}
`
;
this
[
'bloodTxt'
].
text
=
`你的可用体力值为:
${
homeData
.
remainEnargy
}
`
;
const
data
=
getHomeData
();
const
data
=
getHomeData
();
this
[
'invitTxt'
].
text
=
`(已领
${
data
.
askForEnergy
}
/
${
BloodPanel
.
MAX
}
)`
;
this
[
'invitTxt'
].
text
=
`(已领
${
data
.
askForEnergy
}
/
${
BloodPanel
.
MAX
}
)`
;
if
(
data
.
askForEnergy
>=
BloodPanel
.
MAX
)
{
if
(
data
.
askForEnergy
>=
BloodPanel
.
MAX
)
{
this
[
'inviteBtn2'
].
visible
=
true
;
this
[
'inviteBtn2'
].
visible
=
true
;
}
}
if
(
data
.
remainEnargy
>=
BLOOD_NUMS_MAX
)
{
//满了
if
(
data
.
remainEnargy
>=
BLOOD_NUMS_MAX
)
{
//满了
this
[
'bloodTxt'
].
text
=
`你的可用体力值为:
${
homeData
.
remainEnargy
}
`
;
this
[
'bloodTxt'
].
text
=
`你的可用体力值为:
${
homeData
.
remainEnargy
}
`
;
this
.
_countDown
.
stop
();
this
.
_countDown
.
stop
();
this
[
'countdownTxt'
].
visible
=
false
;
this
[
'countdownTxt'
].
visible
=
false
;
...
@@ -73,7 +74,7 @@ export default class BloodPanel extends Panel {
...
@@ -73,7 +74,7 @@ export default class BloodPanel extends Panel {
this
[
'buyBtn'
].
enabled
=
false
;
this
[
'buyBtn'
].
enabled
=
false
;
NetManager
.
ins
.
hc_exchange
((
success
,
res
)
=>
{
NetManager
.
ins
.
hc_exchange
((
success
,
res
)
=>
{
this
[
'buyBtn'
].
enabled
=
true
;
this
[
'buyBtn'
].
enabled
=
true
;
if
(
success
)
{
if
(
success
)
{
showToast
(
'兑换成功'
);
showToast
(
'兑换成功'
);
NetManager
.
ins
.
hc_home
(()
=>
{
NetManager
.
ins
.
hc_home
(()
=>
{
this
.
updateData
();
this
.
updateData
();
...
@@ -81,43 +82,92 @@ export default class BloodPanel extends Panel {
...
@@ -81,43 +82,92 @@ export default class BloodPanel extends Panel {
SceneCtrl
.
instance
.
updateScene
();
SceneCtrl
.
instance
.
updateScene
();
},
window
[
'collectRuleId'
]);
},
window
[
'collectRuleId'
]);
}
else
{
}
else
{
if
(
res
.
code
==
'600005'
)
{
if
(
res
.
code
==
'600005'
)
{
showToast
(
'体力已满,快去闯关吧'
);
showToast
(
'体力已满,快去闯关吧'
);
}
else
{
}
else
{
PanelCtrl
.
instance
.
show
(
'shopTip'
,
{
from
:
'bloodPanel'
,
data
:
null
});
PanelCtrl
.
instance
.
show
(
'shopTip'
,
{
from
:
'bloodPanel'
,
data
:
null
});
}
}
}
}
},
1
);
},
1
);
}
}
onTapInvite
()
{
//
onTapInvite() {
if
(
iswx
())
{
// if(iswx()) {
getShareUrl
(
this
.
stage
);
// getShareUrl(this.stage);
}
else
// } else
showShare
(
1
);
// showShare(1);
// NetManager.ins.clickLog(getlogItem(4));
// const data = getHomeData();
// if(data.askForEnergy >= BloodPanel.MAX) {
// showToast('对不起,索要体力的机会已经用完了~');
// return;
// }
// this['inviteBtn'].enabled = false;
// NetManager.ins.hc_askForEnergy((success) => {
// this['inviteBtn'].enabled = true;
// if(success) {
// }
// NetManager.ins.hc_home(() => {
// this.updateData();
// updateMainTimer();
// SceneCtrl.instance.updateScene();
// }, window['collectRuleId']);
// wait(2000).then(() => {
// showToast('分享成功~');
// });
// })
// }
//0224修改
onTapInvite
()
{
NetManager
.
ins
.
clickLog
(
getlogItem
(
4
));
NetManager
.
ins
.
clickLog
(
getlogItem
(
4
));
const
data
=
getHomeData
();
const
data
=
getHomeData
();
if
(
data
.
askForEnergy
>=
BloodPanel
.
MAX
)
{
if
(
iswx
())
{
showToast
(
'对不起,索要体力的机会已经用完了~'
);
//微信流程不变
return
;
getShareUrl
(
this
.
stage
);
}
if
(
data
.
askForEnergy
>=
BloodPanel
.
MAX
)
{
this
[
'inviteBtn'
].
enabled
=
false
;
showToast
(
'对不起,索要体力的机会已经用完了~'
);
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
return
;
this
[
'inviteBtn'
].
enabled
=
true
;
if
(
success
)
{
}
}
NetManager
.
ins
.
hc_home
(()
=>
{
this
[
'inviteBtn'
].
enabled
=
false
;
this
.
updateData
();
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
updateMainTimer
();
this
[
'inviteBtn'
].
enabled
=
true
;
SceneCtrl
.
instance
.
updateScene
();
if
(
success
)
{
},
window
[
'collectRuleId'
]);
}
wait
(
2000
).
then
(()
=>
{
NetManager
.
ins
.
hc_home
(()
=>
{
showToast
(
'分享成功~'
);
this
.
updateData
();
});
updateMainTimer
();
})
SceneCtrl
.
instance
.
updateScene
();
},
window
[
'collectRuleId'
]);
wait
(
2000
).
then
(()
=>
{
showToast
(
'分享成功~'
);
});
})
}
else
{
showShareCodePanel
(
CodeChannels
.
AddBlood
,
null
,
()
=>
{
if
(
data
.
askForEnergy
>=
BloodPanel
.
MAX
)
{
wait
(
2000
).
then
(()
=>
{
showToast
(
'对不起,索要体力的机会已经用完了~'
);
});
}
else
{
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
NetManager
.
ins
.
hc_home
(()
=>
{
this
.
updateData
();
updateMainTimer
();
SceneCtrl
.
instance
.
updateScene
();
},
window
[
'collectRuleId'
]);
wait
(
2000
).
then
(()
=>
{
showToast
(
'分享成功~'
);
});
})
}
})
}
}
}
protected
get
closeBtns
():
eui
.
Button
[]
{
protected
get
closeBtns
():
eui
.
Button
[]
{
return
[
this
[
'closeBtn'
],
this
[
'resumeBtn'
]]
return
[
this
[
'closeBtn'
],
this
[
'resumeBtn'
]]
}
}
...
...
egret/src/panels/BloodPanel2.ts
View file @
e1f2e312
...
@@ -12,6 +12,7 @@ import CountDown from "../mapScene/CountDown";
...
@@ -12,6 +12,7 @@ import CountDown from "../mapScene/CountDown";
import
{
showShare
}
from
"../shareCtrl"
;
import
{
showShare
}
from
"../shareCtrl"
;
import
BloodPanel
from
"./BloodPanel"
;
import
BloodPanel
from
"./BloodPanel"
;
import
PanelCtrl
from
"../../libs/new_wx/ctrls/panelCtrl"
;
import
PanelCtrl
from
"../../libs/new_wx/ctrls/panelCtrl"
;
import
{
showShareCodePanel
,
CodeChannels
}
from
"./ShareCodePanel"
;
export
default
class
BloodPanel2
extends
Panel
{
export
default
class
BloodPanel2
extends
Panel
{
start
(
data
)
{
start
(
data
)
{
...
@@ -31,17 +32,17 @@ export default class BloodPanel2 extends Panel {
...
@@ -31,17 +32,17 @@ export default class BloodPanel2 extends Panel {
private
_countDown
:
CountDown
;
private
_countDown
:
CountDown
;
private
updateData
()
{
private
updateData
()
{
if
(
this
.
_countDown
==
null
)
{
if
(
this
.
_countDown
==
null
)
{
this
.
_countDown
=
new
CountDown
(
this
[
'countdownTxt'
],
(
str
)
=>
`距离下一次体力补给时间:
${
str
}
`
);
this
.
_countDown
=
new
CountDown
(
this
[
'countdownTxt'
],
(
str
)
=>
`距离下一次体力补给时间:
${
str
}
`
);
}
}
const
homeData
=
getHomeData
();
const
homeData
=
getHomeData
();
this
[
'bloodTxt'
].
text
=
`你的可用体力值为:
${
homeData
.
remainEnargy
}
`
;
this
[
'bloodTxt'
].
text
=
`你的可用体力值为:
${
homeData
.
remainEnargy
}
`
;
const
data
=
getHomeData
();
const
data
=
getHomeData
();
this
[
'invitTxt'
].
text
=
`(已领
${
data
.
askForEnergy
}
/
${
BloodPanel
.
MAX
}
)`
;
this
[
'invitTxt'
].
text
=
`(已领
${
data
.
askForEnergy
}
/
${
BloodPanel
.
MAX
}
)`
;
if
(
data
.
askForEnergy
>=
BloodPanel
.
MAX
)
{
if
(
data
.
askForEnergy
>=
BloodPanel
.
MAX
)
{
this
[
'inviteBtn2'
].
visible
=
true
;
this
[
'inviteBtn2'
].
visible
=
true
;
}
}
if
(
data
.
remainEnargy
>=
BLOOD_NUMS_MAX
)
{
//满了
if
(
data
.
remainEnargy
>=
BLOOD_NUMS_MAX
)
{
//满了
this
[
'bloodTxt'
].
text
=
`你的可用体力值为:
${
homeData
.
remainEnargy
}
`
;
this
[
'bloodTxt'
].
text
=
`你的可用体力值为:
${
homeData
.
remainEnargy
}
`
;
this
.
_countDown
.
stop
();
this
.
_countDown
.
stop
();
this
[
'countdownTxt'
].
visible
=
false
;
this
[
'countdownTxt'
].
visible
=
false
;
...
@@ -68,7 +69,7 @@ export default class BloodPanel2 extends Panel {
...
@@ -68,7 +69,7 @@ export default class BloodPanel2 extends Panel {
this
[
'buyBtn'
].
enabled
=
false
;
this
[
'buyBtn'
].
enabled
=
false
;
NetManager
.
ins
.
hc_exchange
((
success
,
res
)
=>
{
NetManager
.
ins
.
hc_exchange
((
success
,
res
)
=>
{
this
[
'buyBtn'
].
enabled
=
true
;
this
[
'buyBtn'
].
enabled
=
true
;
if
(
success
)
{
if
(
success
)
{
showToast
(
'兑换成功'
);
showToast
(
'兑换成功'
);
NetManager
.
ins
.
hc_home
(()
=>
{
NetManager
.
ins
.
hc_home
(()
=>
{
this
.
updateData
();
this
.
updateData
();
...
@@ -77,42 +78,90 @@ export default class BloodPanel2 extends Panel {
...
@@ -77,42 +78,90 @@ export default class BloodPanel2 extends Panel {
},
window
[
'collectRuleId'
]);
},
window
[
'collectRuleId'
]);
}
else
{
}
else
{
if
(
res
.
code
==
'600005'
)
{
if
(
res
.
code
==
'600005'
)
{
showToast
(
'体力已满,快去闯关吧'
);
showToast
(
'体力已满,快去闯关吧'
);
}
else
{
}
else
{
PanelCtrl
.
instance
.
show
(
'shopTip'
,
{
from
:
'blood2Panel'
,
data
:
null
});
PanelCtrl
.
instance
.
show
(
'shopTip'
,
{
from
:
'blood2Panel'
,
data
:
null
});
}
}
}
}
},
1
);
},
1
);
}
}
onTapInvite
()
{
//
onTapInvite() {
if
(
iswx
())
{
// if(iswx()) {
getShareUrl
(
this
.
stage
);
// getShareUrl(this.stage);
}
else
// } else
showShare
(
1
);
// showShare(1);
// NetManager.ins.clickLog(getlogItem(4));
// const data = getHomeData();
// if(data.askForEnergy >= BloodPanel.MAX) {
// showToast('对不起,索要体力的机会已经用完了~');
// return;
// }
// this['inviteBtn'].enabled = false;
// NetManager.ins.hc_askForEnergy((success) => {
// this['inviteBtn'].enabled = true;
// if(success) {
// }
// NetManager.ins.hc_home(() => {
// this.updateData();
// updateMainTimer();
// SceneCtrl.instance.updateScene();
// }, window['collectRuleId']);
// wait(2000).then(() => {
// showToast('分享成功~');
// });
// })
// }
//0224修改
onTapInvite
()
{
NetManager
.
ins
.
clickLog
(
getlogItem
(
4
));
NetManager
.
ins
.
clickLog
(
getlogItem
(
4
));
const
data
=
getHomeData
();
const
data
=
getHomeData
();
if
(
data
.
askForEnergy
>=
BloodPanel
.
MAX
)
{
if
(
iswx
())
{
showToast
(
'对不起,索要体力的机会已经用完了~'
);
getShareUrl
(
this
.
stage
);
return
;
//原先微信流程不变
}
if
(
data
.
askForEnergy
>=
BloodPanel
.
MAX
)
{
this
[
'inviteBtn'
].
enabled
=
false
;
showToast
(
'对不起,索要体力的机会已经用完了~'
);
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
return
;
this
[
'inviteBtn'
].
enabled
=
true
;
if
(
success
)
{
}
}
NetManager
.
ins
.
hc_home
(()
=>
{
this
[
'inviteBtn'
].
enabled
=
false
;
this
.
updateData
();
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
updateMainTimer
();
this
[
'inviteBtn'
].
enabled
=
true
;
SceneCtrl
.
instance
.
updateScene
();
if
(
success
)
{
},
window
[
'collectRuleId'
]);
wait
(
2000
).
then
(()
=>
{
}
showToast
(
'分享成功~'
);
NetManager
.
ins
.
hc_home
(()
=>
{
});
this
.
updateData
();
})
updateMainTimer
();
SceneCtrl
.
instance
.
updateScene
();
},
window
[
'collectRuleId'
]);
wait
(
2000
).
then
(()
=>
{
showToast
(
'分享成功~'
);
});
})
}
else
{
showShareCodePanel
(
CodeChannels
.
AddBlood
,
null
,
()
=>
{
if
(
data
.
askForEnergy
>=
BloodPanel
.
MAX
)
{
wait
(
2000
).
then
(()
=>
{
showToast
(
'对不起,索要体力的机会已经用完了~'
);
});
}
else
{
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
NetManager
.
ins
.
hc_home
(()
=>
{
this
.
updateData
();
updateMainTimer
();
SceneCtrl
.
instance
.
updateScene
();
},
window
[
'collectRuleId'
]);
wait
(
2000
).
then
(()
=>
{
showToast
(
'分享成功~'
);
});
})
}
})
}
}
}
protected
get
closeBtns
():
eui
.
Button
[]
{
protected
get
closeBtns
():
eui
.
Button
[]
{
...
...
egret/src/panels/FriendPanel.ts
View file @
e1f2e312
...
@@ -7,6 +7,7 @@ import { showShare3 } from "../shareCtrl3";
...
@@ -7,6 +7,7 @@ import { showShare3 } from "../shareCtrl3";
import
FriendItemRenderer
from
"./FriendItemRenderer"
;
import
FriendItemRenderer
from
"./FriendItemRenderer"
;
import
{
getFriendShareUrl
}
from
"../getFriendSharePic"
;
import
{
getFriendShareUrl
}
from
"../getFriendSharePic"
;
import
{
getlogItem
}
from
"../Main"
;
import
{
getlogItem
}
from
"../Main"
;
import
{
showShareCodePanel
,
CodeChannels
}
from
"./ShareCodePanel"
;
export
default
class
FriendPanel
extends
Panel
{
export
default
class
FriendPanel
extends
Panel
{
public
list
:
eui
.
List
;
public
list
:
eui
.
List
;
...
@@ -66,9 +67,9 @@ export default class FriendPanel extends Panel {
...
@@ -66,9 +67,9 @@ export default class FriendPanel extends Panel {
this
[
'avatar'
].
source
=
this
[
'avatar0'
].
source
=
data
.
avatar
||
"http://yun.duiba.com.cn/db_games/default_avatar.png"
;
this
[
'avatar'
].
source
=
this
[
'avatar0'
].
source
=
data
.
avatar
||
"http://yun.duiba.com.cn/db_games/default_avatar.png"
;
else
else
this
[
'avatar'
].
source
=
this
[
'avatar0'
].
source
=
"http://yun.duiba.com.cn/db_games/default_avatar.png"
;
this
[
'avatar'
].
source
=
this
[
'avatar0'
].
source
=
"http://yun.duiba.com.cn/db_games/default_avatar.png"
;
if
(
data
&&
data
.
nickname
)
if
(
data
&&
data
.
nickname
)
this
[
'nameTxt'
].
text
=
getNick
(
data
.
nickname
,
10
);
this
[
'nameTxt'
].
text
=
getNick
(
data
.
nickname
,
10
);
if
(
data
&&
data
.
nickname
)
if
(
data
&&
data
.
nickname
)
this
[
'nameTxt0'
].
text
=
getNick
(
data
.
nickname
,
10
);
this
[
'nameTxt0'
].
text
=
getNick
(
data
.
nickname
,
10
);
});
});
}
}
...
@@ -92,7 +93,8 @@ export default class FriendPanel extends Panel {
...
@@ -92,7 +93,8 @@ export default class FriendPanel extends Panel {
if
(
iswx
())
{
if
(
iswx
())
{
getFriendShareUrl
(
this
.
stage
);
getFriendShareUrl
(
this
.
stage
);
}
else
}
else
showShare3
();
// showShare3();
showShareCodePanel
(
CodeChannels
.
RankPlay
);
}
}
protected
get
closeBtns
():
eui
.
Button
[]
{
return
[
this
[
'closeBtn'
]]
}
protected
get
closeBtns
():
eui
.
Button
[]
{
return
[
this
[
'closeBtn'
]]
}
...
...
egret/src/panels/InvitePanel.ts
View file @
e1f2e312
...
@@ -7,6 +7,7 @@ import Utils from "../Utils";
...
@@ -7,6 +7,7 @@ import Utils from "../Utils";
import
InviteRulePanel
from
"./InviteRulePanel"
;
import
InviteRulePanel
from
"./InviteRulePanel"
;
import
wait
from
"../../libs/new_tc/wait"
;
import
wait
from
"../../libs/new_tc/wait"
;
import
{
getlogItem
}
from
"../Main"
;
import
{
getlogItem
}
from
"../Main"
;
import
{
showShareCodePanel
,
CodeChannels
}
from
"./ShareCodePanel"
;
export
default
class
InvitePanel
extends
Panel
{
export
default
class
InvitePanel
extends
Panel
{
public
prizeImg
:
eui
.
Image
;
public
prizeImg
:
eui
.
Image
;
...
@@ -30,7 +31,7 @@ export default class InvitePanel extends Panel {
...
@@ -30,7 +31,7 @@ export default class InvitePanel extends Panel {
super
.
start
();
super
.
start
();
this
.
showlog
();
this
.
showlog
();
this
[
'light1'
].
visible
=
this
[
'light2'
].
visible
=
false
;
this
[
'light1'
].
visible
=
this
[
'light2'
].
visible
=
false
;
this
[
'con'
].
addChild
(
this
.
data
.
svga
);
this
[
'con'
].
addChild
(
this
.
data
.
svga
);
this
.
data
.
svga
.
gotoAndPlay
(
1
,
true
);
this
.
data
.
svga
.
gotoAndPlay
(
1
,
true
);
this
.
data
.
svga
.
once
(
egret
.
Event
.
COMPLETE
,
()
=>
{
this
.
data
.
svga
.
once
(
egret
.
Event
.
COMPLETE
,
()
=>
{
...
@@ -118,13 +119,15 @@ export default class InvitePanel extends Panel {
...
@@ -118,13 +119,15 @@ export default class InvitePanel extends Panel {
CFG
.
wxShareLink
=
window
[
'h5URL'
]
+
"&shareCode="
+
shareCode
;
// 分享链接
CFG
.
wxShareLink
=
window
[
'h5URL'
]
+
"&shareCode="
+
shareCode
;
// 分享链接
CFG
.
wxShareTitle
=
'狮狮连萌超好玩~我已经玩到第一了!'
;
CFG
.
wxShareTitle
=
'狮狮连萌超好玩~我已经玩到第一了!'
;
CFG
.
wxShareDesc
=
'我在萌狮消消乐等你来挑战哦'
;
CFG
.
wxShareDesc
=
'我在萌狮消消乐等你来挑战哦'
;
CFG
.
wxShareImg
=
"http://yun.duiba.com.cn/db_games/xiaoxiaole2.jpg"
;
CFG
.
wxShareImg
=
"http://yun.duiba.com.cn/db_games/xiaoxiaole2.jpg"
;
if
(
iswx
())
{
//微信端
if
(
iswx
())
{
//微信端
this
.
wxShareTip
.
visible
=
true
;
this
.
wxShareTip
.
visible
=
true
;
window
[
"invokeWX"
]();
window
[
"invokeWX"
]();
}
else
{
//端内
}
else
{
//端内
this
.
wxShareTip
.
visible
=
false
;
this
.
wxShareTip
.
visible
=
false
;
window
[
"inviteShare"
](
shareCode
);
// window["inviteShare"](shareCode);
//0224修改,去掉原先邀请逻辑,新增口令逻辑
showShareCodePanel
(
CodeChannels
.
InvitePrize
,
shareCode
)
}
}
});
});
}
}
...
@@ -189,7 +192,7 @@ export default class InvitePanel extends Panel {
...
@@ -189,7 +192,7 @@ export default class InvitePanel extends Panel {
destroy
()
{
destroy
()
{
super
.
destroy
();
super
.
destroy
();
if
(
this
.
timer
)
{
if
(
this
.
timer
)
{
this
.
timer
.
stop
();
this
.
timer
.
stop
();
this
.
timer
.
removeEventListener
(
egret
.
TimerEvent
.
TIMER
,
this
.
cutTimer
,
this
);
this
.
timer
.
removeEventListener
(
egret
.
TimerEvent
.
TIMER
,
this
.
cutTimer
,
this
);
}
}
...
...
egret/src/panels/ScratchPanel.ts
View file @
e1f2e312
...
@@ -7,6 +7,7 @@ import ScratchRulePanel from "./ScratchRulePanel";
...
@@ -7,6 +7,7 @@ import ScratchRulePanel from "./ScratchRulePanel";
import
CutTimer
from
"../CutTimer"
;
import
CutTimer
from
"../CutTimer"
;
import
{
getlogItem
}
from
"../Main"
;
import
{
getlogItem
}
from
"../Main"
;
import
{
HtmlTextParser
}
from
"../../libs/new_wx/HtmlTextParser"
;
import
{
HtmlTextParser
}
from
"../../libs/new_wx/HtmlTextParser"
;
import
{
showShareCodePanel
,
CodeChannels
}
from
"./ShareCodePanel"
;
export
default
class
ScratchPanel
extends
Panel
{
export
default
class
ScratchPanel
extends
Panel
{
private
cutTimer
:
CutTimer
;
private
cutTimer
:
CutTimer
;
...
@@ -258,7 +259,9 @@ class ScratchItem extends eui.ItemRenderer {
...
@@ -258,7 +259,9 @@ class ScratchItem extends eui.ItemRenderer {
window
[
"invokeWX"
]();
window
[
"invokeWX"
]();
}
else
{
//端内
}
else
{
//端内
this
.
data
.
wxShareTip
.
visible
=
false
;
this
.
data
.
wxShareTip
.
visible
=
false
;
window
[
"scratchShare"
](
code
);
// window["scratchShare"](code);
//0224修改,去掉原先邀请逻辑,新增口令逻辑
showShareCodePanel
(
CodeChannels
.
InvitePrize
,
code
)
}
}
},
this
.
data
.
scratchTaskId
);
},
this
.
data
.
scratchTaskId
);
},
this
);
},
this
);
...
...
egret/src/panels/ShareCodePanel.ts
View file @
e1f2e312
...
@@ -5,6 +5,8 @@ import { getlogItem } from "../Main";
...
@@ -5,6 +5,8 @@ import { getlogItem } from "../Main";
import
{
showToast
}
from
"../../libs/new_wx/ctrls/toastCtrl"
;
import
{
showToast
}
from
"../../libs/new_wx/ctrls/toastCtrl"
;
import
ComponentBase
from
"../../libs/new_wx/components/ComponentBase"
;
import
ComponentBase
from
"../../libs/new_wx/components/ComponentBase"
;
import
layers
from
"../../libs/new_wx/views/layers"
;
import
layers
from
"../../libs/new_wx/views/layers"
;
import
SceneCtrl
from
"../../libs/new_wx/ctrls/sceneCtrl"
;
import
wait
from
"../../libs/new_tc/wait"
;
export
enum
CodeChannels
{
export
enum
CodeChannels
{
/**
/**
...
@@ -36,7 +38,11 @@ const panelMsg = {
...
@@ -36,7 +38,11 @@ const panelMsg = {
"2"
:
"快去邀请好友帮你刮卡"
,
"2"
:
"快去邀请好友帮你刮卡"
,
"3"
:
"快去邀请好友闯关赢现金"
"3"
:
"快去邀请好友闯关赢现金"
}
}
interface
ShareData
{
channel
:
CodeChannels
,
shareCode
?:
string
,
//0224期加体力和排行榜分享好友没有分享码
addFun
:
Function
,
//点击立即前往的额外操作
}
class
ShareCodePanel
extends
ComponentBase
{
class
ShareCodePanel
extends
ComponentBase
{
public
closeBtn
:
eui
.
Button
;
public
closeBtn
:
eui
.
Button
;
...
@@ -52,15 +58,12 @@ class ShareCodePanel extends ComponentBase {
...
@@ -52,15 +58,12 @@ class ShareCodePanel extends ComponentBase {
* 0表示微信,1表示朋友圈
* 0表示微信,1表示朋友圈
*/
*/
private
mark
:
0
|
1
private
mark
:
0
|
1
data
:
{
data
:
ShareData
channel
:
CodeChannels
,
shareCode
?:
string
,
}
/**
/**
* 口令
* 口令
*/
*/
private
code
:
string
private
code
:
string
setData
(
data
)
{
setData
(
data
:
ShareData
)
{
this
.
data
=
data
;
this
.
data
=
data
;
//显示提示文案
//显示提示文案
this
.
msg
.
text
=
panelMsg
[
this
.
data
.
channel
];
this
.
msg
.
text
=
panelMsg
[
this
.
data
.
channel
];
...
@@ -70,11 +73,7 @@ class ShareCodePanel extends ComponentBase {
...
@@ -70,11 +73,7 @@ class ShareCodePanel extends ComponentBase {
super
.
start
();
super
.
start
();
this
.
height
=
this
.
stage
.
stageHeight
;
this
.
height
=
this
.
stage
.
stageHeight
;
}
}
//不再关闭
public
onTouchTap_closeBtn
()
{
// super.onTouchTap_closeBtn();
this
.
panelGroup
.
visible
=
false
;
}
initEvents
()
{
initEvents
()
{
super
.
initEvents
();
super
.
initEvents
();
...
@@ -82,6 +81,7 @@ class ShareCodePanel extends ComponentBase {
...
@@ -82,6 +81,7 @@ class ShareCodePanel extends ComponentBase {
this
.
wxpyq
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouchWxpyqBtn
,
this
);
this
.
wxpyq
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouchWxpyqBtn
,
this
);
this
.
goBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouchGoBtn
,
this
);
this
.
goBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouchGoBtn
,
this
);
this
.
clickBg
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouchClickBg
,
this
);
this
.
clickBg
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouchClickBg
,
this
);
this
.
closeBtn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouchCloseBtn
,
this
);
}
}
onTouchWxBtn
()
{
onTouchWxBtn
()
{
...
@@ -102,13 +102,16 @@ class ShareCodePanel extends ComponentBase {
...
@@ -102,13 +102,16 @@ class ShareCodePanel extends ComponentBase {
linkWxpyq
();
linkWxpyq
();
break
;
break
;
}
}
//还需要根据channel加体力接口
this
.
data
.
addFun
&&
this
.
data
.
addFun
();
}
}
onTouchClickBg
()
{
onTouchClickBg
()
{
layers
.
shareLayer
.
visible
=
false
;
layers
.
shareLayer
.
visible
=
false
;
//关闭后要置null
//关闭后要置null
,因为不同渠道进来要获取不同的code
this
.
code
=
null
this
.
code
=
null
}
}
onTouchCloseBtn
()
{
this
.
panelGroup
.
visible
=
false
;
}
private
codeOpr
()
{
private
codeOpr
()
{
//如果是开发中,获取不到口令就用假的
//如果是开发中,获取不到口令就用假的
...
@@ -153,6 +156,7 @@ class ShareCodePanel extends ComponentBase {
...
@@ -153,6 +156,7 @@ class ShareCodePanel extends ComponentBase {
this
.
wxpyq
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouchWxpyqBtn
,
this
);
this
.
wxpyq
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouchWxpyqBtn
,
this
);
this
.
goBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouchGoBtn
,
this
);
this
.
goBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouchGoBtn
,
this
);
this
.
clickBg
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouchClickBg
,
this
);
this
.
clickBg
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouchClickBg
,
this
);
this
.
closeBtn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouchCloseBtn
,
this
);
}
}
get
skinKey
()
{
get
skinKey
()
{
...
@@ -169,12 +173,12 @@ const initShare = () => {
...
@@ -169,12 +173,12 @@ const initShare = () => {
share
.
start
();
share
.
start
();
_share
=
share
;
_share
=
share
;
};
};
export
const
showShareCodePanel
=
(
data
:
{
channel
:
CodeChannels
,
shareCode
?:
string
,
}
)
=>
{
export
const
showShareCodePanel
=
(
channel
:
CodeChannels
,
shareCode
?:
string
,
addFun
?:
Function
)
=>
{
if
(
!
inited
)
{
if
(
!
inited
)
{
initShare
();
initShare
();
inited
=
true
;
inited
=
true
;
}
}
_share
.
setData
(
data
);
_share
.
setData
(
{
channel
,
shareCode
,
addFun
}
);
layers
.
shareLayer
.
visible
=
true
;
layers
.
shareLayer
.
visible
=
true
;
}
}
...
...
egret/src/panels/StartPanel.ts
View file @
e1f2e312
...
@@ -20,6 +20,7 @@ import { addRankFriendList } from "../mapScene/RankFriendList";
...
@@ -20,6 +20,7 @@ import { addRankFriendList } from "../mapScene/RankFriendList";
import
{
addAdComp
}
from
"./BoxPanel"
;
import
{
addAdComp
}
from
"./BoxPanel"
;
import
{
getChapterData
}
from
"../something/chapters/getChapter"
;
import
{
getChapterData
}
from
"../something/chapters/getChapter"
;
import
{
getlogItem
}
from
"../Main"
;
import
{
getlogItem
}
from
"../Main"
;
import
{
showShareCodePanel
,
CodeChannels
}
from
"./ShareCodePanel"
;
export
default
class
StartPanel
extends
Panel
{
export
default
class
StartPanel
extends
Panel
{
static
currlevel
;
static
currlevel
;
...
@@ -38,7 +39,7 @@ export default class StartPanel extends Panel {
...
@@ -38,7 +39,7 @@ export default class StartPanel extends Panel {
this
[
'price4'
].
text
=
`-
${
window
[
'price4'
]}
元宝`
;
this
[
'price4'
].
text
=
`-
${
window
[
'price4'
]}
元宝`
;
const
homedata
=
getHomeData
();
const
homedata
=
getHomeData
();
if
(
data
>
homedata
.
levels
.
length
)
{
if
(
data
>
homedata
.
levels
.
length
)
{
addAdComp
(
84
,
901
,
this
,
29
);
addAdComp
(
84
,
901
,
this
,
29
);
NetManager
.
ins
.
showLog
(
getlogItem
(
29
));
NetManager
.
ins
.
showLog
(
getlogItem
(
29
));
}
else
}
else
...
@@ -51,7 +52,7 @@ export default class StartPanel extends Panel {
...
@@ -51,7 +52,7 @@ export default class StartPanel extends Panel {
this
[
'targetGroup'
].
visible
=
false
;
this
[
'targetGroup'
].
visible
=
false
;
this
[
'scoreGroup'
].
visible
=
false
;
this
[
'scoreGroup'
].
visible
=
false
;
const
levelType
=
getChapterData
(
mapDataIndex
).
passTarget
.
type
;
const
levelType
=
getChapterData
(
mapDataIndex
).
passTarget
.
type
;
if
(
levelType
==
PassType
.
ELEMENT_TARGET
)
{
if
(
levelType
==
PassType
.
ELEMENT_TARGET
)
{
this
[
'targetGroup'
].
visible
=
true
;
this
[
'targetGroup'
].
visible
=
true
;
// this['targetTxt'].text = '在规定步数内\n消除足够数量目标';
// this['targetTxt'].text = '在规定步数内\n消除足够数量目标';
...
@@ -59,9 +60,9 @@ export default class StartPanel extends Panel {
...
@@ -59,9 +60,9 @@ export default class StartPanel extends Panel {
const
ac
=
new
eui
.
ArrayCollection
(
getChapterData
(
mapDataIndex
).
passTarget
.
elements
);
const
ac
=
new
eui
.
ArrayCollection
(
getChapterData
(
mapDataIndex
).
passTarget
.
elements
);
this
.
list
.
dataProvider
=
ac
;
this
.
list
.
dataProvider
=
ac
;
const
elements
=
getChapterData
(
mapDataIndex
).
passTarget
.
elements
;
const
elements
=
getChapterData
(
mapDataIndex
).
passTarget
.
elements
;
if
(
elements
.
length
==
1
&&
elements
[
0
].
type
==
ElementType
.
LOLLIPOP
)
if
(
elements
.
length
==
1
&&
elements
[
0
].
type
==
ElementType
.
LOLLIPOP
)
this
[
'tips'
].
text
=
'在指定步数内将目标元素移至最底部'
;
this
[
'tips'
].
text
=
'在指定步数内将目标元素移至最底部'
;
}
else
if
(
levelType
==
PassType
.
SCORE_TARGET
)
{
}
else
if
(
levelType
==
PassType
.
SCORE_TARGET
)
{
this
[
'scoreGroup'
].
visible
=
true
;
this
[
'scoreGroup'
].
visible
=
true
;
this
[
'targetScoreTxt'
].
text
=
`
${
getChapterData
(
mapDataIndex
).
passTarget
.
score
}
`
;
this
[
'targetScoreTxt'
].
text
=
`
${
getChapterData
(
mapDataIndex
).
passTarget
.
score
}
`
;
// this['targetTxt'].text = `在规定步数内\n分数达到${getChapterData(mapDataIndex).passTarget.score}分`;
// this['targetTxt'].text = `在规定步数内\n分数达到${getChapterData(mapDataIndex).passTarget.score}分`;
...
@@ -85,22 +86,45 @@ export default class StartPanel extends Panel {
...
@@ -85,22 +86,45 @@ export default class StartPanel extends Panel {
onTap_startBtn
()
{
onTap_startBtn
()
{
const
homeData
=
getHomeData
();
const
homeData
=
getHomeData
();
if
(
homeData
.
remainEnargy
<=
0
)
{
if
(
homeData
.
remainEnargy
<=
0
)
{
if
(
homeData
.
askForEnergy
)
{
if
(
homeData
.
askForEnergy
)
{
PanelCtrl
.
instance
.
show
(
'blood2Panel'
);
PanelCtrl
.
instance
.
show
(
'blood2Panel'
);
}
else
{
}
else
{
if
(
iswx
())
{
// if(iswx()) {
// getShareUrl(this.stage);
// } else
// showShare(1);
// NetManager.ins.hc_askForEnergy((success) => {
// NetManager.ins.hc_home(() => {
// SceneCtrl.instance.updateScene();
// }, window['collectRuleId']);
// wait(2000).then(() => {
// showToast('分享成功~');
// });
// })
//0224修改,微信环境不变
if
(
iswx
())
{
getShareUrl
(
this
.
stage
);
getShareUrl
(
this
.
stage
);
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
NetManager
.
ins
.
hc_home
(()
=>
{
SceneCtrl
.
instance
.
updateScene
();
},
window
[
'collectRuleId'
]);
wait
(
2000
).
then
(()
=>
{
showToast
(
'分享成功~'
);
});
})
}
else
}
else
showShare
(
1
);
// showShare(1);
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
showShareCodePanel
(
CodeChannels
.
AddBlood
,
null
,
()
=>
{
NetManager
.
ins
.
hc_home
(()
=>
{
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
SceneCtrl
.
instance
.
updateScene
();
NetManager
.
ins
.
hc_home
(()
=>
{
},
window
[
'collectRuleId'
]);
SceneCtrl
.
instance
.
updateScene
();
wait
(
2000
).
then
(()
=>
{
},
window
[
'collectRuleId'
]);
showToast
(
'分享成功~'
);
wait
(
2000
).
then
(()
=>
{
showToast
(
'分享成功~'
);
});
})
});
});
})
}
}
return
;
return
;
}
}
...
@@ -121,7 +145,7 @@ export default class StartPanel extends Panel {
...
@@ -121,7 +145,7 @@ export default class StartPanel extends Panel {
wait
(
5000
).
then
(()
=>
{
wait
(
5000
).
then
(()
=>
{
updateMainTimerAfterGetData
();
updateMainTimerAfterGetData
();
});
});
if
(
success
)
{
if
(
success
)
{
// Loading.instace.show();
// Loading.instace.show();
this
.
hidePanel
();
this
.
hidePanel
();
try
{
try
{
...
@@ -129,12 +153,12 @@ export default class StartPanel extends Panel {
...
@@ -129,12 +153,12 @@ export default class StartPanel extends Panel {
await
Promise
.
all
([
await
Promise
.
all
([
RES
.
getResAsync
(
`
${
key
}
_json`
),
RES
.
getResAsync
(
`
${
key
}
_json`
),
RES
.
getResAsync
(
`
${
key
}
_png`
)]);
RES
.
getResAsync
(
`
${
key
}
_png`
)]);
}
catch
(
error
)
{
}
catch
(
error
)
{
}
}
// Loading.instace.hide();
// Loading.instace.hide();
SceneCtrl
.
instance
.
change
(
ModuleTypes
.
MAIN_SCENE
,
{
chapter
:
this
.
_level
});
SceneCtrl
.
instance
.
change
(
ModuleTypes
.
MAIN_SCENE
,
{
chapter
:
this
.
_level
});
StartPanel
.
currlevel
=
this
.
_level
StartPanel
.
currlevel
=
this
.
_level
}
}
},
this
.
_level
);
},
this
.
_level
);
...
@@ -143,15 +167,15 @@ export default class StartPanel extends Panel {
...
@@ -143,15 +167,15 @@ export default class StartPanel extends Panel {
}
}
onTap_buy1btn
()
{
onTap_buy1btn
()
{
PanelCtrl
.
instance
.
show
(
'Buy1'
,
{
from
:
'StartPanel'
,
data
:
this
.
_level
});
PanelCtrl
.
instance
.
show
(
'Buy1'
,
{
from
:
'StartPanel'
,
data
:
this
.
_level
});
}
}
onTap_buy2btn
()
{
onTap_buy2btn
()
{
PanelCtrl
.
instance
.
show
(
'Buy2'
,
{
from
:
'StartPanel'
,
data
:
this
.
_level
});
PanelCtrl
.
instance
.
show
(
'Buy2'
,
{
from
:
'StartPanel'
,
data
:
this
.
_level
});
}
}
onTap_buy3btn
()
{
onTap_buy3btn
()
{
PanelCtrl
.
instance
.
show
(
'Buy3'
,
{
from
:
'StartPanel'
,
data
:
this
.
_level
});
PanelCtrl
.
instance
.
show
(
'Buy3'
,
{
from
:
'StartPanel'
,
data
:
this
.
_level
});
}
}
get
skinKey
()
{
get
skinKey
()
{
...
...
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