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
Show 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
...
@@ -17,7 +17,7 @@ export class NetManager extends ABNetManager {
...
@@ -17,7 +17,7 @@ export class NetManager extends ABNetManager {
private
static
instance
:
NetManager
;
private
static
instance
:
NetManager
;
public
static
get
ins
():
NetManager
{
public
static
get
ins
():
NetManager
{
if
(
!
this
.
instance
)
{
if
(
!
this
.
instance
)
{
this
.
instance
=
new
NetManager
();
this
.
instance
=
new
NetManager
();
}
}
return
this
.
instance
;
return
this
.
instance
;
...
@@ -27,7 +27,7 @@ export class NetManager extends ABNetManager {
...
@@ -27,7 +27,7 @@ export class NetManager extends ABNetManager {
constructor
()
{
constructor
()
{
super
();
super
();
if
(
this
.
isInit
)
{
if
(
this
.
isInit
)
{
throw
Error
(
TwLang
.
lang_001
);
throw
Error
(
TwLang
.
lang_001
);
}
}
this
.
isInit
=
true
;
this
.
isInit
=
true
;
...
@@ -98,7 +98,7 @@ export class NetManager extends ABNetManager {
...
@@ -98,7 +98,7 @@ export class NetManager extends ABNetManager {
*/
*/
public
addTimesForActivity
(
callback
:
Function
,
type
:
number
,
count
:
number
,
validType
:
number
):
void
{
public
addTimesForActivity
(
callback
:
Function
,
type
:
number
,
count
:
number
,
validType
:
number
):
void
{
let
activityId
:
number
;
let
activityId
:
number
;
if
(
type
==
1
)
{
if
(
type
==
1
)
{
activityId
=
DataManager
.
ins
.
gameCfgData
.
gameInfo
.
oaId
;
activityId
=
DataManager
.
ins
.
gameCfgData
.
gameInfo
.
oaId
;
}
else
{
}
else
{
activityId
=
DataManager
.
ins
.
customCfgData
.
oaId
;
activityId
=
DataManager
.
ins
.
customCfgData
.
oaId
;
...
@@ -108,7 +108,7 @@ export class NetManager extends ABNetManager {
...
@@ -108,7 +108,7 @@ export class NetManager extends ABNetManager {
addCount
:
count
,
addCount
:
count
,
activityId
:
activityId
activityId
:
activityId
};
};
if
(
validType
)
{
if
(
validType
)
{
param
.
validType
=
validType
;
param
.
validType
=
validType
;
}
}
...
@@ -149,15 +149,15 @@ export class NetManager extends ABNetManager {
...
@@ -149,15 +149,15 @@ export class NetManager extends ABNetManager {
public
openCollectGoodsPrize
(
callback
:
Function
,
collectRuleId
:
number
,
type
?:
number
):
void
{
public
openCollectGoodsPrize
(
callback
:
Function
,
collectRuleId
:
number
,
type
?:
number
):
void
{
let
actId
:
number
;
let
actId
:
number
;
let
param
:
any
;
let
param
:
any
;
if
(
type
==
1
)
{
if
(
type
==
1
)
{
actId
=
DataManager
.
ins
.
gameCfgData
.
gameInfo
.
oaId
;
actId
=
DataManager
.
ins
.
gameCfgData
.
gameInfo
.
oaId
;
}
else
if
(
type
==
2
)
{
}
else
if
(
type
==
2
)
{
actId
=
DataManager
.
ins
.
customCfgData
.
oaId
;
actId
=
DataManager
.
ins
.
customCfgData
.
oaId
;
}
}
if
(
type
)
{
if
(
type
)
{
param
=
{
collectRuleId
:
collectRuleId
,
actId
:
actId
}
param
=
{
collectRuleId
:
collectRuleId
,
actId
:
actId
}
}
else
{
}
else
{
param
=
{
collectRuleId
:
collectRuleId
};
param
=
{
collectRuleId
:
collectRuleId
};
}
}
const
net
:
INetData
=
{
const
net
:
INetData
=
{
name
:
NetName
.
OPEN_COLLECT
,
name
:
NetName
.
OPEN_COLLECT
,
...
@@ -238,7 +238,7 @@ export class NetManager extends ABNetManager {
...
@@ -238,7 +238,7 @@ export class NetManager extends ABNetManager {
uri
:
'/summer/getToyInfo'
,
uri
:
'/summer/getToyInfo'
,
type
:
'get'
,
type
:
'get'
,
dataType
:
'json'
,
dataType
:
'json'
,
param
:
{
operatingActivityId
:
operatingActivityId
},
param
:
{
operatingActivityId
:
operatingActivityId
},
callback
:
callback
callback
:
callback
};
};
this
.
send
(
net
);
this
.
send
(
net
);
...
@@ -254,7 +254,7 @@ export class NetManager extends ABNetManager {
...
@@ -254,7 +254,7 @@ export class NetManager extends ABNetManager {
public
doStart
(
callback
:
Function
,
isAgain
:
boolean
,
credits
?:
number
,
customizedType
?:
number
):
void
{
public
doStart
(
callback
:
Function
,
isAgain
:
boolean
,
credits
?:
number
,
customizedType
?:
number
):
void
{
let
addUrl
=
''
;
let
addUrl
=
''
;
if
(
isAgain
)
{
if
(
isAgain
)
{
addUrl
+=
'?dpm='
+
DataManager
.
ins
.
gameGetSubmitResultData
.
againExposure
.
dpm
;
addUrl
+=
'?dpm='
+
DataManager
.
ins
.
gameGetSubmitResultData
.
againExposure
.
dpm
;
}
}
...
@@ -263,11 +263,11 @@ export class NetManager extends ABNetManager {
...
@@ -263,11 +263,11 @@ export class NetManager extends ABNetManager {
oaId
:
DataManager
.
ins
.
gameCfgData
.
gameInfo
.
oaId
oaId
:
DataManager
.
ins
.
gameCfgData
.
gameInfo
.
oaId
};
};
if
(
credits
)
{
if
(
credits
)
{
param
.
credits
=
credits
;
param
.
credits
=
credits
;
}
}
if
(
customizedType
)
{
if
(
customizedType
)
{
param
.
customizedType
=
customizedType
;
param
.
customizedType
=
customizedType
;
}
}
...
@@ -294,7 +294,7 @@ export class NetManager extends ABNetManager {
...
@@ -294,7 +294,7 @@ export class NetManager extends ABNetManager {
const
param
:
any
=
{
const
param
:
any
=
{
ticketId
:
ticketId
ticketId
:
ticketId
};
};
if
(
customizedType
)
{
if
(
customizedType
)
{
param
.
customizedType
=
customizedType
param
.
customizedType
=
customizedType
}
}
...
@@ -421,7 +421,7 @@ export class NetManager extends ABNetManager {
...
@@ -421,7 +421,7 @@ export class NetManager extends ABNetManager {
sgin
:
sign
,
sgin
:
sign
,
dynamicData
:
JSON
.
stringify
(
dynamicData
)
dynamicData
:
JSON
.
stringify
(
dynamicData
)
};
};
if
(
rankId
)
{
if
(
rankId
)
{
param
.
rankId
=
rankId
;
param
.
rankId
=
rankId
;
}
}
const
net
:
INetData
=
{
const
net
:
INetData
=
{
...
@@ -441,7 +441,7 @@ export class NetManager extends ABNetManager {
...
@@ -441,7 +441,7 @@ export class NetManager extends ABNetManager {
kk
=
kk
.
substring
(
0
,
16
);
kk
=
kk
.
substring
(
0
,
16
);
//补0;
//补0;
var
len
=
kk
.
length
;
var
len
=
kk
.
length
;
while
(
len
<
16
)
{
while
(
len
<
16
)
{
kk
=
kk
+
"0"
;
kk
=
kk
+
"0"
;
len
++
;
len
++
;
}
}
...
@@ -476,7 +476,7 @@ export class NetManager extends ABNetManager {
...
@@ -476,7 +476,7 @@ export class NetManager extends ABNetManager {
deviceSessionId
:
window
[
'_device_session_id'
],
deviceSessionId
:
window
[
'_device_session_id'
],
score
:
score
score
:
score
};
};
if
(
relatedTaskType
)
{
if
(
relatedTaskType
)
{
data
[
'relatedTaskType'
]
=
relatedTaskType
;
data
[
'relatedTaskType'
]
=
relatedTaskType
;
}
}
var
sgin
=
this
.
encrypt
(
JSON
.
stringify
(
data
));
var
sgin
=
this
.
encrypt
(
JSON
.
stringify
(
data
));
...
@@ -572,10 +572,10 @@ export class NetManager extends ABNetManager {
...
@@ -572,10 +572,10 @@ export class NetManager extends ABNetManager {
sgin
:
sign
,
sgin
:
sign
,
dynamicData
:
dynamicData
dynamicData
:
dynamicData
};
};
if
(
checkScore
)
{
if
(
checkScore
)
{
param
.
checkScore
=
checkScore
;
param
.
checkScore
=
checkScore
;
}
}
if
(
customizedType
)
{
if
(
customizedType
)
{
param
.
customizedType
=
customizedType
;
param
.
customizedType
=
customizedType
;
}
}
...
@@ -833,7 +833,7 @@ export class NetManager extends ABNetManager {
...
@@ -833,7 +833,7 @@ export class NetManager extends ABNetManager {
this
.
send
(
net
);
this
.
send
(
net
);
}
}
public
getShareInfo
(
callback
:
Function
,):
void
{
public
getShareInfo
(
callback
:
Function
,
):
void
{
const
net
:
INetData
=
{
const
net
:
INetData
=
{
name
:
'getShareInfo'
,
name
:
'getShareInfo'
,
uri
:
window
[
'duiba'
]
+
'/wechatShare/getShareInfo/v2'
,
uri
:
window
[
'duiba'
]
+
'/wechatShare/getShareInfo/v2'
,
...
@@ -932,7 +932,7 @@ export class NetManager extends ABNetManager {
...
@@ -932,7 +932,7 @@ export class NetManager extends ABNetManager {
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
};
};
if
(
propType
)
{
if
(
propType
)
{
d
.
propType
=
propType
;
d
.
propType
=
propType
;
}
}
const
net
:
INetData
=
{
const
net
:
INetData
=
{
...
@@ -993,7 +993,7 @@ export class NetManager extends ABNetManager {
...
@@ -993,7 +993,7 @@ export class NetManager extends ABNetManager {
uri
:
window
[
'duiba'
]
+
'/customActivity/happyclear/getBackReward'
,
uri
:
window
[
'duiba'
]
+
'/customActivity/happyclear/getBackReward'
,
type
:
'get'
,
type
:
'get'
,
dataType
:
'json'
,
dataType
:
'json'
,
hideMsg
:
true
,
hideMsg
:
true
,
param
:
d
,
param
:
d
,
callback
:
callback
callback
:
callback
};
};
...
@@ -1006,7 +1006,7 @@ export class NetManager extends ABNetManager {
...
@@ -1006,7 +1006,7 @@ export class NetManager extends ABNetManager {
uri
:
window
[
'duiba'
]
+
'/customActivity/happyclear/hasBackReward'
,
uri
:
window
[
'duiba'
]
+
'/customActivity/happyclear/hasBackReward'
,
type
:
'get'
,
type
:
'get'
,
dataType
:
'json'
,
dataType
:
'json'
,
hideMsg
:
true
,
hideMsg
:
true
,
param
:
d
,
param
:
d
,
callback
:
callback
callback
:
callback
};
};
...
@@ -1061,9 +1061,9 @@ export class NetManager extends ABNetManager {
...
@@ -1061,9 +1061,9 @@ export class NetManager extends ABNetManager {
public
getMusicCategory
(
callback
:
Function
,
categoryID
?:
number
,
categoryCode
?,
liteVersion
?):
void
{
public
getMusicCategory
(
callback
:
Function
,
categoryID
?:
number
,
categoryCode
?,
liteVersion
?):
void
{
const
data
:
any
=
{};
const
data
:
any
=
{};
if
(
categoryID
)
data
.
categoryID
=
categoryID
;
if
(
categoryID
)
data
.
categoryID
=
categoryID
;
if
(
categoryCode
)
data
.
categoryCode
=
categoryCode
;
if
(
categoryCode
)
data
.
categoryCode
=
categoryCode
;
if
(
liteVersion
)
data
.
liteVersion
=
liteVersion
;
if
(
liteVersion
)
data
.
liteVersion
=
liteVersion
;
const
net
:
INetData
=
{
const
net
:
INetData
=
{
name
:
'getMusicCategory'
,
name
:
'getMusicCategory'
,
uri
:
'/aaw/music/category'
,
uri
:
'/aaw/music/category'
,
...
@@ -1098,8 +1098,8 @@ export class NetManager extends ABNetManager {
...
@@ -1098,8 +1098,8 @@ export class NetManager extends ABNetManager {
public
getMusicItem
(
callback
:
Function
,
songListId
,
itemId
):
void
{
public
getMusicItem
(
callback
:
Function
,
songListId
,
itemId
):
void
{
const
data
:
any
=
{};
const
data
:
any
=
{};
if
(
itemId
)
data
.
itemId
=
itemId
;
if
(
itemId
)
data
.
itemId
=
itemId
;
if
(
songListId
)
data
.
songListId
=
songListId
;
if
(
songListId
)
data
.
songListId
=
songListId
;
const
net
:
INetData
=
{
const
net
:
INetData
=
{
name
:
'getMusicItem'
,
name
:
'getMusicItem'
,
uri
:
'/aaw/music/item'
,
uri
:
'/aaw/music/item'
,
...
@@ -1154,10 +1154,10 @@ export class NetManager extends ABNetManager {
...
@@ -1154,10 +1154,10 @@ export class NetManager extends ABNetManager {
activityType
:
'hdtool'
,
activityType
:
'hdtool'
,
consumerId
:
window
[
'CFG'
].
consumerId
consumerId
:
window
[
'CFG'
].
consumerId
};
};
if
(
credits
)
{
if
(
credits
)
{
param
.
credits
=
credits
;
param
.
credits
=
credits
;
}
}
if
(
collectRuleId
)
{
if
(
collectRuleId
)
{
param
.
collectRuleId
=
collectRuleId
;
param
.
collectRuleId
=
collectRuleId
;
}
}
const
net
:
INetData
=
{
const
net
:
INetData
=
{
...
@@ -1851,7 +1851,7 @@ export class NetManager extends ABNetManager {
...
@@ -1851,7 +1851,7 @@ export class NetManager extends ABNetManager {
* @param net
* @param net
*/
*/
public
getToken
(
net
:
INetData
):
void
{
public
getToken
(
net
:
INetData
):
void
{
if
(
window
[
'getDuibaToken'
])
{
if
(
window
[
'getDuibaToken'
])
{
window
[
'getDuibaToken'
]((
tokenObj
:
any
)
=>
{
window
[
'getDuibaToken'
]((
tokenObj
:
any
)
=>
{
net
.
param
.
token
=
tokenObj
.
token
;
net
.
param
.
token
=
tokenObj
.
token
;
this
.
send
(
net
);
this
.
send
(
net
);
...
@@ -1882,12 +1882,12 @@ export class NetManager extends ABNetManager {
...
@@ -1882,12 +1882,12 @@ export class NetManager extends ABNetManager {
let
gTime
:
string
=
'?_='
+
GTime
.
getTimestamp
();
let
gTime
:
string
=
'?_='
+
GTime
.
getTimestamp
();
let
realUrl
:
string
=
net
.
uri
;
let
realUrl
:
string
=
net
.
uri
;
if
(
realUrl
.
indexOf
(
'?'
)
!=
-
1
)
{
if
(
realUrl
.
indexOf
(
'?'
)
!=
-
1
)
{
gTime
=
'&_='
+
GTime
.
getTimestamp
();
gTime
=
'&_='
+
GTime
.
getTimestamp
();
}
}
//url加参数等特殊需求(例如再玩一次需要在dostart接口的url上加埋点)
//url加参数等特殊需求(例如再玩一次需要在dostart接口的url上加埋点)
if
(
net
.
addUrl
)
{
if
(
net
.
addUrl
)
{
realUrl
+=
net
.
addUrl
;
realUrl
+=
net
.
addUrl
;
}
}
...
@@ -2009,33 +2009,33 @@ export class NetManager extends ABNetManager {
...
@@ -2009,33 +2009,33 @@ export class NetManager extends ABNetManager {
* @param result 结果
* @param result 结果
*/
*/
protected
onResponse
(
net
:
INetData
,
result
:
any
):
void
{
protected
onResponse
(
net
:
INetData
,
result
:
any
):
void
{
if
(
net
.
name
==
'hc_home'
)
{
if
(
net
.
name
==
'hc_home'
)
{
// if(result.data.refectionCountdown==null)
// if(result.data.refectionCountdown==null)
// result.data.refectionCountdown==0;
// result.data.refectionCountdown==0;
if
(
result
.
data
.
refectionCountdown
==
0
)
if
(
result
.
data
.
refectionCountdown
==
0
)
result
.
data
.
refectionCountdown
=
5
;
result
.
data
.
refectionCountdown
=
5
;
result
.
data
.
refectionCountdown
+=
Math
.
floor
(
new
Date
().
getTime
()
/
1000
);
result
.
data
.
refectionCountdown
+=
Math
.
floor
(
new
Date
().
getTime
()
/
1000
);
}
}
//数据处理
//数据处理
const
data
:
Data
=
DataManager
.
ins
.
updateData
(
net
.
name
,
result
,
net
.
param
);
const
data
:
Data
=
DataManager
.
ins
.
updateData
(
net
.
name
,
result
,
net
.
param
);
//接口成功
//接口成功
if
(
net
.
pollingCount
&&
net
.
pollingCheck
(
data
))
{
if
(
net
.
pollingCount
&&
net
.
pollingCheck
(
data
))
{
net
.
pollingCount
-=
1
;
net
.
pollingCount
-=
1
;
//轮询接口特殊处理
//轮询接口特殊处理
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
send
(
net
);
this
.
send
(
net
);
},
500
);
},
500
);
}
else
if
(
net
.
callback
)
{
}
else
if
(
net
.
callback
)
{
if
(
net
.
pollingCheck
&&
net
.
pollingCount
==
0
&&
net
.
pollingCheck
(
data
))
{
if
(
net
.
pollingCheck
&&
net
.
pollingCount
==
0
&&
net
.
pollingCheck
(
data
))
{
result
.
message
=
'系统异常,请稍后再试。'
;
result
.
message
=
'系统异常,请稍后再试。'
;
data
[
'success'
]
=
false
;
data
[
'success'
]
=
false
;
}
}
net
.
callback
(
data
.
success
,
data
||
result
);
net
.
callback
(
data
.
success
,
data
||
result
);
}
}
if
(
!
data
.
success
&&
!
net
.
hideMsg
)
{
if
(
!
data
.
success
&&
!
net
.
hideMsg
)
{
GDispatcher
.
dispatchEvent
(
ABNetManager
.
ERROR
,
net
,
result
.
message
||
result
.
desc
||
result
.
msg
);
GDispatcher
.
dispatchEvent
(
ABNetManager
.
ERROR
,
net
,
result
.
message
||
result
.
desc
||
result
.
msg
);
}
}
if
(
!
data
.
success
&&
!
net
.
hideMsg
)
{
if
(
!
data
.
success
&&
!
net
.
hideMsg
)
{
onNotSuccess
(
data
,
net
.
name
)
onNotSuccess
(
data
,
net
.
name
)
}
}
}
}
...
@@ -2048,11 +2048,11 @@ export class NetManager extends ABNetManager {
...
@@ -2048,11 +2048,11 @@ export class NetManager extends ABNetManager {
* @param message
* @param message
*/
*/
protected
onError
(
net
:
INetData
):
void
{
protected
onError
(
net
:
INetData
):
void
{
if
(
net
.
callback
)
{
if
(
net
.
callback
)
{
net
.
callback
(
false
);
net
.
callback
(
false
);
}
}
if
(
!
net
.
hideMsg
)
{
if
(
!
net
.
hideMsg
)
{
GDispatcher
.
dispatchEvent
(
ABNetManager
.
ERROR
,
net
);
GDispatcher
.
dispatchEvent
(
ABNetManager
.
ERROR
,
net
);
showToast
(
'网络开小差了,再试一次吧'
);
showToast
(
'网络开小差了,再试一次吧'
);
console
.
log
(
'接口错误'
,
net
.
uri
)
console
.
log
(
'接口错误'
,
net
.
uri
)
...
@@ -2362,4 +2362,48 @@ export class NetManager extends ABNetManager {
...
@@ -2362,4 +2362,48 @@ export class NetManager extends ABNetManager {
}
}
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////// 分享加体力 /////////////////////////////////////
/**
* 通用接口,现在用于获取分享加体力的分享码
*
*/
public
getUserShareCode
(
callback
:
Function
)
{
const
net
:
INetData
=
{
name
:
"getUserShareCode"
,
uri
:
window
[
'duiba'
]
+
'/activtyShareCode/getUserShareCode'
,
type
:
'get'
,
dataType
:
'json'
,
hideMsg
:
true
,
param
:
{
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
activityType
:
"hdtool"
,
// dateUnit
},
callback
:
callback
};
this
.
send
(
net
);
}
/**
* 通用接口,现在用于分享加体力助力
* @param callback
* @param shareCode
*/
public
doHelpNew
(
callback
:
Function
,
shareCode
:
string
)
{
const
net
:
INetData
=
{
name
:
"doHelpNew"
,
uri
:
window
[
'duiba'
]
+
'/activtyShareCode/doHelpNew'
,
type
:
'get'
,
dataType
:
'json'
,
hideMsg
:
true
,
param
:
{
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
activityType
:
"hdtool"
,
shareCode
,
// singleLimitType: "",//待写
// subType: "" //待写
},
callback
:
callback
};
this
.
send
(
net
);
}
}
}
\ No newline at end of file
egret/src/mapScene/MapScene.ts
View file @
e1f2e312
...
@@ -32,6 +32,7 @@ import { NetName } from "../../libs/tw/enum/NetName";
...
@@ -32,6 +32,7 @@ import { NetName } from "../../libs/tw/enum/NetName";
import
TaskCenterIcon
from
"./icon/TaskCenterIcon"
;
import
TaskCenterIcon
from
"./icon/TaskCenterIcon"
;
import
HbBombIcon
from
"./icon/HbBombIcon"
;
import
HbBombIcon
from
"./icon/HbBombIcon"
;
import
{
createEffect1MovieClip
}
from
"../effect/createEffect1"
;
import
{
createEffect1MovieClip
}
from
"../effect/createEffect1"
;
import
{
CodeChannels
}
from
"../panels/ShareCodePanel"
;
let
doHelpFlag
=
false
;
let
doHelpFlag
=
false
;
// let doScratchHelpFlag = false;
// let doScratchHelpFlag = false;
...
@@ -51,17 +52,29 @@ export default class MapScene extends Scene {
...
@@ -51,17 +52,29 @@ export default class MapScene extends Scene {
private
actIcon
:
ActIcon
=
null
;
private
actIcon
:
ActIcon
=
null
;
sendInvite
()
{
sendInvite
()
{
const
code
=
Utils
.
getRequestByKey
(
'shareCode'
)
;
const
code
=
Utils
.
getRequestByKey
(
'shareCode'
)
||
Utils
.
getRequestByKey
(
'token'
);
//0224新加用token取一边
if
(
!
code
)
return
;
if
(
!
code
)
return
;
if
(
doHelpFlag
)
{
if
(
doHelpFlag
)
{
return
;
return
;
}
}
if
(
code
.
indexOf
(
"12345678"
)
==
-
1
)
{
// 邀请有礼
//0224修改,取sceneCode,
const
sceneCode
=
Utils
.
getRequestByKey
(
'sceneCode'
)
if
(
sceneCode
==
CodeChannels
.
AddBlood
)
{
//加体力的,0228到时会修改成助力,这里要加逻辑
if
(
window
[
"test0228"
])
{
}
else
{
showToast
(
"欢迎加入游戏,去闯关吧"
);
}
}
else
if
(
sceneCode
==
CodeChannels
.
RankPlay
)
{
//排行榜邀请好友的,
showToast
(
"欢迎加入游戏,去闯关吧"
);
}
//剩下的就是邀请有礼和刮刮卡了,本身code上有区分
else
if
(
code
.
indexOf
(
"12345678"
)
==
-
1
)
{
// 邀请有礼
const
dojoin
=
DataManager
.
ins
.
getData
(
'hc_doJoin'
);
const
dojoin
=
DataManager
.
ins
.
getData
(
'hc_doJoin'
);
if
(
!
dojoin
)
return
;
if
(
!
dojoin
)
return
;
NetManager
.
ins
.
doHelp
((
success
,
res
)
=>
{
NetManager
.
ins
.
doHelp
((
success
,
res
)
=>
{
doHelpFlag
=
true
;
doHelpFlag
=
true
;
switch
(
true
)
{
switch
(
true
)
{
case
(
res
.
code
==
"400017"
):
case
(
res
.
code
==
"400017"
):
showToast
(
"您不是新用户呢~"
);
showToast
(
"您不是新用户呢~"
);
break
;
break
;
...
@@ -74,7 +87,7 @@ export default class MapScene extends Scene {
...
@@ -74,7 +87,7 @@ export default class MapScene extends Scene {
default
:
default
:
break
;
break
;
}
}
if
(
!
success
)
{
if
(
!
success
)
{
return
;
return
;
}
}
showToast
(
"助力成功"
);
showToast
(
"助力成功"
);
...
@@ -84,7 +97,7 @@ export default class MapScene extends Scene {
...
@@ -84,7 +97,7 @@ export default class MapScene extends Scene {
const
_code
=
code
.
slice
(
8
);
const
_code
=
code
.
slice
(
8
);
NetManager
.
ins
.
scratchDoHelp
((
success
,
res
)
=>
{
NetManager
.
ins
.
scratchDoHelp
((
success
,
res
)
=>
{
doHelpFlag
=
true
;
doHelpFlag
=
true
;
switch
(
true
)
{
switch
(
true
)
{
case
(
res
.
code
==
"0000024"
):
case
(
res
.
code
==
"0000024"
):
showToast
(
"今日刮卡次数已达到上线限哦~"
);
showToast
(
"今日刮卡次数已达到上线限哦~"
);
break
;
break
;
...
@@ -97,7 +110,7 @@ export default class MapScene extends Scene {
...
@@ -97,7 +110,7 @@ export default class MapScene extends Scene {
default
:
default
:
break
;
break
;
}
}
if
(
!
success
)
{
if
(
!
success
)
{
return
;
return
;
}
}
showToast
(
"帮刮成功!"
);
showToast
(
"帮刮成功!"
);
...
@@ -150,7 +163,7 @@ export default class MapScene extends Scene {
...
@@ -150,7 +163,7 @@ export default class MapScene extends Scene {
GDispatcher
.
dispatchEvent
(
"getInviteInfo"
);
// 查询邀请信息,控制邀请有礼角标
GDispatcher
.
dispatchEvent
(
"getInviteInfo"
);
// 查询邀请信息,控制邀请有礼角标
this
[
'avatar'
].
mask
=
this
[
'avatarMask'
];
this
[
'avatar'
].
mask
=
this
[
'avatarMask'
];
if
(
getBgOn
()
&&
MapScene
[
'firstPlayBgTag'
]
==
true
)
{
if
(
getBgOn
()
&&
MapScene
[
'firstPlayBgTag'
]
==
true
)
{
playBg
();
playBg
();
}
}
...
@@ -167,12 +180,12 @@ export default class MapScene extends Scene {
...
@@ -167,12 +180,12 @@ export default class MapScene extends Scene {
const
oldTimerStr2
=
localStorage
.
getItem
(
'nowTimer2Str'
+
window
[
'CFG'
].
consumerId
);
const
oldTimerStr2
=
localStorage
.
getItem
(
'nowTimer2Str'
+
window
[
'CFG'
].
consumerId
);
const
hc_advert
=
DataManager
.
ins
.
getData
(
'hc_advert'
).
data
||
{};
const
hc_advert
=
DataManager
.
ins
.
getData
(
'hc_advert'
).
data
||
{};
let
{
noticeAdvert
}
=
hc_advert
;
let
{
noticeAdvert
}
=
hc_advert
;
if
(
noticeAdvert
==
null
)
{
if
(
noticeAdvert
==
null
)
{
noticeAdvert
=
{
enable
:
false
}
noticeAdvert
=
{
enable
:
false
}
}
}
if
(
noticeAdvert
&&
noticeAdvert
.
enable
&&
nowTimerStr2
!=
oldTimerStr2
)
{
if
(
noticeAdvert
&&
noticeAdvert
.
enable
&&
nowTimerStr2
!=
oldTimerStr2
)
{
// if (!adTag) {
// if (!adTag) {
panels
.
push
(
'ad'
);
panels
.
push
(
'ad'
);
// adTag = true;
// adTag = true;
...
@@ -181,14 +194,14 @@ export default class MapScene extends Scene {
...
@@ -181,14 +194,14 @@ export default class MapScene extends Scene {
}
}
const
backData
=
DataManager
.
ins
.
getData
(
'hc_hasBackReward'
);
const
backData
=
DataManager
.
ins
.
getData
(
'hc_hasBackReward'
);
if
(
backData
.
success
)
{
if
(
backData
.
success
)
{
backData
.
success
=
false
;
backData
.
success
=
false
;
panels
.
push
(
'BackIndex'
);
panels
.
push
(
'BackIndex'
);
}
}
const
{
signInfoVO
}
=
DataManager
.
ins
.
getData
(
'getSignInfo'
);
const
{
signInfoVO
}
=
DataManager
.
ins
.
getData
(
'getSignInfo'
);
if
(
signInfoVO
&&
signInfoVO
.
continueDay
<
7
)
{
//表示明天还可以签到
if
(
signInfoVO
&&
signInfoVO
.
continueDay
<
7
)
{
//表示明天还可以签到
if
(
signInfoVO
.
todaySigned
==
0
&&
oldTimerStr
!=
nowTimerStr
)
{
if
(
signInfoVO
.
todaySigned
==
0
&&
oldTimerStr
!=
nowTimerStr
)
{
panels
.
push
(
'sign'
);
panels
.
push
(
'sign'
);
localStorage
.
setItem
(
'nowTimerStr'
+
window
[
'CFG'
].
consumerId
,
nowTimerStr
);
localStorage
.
setItem
(
'nowTimerStr'
+
window
[
'CFG'
].
consumerId
,
nowTimerStr
);
}
}
...
@@ -197,12 +210,12 @@ export default class MapScene extends Scene {
...
@@ -197,12 +210,12 @@ export default class MapScene extends Scene {
// 红包雨强提示
// 红包雨强提示
const
hbRainRes
=
DataManager
.
ins
.
getData
(
NetName
.
HBRAIN_BASEINFO
);
const
hbRainRes
=
DataManager
.
ins
.
getData
(
NetName
.
HBRAIN_BASEINFO
);
if
(
hbRainRes
.
data
)
{
if
(
hbRainRes
.
data
)
{
if
(
hbRainRes
.
data
.
currentSession
||
hbRainRes
.
data
.
nextSession
)
{
if
(
hbRainRes
.
data
.
currentSession
||
hbRainRes
.
data
.
nextSession
)
{
const
sessionId
=
hbRainRes
.
data
.
currentSession
?
hbRainRes
.
data
.
currentSession
.
sessionIndex
:
hbRainRes
.
data
.
nextSession
.
sessionIndex
;
// 场次ID
const
sessionId
=
hbRainRes
.
data
.
currentSession
?
hbRainRes
.
data
.
currentSession
.
sessionIndex
:
hbRainRes
.
data
.
nextSession
.
sessionIndex
;
// 场次ID
const
nowTimerStr3
=
date
.
getTime
()
+
sessionId
+
''
;
const
nowTimerStr3
=
date
.
getTime
()
+
sessionId
+
''
;
const
oldTimerStr3
=
localStorage
.
getItem
(
'nowTimer3Str'
+
window
[
'CFG'
].
consumerId
);
const
oldTimerStr3
=
localStorage
.
getItem
(
'nowTimer3Str'
+
window
[
'CFG'
].
consumerId
);
if
(
nowTimerStr3
!=
oldTimerStr3
)
{
if
(
nowTimerStr3
!=
oldTimerStr3
)
{
panels
.
push
(
'HbCutTime'
);
panels
.
push
(
'HbCutTime'
);
localStorage
.
setItem
(
'nowTimer3Str'
+
window
[
'CFG'
].
consumerId
,
nowTimerStr3
);
localStorage
.
setItem
(
'nowTimer3Str'
+
window
[
'CFG'
].
consumerId
,
nowTimerStr3
);
}
}
...
@@ -211,11 +224,11 @@ export default class MapScene extends Scene {
...
@@ -211,11 +224,11 @@ export default class MapScene extends Scene {
// 任务中心可领奖强提示
// 任务中心可领奖强提示
let
canShow
=
localStorage
.
getItem
(
'taskCenter'
+
window
[
'CFG'
].
consumerId
);
let
canShow
=
localStorage
.
getItem
(
'taskCenter'
+
window
[
'CFG'
].
consumerId
);
if
(
canShow
==
'true'
)
{
if
(
canShow
==
'true'
)
{
const
taskInfoRes
=
DataManager
.
ins
.
getData
(
NetName
.
GET_TASKINFO
);
const
taskInfoRes
=
DataManager
.
ins
.
getData
(
NetName
.
GET_TASKINFO
);
if
(
taskInfoRes
&&
taskInfoRes
.
data
&&
taskInfoRes
.
data
.
length
>
0
)
{
if
(
taskInfoRes
&&
taskInfoRes
.
data
&&
taskInfoRes
.
data
.
length
>
0
)
{
for
(
let
i
=
0
;
i
<
taskInfoRes
.
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
taskInfoRes
.
data
.
length
;
i
++
)
{
if
(
taskInfoRes
.
data
[
i
].
count
>
0
)
{
if
(
taskInfoRes
.
data
[
i
].
count
>
0
)
{
panels
.
push
(
'task'
);
panels
.
push
(
'task'
);
break
;
break
;
}
}
...
@@ -225,18 +238,18 @@ export default class MapScene extends Scene {
...
@@ -225,18 +238,18 @@ export default class MapScene extends Scene {
localStorage
.
setItem
(
'taskCenter'
+
window
[
'CFG'
].
consumerId
,
'false'
);
localStorage
.
setItem
(
'taskCenter'
+
window
[
'CFG'
].
consumerId
,
'false'
);
let
res
=
DataManager
.
ins
.
getData
(
'hc_redBombBaseInfo'
);
let
res
=
DataManager
.
ins
.
getData
(
'hc_redBombBaseInfo'
);
if
(
res
&&
res
.
data
)
{
if
(
res
&&
res
.
data
)
{
let
_t
=
res
.
data
.
redBombSwitchTime
||
""
;
let
_t
=
res
.
data
.
redBombSwitchTime
||
""
;
if
(
res
.
data
.
remain
>
0
)
{
if
(
res
.
data
.
remain
>
0
)
{
let
showBomb
=
localStorage
.
getItem
(
'showBomb'
+
window
[
'CFG'
].
consumerId
);
let
showBomb
=
localStorage
.
getItem
(
'showBomb'
+
window
[
'CFG'
].
consumerId
);
if
(
showBomb
!=
_t
.
toString
()
&&
_t
!=
""
)
{
if
(
showBomb
!=
_t
.
toString
()
&&
_t
!=
""
)
{
localStorage
.
setItem
(
'showBomb'
+
window
[
'CFG'
].
consumerId
,
_t
.
toString
());
localStorage
.
setItem
(
'showBomb'
+
window
[
'CFG'
].
consumerId
,
_t
.
toString
());
panels
.
push
(
'BombTips2Panel'
);
panels
.
push
(
'BombTips2Panel'
);
}
}
}
}
}
}
if
(
!
readCache
()
&&
getHomeData
().
levels
.
length
<=
0
)
{
//引导
if
(
!
readCache
()
&&
getHomeData
().
levels
.
length
<=
0
)
{
//引导
const
guide
=
new
GuideCon
(()
=>
{
const
guide
=
new
GuideCon
(()
=>
{
PanelCtrl
.
instance
.
showPanels
(
panels
,
[],
this
.
onAllPanelHide
);
PanelCtrl
.
instance
.
showPanels
(
panels
,
[],
this
.
onAllPanelHide
);
});
});
...
@@ -276,19 +289,19 @@ export default class MapScene extends Scene {
...
@@ -276,19 +289,19 @@ export default class MapScene extends Scene {
let
target
;
let
target
;
const
homeData
=
getHomeData
();
const
homeData
=
getHomeData
();
if
(
homeData
.
levels
.
length
==
0
)
{
if
(
homeData
.
levels
.
length
==
0
)
{
target
=
1
;
target
=
1
;
}
else
if
(
homeData
.
levels
.
length
==
window
[
'total_level'
])
{
}
else
if
(
homeData
.
levels
.
length
==
window
[
'total_level'
])
{
target
=
window
[
'total_level'
]
+
1
;
target
=
window
[
'total_level'
]
+
1
;
}
else
{
}
else
{
target
=
homeData
.
levels
.
length
+
1
;
target
=
homeData
.
levels
.
length
+
1
;
}
}
for
(
const
key
in
MapScene
.
iconHash
)
{
for
(
const
key
in
MapScene
.
iconHash
)
{
const
levelOrder
=
parseInt
(
key
);
const
levelOrder
=
parseInt
(
key
);
const
element
=
MapScene
.
iconHash
[
key
];
const
element
=
MapScene
.
iconHash
[
key
];
if
(
!
element
.
hasEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
))
{
if
(
!
element
.
hasEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
))
{
element
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
element
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
if
(
if
(
(
levelOrder
>
(
getHomeData
().
levels
.
length
+
1
)
&&
levelOrder
>
1
)
(
levelOrder
>
(
getHomeData
().
levels
.
length
+
1
)
&&
levelOrder
>
1
)
||
(
levelOrder
>
window
[
'last_level'
])
||
(
levelOrder
>
window
[
'last_level'
])
)
{
)
{
...
@@ -302,7 +315,7 @@ export default class MapScene extends Scene {
...
@@ -302,7 +315,7 @@ export default class MapScene extends Scene {
}
}
// 当前关卡的水花动效
// 当前关卡的水花动效
if
(
homeData
.
levels
.
length
<
window
[
'total_level'
])
{
if
(
homeData
.
levels
.
length
<
window
[
'total_level'
])
{
const
targetIcon
=
MapScene
.
iconHash
[
target
];
const
targetIcon
=
MapScene
.
iconHash
[
target
];
const
light
=
RES
.
getRes
(
'lightani_png'
);
const
light
=
RES
.
getRes
(
'lightani_png'
);
...
@@ -315,7 +328,7 @@ export default class MapScene extends Scene {
...
@@ -315,7 +328,7 @@ export default class MapScene extends Scene {
pic
.
anchorOffsetY
=
61
;
pic
.
anchorOffsetY
=
61
;
// pic.x = 50 - 2;
// pic.x = 50 - 2;
// pic.y = 37 + 10;
// pic.y = 37 + 10;
egret
.
Tween
.
get
(
pic
,
{
loop
:
true
}).
to
({
scaleX
:
2
,
scaleY
:
2
,
alpha
:
0
},
1000
).
wait
(
1000
);
egret
.
Tween
.
get
(
pic
,
{
loop
:
true
}).
to
({
scaleX
:
2
,
scaleY
:
2
,
alpha
:
0
},
1000
).
wait
(
1000
);
this
[
'pic'
]
=
pic
;
this
[
'pic'
]
=
pic
;
}
}
...
@@ -325,8 +338,8 @@ export default class MapScene extends Scene {
...
@@ -325,8 +338,8 @@ export default class MapScene extends Scene {
this
.
showLog
();
this
.
showLog
();
this
.
updateBox
();
this
.
updateBox
();
if
(
data
.
level
)
{
if
(
data
.
level
)
{
if
(
homeData
.
remainEnargy
==
0
)
if
(
homeData
.
remainEnargy
==
0
)
PanelCtrl
.
instance
.
show
(
'bloodPanel'
)
PanelCtrl
.
instance
.
show
(
'bloodPanel'
)
else
else
...
@@ -334,8 +347,8 @@ export default class MapScene extends Scene {
...
@@ -334,8 +347,8 @@ export default class MapScene extends Scene {
}
}
this
.
stage
.
once
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
this
.
stage
.
once
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
if
(
!
MapScene
[
'firstPlayBgTag'
])
{
if
(
!
MapScene
[
'firstPlayBgTag'
])
{
if
(
getBgOn
())
{
if
(
getBgOn
())
{
playBg
();
playBg
();
}
}
MapScene
[
'firstPlayBgTag'
]
=
true
;
MapScene
[
'firstPlayBgTag'
]
=
true
;
...
@@ -343,7 +356,7 @@ export default class MapScene extends Scene {
...
@@ -343,7 +356,7 @@ export default class MapScene extends Scene {
},
this
);
},
this
);
let
lastOrder
=
homeData
.
levels
.
length
+
1
;
let
lastOrder
=
homeData
.
levels
.
length
+
1
;
if
(
homeData
.
levels
.
length
>=
window
[
'total_level'
])
if
(
homeData
.
levels
.
length
>=
window
[
'total_level'
])
lastOrder
=
window
[
'total_level'
];
lastOrder
=
window
[
'total_level'
];
this
.
scroll
.
viewport
.
scrollV
=
this
.
getScrollV
(
lastOrder
,
this
.
stage
.
stageHeight
);
this
.
scroll
.
viewport
.
scrollV
=
this
.
getScrollV
(
lastOrder
,
this
.
stage
.
stageHeight
);
// console.warn(this.getScrollV(lastOrder, this.stage.stageHeight));
// console.warn(this.getScrollV(lastOrder, this.stage.stageHeight));
...
@@ -354,7 +367,7 @@ export default class MapScene extends Scene {
...
@@ -354,7 +367,7 @@ export default class MapScene extends Scene {
Promise
.
all
([
Promise
.
all
([
RES
.
getResAsync
(
`
${
key
}
_json`
),
RES
.
getResAsync
(
`
${
key
}
_json`
),
RES
.
getResAsync
(
`
${
key
}
_png`
)]);
RES
.
getResAsync
(
`
${
key
}
_png`
)]);
}
catch
(
error
)
{
}
catch
(
error
)
{
}
}
RES
.
getResAsync
(
'candydis0_json'
);
RES
.
getResAsync
(
'candydis0_json'
);
...
@@ -388,7 +401,7 @@ export default class MapScene extends Scene {
...
@@ -388,7 +401,7 @@ export default class MapScene extends Scene {
loadSvga
(
getResPath
()
+
'resource/assets/svgas/monster.svga'
);
loadSvga
(
getResPath
()
+
'resource/assets/svgas/monster.svga'
);
// loadSvga(getResPath() + 'resource/assets/svgas/fireworks.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/fireworks.svga');
if
(
!
window
[
'development'
])
{
if
(
!
window
[
'development'
])
{
RES
.
getResAsync
(
`inviterulepanel_json`
);
RES
.
getResAsync
(
`inviterulepanel_json`
);
}
}
},
5
*
1000
);
},
5
*
1000
);
...
@@ -399,7 +412,7 @@ export default class MapScene extends Scene {
...
@@ -399,7 +412,7 @@ export default class MapScene extends Scene {
}
}
onAllPanelHide
=
()
=>
{
onAllPanelHide
=
()
=>
{
if
(
!
localStorage
.
getItem
(
'activityguide'
))
{
if
(
!
localStorage
.
getItem
(
'activityguide'
))
{
// NetManager.ins.hbRainBaseInfo((success, res) => {
// NetManager.ins.hbRainBaseInfo((success, res) => {
// if(!success) {
// if(!success) {
// if(res.code == "600054" || res.code == "600055") {
// if(res.code == "600054" || res.code == "600055") {
...
@@ -423,21 +436,21 @@ export default class MapScene extends Scene {
...
@@ -423,21 +436,21 @@ export default class MapScene extends Scene {
const
y1
=
this
.
stage
.
stageHeight
+
this
.
scroll
.
viewport
.
scrollV
-
offset
;
const
y1
=
this
.
stage
.
stageHeight
+
this
.
scroll
.
viewport
.
scrollV
-
offset
;
// console.log(y0, y1);
// console.log(y0, y1);
let
count
=
0
;
let
count
=
0
;
for
(
const
key
in
MapScene
.
iconHash
)
{
for
(
const
key
in
MapScene
.
iconHash
)
{
const
icon
=
MapScene
.
iconHash
[
key
];
const
icon
=
MapScene
.
iconHash
[
key
];
if
(
icon
[
'visibleY'
]
>=
y0
&&
icon
[
'visibleY'
]
<=
y1
)
{
if
(
icon
[
'visibleY'
]
>=
y0
&&
icon
[
'visibleY'
]
<=
y1
)
{
icon
.
show
();
icon
.
show
();
}
else
if
(
icon
.
parent
)
{
}
else
if
(
icon
.
parent
)
{
icon
.
hide
();
icon
.
hide
();
}
}
if
(
icon
.
parent
)
if
(
icon
.
parent
)
count
++
;
count
++
;
}
}
if
(
this
.
_avatarsCache
)
{
if
(
this
.
_avatarsCache
)
{
this
.
_avatarsCache
.
forEach
((
item
)
=>
{
this
.
_avatarsCache
.
forEach
((
item
)
=>
{
if
(
item
.
parent
)
item
.
parent
.
addChild
(
item
);
if
(
item
.
parent
)
item
.
parent
.
addChild
(
item
);
});
});
}
}
...
@@ -458,7 +471,7 @@ export default class MapScene extends Scene {
...
@@ -458,7 +471,7 @@ export default class MapScene extends Scene {
}
}
private
removeIcon
()
{
private
removeIcon
()
{
for
(
let
k
in
this
.
icons
)
{
for
(
let
k
in
this
.
icons
)
{
this
.
icons
[
k
].
destory
();
this
.
icons
[
k
].
destory
();
}
}
this
.
icons
=
{};
this
.
icons
=
{};
...
@@ -471,20 +484,20 @@ export default class MapScene extends Scene {
...
@@ -471,20 +484,20 @@ export default class MapScene extends Scene {
this
[
'nameTxt'
].
text
=
''
;
this
[
'nameTxt'
].
text
=
''
;
// NetManager.ins.hc_userInfo(() => {
// NetManager.ins.hc_userInfo(() => {
this
[
'avatar'
].
visible
=
true
;
this
[
'avatar'
].
visible
=
true
;
const
{
data
}
=
DataManager
.
ins
.
getData
(
'hc_userInfo'
);
const
{
data
}
=
DataManager
.
ins
.
getData
(
'hc_userInfo'
);
if
(
data
)
if
(
data
)
this
[
'avatar'
].
source
=
data
.
avatar
||
"http://yun.duiba.com.cn/db_games/default_avatar.png"
;
this
[
'avatar'
].
source
=
data
.
avatar
||
"http://yun.duiba.com.cn/db_games/default_avatar.png"
;
else
else
this
[
'avatar'
].
source
=
"http://yun.duiba.com.cn/db_games/default_avatar.png"
;
this
[
'avatar'
].
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
);
this
[
'nameTxt'
].
text
=
getNick
(
data
.
nickname
);
// });
// });
}
}
updateSign
()
{
updateSign
()
{
const
{
signInfoVO
}
=
DataManager
.
ins
.
getData
(
'getSignInfo'
);
const
{
signInfoVO
}
=
DataManager
.
ins
.
getData
(
'getSignInfo'
);
if
(
signInfoVO
&&
signInfoVO
.
continueDay
<
7
)
{
//表示明天还可以签到
if
(
signInfoVO
&&
signInfoVO
.
continueDay
<
7
)
{
//表示明天还可以签到
this
[
'sign_s1'
].
visible
=
signInfoVO
.
todaySigned
==
0
;
this
[
'sign_s1'
].
visible
=
signInfoVO
.
todaySigned
==
0
;
this
[
'sign_s2'
].
visible
=
!
this
[
'sign_s1'
].
visible
;
this
[
'sign_s2'
].
visible
=
!
this
[
'sign_s1'
].
visible
;
}
else
{
}
else
{
...
@@ -495,17 +508,17 @@ export default class MapScene extends Scene {
...
@@ -495,17 +508,17 @@ export default class MapScene extends Scene {
// 更新广告数据
// 更新广告数据
updateAdData
()
{
updateAdData
()
{
const
hc_advert
=
DataManager
.
ins
.
getData
(
'hc_advert'
).
data
||
{};
const
hc_advert
=
DataManager
.
ins
.
getData
(
'hc_advert'
).
data
||
{};
let
{
mapAdvert
}
=
hc_advert
;
let
{
mapAdvert
}
=
hc_advert
;
if
(
mapAdvert
==
null
)
if
(
mapAdvert
==
null
)
mapAdvert
=
{
enable
:
false
,
advertList
:
[]
}
mapAdvert
=
{
enable
:
false
,
advertList
:
[]
}
this
[
'adBtn'
].
visible
=
mapAdvert
.
enable
;
this
[
'adBtn'
].
visible
=
mapAdvert
.
enable
;
if
(
this
[
'adBtn'
].
visible
)
{
if
(
this
[
'adBtn'
].
visible
)
{
NetManager
.
ins
.
showLog
(
getlogItem
(
32
));
NetManager
.
ins
.
showLog
(
getlogItem
(
32
));
}
}
if
(
mapAdvert
.
enable
)
{
if
(
mapAdvert
.
enable
)
{
let
result
;
let
result
;
result
=
mapAdvert
.
advertList
;
result
=
mapAdvert
.
advertList
;
if
(
Array
.
isArray
(
mapAdvert
.
advertList
))
{
if
(
Array
.
isArray
(
mapAdvert
.
advertList
))
{
const
index
=
Math
.
floor
(
mapAdvert
.
advertList
.
length
*
Math
.
random
());
const
index
=
Math
.
floor
(
mapAdvert
.
advertList
.
length
*
Math
.
random
());
result
=
mapAdvert
.
advertList
[
index
];
result
=
mapAdvert
.
advertList
[
index
];
}
}
...
@@ -523,12 +536,12 @@ export default class MapScene extends Scene {
...
@@ -523,12 +536,12 @@ export default class MapScene extends Scene {
this
.
removeIcon
();
this
.
removeIcon
();
this
.
actIcon
.
destory
();
this
.
actIcon
.
destory
();
if
(
this
[
'pic'
])
{
if
(
this
[
'pic'
])
{
egret
.
Tween
.
removeTweens
(
this
[
'pic'
]);
egret
.
Tween
.
removeTweens
(
this
[
'pic'
]);
(
this
[
'pic'
].
parent
as
egret
.
DisplayObjectContainer
).
removeChild
(
this
[
'pic'
]);
(
this
[
'pic'
].
parent
as
egret
.
DisplayObjectContainer
).
removeChild
(
this
[
'pic'
]);
}
}
if
(
this
.
inviteTimer
)
{
if
(
this
.
inviteTimer
)
{
this
.
inviteTimer
.
stop
();
this
.
inviteTimer
.
stop
();
this
.
inviteTimer
.
removeEventListener
(
egret
.
TimerEvent
.
TIMER
,
this
.
inviteCutTimer
,
this
);
this
.
inviteTimer
.
removeEventListener
(
egret
.
TimerEvent
.
TIMER
,
this
.
inviteCutTimer
,
this
);
}
}
...
@@ -536,19 +549,19 @@ export default class MapScene extends Scene {
...
@@ -536,19 +549,19 @@ export default class MapScene extends Scene {
this
.
scroll
.
removeEventListener
(
egret
.
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
);
this
.
scroll
.
removeEventListener
(
egret
.
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
);
this
.
_avatarsCache
.
forEach
((
item
)
=>
{
this
.
_avatarsCache
.
forEach
((
item
)
=>
{
if
(
item
.
parent
)
item
.
parent
.
removeChild
(
item
);
if
(
item
.
parent
)
item
.
parent
.
removeChild
(
item
);
});
});
this
.
_avatarsCache
=
null
;
this
.
_avatarsCache
=
null
;
}
}
getScrollV
(
lastOrder
,
stageHeight
)
{
getScrollV
(
lastOrder
,
stageHeight
)
{
// 如果是顶部
// 如果是顶部
if
(
lastOrder
<=
MapTopPart
.
LEVEL_NUMS
)
{
if
(
lastOrder
<=
MapTopPart
.
LEVEL_NUMS
)
{
return
this
.
getScrollV1
(
lastOrder
,
stageHeight
);
return
this
.
getScrollV1
(
lastOrder
,
stageHeight
);
}
}
// 如果是尾部
// 如果是尾部
if
(
lastOrder
>
window
[
'total_level'
]
-
MapBottomPart
.
LEVEL_NUMS
)
{
if
(
lastOrder
>
window
[
'total_level'
]
-
MapBottomPart
.
LEVEL_NUMS
)
{
return
this
.
getScrollV2
(
lastOrder
,
stageHeight
);
return
this
.
getScrollV2
(
lastOrder
,
stageHeight
);
}
}
...
@@ -561,7 +574,7 @@ export default class MapScene extends Scene {
...
@@ -561,7 +574,7 @@ export default class MapScene extends Scene {
const
ylist
=
[
4
,
55
,
160
,
315
,
431
,
529
,
594
,
714
,
820
,
900
,
970
,
1098
,
1164
,
1245
,
1380
,
1493
,
1548
,
1611
,
1734
,
1882
,
2023
,
2180
];
const
ylist
=
[
4
,
55
,
160
,
315
,
431
,
529
,
594
,
714
,
820
,
900
,
970
,
1098
,
1164
,
1245
,
1380
,
1493
,
1548
,
1611
,
1734
,
1882
,
2023
,
2180
];
const
y0
=
this
.
_data
.
top
.
height
;
//顶部的高度
const
y0
=
this
.
_data
.
top
.
height
;
//顶部的高度
let
a0
=
(
lastOrder
-
MapTopPart
.
LEVEL_NUMS
)
%
MapRpeatPart
.
LEVEL_NUMS
;
//减去7后的order 8-7 = 1
let
a0
=
(
lastOrder
-
MapTopPart
.
LEVEL_NUMS
)
%
MapRpeatPart
.
LEVEL_NUMS
;
//减去7后的order 8-7 = 1
if
(
a0
==
0
)
a0
=
MapRpeatPart
.
LEVEL_NUMS
;
if
(
a0
==
0
)
a0
=
MapRpeatPart
.
LEVEL_NUMS
;
const
a1
=
Math
.
ceil
((
lastOrder
-
MapTopPart
.
LEVEL_NUMS
)
/
MapRpeatPart
.
LEVEL_NUMS
)
-
1
;
//当前地图repeat的顺序
const
a1
=
Math
.
ceil
((
lastOrder
-
MapTopPart
.
LEVEL_NUMS
)
/
MapRpeatPart
.
LEVEL_NUMS
)
-
1
;
//当前地图repeat的顺序
const
y1
=
ylist
[
a0
-
1
];
const
y1
=
ylist
[
a0
-
1
];
const
y2
=
y0
+
y1
+
a1
*
this
.
_data
.
list
[
0
].
height
;
const
y2
=
y0
+
y1
+
a1
*
this
.
_data
.
list
[
0
].
height
;
...
@@ -572,7 +585,7 @@ export default class MapScene extends Scene {
...
@@ -572,7 +585,7 @@ export default class MapScene extends Scene {
getScrollV1
(
lastOrder
,
stageHeight
)
{
getScrollV1
(
lastOrder
,
stageHeight
)
{
const
ylist
=
[
587
,
691
,
749
,
849
,
932
,
1025
,
1085
,
1161
].
map
(
i
=>
i
+
40
);
const
ylist
=
[
587
,
691
,
749
,
849
,
932
,
1025
,
1085
,
1161
].
map
(
i
=>
i
+
40
);
const
targetY
=
ylist
[
lastOrder
-
1
]
-
stageHeight
/
2
;
const
targetY
=
ylist
[
lastOrder
-
1
]
-
stageHeight
/
2
;
if
(
targetY
<=
0
)
return
0
;
if
(
targetY
<=
0
)
return
0
;
return
targetY
;
return
targetY
;
}
}
...
@@ -585,7 +598,7 @@ export default class MapScene extends Scene {
...
@@ -585,7 +598,7 @@ export default class MapScene extends Scene {
+
this
.
_data
.
bottom
.
height
;
+
this
.
_data
.
bottom
.
height
;
const
ylist
=
[
62
,
176
,
314
].
map
(
i
=>
i
+
40
);
const
ylist
=
[
62
,
176
,
314
].
map
(
i
=>
i
+
40
);
const
targetY
=
y0
+
ylist
[
lastOrder
-
1
]
-
stageHeight
/
2
;
const
targetY
=
y0
+
ylist
[
lastOrder
-
1
]
-
stageHeight
/
2
;
if
(
targetY
>=
(
totalHeight
-
stageHeight
))
return
totalHeight
-
stageHeight
;
if
(
targetY
>=
(
totalHeight
-
stageHeight
))
return
totalHeight
-
stageHeight
;
return
targetY
;
return
targetY
;
}
}
...
@@ -634,7 +647,7 @@ export default class MapScene extends Scene {
...
@@ -634,7 +647,7 @@ export default class MapScene extends Scene {
updateBox
()
{
updateBox
()
{
const
homeData
=
getHomeData
();
const
homeData
=
getHomeData
();
if
(
homeData
.
canReceiveTreasureBoxNum
<=
0
)
if
(
homeData
.
canReceiveTreasureBoxNum
<=
0
)
setGray
(
this
[
'box'
]);
setGray
(
this
[
'box'
]);
this
[
'boxiconWrapper'
].
visible
=
homeData
.
canReceiveTreasureBoxNum
>
0
;
this
[
'boxiconWrapper'
].
visible
=
homeData
.
canReceiveTreasureBoxNum
>
0
;
this
[
'totalStarTxt'
].
text
=
`
${
homeData
.
totalStars
}
/
${
homeData
.
nextRangeStarsNum
}
`
;
this
[
'totalStarTxt'
].
text
=
`
${
homeData
.
totalStars
}
/
${
homeData
.
nextRangeStarsNum
}
`
;
...
@@ -659,7 +672,7 @@ export default class MapScene extends Scene {
...
@@ -659,7 +672,7 @@ export default class MapScene extends Scene {
parent
.
addChild
(
avatar
);
parent
.
addChild
(
avatar
);
avatar
.
x
=
item
.
x
+
6
;
avatar
.
x
=
item
.
x
+
6
;
avatar
.
y
=
item
.
y
-
avatar
.
height
+
10
;
avatar
.
y
=
item
.
y
-
avatar
.
height
+
10
;
if
(
!
MapScene
.
starHash
[
level
].
visible
)
{
if
(
!
MapScene
.
starHash
[
level
].
visible
)
{
avatar
.
y
=
item
.
y
-
avatar
.
height
;
avatar
.
y
=
item
.
y
-
avatar
.
height
;
}
}
this
.
_avatarsCache
.
push
(
avatar
);
this
.
_avatarsCache
.
push
(
avatar
);
...
@@ -669,11 +682,11 @@ export default class MapScene extends Scene {
...
@@ -669,11 +682,11 @@ export default class MapScene extends Scene {
updateFriends
()
{
updateFriends
()
{
NetManager
.
ins
.
hc_mapRank
(()
=>
{
NetManager
.
ins
.
hc_mapRank
(()
=>
{
const
hc_mapRank
=
DataManager
.
ins
.
getData
(
'hc_mapRank'
).
data
;
const
hc_mapRank
=
DataManager
.
ins
.
getData
(
'hc_mapRank'
).
data
;
if
(
!
hc_mapRank
)
return
;
if
(
!
hc_mapRank
)
return
;
const
{
data
}
=
DataManager
.
ins
.
getData
(
'hc_userInfo'
);
const
{
data
}
=
DataManager
.
ins
.
getData
(
'hc_userInfo'
);
hc_mapRank
.
forEach
((
ele
)
=>
{
hc_mapRank
.
forEach
((
ele
)
=>
{
if
(
ele
.
levelNum
==
getHomeData
().
levels
.
length
+
1
)
{
if
(
ele
.
levelNum
==
getHomeData
().
levels
.
length
+
1
)
{
if
(
data
==
null
)
if
(
data
==
null
)
ele
.
rank
[
0
].
avatar
=
"http://yun.duiba.com.cn/db_games/default_avatar.png"
;
ele
.
rank
[
0
].
avatar
=
"http://yun.duiba.com.cn/db_games/default_avatar.png"
;
else
else
ele
.
rank
[
0
].
avatar
=
data
.
avatar
||
"http://yun.duiba.com.cn/db_games/default_avatar.png"
;
ele
.
rank
[
0
].
avatar
=
data
.
avatar
||
"http://yun.duiba.com.cn/db_games/default_avatar.png"
;
...
@@ -688,24 +701,24 @@ export default class MapScene extends Scene {
...
@@ -688,24 +701,24 @@ export default class MapScene extends Scene {
this
[
'goldTxt'
].
text
=
`
${
homeData
.
wealth
}
`
;
this
[
'goldTxt'
].
text
=
`
${
homeData
.
wealth
}
`
;
for
(
let
j
=
1
;
j
<
window
[
'total_level'
];
j
++
)
{
for
(
let
j
=
1
;
j
<
window
[
'total_level'
];
j
++
)
{
this
.
disableIcon
(
j
+
1
);
this
.
disableIcon
(
j
+
1
);
}
}
for
(
let
i
=
0
;
i
<
homeData
.
levels
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
homeData
.
levels
.
length
;
i
++
)
{
const
level
=
homeData
.
levels
[
i
];
const
level
=
homeData
.
levels
[
i
];
const
star
=
MapScene
.
starHash
[
i
+
1
];
const
star
=
MapScene
.
starHash
[
i
+
1
];
if
(
level
)
{
if
(
level
)
{
star
.
setStar
(
level
.
stars
);
star
.
setStar
(
level
.
stars
);
this
.
enableIcon
(
level
.
levelNum
);
this
.
enableIcon
(
level
.
levelNum
);
}
else
{
}
else
{
this
.
disableIcon
(
level
.
levelNum
);
this
.
disableIcon
(
level
.
levelNum
);
}
}
}
}
if
(
homeData
.
levels
.
length
==
0
)
{
if
(
homeData
.
levels
.
length
==
0
)
{
const
star
=
MapScene
.
starHash
[
1
];
const
star
=
MapScene
.
starHash
[
1
];
star
.
setStar
(
0
);
star
.
setStar
(
0
);
this
.
enableIcon
(
1
);
this
.
enableIcon
(
1
);
}
else
if
(
homeData
.
levels
.
length
==
window
[
'last_level'
])
{
}
else
if
(
homeData
.
levels
.
length
==
window
[
'last_level'
])
{
}
else
{
}
else
{
const
star
=
MapScene
.
starHash
[
homeData
.
levels
.
length
+
1
];
const
star
=
MapScene
.
starHash
[
homeData
.
levels
.
length
+
1
];
...
@@ -719,11 +732,11 @@ export default class MapScene extends Scene {
...
@@ -719,11 +732,11 @@ export default class MapScene extends Scene {
updateTimerView
()
{
updateTimerView
()
{
//更新倒计时
//更新倒计时
if
(
this
.
_countDown
==
null
)
{
if
(
this
.
_countDown
==
null
)
{
this
.
_countDown
=
new
CountDown
(
this
[
'countdown'
]);
this
.
_countDown
=
new
CountDown
(
this
[
'countdown'
]);
}
}
const
data
=
getHomeData
();
const
data
=
getHomeData
();
if
(
data
.
remainEnargy
>=
BLOOD_NUMS_MAX
)
{
//满了
if
(
data
.
remainEnargy
>=
BLOOD_NUMS_MAX
)
{
//满了
this
.
_countDown
.
stop
();
this
.
_countDown
.
stop
();
this
[
'fullTxt'
].
visible
=
true
;
this
[
'fullTxt'
].
visible
=
true
;
...
@@ -753,28 +766,28 @@ export default class MapScene extends Scene {
...
@@ -753,28 +766,28 @@ export default class MapScene extends Scene {
onTap_inviteBtn
()
{
onTap_inviteBtn
()
{
NetManager
.
ins
.
clickLog
(
getlogItem
(
33
));
NetManager
.
ins
.
clickLog
(
getlogItem
(
33
));
NetManager
.
ins
.
getInviteInfo
((
success
,
res
)
=>
{
NetManager
.
ins
.
getInviteInfo
((
success
,
res
)
=>
{
if
(
!
success
||
!
res
.
data
)
{
if
(
!
success
||
!
res
.
data
)
{
return
;
return
;
}
}
const
flag
=
res
.
data
.
completeFlag
;
const
flag
=
res
.
data
.
completeFlag
;
switch
(
true
)
{
switch
(
true
)
{
case
(
flag
==
0
):
// 未完成
case
(
flag
==
0
):
// 未完成
this
.
loadsvga
(
res
);
this
.
loadsvga
(
res
);
break
;
break
;
case
(
flag
==
1
):
// 完成未开奖 待领奖 请求领奖接口
case
(
flag
==
1
):
// 完成未开奖 待领奖 请求领奖接口
try
{
try
{
if
(
window
[
'getRST'
])
window
[
'getRST'
]();
if
(
window
[
'getRST'
])
window
[
'getRST'
]();
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
warn
(
error
)
console
.
warn
(
error
)
}
}
NetManager
.
ins
.
acceptInvitationPrize
((
success
,
res
)
=>
{
NetManager
.
ins
.
acceptInvitationPrize
((
success
,
res
)
=>
{
if
(
!
success
)
{
if
(
!
success
)
{
showToast
(
"哎呀,萌狮开小差啦!
\n
过会再来看吧!"
);
showToast
(
"哎呀,萌狮开小差啦!
\n
过会再来看吧!"
);
GDispatcher
.
dispatchEvent
(
"getInviteInfo"
);
GDispatcher
.
dispatchEvent
(
"getInviteInfo"
);
return
;
return
;
}
}
// console.log(res.data);
// console.log(res.data);
if
(
res
.
data
.
completeFlag
==
3
)
{
if
(
res
.
data
.
completeFlag
==
3
)
{
showToast
(
"哎呀,萌狮开小差啦!
\n
过会再来看吧!"
);
showToast
(
"哎呀,萌狮开小差啦!
\n
过会再来看吧!"
);
GDispatcher
.
dispatchEvent
(
"getInviteInfo"
);
GDispatcher
.
dispatchEvent
(
"getInviteInfo"
);
}
else
{
}
else
{
...
@@ -789,7 +802,7 @@ export default class MapScene extends Scene {
...
@@ -789,7 +802,7 @@ export default class MapScene extends Scene {
case
(
flag
==
4
):
// 可以开启下一次发任务
case
(
flag
==
4
):
// 可以开启下一次发任务
NetManager
.
ins
.
acceptInvitationInfo
((
success
,
res
)
=>
{
NetManager
.
ins
.
acceptInvitationInfo
((
success
,
res
)
=>
{
if
(
!
success
)
{
if
(
!
success
)
{
return
;
return
;
}
}
this
.
loadsvga
(
res
);
this
.
loadsvga
(
res
);
...
@@ -805,7 +818,7 @@ export default class MapScene extends Scene {
...
@@ -805,7 +818,7 @@ export default class MapScene extends Scene {
}
}
loadsvga
(
res
)
{
loadsvga
(
res
)
{
if
(
MapScene
[
'svga'
])
{
if
(
MapScene
[
'svga'
])
{
const
mv
=
MapScene
[
'svga'
]
const
mv
=
MapScene
[
'svga'
]
mv
.
gotoAndStop
(
1
);
mv
.
gotoAndStop
(
1
);
res
.
data
.
svga
=
mv
;
res
.
data
.
svga
=
mv
;
...
@@ -830,21 +843,21 @@ export default class MapScene extends Scene {
...
@@ -830,21 +843,21 @@ export default class MapScene extends Scene {
*/
*/
getInviteInfo
()
{
getInviteInfo
()
{
const
hc_advert
=
DataManager
.
ins
.
getData
(
'hc_advert'
).
data
||
{};
const
hc_advert
=
DataManager
.
ins
.
getData
(
'hc_advert'
).
data
||
{};
const
{
mapAdvert
}
=
hc_advert
;
const
{
mapAdvert
}
=
hc_advert
;
// tslint:disable-next-line: cyclomatic-complexity
// tslint:disable-next-line: cyclomatic-complexity
NetManager
.
ins
.
getInviteInfo
((
success
,
res
)
=>
{
NetManager
.
ins
.
getInviteInfo
((
success
,
res
)
=>
{
if
(
!
success
||
!
res
.
data
)
{
if
(
!
success
||
!
res
.
data
)
{
return
;
return
;
}
}
const
flag
=
res
.
data
.
completeFlag
;
const
flag
=
res
.
data
.
completeFlag
;
if
(
this
.
inviteTimer
)
{
if
(
this
.
inviteTimer
)
{
this
.
inviteTimer
.
stop
();
this
.
inviteTimer
.
stop
();
}
}
switch
(
true
)
{
switch
(
true
)
{
case
(
flag
==
0
):
// 未完成 显示倒计时
case
(
flag
==
0
):
// 未完成 显示倒计时
this
[
"inviteGroup"
].
visible
=
true
;
this
[
"inviteGroup"
].
visible
=
true
;
this
[
"inviteGroup"
].
touchEnabled
=
true
;
this
[
"inviteGroup"
].
touchEnabled
=
true
;
if
(
!
mapAdvert
||
mapAdvert
.
enable
==
false
)
{
if
(
!
mapAdvert
||
mapAdvert
.
enable
==
false
)
{
this
[
'activitys'
].
y
=
458
;
this
[
'activitys'
].
y
=
458
;
this
[
'guideInner'
].
y
=
185
;
this
[
'guideInner'
].
y
=
185
;
}
}
...
@@ -861,7 +874,7 @@ export default class MapScene extends Scene {
...
@@ -861,7 +874,7 @@ export default class MapScene extends Scene {
NetManager
.
ins
.
showLog
(
getlogItem
(
33
));
NetManager
.
ins
.
showLog
(
getlogItem
(
33
));
this
[
"inviteGroup"
].
visible
=
true
;
this
[
"inviteGroup"
].
visible
=
true
;
this
[
"inviteGroup"
].
touchEnabled
=
true
;
this
[
"inviteGroup"
].
touchEnabled
=
true
;
if
(
!
mapAdvert
||
mapAdvert
.
enable
==
false
)
{
if
(
!
mapAdvert
||
mapAdvert
.
enable
==
false
)
{
this
[
'activitys'
].
y
=
458
;
this
[
'activitys'
].
y
=
458
;
this
[
'guideInner'
].
y
=
185
;
this
[
'guideInner'
].
y
=
185
;
}
}
...
@@ -873,7 +886,7 @@ export default class MapScene extends Scene {
...
@@ -873,7 +886,7 @@ export default class MapScene extends Scene {
case
(
flag
==
3
):
// 领奖失败 无角标
case
(
flag
==
3
):
// 领奖失败 无角标
this
[
"inviteGroup"
].
visible
=
true
;
this
[
"inviteGroup"
].
visible
=
true
;
this
[
"inviteGroup"
].
touchEnabled
=
true
;
this
[
"inviteGroup"
].
touchEnabled
=
true
;
if
(
!
mapAdvert
||
mapAdvert
.
enable
==
false
)
{
if
(
!
mapAdvert
||
mapAdvert
.
enable
==
false
)
{
this
[
'activitys'
].
y
=
458
;
this
[
'activitys'
].
y
=
458
;
this
[
'guideInner'
].
y
=
185
;
this
[
'guideInner'
].
y
=
185
;
}
}
...
@@ -884,7 +897,7 @@ export default class MapScene extends Scene {
...
@@ -884,7 +897,7 @@ export default class MapScene extends Scene {
case
(
flag
==
4
):
// 可以开启下一次发任务 显示立即到账
case
(
flag
==
4
):
// 可以开启下一次发任务 显示立即到账
this
[
"inviteGroup"
].
visible
=
true
;
this
[
"inviteGroup"
].
visible
=
true
;
this
[
"inviteGroup"
].
touchEnabled
=
true
;
this
[
"inviteGroup"
].
touchEnabled
=
true
;
if
(
!
mapAdvert
||
mapAdvert
.
enable
==
false
)
{
if
(
!
mapAdvert
||
mapAdvert
.
enable
==
false
)
{
this
[
'activitys'
].
y
=
458
;
this
[
'activitys'
].
y
=
458
;
this
[
'guideInner'
].
y
=
185
;
this
[
'guideInner'
].
y
=
185
;
}
}
...
@@ -896,7 +909,7 @@ export default class MapScene extends Scene {
...
@@ -896,7 +909,7 @@ export default class MapScene extends Scene {
case
(
flag
==
5
):
// 等待开启下一次发任务 无角标
case
(
flag
==
5
):
// 等待开启下一次发任务 无角标
this
[
"inviteGroup"
].
visible
=
true
;
this
[
"inviteGroup"
].
visible
=
true
;
this
[
"inviteGroup"
].
touchEnabled
=
true
;
this
[
"inviteGroup"
].
touchEnabled
=
true
;
if
(
!
mapAdvert
||
mapAdvert
.
enable
==
false
)
{
if
(
!
mapAdvert
||
mapAdvert
.
enable
==
false
)
{
this
[
'activitys'
].
y
=
458
;
this
[
'activitys'
].
y
=
458
;
this
[
'guideInner'
].
y
=
185
;
this
[
'guideInner'
].
y
=
185
;
}
}
...
@@ -908,7 +921,7 @@ export default class MapScene extends Scene {
...
@@ -908,7 +921,7 @@ export default class MapScene extends Scene {
this
[
"inviteGroup"
].
visible
=
false
;
this
[
"inviteGroup"
].
visible
=
false
;
this
[
"inviteGroup"
].
touchEnabled
=
false
;
this
[
"inviteGroup"
].
touchEnabled
=
false
;
this
[
'adBtn'
].
y
=
323.76
;
this
[
'adBtn'
].
y
=
323.76
;
if
(
mapAdvert
&&
mapAdvert
.
enable
)
{
if
(
mapAdvert
&&
mapAdvert
.
enable
)
{
this
[
'guideInner'
].
y
=
185
;
this
[
'guideInner'
].
y
=
185
;
this
[
'activitys'
].
y
=
458
;
this
[
'activitys'
].
y
=
458
;
}
else
{
}
else
{
...
@@ -925,7 +938,7 @@ export default class MapScene extends Scene {
...
@@ -925,7 +938,7 @@ export default class MapScene extends Scene {
// 倒计时
// 倒计时
private
inviteCutTimer
()
{
private
inviteCutTimer
()
{
const
timer
=
this
.
convertTime
(
this
.
cutTime
-=
1000
);
const
timer
=
this
.
convertTime
(
this
.
cutTime
-=
1000
);
if
(
timer
.
hour
===
"00"
if
(
timer
.
hour
===
"00"
&&
timer
.
min
===
"00"
&&
timer
.
min
===
"00"
&&
timer
.
sec
===
"00"
)
{
&&
timer
.
sec
===
"00"
)
{
this
.
inviteTimer
.
stop
();
this
.
inviteTimer
.
stop
();
...
@@ -1018,9 +1031,9 @@ export default class MapScene extends Scene {
...
@@ -1018,9 +1031,9 @@ export default class MapScene extends Scene {
async
onTap_boxLayer
()
{
async
onTap_boxLayer
()
{
NetManager
.
ins
.
clickLog
(
getlogItem
(
1
));
NetManager
.
ins
.
clickLog
(
getlogItem
(
1
));
const
data
=
getHomeData
();
const
data
=
getHomeData
();
if
(
data
.
canReceiveTreasureBoxNum
>
0
)
{
if
(
data
.
canReceiveTreasureBoxNum
>
0
)
{
this
[
'boxLayer'
].
visible
=
true
;
this
[
'boxLayer'
].
visible
=
true
;
if
(
!
this
.
_mc
)
if
(
!
this
.
_mc
)
this
.
_mc
=
await
loadSvga
(
getResPath
()
+
'resource/assets/svgas/box.svga'
,
this
[
'boxani'
]);
this
.
_mc
=
await
loadSvga
(
getResPath
()
+
'resource/assets/svgas/box.svga'
,
this
[
'boxani'
]);
this
.
_mc
.
stop
();
this
.
_mc
.
stop
();
this
.
_mc
.
gotoAndStop
(
1
);
this
.
_mc
.
gotoAndStop
(
1
);
...
@@ -1032,18 +1045,18 @@ export default class MapScene extends Scene {
...
@@ -1032,18 +1045,18 @@ export default class MapScene extends Scene {
await
wait
(
50
);
await
wait
(
50
);
this
.
_mc
.
visible
=
true
;
this
.
_mc
.
visible
=
true
;
const
a
=
100
,
b
=
10
;
const
a
=
100
,
b
=
10
;
egret
.
Tween
.
get
(
this
.
_mc
,
{
loop
:
true
}).
set
({
rotation
:
b
})
egret
.
Tween
.
get
(
this
.
_mc
,
{
loop
:
true
}).
set
({
rotation
:
b
})
.
to
({
rotation
:
-
b
},
a
).
to
({
rotation
:
b
},
a
)
.
to
({
rotation
:
-
b
},
a
).
to
({
rotation
:
b
},
a
)
.
to
({
rotation
:
-
b
},
a
).
to
({
rotation
:
b
},
a
)
.
to
({
rotation
:
-
b
},
a
).
to
({
rotation
:
b
},
a
)
.
to
({
rotation
:
-
b
},
a
).
to
({
rotation
:
b
},
a
)
.
to
({
rotation
:
-
b
},
a
).
to
({
rotation
:
b
},
a
)
.
to
({
rotation
:
0
},
a
/
2
)
.
to
({
rotation
:
0
},
a
/
2
)
.
wait
(
1000
);
.
wait
(
1000
);
}
}
}
}
async
playAni
()
{
async
playAni
()
{
if
(
this
.
_mc
)
{
if
(
this
.
_mc
)
{
egret
.
Tween
.
removeTweens
(
this
.
_mc
);
egret
.
Tween
.
removeTweens
(
this
.
_mc
);
this
.
_mc
.
gotoAndPlay
(
1
,
true
);
this
.
_mc
.
gotoAndPlay
(
1
,
true
);
await
this
.
onPlaySTOP
();
await
this
.
onPlaySTOP
();
...
@@ -1054,7 +1067,7 @@ export default class MapScene extends Scene {
...
@@ -1054,7 +1067,7 @@ export default class MapScene extends Scene {
async
onPlaySTOP
()
{
async
onPlaySTOP
()
{
return
new
Promise
((
r
)
=>
{
return
new
Promise
((
r
)
=>
{
const
func
=
()
=>
{
const
func
=
()
=>
{
if
(
this
.
_mc
.
currentFrame
>=
100
)
{
if
(
this
.
_mc
.
currentFrame
>=
100
)
{
this
.
_mc
.
removeEventListener
(
egret
.
Event
.
ENTER_FRAME
,
func
,
this
);
this
.
_mc
.
removeEventListener
(
egret
.
Event
.
ENTER_FRAME
,
func
,
this
);
this
.
_mc
.
stop
();
this
.
_mc
.
stop
();
r
();
r
();
...
@@ -1073,14 +1086,14 @@ export default class MapScene extends Scene {
...
@@ -1073,14 +1086,14 @@ export default class MapScene extends Scene {
this
[
'boxani'
].
touchChildren
=
false
;
this
[
'boxani'
].
touchChildren
=
false
;
await
this
.
playAni
();
await
this
.
playAni
();
try
{
try
{
if
(
window
[
'getRST'
])
window
[
'getRST'
]();
if
(
window
[
'getRST'
])
window
[
'getRST'
]();
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
warn
(
error
)
console
.
warn
(
error
)
}
}
NetManager
.
ins
.
hc_openTreasureBox
((
success
)
=>
{
NetManager
.
ins
.
hc_openTreasureBox
((
success
)
=>
{
this
[
'boxani'
].
touchEnabled
=
true
;
this
[
'boxani'
].
touchEnabled
=
true
;
this
[
'boxani'
].
touchChildren
=
true
;
this
[
'boxani'
].
touchChildren
=
true
;
if
(
success
)
{
if
(
success
)
{
const
hc_openTreasureBox
=
DataManager
.
ins
.
getData
(
'hc_openTreasureBox'
);
const
hc_openTreasureBox
=
DataManager
.
ins
.
getData
(
'hc_openTreasureBox'
);
const
boxdata
=
hc_openTreasureBox
.
data
;
const
boxdata
=
hc_openTreasureBox
.
data
;
const
homeData
=
DataManager
.
ins
.
getData
(
'hc_home'
).
data
;
const
homeData
=
DataManager
.
ins
.
getData
(
'hc_home'
).
data
;
...
@@ -1090,7 +1103,7 @@ export default class MapScene extends Scene {
...
@@ -1090,7 +1103,7 @@ export default class MapScene extends Scene {
homeData
.
isGetAllTreasureBox
=
boxdata
.
isGetAllTreasureBox
;
homeData
.
isGetAllTreasureBox
=
boxdata
.
isGetAllTreasureBox
;
this
.
updateBox
();
this
.
updateBox
();
if
(
hc_openTreasureBox
.
success
&&
boxdata
&&
boxdata
.
option
)
{
if
(
hc_openTreasureBox
.
success
&&
boxdata
&&
boxdata
.
option
)
{
PanelCtrl
.
instance
.
show
(
'box'
);
PanelCtrl
.
instance
.
show
(
'box'
);
}
else
{
}
else
{
...
@@ -1124,7 +1137,7 @@ export default class MapScene extends Scene {
...
@@ -1124,7 +1137,7 @@ export default class MapScene extends Scene {
onTap_bloodBtn
()
{
onTap_bloodBtn
()
{
NetManager
.
ins
.
clickLog
(
getlogItem
(
2
));
NetManager
.
ins
.
clickLog
(
getlogItem
(
2
));
if
(
getHomeData
().
remainEnargy
>
0
)
if
(
getHomeData
().
remainEnargy
>
0
)
PanelCtrl
.
instance
.
show
(
'bloodPanel'
);
PanelCtrl
.
instance
.
show
(
'bloodPanel'
);
else
else
PanelCtrl
.
instance
.
show
(
'blood2Panel'
);
PanelCtrl
.
instance
.
show
(
'blood2Panel'
);
...
@@ -1137,14 +1150,14 @@ export default class MapScene extends Scene {
...
@@ -1137,14 +1150,14 @@ export default class MapScene extends Scene {
showRedBagAni
()
{
showRedBagAni
()
{
const
hash
=
MapScene
.
iconHash
;
const
hash
=
MapScene
.
iconHash
;
const
keys
=
[];
const
keys
=
[];
for
(
const
key
in
hash
)
{
for
(
const
key
in
hash
)
{
const
ele
=
hash
[
key
];
const
ele
=
hash
[
key
];
if
(
ele
.
parent
)
if
(
ele
.
parent
)
keys
.
push
(
key
);
keys
.
push
(
key
);
}
}
const
p0
=
new
egret
.
Point
(
750
/
2
,
750
/
1.5
);
const
p0
=
new
egret
.
Point
(
750
/
2
,
750
/
1.5
);
const
pics
=
[];
const
pics
=
[];
for
(
const
key
of
keys
)
{
for
(
const
key
of
keys
)
{
const
icon
=
MapScene
.
iconHash
[
key
]
as
egret
.
DisplayObject
;
const
icon
=
MapScene
.
iconHash
[
key
]
as
egret
.
DisplayObject
;
const
p
=
(
icon
.
localToGlobal
(
0
,
0
));
const
p
=
(
icon
.
localToGlobal
(
0
,
0
));
const
pic
=
createRedBagIcon
(
this
);
const
pic
=
createRedBagIcon
(
this
);
...
@@ -1161,7 +1174,7 @@ export default class MapScene extends Scene {
...
@@ -1161,7 +1174,7 @@ export default class MapScene extends Scene {
pic
.
visible
=
true
;
pic
.
visible
=
true
;
const
p2
=
pic
[
'__p2__'
]
as
egret
.
Point
;
const
p2
=
pic
[
'__p2__'
]
as
egret
.
Point
;
let
dir
=
100
;
let
dir
=
100
;
if
(
p2
.
y
<
p0
.
y
)
if
(
p2
.
y
<
p0
.
y
)
dir
*=
-
1
;
dir
*=
-
1
;
const
p1x
=
(
p0
.
x
+
p2
.
x
)
/
2
+
dir
;
const
p1x
=
(
p0
.
x
+
p2
.
x
)
/
2
+
dir
;
const
p1y
=
(
p0
.
y
+
p2
.
y
)
/
2
;
const
p1y
=
(
p0
.
y
+
p2
.
y
)
/
2
;
...
@@ -1171,16 +1184,16 @@ export default class MapScene extends Scene {
...
@@ -1171,16 +1184,16 @@ export default class MapScene extends Scene {
this
.
addChild
(
mc
);
this
.
addChild
(
mc
);
const
x0
=
pic
[
'__icon__'
].
x
;
const
x0
=
pic
[
'__icon__'
].
x
;
const
y0
=
pic
[
'__icon__'
].
y
;
const
y0
=
pic
[
'__icon__'
].
y
;
egret
.
Tween
.
get
(
pic
[
'__icon__'
]).
to
({
y
:
y0
+
10
},
100
).
to
({
y
:
y0
},
100
);
egret
.
Tween
.
get
(
pic
[
'__icon__'
]).
to
({
y
:
y0
+
10
},
100
).
to
({
y
:
y0
},
100
);
const
light
=
new
egret
.
Bitmap
(
RES
.
getRes
(
'maplight2_png'
));
const
light
=
new
egret
.
Bitmap
(
RES
.
getRes
(
'maplight2_png'
));
light
.
anchorOffsetX
=
75
;
light
.
anchorOffsetX
=
75
;
light
.
anchorOffsetY
=
49
;
light
.
anchorOffsetY
=
49
;
light
.
x
=
50
;
light
.
x
=
50
;
light
.
y
=
40
+
5
;
light
.
y
=
40
+
5
;
pic
[
'__icon__'
].
addChildAt
(
light
,
0
);
pic
[
'__icon__'
].
addChildAt
(
light
,
0
);
egret
.
Tween
.
get
(
light
).
to
({
scaleX
:
1.5
,
scaleY
:
1.5
,
},
200
).
call
(()
=>
{
egret
.
Tween
.
get
(
light
).
to
({
scaleX
:
1.5
,
scaleY
:
1.5
,
},
200
).
call
(()
=>
{
pic
[
'__icon__'
].
removeChild
(
light
);
pic
[
'__icon__'
].
removeChild
(
light
);
if
(
index
==
pics
.
length
-
1
)
{
if
(
index
==
pics
.
length
-
1
)
{
showToast
(
'红包隐藏在任意关卡中,快去找他们吧~'
);
showToast
(
'红包隐藏在任意关卡中,快去找他们吧~'
);
}
}
});
});
...
@@ -1190,9 +1203,9 @@ export default class MapScene extends Scene {
...
@@ -1190,9 +1203,9 @@ export default class MapScene extends Scene {
}
}
}
}
export
const
getNick
=
(
nickname
,
max
=
4
)
=>
{
export
const
getNick
=
(
nickname
,
max
=
4
)
=>
{
if
(
!
nickname
)
return
nickname
;
if
(
!
nickname
)
return
nickname
;
if
(
nickname
.
length
>
max
)
if
(
nickname
.
length
>
max
)
return
nickname
.
slice
(
0
,
max
)
+
'...'
;
return
nickname
.
slice
(
0
,
max
)
+
'...'
;
return
nickname
;
return
nickname
;
};
};
\ No newline at end of file
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,31 +82,58 @@ export default class BloodPanel extends Panel {
...
@@ -81,31 +82,58 @@ 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
())
{
//微信流程不变
getShareUrl
(
this
.
stage
);
if
(
data
.
askForEnergy
>=
BloodPanel
.
MAX
)
{
showToast
(
'对不起,索要体力的机会已经用完了~'
);
showToast
(
'对不起,索要体力的机会已经用完了~'
);
return
;
return
;
}
}
this
[
'inviteBtn'
].
enabled
=
false
;
this
[
'inviteBtn'
].
enabled
=
false
;
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
this
[
'inviteBtn'
].
enabled
=
true
;
this
[
'inviteBtn'
].
enabled
=
true
;
if
(
success
)
{
if
(
success
)
{
}
}
NetManager
.
ins
.
hc_home
(()
=>
{
NetManager
.
ins
.
hc_home
(()
=>
{
this
.
updateData
();
this
.
updateData
();
...
@@ -116,7 +144,29 @@ export default class BloodPanel extends Panel {
...
@@ -116,7 +144,29 @@ export default class BloodPanel extends Panel {
showToast
(
'分享成功~'
);
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,31 +78,59 @@ export default class BloodPanel2 extends Panel {
...
@@ -77,31 +78,59 @@ 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
())
{
getShareUrl
(
this
.
stage
);
//原先微信流程不变
if
(
data
.
askForEnergy
>=
BloodPanel
.
MAX
)
{
showToast
(
'对不起,索要体力的机会已经用完了~'
);
showToast
(
'对不起,索要体力的机会已经用完了~'
);
return
;
return
;
}
}
this
[
'inviteBtn'
].
enabled
=
false
;
this
[
'inviteBtn'
].
enabled
=
false
;
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
this
[
'inviteBtn'
].
enabled
=
true
;
this
[
'inviteBtn'
].
enabled
=
true
;
if
(
success
)
{
if
(
success
)
{
}
}
NetManager
.
ins
.
hc_home
(()
=>
{
NetManager
.
ins
.
hc_home
(()
=>
{
...
@@ -113,6 +142,26 @@ export default class BloodPanel2 extends Panel {
...
@@ -113,6 +142,26 @@ export default class BloodPanel2 extends Panel {
showToast
(
'分享成功~'
);
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
;
...
@@ -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,14 +86,36 @@ export default class StartPanel extends Panel {
...
@@ -85,14 +86,36 @@ 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);
showShareCodePanel
(
CodeChannels
.
AddBlood
,
null
,
()
=>
{
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
NetManager
.
ins
.
hc_askForEnergy
((
success
)
=>
{
NetManager
.
ins
.
hc_home
(()
=>
{
NetManager
.
ins
.
hc_home
(()
=>
{
SceneCtrl
.
instance
.
updateScene
();
SceneCtrl
.
instance
.
updateScene
();
...
@@ -101,6 +124,7 @@ export default class StartPanel extends Panel {
...
@@ -101,6 +124,7 @@ export default class StartPanel extends Panel {
showToast
(
'分享成功~'
);
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