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 {
...
@@ -11,6 +11,10 @@ export default class Scene extends ComponentBase {
this
.
playAnimation
();
this
.
playAnimation
();
}
}
updateScene
(){
}
playAnimation
()
{
playAnimation
()
{
}
}
...
...
egret/libs/new_wx/ctrls/sceneCtrl.ts
View file @
1fd66a6e
...
@@ -14,6 +14,11 @@ export default class SceneCtrl {
...
@@ -14,6 +14,11 @@ export default class SceneCtrl {
this
.
_parent
=
parent
;
this
.
_parent
=
parent
;
}
}
updateScene
()
{
if
(
this
.
_currentScene
)
this
.
_currentScene
.
updateScene
();
}
change
(
type
:
ModuleTypes
,
data
?,
onComplete
?:
Function
)
{
change
(
type
:
ModuleTypes
,
data
?,
onComplete
?:
Function
)
{
const
cls
=
this
.
_sceneClassMap
[
type
];
const
cls
=
this
.
_sceneClassMap
[
type
];
const
scene
:
Scene
=
new
cls
();
const
scene
:
Scene
=
new
cls
();
...
...
egret/libs/tw/manager/NetManager.ts
View file @
1fd66a6e
...
@@ -439,7 +439,7 @@ export class NetManager extends ABNetManager {
...
@@ -439,7 +439,7 @@ export class NetManager extends ABNetManager {
dataType
:
'json'
,
dataType
:
'json'
,
param
:
{
param
:
{
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
gameData
:
gamedata
gameData
:
gamedata
},
},
hideMsg
:
true
,
hideMsg
:
true
,
callback
:
callback
callback
:
callback
...
@@ -752,14 +752,14 @@ export class NetManager extends ABNetManager {
...
@@ -752,14 +752,14 @@ export class NetManager extends ABNetManager {
this
.
send
(
net
);
this
.
send
(
net
);
}
}
public
hc_home
(
callback
:
Function
,
collectRuleId
:
number
):
void
{
public
hc_home
(
callback
:
Function
,
collectRuleId
:
number
):
void
{
const
net
:
INetData
=
{
const
net
:
INetData
=
{
name
:
'hc_home'
,
name
:
'hc_home'
,
uri
:
'/customActivity/happyclear/home'
,
uri
:
'/customActivity/happyclear/home'
,
type
:
'get'
,
type
:
'get'
,
dataType
:
'json'
,
dataType
:
'json'
,
param
:
{
param
:
{
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
collectRuleId
:
collectRuleId
,
collectRuleId
:
collectRuleId
,
},
},
...
@@ -767,14 +767,14 @@ export class NetManager extends ABNetManager {
...
@@ -767,14 +767,14 @@ export class NetManager extends ABNetManager {
};
};
this
.
send
(
net
);
this
.
send
(
net
);
}
}
public
hc_getLevelInfo
(
callback
:
Function
,
getLevelInfo
:
number
):
void
{
public
hc_getLevelInfo
(
callback
:
Function
,
getLevelInfo
:
number
):
void
{
const
net
:
INetData
=
{
const
net
:
INetData
=
{
name
:
'hc_getLevelInfo'
,
name
:
'hc_getLevelInfo'
,
uri
:
'/customActivity/happyclear/getLevelInfo'
,
uri
:
'/customActivity/happyclear/getLevelInfo'
,
type
:
'get'
,
type
:
'get'
,
dataType
:
'json'
,
dataType
:
'json'
,
param
:
{
param
:
{
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
getLevelInfo
:
getLevelInfo
,
getLevelInfo
:
getLevelInfo
,
},
},
...
@@ -782,17 +782,20 @@ export class NetManager extends ABNetManager {
...
@@ -782,17 +782,20 @@ export class NetManager extends ABNetManager {
};
};
this
.
send
(
net
);
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
=
{
const
net
:
INetData
=
{
name
:
'hc_exchange'
,
name
:
'hc_exchange'
,
uri
:
'/customActivity/happyclear/exchange'
,
uri
:
'/customActivity/happyclear/exchange'
,
type
:
'post'
,
type
:
'post'
,
dataType
:
'json'
,
dataType
:
'json'
,
param
:
{
param
:
d
,
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
category
:
category
,
propType
:
propType
},
callback
:
callback
callback
:
callback
};
};
this
.
send
(
net
);
this
.
send
(
net
);
...
@@ -810,7 +813,7 @@ export class NetManager extends ABNetManager {
...
@@ -810,7 +813,7 @@ export class NetManager extends ABNetManager {
};
};
this
.
send
(
net
);
this
.
send
(
net
);
}
}
public
hc_useProp
(
callback
:
Function
,
propType
:
number
):
void
{
public
hc_useProp
(
callback
:
Function
,
propType
:
number
):
void
{
const
net
:
INetData
=
{
const
net
:
INetData
=
{
name
:
'hc_useProp'
,
name
:
'hc_useProp'
,
uri
:
'/customActivity/happyclear/useProp'
,
uri
:
'/customActivity/happyclear/useProp'
,
...
@@ -840,13 +843,13 @@ export class NetManager extends ABNetManager {
...
@@ -840,13 +843,13 @@ export class NetManager extends ABNetManager {
this
.
send
(
net
);
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
=
{
const
data
:
any
=
{
durationOfPlay
:
durationOfPlay
,
songListId
:
songListId
,
songId
:
songId
,
timestamp
:
timestamp
,
durationOfPlay
:
durationOfPlay
,
songListId
:
songListId
,
songId
:
songId
,
timestamp
:
timestamp
,
action
:
7
,
action
:
7
,
playCount
:
playCount
,
playCount
:
playCount
,
bitrate
:
bitrate
,
bitrate
:
bitrate
,
isOnline
:
1
,
songDuration
:
songDuration
isOnline
:
1
,
songDuration
:
songDuration
};
};
// if (categoryID) data.categoryID = categoryID;
// if (categoryID) data.categoryID = categoryID;
...
@@ -935,7 +938,7 @@ export class NetManager extends ABNetManager {
...
@@ -935,7 +938,7 @@ export class NetManager extends ABNetManager {
};
};
this
.
getToken
(
net
);
this
.
getToken
(
net
);
}
}
public
hc_doJoin
(
callback
:
Function
,
credits
?:
number
,
collectRuleId
?:
number
):
void
{
public
hc_doJoin
(
callback
:
Function
,
credits
?:
number
,
collectRuleId
?:
number
):
void
{
const
param
:
any
=
{
const
param
:
any
=
{
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
...
...
egret/resource/skins/MapSkin.exml
View file @
1fd66a6e
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
<e:Group
id=
"top"
x=
"36"
y=
"24"
>
<e:Group
id=
"top"
x=
"36"
y=
"24"
>
<e:Image
source=
"元宝bg_png"
x=
"0"
y=
"0"
/>
<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=
"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:Button
id=
"bloodBtn"
label=
""
x=
"165.72"
y=
"16.6"
>
<e:skinName>
<e:skinName>
<e:Skin
states=
"up,down,disabled"
>
<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";
...
@@ -5,6 +5,7 @@ import MapRpeatPart from "./MapRpeatPart";
import
MapTopPart
from
"./MapTopPart"
;
import
MapTopPart
from
"./MapTopPart"
;
import
PanelCtrl
from
"../../libs/new_wx/ctrls/panelCtrl"
;
import
PanelCtrl
from
"../../libs/new_wx/ctrls/panelCtrl"
;
import
{
ModuleTypes
}
from
"../../libs/new_wx/types/sceneTypes"
;
import
{
ModuleTypes
}
from
"../../libs/new_wx/types/sceneTypes"
;
import
getHomeData
from
"../getHomeData"
;
export
default
class
MapScene
extends
Scene
{
export
default
class
MapScene
extends
Scene
{
scrollGroup
:
eui
.
Group
;
scrollGroup
:
eui
.
Group
;
...
@@ -39,20 +40,37 @@ export default class MapScene extends Scene {
...
@@ -39,20 +40,37 @@ export default class MapScene extends Scene {
this
.
scrollGroup
.
addChild
(
data
.
bottom
);
this
.
scrollGroup
.
addChild
(
data
.
bottom
);
data
.
bottom
.
y
=
data
.
top
.
height
+
(
data
.
list
.
length
*
data
.
list
[
0
].
height
);
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
)
{
for
(
const
key
in
MapScene
.
iconHash
)
{
const
element
=
MapScene
.
iconHash
[
key
];
const
element
=
MapScene
.
iconHash
[
key
];
element
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
element
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
PanelCtrl
.
instance
.
show
(
'StartPanel'
,
key
);
PanelCtrl
.
instance
.
show
(
'StartPanel'
,
key
);
},
this
)
},
this
)
}
}
// setTimeout(() => {
// setTimeout(() => {
// PanelCtrl.instance.show('box');
// PanelCtrl.instance.show('box');
// }, 2000);
// }, 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
()
{
protected
initEvents
()
{
// this['goldBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_goldBtn, this)
// this['goldBtn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_goldBtn, this)
this
[
'bloodBtn'
].
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_bloodBtn
,
this
)
this
[
'bloodBtn'
].
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_bloodBtn
,
this
)
...
@@ -61,20 +79,20 @@ export default class MapScene extends Scene {
...
@@ -61,20 +79,20 @@ export default class MapScene extends Scene {
this
[
'questionBtn'
].
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_questionBtn
,
this
)
this
[
'questionBtn'
].
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTap_questionBtn
,
this
)
}
}
onTap_questionBtn
(){
onTap_questionBtn
()
{
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
RULE_PANEL
);
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
RULE_PANEL
);
this
.
toggleSettings
();
this
.
toggleSettings
();
}
}
onTap_shopBtn
(){
onTap_shopBtn
()
{
PanelCtrl
.
instance
.
show
(
'Shop'
)
PanelCtrl
.
instance
.
show
(
'Shop'
)
}
}
toggleSettings
(){
toggleSettings
()
{
this
[
'settingGroup'
].
visible
=
!
this
[
'settingGroup'
].
visible
;
this
[
'settingGroup'
].
visible
=
!
this
[
'settingGroup'
].
visible
;
}
}
// onTap_goldBtn() {
// onTap_goldBtn() {
// PanelCtrl.instance.show('GoldPanel')
// PanelCtrl.instance.show('GoldPanel')
// }
// }
onTap_bloodBtn
()
{
onTap_bloodBtn
()
{
...
...
egret/src/panels/BloodPanel.ts
View file @
1fd66a6e
import
Panel
from
"../../libs/new_wx/components/Panel"
;
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
{
export
default
class
BloodPanel
extends
Panel
{
start
(
data
)
{
start
(
data
)
{
super
.
start
();
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'
}
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