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
1fd66a6e
Commit
1fd66a6e
authored
Aug 20, 2019
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
ee5b6817
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
131 additions
and
29 deletions
+131
-29
Scene.ts
egret/libs/new_wx/components/Scene.ts
+4
-0
sceneCtrl.ts
egret/libs/new_wx/ctrls/sceneCtrl.ts
+5
-0
NetManager.ts
egret/libs/tw/manager/NetManager.ts
+22
-19
MapSkin.exml
egret/resource/skins/MapSkin.exml
+1
-1
getHomeData.ts
egret/src/getHomeData.ts
+11
-0
MapScene.ts
egret/src/mapScene/MapScene.ts
+25
-7
BloodPanel.ts
egret/src/panels/BloodPanel.ts
+32
-1
home.json
mock/happyclear/home.json
+31
-1
No files found.
egret/libs/new_wx/components/Scene.ts
View file @
1fd66a6e
...
...
@@ -11,6 +11,10 @@ export default class Scene extends ComponentBase {
this
.
playAnimation
();
}
updateScene
(){
}
playAnimation
()
{
}
...
...
egret/libs/new_wx/ctrls/sceneCtrl.ts
View file @
1fd66a6e
...
...
@@ -14,6 +14,11 @@ export default class SceneCtrl {
this
.
_parent
=
parent
;
}
updateScene
()
{
if
(
this
.
_currentScene
)
this
.
_currentScene
.
updateScene
();
}
change
(
type
:
ModuleTypes
,
data
?,
onComplete
?:
Function
)
{
const
cls
=
this
.
_sceneClassMap
[
type
];
const
scene
:
Scene
=
new
cls
();
...
...
egret/libs/tw/manager/NetManager.ts
View file @
1fd66a6e
...
...
@@ -439,7 +439,7 @@ export class NetManager extends ABNetManager {
dataType
:
'json'
,
param
:
{
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
gameData
:
gamedata
gameData
:
gamedata
},
hideMsg
:
true
,
callback
:
callback
...
...
@@ -752,14 +752,14 @@ export class NetManager extends ABNetManager {
this
.
send
(
net
);
}
public
hc_home
(
callback
:
Function
,
collectRuleId
:
number
):
void
{
public
hc_home
(
callback
:
Function
,
collectRuleId
:
number
):
void
{
const
net
:
INetData
=
{
name
:
'hc_home'
,
uri
:
'/customActivity/happyclear/home'
,
type
:
'get'
,
dataType
:
'json'
,
param
:
{
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
collectRuleId
:
collectRuleId
,
},
...
...
@@ -767,14 +767,14 @@ export class NetManager extends ABNetManager {
};
this
.
send
(
net
);
}
public
hc_getLevelInfo
(
callback
:
Function
,
getLevelInfo
:
number
):
void
{
public
hc_getLevelInfo
(
callback
:
Function
,
getLevelInfo
:
number
):
void
{
const
net
:
INetData
=
{
name
:
'hc_getLevelInfo'
,
uri
:
'/customActivity/happyclear/getLevelInfo'
,
type
:
'get'
,
dataType
:
'json'
,
param
:
{
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
getLevelInfo
:
getLevelInfo
,
},
...
...
@@ -782,17 +782,20 @@ export class NetManager extends ABNetManager {
};
this
.
send
(
net
);
}
public
hc_exchange
(
callback
:
Function
,
category
:
number
,
propType
:
number
):
void
{
public
hc_exchange
(
callback
:
Function
,
category
:
number
,
propType
?:
number
):
void
{
const
d
:
any
=
{
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
category
:
category
};
if
(
propType
)
{
d
.
propType
=
propType
;
}
const
net
:
INetData
=
{
name
:
'hc_exchange'
,
uri
:
'/customActivity/happyclear/exchange'
,
type
:
'post'
,
dataType
:
'json'
,
param
:
{
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
category
:
category
,
propType
:
propType
},
param
:
d
,
callback
:
callback
};
this
.
send
(
net
);
...
...
@@ -810,7 +813,7 @@ export class NetManager extends ABNetManager {
};
this
.
send
(
net
);
}
public
hc_useProp
(
callback
:
Function
,
propType
:
number
):
void
{
public
hc_useProp
(
callback
:
Function
,
propType
:
number
):
void
{
const
net
:
INetData
=
{
name
:
'hc_useProp'
,
uri
:
'/customActivity/happyclear/useProp'
,
...
...
@@ -840,13 +843,13 @@ export class NetManager extends ABNetManager {
this
.
send
(
net
);
}
public
reportMusic
(
callback
:
Function
,
durationOfPlay
,
songListId
,
songId
,
playCount
,
timestamp
,
bitrate
,
songDuration
):
void
{
public
reportMusic
(
callback
:
Function
,
durationOfPlay
,
songListId
,
songId
,
playCount
,
timestamp
,
bitrate
,
songDuration
):
void
{
const
data
:
any
=
{
durationOfPlay
:
durationOfPlay
,
songListId
:
songListId
,
songId
:
songId
,
timestamp
:
timestamp
,
action
:
7
,
playCount
:
playCount
,
bitrate
:
bitrate
,
isOnline
:
1
,
songDuration
:
songDuration
durationOfPlay
:
durationOfPlay
,
songListId
:
songListId
,
songId
:
songId
,
timestamp
:
timestamp
,
action
:
7
,
playCount
:
playCount
,
bitrate
:
bitrate
,
isOnline
:
1
,
songDuration
:
songDuration
};
// if (categoryID) data.categoryID = categoryID;
...
...
@@ -935,7 +938,7 @@ export class NetManager extends ABNetManager {
};
this
.
getToken
(
net
);
}
public
hc_doJoin
(
callback
:
Function
,
credits
?:
number
,
collectRuleId
?:
number
):
void
{
const
param
:
any
=
{
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
...
...
egret/resource/skins/MapSkin.exml
View file @
1fd66a6e
...
...
@@ -19,7 +19,7 @@
<e:Group
id=
"top"
x=
"36"
y=
"24"
>
<e:Image
source=
"元宝bg_png"
x=
"0"
y=
"0"
/>
<e:Label
id=
"bloodTxt"
text=
"50/50"
x=
"78.04"
y=
"27.84"
width=
"82"
verticalAlign=
"middle"
textAlign=
"center"
/>
<e:Label
id=
"goldT
z
t"
text=
"50/50"
x=
"396.04"
y=
"27.84"
width=
"88"
verticalAlign=
"middle"
textAlign=
"center"
/>
<e:Label
id=
"goldT
x
t"
text=
"50/50"
x=
"396.04"
y=
"27.84"
width=
"88"
verticalAlign=
"middle"
textAlign=
"center"
/>
<e:Button
id=
"bloodBtn"
label=
""
x=
"165.72"
y=
"16.6"
>
<e:skinName>
<e:Skin
states=
"up,down,disabled"
>
...
...
egret/src/getHomeData.ts
0 → 100644
View file @
1fd66a6e
import
{
DataManager
}
from
"../libs/tw/manager/DataManager"
;
interface
IHomeData
{
levels
:{
levelNum
,
maxScore
,
stars
}[];
totalRemainStarts
;
wealth
;
heartNums
;
}
export
default
():
IHomeData
=>
{
const
{
data
}
=
DataManager
.
ins
.
getData
(
'hc_home'
);
return
data
;
}
\ No newline at end of file
egret/src/mapScene/MapScene.ts
View file @
1fd66a6e
...
...
@@ -5,6 +5,7 @@ import MapRpeatPart from "./MapRpeatPart";
import
MapTopPart
from
"./MapTopPart"
;
import
PanelCtrl
from
"../../libs/new_wx/ctrls/panelCtrl"
;
import
{
ModuleTypes
}
from
"../../libs/new_wx/types/sceneTypes"
;
import
getHomeData
from
"../getHomeData"
;
export
default
class
MapScene
extends
Scene
{
scrollGroup
:
eui
.
Group
;
...
...
@@ -39,20 +40,37 @@ export default class MapScene extends Scene {
this
.
scrollGroup
.
addChild
(
data
.
bottom
);
data
.
bottom
.
y
=
data
.
top
.
height
+
(
data
.
list
.
length
*
data
.
list
[
0
].
height
);
this
.
setGray
(
1
);
//
this.setGray(1);
for
(
const
key
in
MapScene
.
iconHash
)
{
const
element
=
MapScene
.
iconHash
[
key
];
element
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
PanelCtrl
.
instance
.
show
(
'StartPanel'
,
key
);
PanelCtrl
.
instance
.
show
(
'StartPanel'
,
key
);
},
this
)
}
// setTimeout(() => {
// PanelCtrl.instance.show('box');
// }, 2000);
this
.
updateHomeData
();
}
updateScene
()
{
this
.
updateHomeData
();
}
updateHomeData
()
{
const
homeData
=
getHomeData
();
this
[
'bloodTxt'
].
text
=
`
${
homeData
.
heartNums
}
/5`
;
this
[
'goldTxt'
].
text
=
`
${
homeData
.
wealth
}
`
;
this
[
'totalStarTxt'
].
text
=
`
${
homeData
.
totalRemainStarts
}
/210`
;
for
(
let
i
=
0
;
i
<
homeData
.
levels
.
length
;
i
++
)
{
const
level
=
homeData
.
levels
[
i
];
const
star
=
MapScene
.
starHash
[
i
+
1
];
if
(
level
)
star
.
setStar
(
level
.
stars
);
}
}
protected
initEvents
()
{
// this['goldBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_goldBtn, this)
this
[
'bloodBtn'
].
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_bloodBtn
,
this
)
...
...
@@ -61,20 +79,20 @@ export default class MapScene extends Scene {
this
[
'questionBtn'
].
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_questionBtn
,
this
)
}
onTap_questionBtn
(){
onTap_questionBtn
()
{
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
RULE_PANEL
);
this
.
toggleSettings
();
}
onTap_shopBtn
(){
onTap_shopBtn
()
{
PanelCtrl
.
instance
.
show
(
'Shop'
)
}
toggleSettings
(){
this
[
'settingGroup'
].
visible
=
!
this
[
'settingGroup'
].
visible
;
toggleSettings
()
{
this
[
'settingGroup'
].
visible
=
!
this
[
'settingGroup'
].
visible
;
}
// onTap_goldBtn() {
// PanelCtrl.instance.show('GoldPanel')
// PanelCtrl.instance.show('GoldPanel')
// }
onTap_bloodBtn
()
{
...
...
egret/src/panels/BloodPanel.ts
View file @
1fd66a6e
import
Panel
from
"../../libs/new_wx/components/Panel"
;
import
getHomeData
from
"../getHomeData"
;
import
{
NetManager
}
from
"../../libs/tw/manager/NetManager"
;
import
SceneCtrl
from
"../../libs/new_wx/ctrls/sceneCtrl"
;
export
default
class
BloodPanel
extends
Panel
{
start
(
data
)
{
super
.
start
();
this
.
updateData
();
}
private
updateData
()
{
const
homeData
=
getHomeData
();
this
[
'bloodTxt'
].
text
=
`你的可用体力值为:
${
homeData
.
heartNums
}
`
;
}
initEvents
()
{
super
.
initEvents
();
this
[
'inviteBtn'
].
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTapInvite
,
this
)
this
[
'buyBtn'
].
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTapBuy
,
this
)
}
onTapBuy
()
{
this
[
'buyBtn'
].
enabled
=
false
;
NetManager
.
ins
.
hc_exchange
((
success
)
=>
{
this
[
'buyBtn'
].
enabled
=
true
;
if
(
success
)
{
NetManager
.
ins
.
hc_home
(()
=>
{
this
.
updateData
();
SceneCtrl
.
instance
.
updateScene
();
},
window
[
'collectRuleId'
])
}
},
1
);
}
onTapInvite
()
{
}
protected
get
closeBtns
():
eui
.
Button
[]
{
return
[
this
[
'closeBtn'
],
this
[
'resumeBtns'
]]
}
get
skinKey
()
{
return
'Blood'
}
}
\ No newline at end of file
mock/happyclear/home.json
View file @
1fd66a6e
{
"success"
:
true
"code"
:
"0000000000"
,
"data"
:{
"heartNums"
:
1
,
"levels"
:[
{
"levelNum"
:
1
,
"maxScore"
:
23
,
"stars"
:
3
},
{
"levelNum"
:
2
,
"maxScore"
:
45
,
"stars"
:
2
}
],
"switchConf"
:[
{
"status"
:
1
,
"type"
:
1
},
{
"status"
:
1
,
"type"
:
2
}
],
"totalRemainStarts"
:
5
,
"wealth"
:
5
},
"desc"
:
"OK"
,
"success"
:
true
,
"timestamp"
:
1565752605970
}
\ No newline at end of file
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