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
99c9d4e4
Commit
99c9d4e4
authored
Feb 22, 2020
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
3879dfd7
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
162 additions
and
70 deletions
+162
-70
MainBase.ts
egret/libs/new_wx/MainBase.ts
+2
-0
MapScene.ts
egret/src/mapScene/MapScene.ts
+12
-2
BloodPanel.ts
egret/src/panels/BloodPanel.ts
+35
-15
BloodPanel2.ts
egret/src/panels/BloodPanel2.ts
+35
-15
InvitePanel.ts
egret/src/panels/InvitePanel.ts
+6
-1
ScratchPanel.ts
egret/src/panels/ScratchPanel.ts
+28
-23
ShareCodePanel.ts
egret/src/panels/ShareCodePanel.ts
+11
-3
StartPanel.ts
egret/src/panels/StartPanel.ts
+33
-11
No files found.
egret/libs/new_wx/MainBase.ts
View file @
99c9d4e4
...
...
@@ -533,6 +533,8 @@ export default class MainBase extends eui.UILayer {
this
.
getBackReward
(),
this
.
hcRedBoobBaseInfo
(),
]);
//获取分享加体力的shareCode,不影响初始化场景,不进await
NetManager
.
ins
.
getUserShareCode
(()
=>
{})
MapScene
.
adData
=
DataManager
.
ins
.
getData
(
'hc_advert'
);
...
...
egret/src/mapScene/MapScene.ts
View file @
99c9d4e4
...
...
@@ -60,8 +60,18 @@ export default class MapScene extends Scene {
//0224修改,取sceneCode,
const
sceneCode
=
Utils
.
getRequestByKey
(
'sceneCode'
)
if
(
sceneCode
==
CodeChannels
.
AddBlood
)
{
//加体力的,0228到时会修改成助力,这里要加逻辑
if
(
window
[
"test0228"
])
{
if
(
window
[
"test0228"
])
{
//测试助力,到时失败code再和后端对接
NetManager
.
ins
.
doHelpNew
((
s
,
res
)
=>
{
if
(
s
)
{
showToast
(
"助力成功!"
)
}
else
if
(
res
)
{
if
(
res
.
code
==
"0000"
)
{
}
else
if
(
res
.
code
==
"00001"
)
{
}
}
else
{
showToast
(
"助力失败"
)
}
},
code
)
}
else
{
showToast
(
"欢迎加入游戏,去闯关吧"
);
}
...
...
egret/src/panels/BloodPanel.ts
View file @
99c9d4e4
...
...
@@ -14,6 +14,7 @@ import { gotoNextLevel } from "./gotoNextLevel";
import
BloodPanel2
from
"./BloodPanel2"
;
import
PanelCtrl
from
"../../libs/new_wx/ctrls/panelCtrl"
;
import
{
showShareCodePanel
,
CodeChannels
}
from
"./ShareCodePanel"
;
import
{
DataManager
}
from
"../../libs/tw/manager/DataManager"
;
export
default
class
BloodPanel
extends
Panel
{
start
(
data
)
{
...
...
@@ -145,24 +146,43 @@ export default class BloodPanel extends Panel {
});
})
}
else
{
showShareCodePanel
(
CodeChannels
.
AddBlood
,
null
,
()
=>
{
if
(
data
.
askForEnergy
>=
BloodPanel
.
MAX
)
{
wait
(
2000
).
then
(()
=>
{
showToast
(
'对不起,索要体力的机会已经用完了~'
);
});
if
(
window
[
"test0228"
])
{
//如果之前没获取到,就再发接口,几率很低
if
(
!
DataManager
.
ins
.
getData
(
"getUserShareCode"
))
{
this
.
touchEnabled
=
false
this
.
touchChildren
=
false
NetManager
.
ins
.
getUserShareCode
((
s
,
res
)
=>
{
this
.
touchEnabled
=
true
this
.
touchChildren
=
true
if
(
!
s
)
{
showToast
(
"获取分享信息失败,请重试"
)
}
else
{
showShareCodePanel
(
CodeChannels
.
AddBlood
,
res
.
data
)
}
})
}
else
{
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
NetManager
.
ins
.
hc_home
(()
=>
{
this
.
updateData
();
updateMainTimer
();
SceneCtrl
.
instance
.
updateScene
();
},
window
[
'collectRuleId'
]);
showShareCodePanel
(
CodeChannels
.
AddBlood
,
DataManager
.
ins
.
getData
(
"getUserShareCode"
).
data
);
}
}
else
{
showShareCodePanel
(
CodeChannels
.
AddBlood
,
null
,
()
=>
{
if
(
data
.
askForEnergy
>=
BloodPanel
.
MAX
)
{
wait
(
2000
).
then
(()
=>
{
showToast
(
'
分享成功
~'
);
showToast
(
'
对不起,索要体力的机会已经用完了
~'
);
});
})
}
})
}
else
{
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
NetManager
.
ins
.
hc_home
(()
=>
{
this
.
updateData
();
updateMainTimer
();
SceneCtrl
.
instance
.
updateScene
();
},
window
[
'collectRuleId'
]);
wait
(
2000
).
then
(()
=>
{
showToast
(
'分享成功~'
);
});
})
}
})
}
}
}
...
...
egret/src/panels/BloodPanel2.ts
View file @
99c9d4e4
...
...
@@ -13,6 +13,7 @@ import { showShare } from "../shareCtrl";
import
BloodPanel
from
"./BloodPanel"
;
import
PanelCtrl
from
"../../libs/new_wx/ctrls/panelCtrl"
;
import
{
showShareCodePanel
,
CodeChannels
}
from
"./ShareCodePanel"
;
import
{
DataManager
}
from
"../../libs/tw/manager/DataManager"
;
export
default
class
BloodPanel2
extends
Panel
{
start
(
data
)
{
...
...
@@ -143,24 +144,43 @@ export default class BloodPanel2 extends Panel {
});
})
}
else
{
showShareCodePanel
(
CodeChannels
.
AddBlood
,
null
,
()
=>
{
if
(
data
.
askForEnergy
>=
BloodPanel
.
MAX
)
{
wait
(
2000
).
then
(()
=>
{
showToast
(
'对不起,索要体力的机会已经用完了~'
);
});
if
(
window
[
"test0228"
])
{
//如果之前没获取到,就再发接口,几率很低
if
(
!
DataManager
.
ins
.
getData
(
"getUserShareCode"
))
{
this
.
touchEnabled
=
false
this
.
touchChildren
=
false
NetManager
.
ins
.
getUserShareCode
((
s
,
res
)
=>
{
this
.
touchEnabled
=
true
this
.
touchChildren
=
true
if
(
!
s
)
{
showToast
(
"获取分享信息失败,请重试"
)
}
else
{
showShareCodePanel
(
CodeChannels
.
AddBlood
,
res
.
data
)
}
})
}
else
{
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
NetManager
.
ins
.
hc_home
(()
=>
{
this
.
updateData
();
updateMainTimer
();
SceneCtrl
.
instance
.
updateScene
();
},
window
[
'collectRuleId'
]);
showShareCodePanel
(
CodeChannels
.
AddBlood
,
DataManager
.
ins
.
getData
(
"getUserShareCode"
).
data
);
}
}
else
{
showShareCodePanel
(
CodeChannels
.
AddBlood
,
null
,
()
=>
{
if
(
data
.
askForEnergy
>=
BloodPanel
.
MAX
)
{
wait
(
2000
).
then
(()
=>
{
showToast
(
'
分享成功
~'
);
showToast
(
'
对不起,索要体力的机会已经用完了
~'
);
});
})
}
})
}
else
{
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
NetManager
.
ins
.
hc_home
(()
=>
{
this
.
updateData
();
updateMainTimer
();
SceneCtrl
.
instance
.
updateScene
();
},
window
[
'collectRuleId'
]);
wait
(
2000
).
then
(()
=>
{
showToast
(
'分享成功~'
);
});
})
}
})
}
}
}
...
...
egret/src/panels/InvitePanel.ts
View file @
99c9d4e4
...
...
@@ -111,7 +111,12 @@ export default class InvitePanel extends Panel {
}
for
(
let
i
=
0
;
i
<
this
.
data
.
invitationUser
.
length
;
i
++
)
{
this
.
data
.
invitationUser
[
i
][
'callFun'
]
=
()
=>
{
NetManager
.
ins
.
getShareCode
((
success
,
res
)
=>
{
//加个防连点,这里影响功能了,要加
this
.
touchEnabled
=
false
;
this
.
touchChildren
=
false
;
NetManager
.
ins
.
getShareCode
((
success
,
res
)
=>
{
//shareCode为啥不缓存,每次好像都一样吧,还有下面失败是否要给个toast
this
.
touchEnabled
=
true
;
this
.
touchChildren
=
true
;
if
(
!
success
)
{
return
;
}
...
...
egret/src/panels/ScratchPanel.ts
View file @
99c9d4e4
...
...
@@ -23,20 +23,20 @@ export default class ScratchPanel extends Panel {
setGtaphics
(
x
,
y
)
{
setTimeout
(()
=>
{
if
(
this
.
pIndex
%
2
==
0
)
{
// 双数
if
(
this
.
pIndex
%
2
==
0
)
{
// 双数
y
-=
25
;
if
(
y
<=
this
[
"prizeImg"
].
y
)
{
if
(
y
<=
this
[
"prizeImg"
].
y
)
{
this
.
pIndex
++
;
}
}
else
{
// 单数
y
+=
25
;
if
(
y
>=
(
this
[
"prizeImg"
].
y
+
this
[
"prizeImg"
].
height
))
{
if
(
y
>=
(
this
[
"prizeImg"
].
y
+
this
[
"prizeImg"
].
height
))
{
this
.
pIndex
++
;
}
}
x
+=
5
;
this
.
myShape
.
graphics
.
lineTo
(
x
,
y
);
if
(
x
>
this
[
"prizeImg"
].
x
+
(
+
this
.
data
.
completePercent
)
/
100
*
this
[
"prizeImg"
].
width
-
60
)
{
if
(
x
>
this
[
"prizeImg"
].
x
+
(
+
this
.
data
.
completePercent
)
/
100
*
this
[
"prizeImg"
].
width
-
60
)
{
return
;
}
this
.
setGtaphics
(
x
,
y
);
...
...
@@ -77,8 +77,8 @@ export default class ScratchPanel extends Panel {
playBgAni
()
{
this
[
'light1'
].
visible
=
this
[
'light2'
].
visible
=
true
;
const
time
=
7000
;
egret
.
Tween
.
get
(
this
[
'light1'
],
{
loop
:
true
}).
to
({
rotation
:
360
},
time
);
egret
.
Tween
.
get
(
this
[
'light2'
],
{
loop
:
true
}).
to
({
rotation
:
-
360
},
time
);
egret
.
Tween
.
get
(
this
[
'light1'
],
{
loop
:
true
}).
to
({
rotation
:
360
},
time
);
egret
.
Tween
.
get
(
this
[
'light2'
],
{
loop
:
true
}).
to
({
rotation
:
-
360
},
time
);
}
showlog
()
{
...
...
@@ -126,17 +126,17 @@ export default class ScratchPanel extends Panel {
this
[
"prizeImg"
].
source
=
this
.
data
.
prizeImage
;
if
(
!
this
.
data
.
avatarList
)
{
if
(
!
this
.
data
.
avatarList
)
{
this
.
data
.
avatarList
=
[];
}
// 添加邀请图标
let
noAvatarNum
=
this
.
data
.
helpedCount
-
this
.
data
.
avatarList
.
length
;
// 没有头像的人数
let
dNum
=
this
.
data
.
totalNeedCount
-
this
.
data
.
avatarList
.
length
-
noAvatarNum
;
// 没邀请的人数
for
(
let
i
=
0
;
i
<
noAvatarNum
;
i
++
)
{
for
(
let
i
=
0
;
i
<
noAvatarNum
;
i
++
)
{
this
.
data
.
avatarList
.
push
(
""
);
}
for
(
let
i
=
0
;
i
<
dNum
;
i
++
)
{
for
(
let
i
=
0
;
i
<
dNum
;
i
++
)
{
this
.
data
.
avatarList
.
push
(
"scratch_invite_png"
);
}
// 添加假用户
...
...
@@ -144,7 +144,7 @@ export default class ScratchPanel extends Panel {
// 创建渲染列表
let
rendererList
=
[];
for
(
let
i
=
0
;
i
<
this
.
data
.
avatarList
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
data
.
avatarList
.
length
;
i
++
)
{
rendererList
.
push
({
avatar
:
this
.
data
.
avatarList
[
i
],
// 传递头像
wxShareTip
:
this
[
"wxShareTip"
],
// 传递shareGroup的引用
...
...
@@ -160,12 +160,12 @@ export default class ScratchPanel extends Panel {
// 倒计时
this
.
cutTimer
=
new
CutTimer
(
this
[
"cutTimeLabel"
],
"将在<b>hh:mm:ss</b>失效"
,
()
=>
{
this
.
hidePanel
();
GDispatcher
.
dispatchEvent
(
"updateScratchTips"
);
}
this
.
hidePanel
();
GDispatcher
.
dispatchEvent
(
"updateScratchTips"
);
}
);
let
cutTime
=
this
.
data
.
endTime
-
this
.
data
.
currentTime
+
3000
;
if
(
!
this
.
cutTimer
.
start
(
cutTime
))
{
if
(
!
this
.
cutTimer
.
start
(
cutTime
))
{
this
.
cutTimer
.
stop
();
this
.
cutTimer
.
start
(
cutTime
);
}
...
...
@@ -176,18 +176,18 @@ export default class ScratchPanel extends Panel {
* @param progress 进度 0 - 100
*/
private
setProgress
(
progress
)
{
if
(
progress
>
100
)
{
if
(
progress
>
100
)
{
progress
=
100
;
}
else
if
(
progress
<
0
)
{
}
else
if
(
progress
<
0
)
{
progress
=
0
;
}
this
[
'numLabel'
].
textFlow
=
(
new
HtmlTextParser
).
parser
(
`共<b>
${
2
+
this
.
data
.
helpedCount
}
</b>位好友帮你刮了<b>
${
progress
.
toFixed
(
2
)}
</b>%`
)
;
this
[
'numLabel'
].
textFlow
=
(
new
HtmlTextParser
).
parser
(
`共<b>
${
2
+
this
.
data
.
helpedCount
}
</b>位好友帮你刮了<b>
${
progress
.
toFixed
(
2
)}
</b>%`
);
this
[
"progressLabel"
].
textFlow
=
(
new
HtmlTextParser
).
parser
(
`仅剩<b>
${(
100
-
progress
).
toFixed
(
2
)}
</b>%`
);
// 进度条文字
let
_width
=
this
[
"progressBg"
].
width
*
progress
/
100
;
// 宽度
let
dProgress
=
Math
.
abs
(
progress
-
this
[
"progress"
].
width
/
this
[
"progressBg"
].
width
);
// 比当前进度的差值的绝对值
let
_duration
=
1000
*
dProgress
/
100
;
// 算出变化的时间
egret
.
Tween
.
get
(
this
[
"progress"
]).
to
({
width
:
_width
},
_duration
);
egret
.
Tween
.
get
(
this
[
"progress"
]).
to
({
width
:
_width
},
_duration
);
}
private
setWXShareTip
()
{
...
...
@@ -197,7 +197,7 @@ export default class ScratchPanel extends Panel {
}
private
hongbaoEffect
()
{
egret
.
Tween
.
get
(
this
[
"hongbao"
]).
to
({
scaleX
:
0.8
,
scaleY
:
0.8
},
200
,
egret
.
Ease
.
quadInOut
).
call
(()
=>
{
egret
.
Tween
.
get
(
this
[
"hongbao"
]).
to
({
scaleX
:
0.8
,
scaleY
:
0.8
},
200
,
egret
.
Ease
.
quadInOut
).
call
(()
=>
{
egret
.
Tween
.
get
(
this
[
"hongbao"
]).
to
({
scaleX
:
1
,
scaleY
:
1
...
...
@@ -243,9 +243,14 @@ class ScratchItem extends eui.ItemRenderer {
let
s
=
this
.
data
.
avatar
||
"http://yun.duiba.com.cn/db_games/default_avatar.png"
;
this
.
img
.
source
=
this
.
data
.
avatar
||
"http://yun.duiba.com.cn/db_games/default_avatar.png"
;
this
.
img
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
//加个防连点,这里影响功能了,要加,但是这里没阻止整个场景的点击事件,再说了
this
.
touchEnabled
=
false
;
this
.
touchChildren
=
false
;
NetManager
.
ins
.
clickLog
(
getlogItem
(
50
));
NetManager
.
ins
.
scratchGetShareCode
((
success
,
res
)
=>
{
if
(
!
success
)
{
NetManager
.
ins
.
scratchGetShareCode
((
success
,
res
)
=>
{
//shareCode为啥不缓存,每次好像都一样吧,还有下面失败是否要给个toast
this
.
touchEnabled
=
true
;
this
.
touchChildren
=
true
;
if
(
!
success
)
{
return
;
}
let
shareCode
=
res
.
data
;
// 分享码
...
...
@@ -254,14 +259,14 @@ class ScratchItem extends eui.ItemRenderer {
CFG
.
wxShareTitle
=
'萌狮消消消'
;
CFG
.
wxShareDesc
=
'超好玩的萌狮消消乐,快来和我一起玩吧~'
;
CFG
.
wxShareImg
=
"http://yun.duiba.com.cn/db_games/xiaoxiaole2.jpg"
;
if
(
iswx
())
{
//微信端
if
(
iswx
())
{
//微信端
this
.
data
.
wxShareTip
.
visible
=
true
;
window
[
"invokeWX"
]();
}
else
{
//端内
this
.
data
.
wxShareTip
.
visible
=
false
;
// window["scratchShare"](code);
//0224修改,去掉原先邀请逻辑,新增口令逻辑
showShareCodePanel
(
CodeChannels
.
InvitePrize
,
code
)
showShareCodePanel
(
CodeChannels
.
Scratch
,
code
)
}
},
this
.
data
.
scratchTaskId
);
},
this
);
...
...
egret/src/panels/ShareCodePanel.ts
View file @
99c9d4e4
...
...
@@ -41,7 +41,7 @@ const panelMsg = {
interface
ShareData
{
channel
:
CodeChannels
,
shareCode
?:
string
,
//0224期加体力和排行榜分享好友没有分享码
addFun
:
Function
,
//点击立即前往的额外操作
addFun
?
:
Function
,
//点击立即前往的额外操作
}
class
ShareCodePanel
extends
ComponentBase
{
...
...
@@ -254,10 +254,18 @@ function linkWx() {
/**
* 唤起微信朋友圈
* 暂未实现
* 暂未实现
,也跳微信
*/
function
linkWxpyq
()
{
var
locatUrl
=
"weixin://"
;
if
(
/ipad|iphone|mac/i
.
test
(
navigator
.
userAgent
))
{
var
ifr
=
document
.
createElement
(
"iframe"
);
ifr
.
src
=
locatUrl
;
ifr
.
style
.
display
=
"none"
;
document
.
body
.
appendChild
(
ifr
);
}
else
{
window
.
location
.
href
=
locatUrl
;
}
}
/**
...
...
egret/src/panels/StartPanel.ts
View file @
99c9d4e4
...
...
@@ -21,6 +21,7 @@ import { addAdComp } from "./BoxPanel";
import
{
getChapterData
}
from
"../something/chapters/getChapter"
;
import
{
getlogItem
}
from
"../Main"
;
import
{
showShareCodePanel
,
CodeChannels
}
from
"./ShareCodePanel"
;
import
{
DataManager
}
from
"../../libs/tw/manager/DataManager"
;
export
default
class
StartPanel
extends
Panel
{
static
currlevel
;
...
...
@@ -114,17 +115,38 @@ export default class StartPanel extends Panel {
});
})
}
else
// showShare(1);
showShareCodePanel
(
CodeChannels
.
AddBlood
,
null
,
()
=>
{
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
NetManager
.
ins
.
hc_home
(()
=>
{
SceneCtrl
.
instance
.
updateScene
();
},
window
[
'collectRuleId'
]);
wait
(
2000
).
then
(()
=>
{
showToast
(
'分享成功~'
);
});
})
});
// showShare(1);
{
if
(
window
[
"test0228"
])
{
//如果之前没获取到,就再发接口,几率很低
if
(
!
DataManager
.
ins
.
getData
(
"getUserShareCode"
))
{
this
.
touchEnabled
=
false
this
.
touchChildren
=
false
NetManager
.
ins
.
getUserShareCode
((
s
,
res
)
=>
{
this
.
touchEnabled
=
true
this
.
touchChildren
=
true
if
(
!
s
)
{
showToast
(
"获取分享信息失败,请重试"
)
}
else
{
showShareCodePanel
(
CodeChannels
.
AddBlood
,
res
.
data
)
}
})
}
else
{
showShareCodePanel
(
CodeChannels
.
AddBlood
,
DataManager
.
ins
.
getData
(
"getUserShareCode"
).
data
);
}
}
else
{
showShareCodePanel
(
CodeChannels
.
AddBlood
,
null
,
()
=>
{
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
NetManager
.
ins
.
hc_home
(()
=>
{
SceneCtrl
.
instance
.
updateScene
();
},
window
[
'collectRuleId'
]);
wait
(
2000
).
then
(()
=>
{
showToast
(
'分享成功~'
);
});
})
});
}
}
}
return
;
}
...
...
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