Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
db-game-template
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
崔立强
db-game-template
Commits
a5812bab
Commit
a5812bab
authored
Dec 05, 2019
by
huangwenjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
dccf7f43
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
475 additions
and
34 deletions
+475
-34
exml.json
egret/.wing/exml.json
+7
-1
project.json
egret/project.json
+1
-1
Main_1.tmproject
egret/resource/TextureMerger/Main_1.tmproject
+1
-0
Play_3.tmproject
egret/resource/TextureMerger/Play_3.tmproject
+0
-1
Preload_0.tmproject
egret/resource/TextureMerger/Preload_0.tmproject
+1
-1
Start_2.tmproject
egret/resource/TextureMerger/Start_2.tmproject
+0
-1
preload_2.tmproject
egret/resource/TextureMerger/preload_2.tmproject
+1
-0
recordBtn.png
egret/resource/assets/pops/recordBtn.png
+0
-0
ruleBg.png
egret/resource/assets/pops/ruleBg.png
+0
-0
ruleBtn.png
egret/resource/assets/pops/ruleBtn.png
+0
-0
default.res.json
egret/resource/default.res.json
+19
-8
default.thm.json
egret/resource/default.thm.json
+20
-18
MainSkin.exml
egret/resource/skins/MainSkin.exml
+3
-1
RuleSkin.exml
egret/resource/skins/RuleSkin.exml
+29
-0
Main.ts
egret/src/Main.ts
+2
-0
qcsNet.ts
egret/src/consts/qcsNet.ts
+16
-0
PrizePanel.ts
egret/src/pops/prizePanel/PrizePanel.ts
+14
-1
HtmlTextParser.ts
egret/src/pops/rule/HtmlTextParser.ts
+279
-0
RulePanel.ts
egret/src/pops/rule/RulePanel.ts
+38
-0
NetPromise.ts
egret/src/promises/NetPromise.ts
+12
-0
MainScene.ts
egret/src/scenes/MainScene.ts
+24
-1
config.js
mock/config.js
+3
-0
getRule.json
mock/qcs/getRule.json
+5
-0
No files found.
egret/.wing/exml.json
View file @
a5812bab
...
@@ -49,7 +49,13 @@
...
@@ -49,7 +49,13 @@
"guideLinesEnabled"
:
true
"guideLinesEnabled"
:
true
},
},
"168654fb707"
:
{
"168654fb707"
:
{
"guideLinesEnabled"
:
false
"guideLinesEnabled"
:
true
,
"guideLines"
:
[
{
"type"
:
"v"
,
"pos"
:
375
}
]
},
},
"1687055130d"
:
{
"1687055130d"
:
{
"guideLines"
:
[
"guideLines"
:
[
...
...
egret/project.json
View file @
a5812bab
{
{
"type"
:
"activity"
,
"type"
:
"activity"
,
"name"
:
"
ChristmasGift
s"
"name"
:
"
ggk_qc
s"
}
}
\ No newline at end of file
egret/resource/TextureMerger/Main_1.tmproject
0 → 100644
View file @
a5812bab
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"Main_1","version":5,"files":["..\\assets\\main\\title.png","..\\assets\\main\\startBtnBg.png","..\\assets\\main\\startBtn.png","..\\assets\\main\\star.png","..\\assets\\main\\smallSnow.png","..\\assets\\main\\prizeMinTitle.png","..\\assets\\main\\plate.png","..\\assets\\main\\emptyStar.png","..\\assets\\main\\snow.png","..\\assets\\main\\startBtn_d.png","..\\assets\\main\\startDrawBg.png","..\\assets\\main\\logo.png","..\\assets\\pops\\recordBtn.png","..\\assets\\pops\\sureBtn.png","..\\assets\\pops\\useBtn.png","..\\assets\\pops\\ruleBtn.png","..\\assets\\pops\\ruleBg.png","..\\assets\\pops\\prizePanelBg.png"]}
\ No newline at end of file
egret/resource/TextureMerger/Play_3.tmproject
deleted
100644 → 0
View file @
dccf7f43
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"Play_3","version":5,"files":["..\\assets\\play\\bell.png","..\\assets\\play\\giftBox.png","..\\assets\\play\\hole.png","..\\assets\\play\\stone.png","..\\assets\\play\\socks.png","..\\assets\\play\\snowBall.png","..\\assets\\play\\scoreBg.png"]}
\ No newline at end of file
egret/resource/TextureMerger/Preload_0.tmproject
View file @
a5812bab
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"Preload_0","version":5,"files":["..\\assets\\waiting\\progress.png","..\\assets\\waiting\\bg.png","..\\assets\\pops\\sureBtn.png","..\\assets\\pops\\ruleTitle.png","..\\assets\\pops\\restartBtn.png","..\\assets\\pops\\prizePanelBg.png","..\\assets\\pops\\noPrizeTitle.png","..\\assets\\pops\\msgSureBtn.png","..\\assets\\pops\\msgBg.png","..\\assets\\pops\\loginBtn.png","..\\assets\\pops\\knowBtn.png","..\\assets\\common\\closeBtn.png","..\\assets\\pops\\noPrizePanelBg.png","..\\assets\\pops\\ruleBg.png","..\\assets\\pops\\restartBtn3.png","..\\assets\\pops\\restartBtn2.png","..\\assets\\pops\\warningtitle.png","..\\assets\\pops\\useBtn.png"]}
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"Preload_0","version":5,"files":["..\\assets\\waiting\\progress.png","..\\assets\\waiting\\bg.png","..\\assets\\common\\closeBtn.png","..\\assets\\pops\\noPrizePanelBg.png","..\\assets\\pops\\msgSureBtn.png"]}
\ No newline at end of file
\ No newline at end of file
egret/resource/TextureMerger/Start_2.tmproject
deleted
100644 → 0
View file @
dccf7f43
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"Start_2","version":5,"files":["..\\assets\\start\\recordBtn.png","..\\assets\\start\\ruleBtn.png","..\\assets\\start\\startBtn.png","..\\assets\\start\\hand.png","..\\assets\\start\\giveStar.png","..\\assets\\start\\star.png","..\\assets\\start\\smallSnow.png","..\\assets\\start\\sled.png","..\\assets\\start\\title.png"]}
\ No newline at end of file
egret/resource/TextureMerger/
Guide_1
.tmproject
→
egret/resource/TextureMerger/
preload_2
.tmproject
View file @
a5812bab
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"Guide_1","version":5,"files":["..\\assets\\guide\\finger.png"]}
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"preload_2","version":5,"files":["..\\assets\\pops\\ruleBg.png"]}
\ No newline at end of file
\ No newline at end of file
egret/resource/assets/pops/recordBtn.png
0 → 100644
View file @
a5812bab
2.31 KB
egret/resource/assets/pops/ruleBg.png
0 → 100644
View file @
a5812bab
64.8 KB
egret/resource/assets/pops/ruleBtn.png
0 → 100644
View file @
a5812bab
2.13 KB
egret/resource/default.res.json
View file @
a5812bab
{
{
"groups"
:
[
"groups"
:
[
{
{
"keys"
:
"progress_png,bg_png,
sureBtn_png,prizePanelBg_png,msgSureBtn_png,closeBtn_png,noPrizePanelBg_png,us
eBtn_png"
,
"keys"
:
"progress_png,bg_png,
closeBtn_png,noPrizePanelBg_png,msgSur
eBtn_png"
,
"name"
:
"Preload"
"name"
:
"Preload"
},
},
{
{
"keys"
:
"title_png,startBtnBg_png,startBtn_png,startBg_jpg,star_png,smallSnow_png,prizeMinTitle_png,plate_png,emptyStar_png,snow_png,startBtn_d_png"
,
"keys"
:
"title_png,startBtnBg_png,startBtn_png,startBg_jpg,star_png,smallSnow_png,prizeMinTitle_png,plate_png,emptyStar_png,snow_png,startBtn_d_png
,startDrawBg_png,logo_png,recordBtn_png,sureBtn_png,useBtn_png,ruleBtn_png,ruleBg_png,prizePanelBg_png
"
,
"name"
:
"Main"
"name"
:
"Main"
},
{
"name"
:
"preload"
,
"keys"
:
"startDrawBg_png"
}
}
],
],
"resources"
:
[
"resources"
:
[
...
@@ -115,9 +111,24 @@
...
@@ -115,9 +111,24 @@
"name"
:
"startBtn_d_png"
"name"
:
"startBtn_d_png"
},
},
{
{
"name"
:
"startDrawBg_png"
,
"url"
:
"assets/main/startDrawBg.png"
,
"type"
:
"image"
,
"name"
:
"startDrawBg_png"
},
{
"url"
:
"assets/pops/recordBtn.png"
,
"type"
:
"image"
,
"name"
:
"recordBtn_png"
},
{
"url"
:
"assets/pops/ruleBtn.png"
,
"type"
:
"image"
,
"name"
:
"ruleBtn_png"
},
{
"url"
:
"assets/pops/ruleBg.png"
,
"type"
:
"image"
,
"type"
:
"image"
,
"
url"
:
"assets/main/startDrawBg.
png"
"
name"
:
"ruleBg_
png"
}
}
]
]
}
}
\ No newline at end of file
egret/resource/default.thm.json
View file @
a5812bab
{
{
"skins"
:
{},
"skins"
:
{},
"autoGenerateExmlsList"
:
true
,
"autoGenerateExmlsList"
:
true
,
"exmls"
:
[
"exmls"
:
[
"resource/skins/ToastSkin.exml"
,
"resource/skins/MainSkin.exml"
,
"resource/skins/PrizeItemSkin.exml"
,
"resource/skins/MsgSkin.exml"
,
"resource/skins/MsgSkin.exml"
,
"resource/skins/NoPrizeSkin.exml"
,
"resource/skins/MainSkin.exml"
,
"resource/skins/PrizeItemSkin.exml"
,
"resource/skins/NoPrizeSkin.exml"
,
"resource/skins/PrizeSkin.exml"
,
"resource/skins/PrizeSkin.exml"
,
"resource/skins/RuleSkin.exml"
,
"resource/skins/VScrollBarSkin.exml"
,
"resource/skins/ToastSkin.exml"
,
"resource/skins/WaitingSkin.exml"
,
"resource/skins/VScrollBarSkin.exml"
,
"resource/skins/ui/IconButtonSkin.exml"
,
"resource/skins/WaitingSkin.exml"
,
"resource/skins/ui/MusicButtonSkin.exml"
,
"resource/skins/WarningSkin.exml"
,
"resource/skins/ui/ProgressBarSkin.exml"
,
"resource/skins/ui/IconButtonSkin.exml"
,
"resource/skins/ui/SliderSkin.exml"
,
"resource/skins/ui/MusicButtonSkin.exml"
,
"resource/skins/ui/StartButtonSkin.exml"
"resource/skins/ui/ProgressBarSkin.exml"
,
],
"resource/skins/ui/SliderSkin.exml"
,
"path"
:
"resource/default.thm.json"
"resource/skins/ui/StartButtonSkin.exml"
],
"path"
:
"resource/default.thm.json"
}
}
\ No newline at end of file
egret/resource/skins/MainSkin.exml
View file @
a5812bab
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<e:Image
id=
"plate"
source=
"plate_png"
y=
"1108"
horizontalCenter=
"0"
/>
<e:Image
id=
"plate"
source=
"plate_png"
y=
"1108"
horizontalCenter=
"0"
/>
<e:Image
source=
"snow_png"
x=
"596"
y=
"194.5"
/>
<e:Image
source=
"snow_png"
x=
"596"
y=
"194.5"
/>
<e:Image
source=
"snow_png"
x=
"-35.51"
y=
"387"
anchorOffsetX=
"0"
width=
"120.33"
anchorOffsetY=
"0"
height=
"106"
/>
<e:Image
source=
"snow_png"
x=
"-35.51"
y=
"387"
anchorOffsetX=
"0"
width=
"120.33"
anchorOffsetY=
"0"
height=
"106"
/>
<e:Image
source=
"star_png"
x=
"
612"
y=
"-8
"
/>
<e:Image
source=
"star_png"
x=
"
599.02"
y=
"9"
anchorOffsetX=
"0"
width=
"54.98"
anchorOffsetY=
"0"
height=
"114
"
/>
<e:Image
source=
"emptyStar_png"
x=
"110"
y=
"188"
/>
<e:Image
source=
"emptyStar_png"
x=
"110"
y=
"188"
/>
<e:Image
source=
"star_png"
x=
"82"
y=
"812.5"
anchorOffsetX=
"0"
width=
"80"
anchorOffsetY=
"0"
height=
"165.88"
/>
<e:Image
source=
"star_png"
x=
"82"
y=
"812.5"
anchorOffsetX=
"0"
width=
"80"
anchorOffsetY=
"0"
height=
"165.88"
/>
<e:Group
id=
"winnerList"
width=
"750"
height=
"50"
x=
"0"
y=
"0"
scaleX=
"1"
scaleY=
"1"
>
<e:Group
id=
"winnerList"
width=
"750"
height=
"50"
x=
"0"
y=
"0"
scaleX=
"1"
scaleY=
"1"
>
...
@@ -35,6 +35,8 @@
...
@@ -35,6 +35,8 @@
<e:Image
id=
"prizeImg"
width=
"494"
height=
"258"
x=
"127.66"
y=
"180.67"
visible=
"false"
/>
<e:Image
id=
"prizeImg"
width=
"494"
height=
"258"
x=
"127.66"
y=
"180.67"
visible=
"false"
/>
</e:Group>
</e:Group>
<e:Button
id=
"startBtn"
label=
""
y=
"670.5"
skinName=
"ui.IconButtonSkin"
icon=
"startBtn_png"
width=
"452"
anchorOffsetX=
"226"
height=
"113"
anchorOffsetY=
"56.5"
touchEnabled=
"true"
touchChildren=
"true"
horizontalCenter=
"0"
/>
<e:Button
id=
"startBtn"
label=
""
y=
"670.5"
skinName=
"ui.IconButtonSkin"
icon=
"startBtn_png"
width=
"452"
anchorOffsetX=
"226"
height=
"113"
anchorOffsetY=
"56.5"
touchEnabled=
"true"
touchChildren=
"true"
horizontalCenter=
"0"
/>
<e:Button
id=
"ruleBtn"
label=
""
y=
"125"
skinName=
"ui.IconButtonSkin"
icon=
"ruleBtn_png"
anchorOffsetX=
"49"
anchorOffsetY=
"14"
right=
"0"
/>
<e:Button
id=
"recordBtn"
label=
""
y=
"167"
skinName=
"ui.IconButtonSkin"
icon=
"recordBtn_png"
anchorOffsetX=
"49"
anchorOffsetY=
"14"
right=
"0"
/>
...
...
egret/resource/skins/RuleSkin.exml
0 → 100644
View file @
a5812bab
<?xml version="1.0" encoding="utf-8"?>
<e:Skin
class=
"RuleSkin"
width=
"750"
height=
"1206"
xmlns:e=
"http://ns.egret.com/eui"
xmlns:w=
"http://ns.egret.com/wing"
>
<w:Config
id=
"168654fb707"
x=
"-86"
y=
"-98"
/>
<e:Group
width=
"750"
height=
"1000"
horizontalCenter=
"0"
verticalCenter=
"-50"
>
<e:Image
horizontalCenter=
"-18.5"
anchorOffsetY=
"0"
height=
"859"
verticalCenter=
"3.5"
x=
"0"
y=
"0"
scaleX=
"1"
scaleY=
"1"
scale9Grid=
"60,380,284,95"
source=
"ruleBg_png"
/>
<e:Scroller
id=
"scroller"
width=
"517"
height=
"670"
y=
"190"
anchorOffsetY=
"0"
anchorOffsetX=
"0"
scaleX=
"1"
scaleY=
"1"
horizontalCenter=
"0"
>
<e:Group
id=
"group"
width=
"100%"
anchorOffsetY=
"0"
x=
"0"
y=
"-252"
height=
"479"
>
<e:Rect
width=
"100%"
height=
"10"
x=
"206"
y=
"59"
fillAlpha=
"0"
/>
<e:Label
id=
"labContent"
width=
"100%"
text=
""
lineSpacing=
"10"
size=
"30"
multiline=
"true"
anchorOffsetY=
"-8"
fontFamily=
"Microsoft YaHei"
textColor=
"0xfcca80"
/>
<e:layout>
<e:VerticalLayout/>
</e:layout>
</e:Group>
</e:Scroller>
<e:Button
id=
"closeBtn"
label=
""
icon=
"closeBtn_png"
y=
"38"
skinName=
"ui.IconButtonSkin"
anchorOffsetY=
"24"
x=
"619"
scaleX=
"1"
scaleY=
"1"
height=
"48"
width=
"48"
anchorOffsetX=
"24"
/>
</e:Group>
</e:Skin>
\ No newline at end of file
egret/src/Main.ts
View file @
a5812bab
...
@@ -18,6 +18,7 @@ import PrizePanel from './pops/prizePanel/PrizePanel';
...
@@ -18,6 +18,7 @@ import PrizePanel from './pops/prizePanel/PrizePanel';
import
MainScene
from
'./scenes/MainScene'
;
import
MainScene
from
'./scenes/MainScene'
;
import
ToastCtrl
from
'./ctrls/toastCtrl'
;
import
ToastCtrl
from
'./ctrls/toastCtrl'
;
import
NoPrizePanel
from
'./pops/prizePanel/NoPrizePanel'
;
import
NoPrizePanel
from
'./pops/prizePanel/NoPrizePanel'
;
import
RulePanel
from
'./pops/rule/RulePanel'
;
class
Main
extends
MainBase
{
class
Main
extends
MainBase
{
...
@@ -26,6 +27,7 @@ class Main extends MainBase {
...
@@ -26,6 +27,7 @@ class Main extends MainBase {
// 注册所有Panel
// 注册所有Panel
PanelCtrl
.
instance
.
registerClass
(
ModuleTypes
.
MSG_PANEL
,
Msg
);
PanelCtrl
.
instance
.
registerClass
(
ModuleTypes
.
MSG_PANEL
,
Msg
);
PanelCtrl
.
instance
.
registerClass
(
ModuleTypes
.
RULE_PANEL
,
RulePanel
);
PanelCtrl
.
instance
.
registerClass
(
ModuleTypes
.
PRIZE_PANEL
,
PrizePanel
);
PanelCtrl
.
instance
.
registerClass
(
ModuleTypes
.
PRIZE_PANEL
,
PrizePanel
);
PanelCtrl
.
instance
.
registerClass
(
ModuleTypes
.
NOPRIZE_PANEL
,
NoPrizePanel
);
PanelCtrl
.
instance
.
registerClass
(
ModuleTypes
.
NOPRIZE_PANEL
,
NoPrizePanel
);
// 注册所有Scene
// 注册所有Scene
...
...
egret/src/consts/qcsNet.ts
View file @
a5812bab
...
@@ -14,6 +14,20 @@ export default class qcsNet {
...
@@ -14,6 +14,20 @@ export default class qcsNet {
uri
:
`/projectx/
${
projectxId
}
/join_1/getRemainTime.do`
,
uri
:
`/projectx/
${
projectxId
}
/join_1/getRemainTime.do`
,
type
:
'get'
,
type
:
'get'
,
dataType
:
'json'
,
dataType
:
'json'
,
hideMsg
:
true
,
param
:
{},
callback
:
callback
};
NetManager
.
ins
.
send
(
net
);
}
public
static
getRule
(
callback
,
projectxId
=
window
[
"projectxId"
])
{
const
net
:
INetData
=
{
name
:
'getRule'
,
uri
:
`/projectx/
${
projectxId
}
/projectRule.query`
,
type
:
'get'
,
dataType
:
'json'
,
hideMsg
:
true
,
param
:
{},
param
:
{},
callback
:
callback
callback
:
callback
};
};
...
@@ -31,6 +45,7 @@ export default class qcsNet {
...
@@ -31,6 +45,7 @@ export default class qcsNet {
uri
:
`/projectx/
${
projectxId
}
/join_1/join.do`
,
uri
:
`/projectx/
${
projectxId
}
/join_1/join.do`
,
type
:
'get'
,
type
:
'get'
,
dataType
:
'json'
,
dataType
:
'json'
,
hideMsg
:
true
,
param
:
{},
param
:
{},
callback
:
callback
callback
:
callback
};
};
...
@@ -53,6 +68,7 @@ export default class qcsNet {
...
@@ -53,6 +68,7 @@ export default class qcsNet {
uri
:
`/projectx/
${
projectxId
}
/prize.query`
,
uri
:
`/projectx/
${
projectxId
}
/prize.query`
,
type
:
'get'
,
type
:
'get'
,
dataType
:
'json'
,
dataType
:
'json'
,
hideMsg
:
true
,
param
:
param
,
param
:
param
,
callback
:
callback
callback
:
callback
};
};
...
...
egret/src/pops/prizePanel/PrizePanel.ts
View file @
a5812bab
...
@@ -50,8 +50,16 @@ export default class PrizePanel extends Panel {
...
@@ -50,8 +50,16 @@ export default class PrizePanel extends Panel {
this
.
prizeName
.
text
=
this
.
lottery
.
name
+
""
this
.
prizeName
.
text
=
this
.
lottery
.
name
+
""
}
}
this
.
initBuried
()
}
}
getExposure
initBuried
()
{
let
dpm
=
Buried
.
connectDpm
(
110
,
1
,
1
)
let
dcm
=
Buried
.
connectDpm
(
202
,
0
,
0
)
this
.
getExposure
=
Buried
.
createExposure
(
dpm
,
dcm
)
NetManager
.
ins
.
showLog
(
this
.
getExposure
)
}
initEvents
()
{
initEvents
()
{
...
@@ -62,7 +70,12 @@ export default class PrizePanel extends Panel {
...
@@ -62,7 +70,12 @@ export default class PrizePanel extends Panel {
}
}
onTap_GetPrize
()
{
onTap_GetPrize
()
{
window
.
location
.
href
=
this
.
prize
.
url
NetManager
.
ins
.
clickLog
(
this
.
getExposure
)
setTimeout
(()
=>
{
window
.
location
.
href
=
this
.
prize
.
url
},
200
);
}
}
onTap_CloseBtn
(
e
:
egret
.
TouchEvent
)
{
onTap_CloseBtn
(
e
:
egret
.
TouchEvent
)
{
...
...
egret/src/pops/rule/HtmlTextParser.ts
0 → 100644
View file @
a5812bab
/**
* Convert the text in html format to the object that can be assigned to the egret.TextField#textFlow property
* @see http://edn.egret.com/cn/docs/page/146 Text mixed in a variety of style
* @version Egret 2.4
* @platform Web,Native
* @includeExample egret/text/HtmlTextParser.ts
* @language en_US
*/
/**
* 将html格式文本转换为可赋值给 egret.TextField#textFlow 属性的对象
* @see http://edn.egret.com/cn/docs/page/146 多种样式文本混合
* @version Egret 2.4
* @platform Web,Native
* @includeExample egret/text/HtmlTextParser.ts
* @language zh_CN
*/
export
class
HtmlTextParser
{
/**
* @version Egret 2.4
* @platform Web,Native
*/
constructor
()
{
this
.
initReplaceArr
();
this
.
initPreReplaceArr
();
}
private
replaceArr
:
any
[]
=
[];
private
initReplaceArr
():
void
{
const
arr
=
this
.
replaceArr
=
[];
arr
.
push
([
/</g
,
"<"
]);
arr
.
push
([
/>/g
,
">"
]);
arr
.
push
([
/&/g
,
"&"
]);
arr
.
push
([
/"/g
,
"
\"
"
]);
arr
.
push
([
/'/g
,
"
\
'"
]);
}
private
preReplaceArr
:
any
[]
=
[];
private
initPreReplaceArr
()
{
const
arr
=
this
.
preReplaceArr
=
[];
arr
.
push
([
/
\\\"
/g
,
"
\"
"
]);
arr
.
push
([
/<br>/g
,
"
\n
"
]);
}
/**
* @private
*
* @param value
* @returns
*/
private
replaceSpecial
(
value
:
string
):
string
{
// tslint:disable-next-line:prefer-for-of
for
(
let
i
=
0
;
i
<
this
.
replaceArr
.
length
;
i
++
)
{
const
k
=
this
.
replaceArr
[
i
][
0
];
const
v
=
this
.
replaceArr
[
i
][
1
];
value
=
value
.
replace
(
k
,
v
);
}
return
value
;
}
/**
* @private
*/
private
resutlArr
:
Array
<
egret
.
ITextElement
>
=
[];
/**
* Convert the text in html format to the object that can be assigned to the egret.TextField#textFlow property
* @param htmltext {string} Text in html
* @returns {Array<egret.ITextElement>} 可赋值给 egret.TextField#textFlow Object that can be assigned to the egret.TextField#textFlow property
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 将html格式文本转换为可赋值给 egret.TextField#textFlow 属性的对象
* @param htmltext {string} html文本
* @returns {Array<egret.ITextElement>} 可赋值给 egret.TextField#textFlow 属性的对象
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
public
parse
(
htmltext
:
string
):
egret
.
ITextElement
[]
{
this
.
preReplaceArr
.
forEach
(
p
=>
{
htmltext
=
htmltext
.
replace
(
p
[
0
],
p
[
1
]);
});
this
.
stackArray
=
[];
this
.
resutlArr
=
[];
let
firstIdx
=
0
;
//文本段开始位置
const
length
:
number
=
htmltext
.
length
;
while
(
firstIdx
<
length
)
{
const
starIdx
:
number
=
htmltext
.
indexOf
(
"<"
,
firstIdx
);
if
(
starIdx
<
0
)
{
this
.
addToResultArr
(
htmltext
.
substring
(
firstIdx
));
firstIdx
=
length
;
}
else
{
this
.
addToResultArr
(
htmltext
.
substring
(
firstIdx
,
starIdx
));
let
fontEnd
=
htmltext
.
indexOf
(
">"
,
starIdx
);
if
(
fontEnd
==
-
1
)
{
egret
.
$error
(
1038
);
fontEnd
=
starIdx
;
}
else
if
(
htmltext
.
charAt
(
starIdx
+
1
)
==
"
\
/"
)
{
//关闭
this
.
stackArray
.
pop
();
}
else
{
this
.
addToArray
(
htmltext
.
substring
(
starIdx
+
1
,
fontEnd
));
}
firstIdx
=
fontEnd
+
1
;
}
}
return
this
.
resutlArr
;
}
public
parser
(
htmltext
:
string
):
Array
<
egret
.
ITextElement
>
{
return
this
.
parse
(
htmltext
);
}
/**
* @private
*
* @param value
*/
private
addToResultArr
(
value
:
string
):
void
{
if
(
value
==
""
)
{
return
;
}
value
=
this
.
replaceSpecial
(
value
);
if
(
this
.
stackArray
.
length
>
0
)
{
this
.
resutlArr
.
push
({
text
:
value
,
style
:
this
.
stackArray
[
this
.
stackArray
.
length
-
1
]
})
}
else
{
this
.
resutlArr
.
push
(
<
egret
.
ITextElement
>
{
text
:
value
});
}
}
//将字符数据转成Json数据
private
changeStringToObject
(
str
:
string
):
egret
.
ITextStyle
{
str
=
this
.
replaceSpecial
(
str
.
trim
());
const
info
:
any
=
{};
let
header
=
[];
if
(
str
.
charAt
(
0
)
==
"i"
||
str
.
charAt
(
0
)
==
"b"
||
str
.
charAt
(
0
)
==
"u"
)
{
this
.
addProperty
(
info
,
str
,
"true"
);
}
// tslint:disable-next-line:no-conditional-assignment
else
if
(
header
=
str
.
match
(
/^
(
font|a
)\s
/
))
{
str
=
str
.
substring
(
header
[
0
].
length
).
trim
();
let
next
=
0
;
let
titles
;
// tslint:disable-next-line:no-conditional-assignment
while
(
titles
=
str
.
match
(
this
.
getHeadReg
()))
{
const
title
=
titles
[
0
];
let
value
=
""
;
str
=
str
.
substring
(
title
.
length
).
trim
();
if
(
str
.
charAt
(
0
)
==
"
\"
"
)
{
next
=
str
.
indexOf
(
"
\"
"
,
1
);
value
=
str
.
substring
(
1
,
next
);
next
+=
1
;
}
else
if
(
str
.
charAt
(
0
)
==
"
\
'"
)
{
next
=
str
.
indexOf
(
"
\
'"
,
1
);
value
=
str
.
substring
(
1
,
next
);
next
+=
1
;
}
else
{
value
=
str
.
match
(
/
(\S)
+/
)[
0
];
next
=
value
.
length
;
}
this
.
addProperty
(
info
,
title
.
substring
(
0
,
title
.
length
-
1
).
trim
(),
value
.
trim
());
str
=
str
.
substring
(
next
).
trim
();
}
}
return
info
;
}
/**
* @private
*
* @returns
*/
private
getHeadReg
():
RegExp
{
return
/^
(
color|textcolor|strokecolor|stroke|b|bold|i|italic|u|size|fontfamily|href|target
)(\s)
*=/
;
}
/**
* @private
*
* @param info
* @param head
* @param value
*/
private
addProperty
(
info
:
egret
.
ITextStyle
,
head
:
string
,
value
:
string
):
void
{
switch
(
head
.
toLowerCase
())
{
case
"color"
:
case
"textcolor"
:
value
=
value
.
replace
(
/#/
,
"0x"
);
info
.
textColor
=
parseInt
(
value
);
break
;
case
"strokecolor"
:
value
=
value
.
replace
(
/#/
,
"0x"
);
info
.
strokeColor
=
parseInt
(
value
);
break
;
case
"stroke"
:
info
.
stroke
=
parseInt
(
value
);
break
;
case
"b"
:
case
"bold"
:
info
.
bold
=
value
==
"true"
;
break
;
case
"u"
:
info
.
underline
=
value
==
"true"
;
break
;
case
"i"
:
case
"italic"
:
info
.
italic
=
value
==
"true"
;
break
;
case
"size"
:
info
.
size
=
parseInt
(
value
);
break
;
case
"fontfamily"
:
info
.
fontFamily
=
value
;
break
;
case
"href"
:
info
.
href
=
this
.
replaceSpecial
(
value
);
break
;
case
"target"
:
info
.
target
=
this
.
replaceSpecial
(
value
);
break
;
}
}
/**
* @private
*/
private
stackArray
:
Array
<
egret
.
ITextStyle
>
;
/**
* @private
*
* @param infoStr
*/
private
addToArray
(
infoStr
:
string
):
void
{
const
info
:
egret
.
ITextStyle
=
this
.
changeStringToObject
(
infoStr
);
if
(
this
.
stackArray
.
length
==
0
)
{
this
.
stackArray
.
push
(
info
);
}
else
{
const
lastInfo
:
Object
=
this
.
stackArray
[
this
.
stackArray
.
length
-
1
];
for
(
const
key
in
lastInfo
)
{
if
(
info
[
key
]
==
null
)
{
info
[
key
]
=
lastInfo
[
key
];
}
}
this
.
stackArray
.
push
(
info
);
}
}
}
const
parser
=
new
HtmlTextParser
();
export
const
parseHtmlText
=
(
content
)
=>
{
return
parser
.
parse
(
content
);
}
egret/src/pops/rule/RulePanel.ts
0 → 100644
View file @
a5812bab
import
{
NetPromise
}
from
'./../../promises/NetPromise'
;
import
{
NetManager
}
from
'../../../libs/tw/manager/NetManager'
;
import
{
DataManager
}
from
'../../../libs/tw/manager/DataManager'
;
import
{
HtmlTextParser
}
from
"./HtmlTextParser"
;
import
Panel
from
"../../views/Panel"
;
import
ToastCtrl
from
'../../ctrls/toastCtrl'
;
export
default
class
RulePanel
extends
Panel
{
public
labContent
:
eui
.
Label
;
public
scroller
:
eui
.
Scroller
;
start
()
{
if
(
window
[
'ruleTxt'
])
{
this
.
labContent
.
textFlow
=
(
new
HtmlTextParser
).
parser
(
window
[
'ruleTxt'
]);
}
else
{
if
(
!
DataManager
.
ins
.
getData
(
"getRule"
))
{
NetPromise
.
getRule
()
.
then
(()
=>
{
this
.
addRule
();
})
.
catch
((
e
)
=>
{
console
.
error
(
e
);
ToastCtrl
.
instance
.
show
(
"获取规则失败,请稍后重试~"
)
})
}
else
{
this
.
addRule
();
}
}
}
group
:
eui
.
Group
;
private
addRule
()
{
const
text
=
DataManager
.
ins
.
getData
(
"getRule"
).
data
;
this
.
labContent
.
textFlow
=
(
new
HtmlTextParser
).
parser
(
text
);
}
get
skinKey
()
{
return
'Rule'
}
}
\ No newline at end of file
egret/src/promises/NetPromise.ts
View file @
a5812bab
...
@@ -17,6 +17,18 @@ export class NetPromise {
...
@@ -17,6 +17,18 @@ export class NetPromise {
})
})
}
}
static
getRule
()
{
return
new
Promise
((
r
,
j
)
=>
{
qcsNet
.
getRule
((
s
)
=>
{
if
(
!
s
)
{
j
(
s
)
return
}
r
()
});
})
}
/**
/**
* 参与刮奖
* 参与刮奖
*/
*/
...
...
egret/src/scenes/MainScene.ts
View file @
a5812bab
...
@@ -34,7 +34,8 @@ export default class MainScene extends Scene {
...
@@ -34,7 +34,8 @@ export default class MainScene extends Scene {
public
thanksBg
:
eui
.
Rect
;
public
thanksBg
:
eui
.
Rect
;
public
prizeImg
:
eui
.
Image
;
public
prizeImg
:
eui
.
Image
;
public
startBtn
:
eui
.
Button
;
public
startBtn
:
eui
.
Button
;
public
ruleBtn
:
eui
.
Button
;
public
recordBtn
:
eui
.
Button
;
public
mainMask
:
egret
.
Shape
;
public
mainMask
:
egret
.
Shape
;
...
@@ -126,15 +127,35 @@ export default class MainScene extends Scene {
...
@@ -126,15 +127,35 @@ export default class MainScene extends Scene {
this
.
snowAni
()
this
.
snowAni
()
ToastCtrl
.
instance
.
show
(
`恭喜你,获得
${
this
.
remainTimes
}
次抽奖次数`
)
}
}
initEvents
()
{
initEvents
()
{
super
.
initEvents
()
super
.
initEvents
()
this
.
onTap
(
this
.
startBtn
,
this
.
onTap_startBtn
)
this
.
onTap
(
this
.
startBtn
,
this
.
onTap_startBtn
)
this
.
onTap
(
this
.
ruleBtn
,
this
.
onTap_ruleBtn
)
this
.
onTap
(
this
.
recordBtn
,
this
.
onTap_recordBtn
)
this
.
addEventListener
(
egret
.
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
)
this
.
addEventListener
(
egret
.
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
)
}
}
onTap_ruleBtn
()
{
NetPromise
.
getRule
()
.
then
(()
=>
{
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
RULE_PANEL
)
})
.
catch
(
e
=>
{
console
.
error
(
e
);
ToastCtrl
.
instance
.
show
(
"获取规则失败,请稍后重试~"
)
})
}
onTap_recordBtn
()
{
window
.
location
.
href
=
window
[
'recordUrl'
]
}
onTap_startBtn
()
{
onTap_startBtn
()
{
if
(
this
.
remainTimes
&&
this
.
remainTimes
>
0
)
{
if
(
this
.
remainTimes
&&
this
.
remainTimes
>
0
)
{
Waiting
.
instance
.
show
()
Waiting
.
instance
.
show
()
...
@@ -174,6 +195,8 @@ export default class MainScene extends Scene {
...
@@ -174,6 +195,8 @@ export default class MainScene extends Scene {
removeEvents
()
{
removeEvents
()
{
super
.
removeEvents
super
.
removeEvents
this
.
clearTap
(
this
.
startBtn
,
this
.
onTap_startBtn
)
this
.
clearTap
(
this
.
startBtn
,
this
.
onTap_startBtn
)
this
.
clearTap
(
this
.
ruleBtn
,
this
.
onTap_ruleBtn
)
this
.
clearTap
(
this
.
recordBtn
,
this
.
onTap_recordBtn
)
this
.
removeEventListener
(
egret
.
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
)
this
.
removeEventListener
(
egret
.
Event
.
ENTER_FRAME
,
this
.
onEnterFrame
,
this
)
}
}
...
...
mock/config.js
View file @
a5812bab
...
@@ -12,6 +12,9 @@ const config = {
...
@@ -12,6 +12,9 @@ const config = {
'/projectx/1/queryAllUserRecords'
:
{
'/projectx/1/queryAllUserRecords'
:
{
data
:
'./qcs/queryAllUserRecords.json'
data
:
'./qcs/queryAllUserRecords.json'
},
},
'/projectx/1/projectRule.query'
:
{
data
:
'./qcs/getRule.json'
},
'/activityCommon/getRole'
:
{
'/activityCommon/getRole'
:
{
data
:
'./json/getRole.json'
data
:
'./json/getRole.json'
...
...
mock/qcs/getRule.json
0 → 100644
View file @
a5812bab
{
"success"
:
true
,
"message"
:
""
,
"data"
:
"afadsfasdfasdfasdfasdfasdfasd"
}
\ 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