Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JM_4-1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
JM_4-1
Commits
de1fdac1
Commit
de1fdac1
authored
Aug 02, 2021
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 更改子模板跳转 字体加载
parent
397452a5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
18 deletions
+45
-18
Util.js
src/app/play/Util.js
+8
-5
play.component.html
src/app/play/play.component.html
+3
-2
play.component.ts
src/app/play/play.component.ts
+34
-11
No files found.
src/app/play/Util.js
View file @
de1fdac1
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
export
async
function
loadFonts
()
{
export
async
function
loadFonts
(
fontName
,
fontFile
)
{
// const font = new FontFace(
// const font = new FontFace(
...
@@ -11,10 +11,10 @@ export async function loadFonts () {
...
@@ -11,10 +11,10 @@ export async function loadFonts () {
// );
// );
try
{
try
{
console
.
log
(
location
.
href
.
split
(
"
#
"
)[
0
]
+
"
assets/play/font/
DroidSansFallback.ttf
"
);
console
.
log
(
location
.
href
.
split
(
"
#
"
)[
0
]
+
"
assets/play/font/
"
+
fontFile
);
const
font
=
new
FontFace
(
const
font
=
new
FontFace
(
"
DroidSansFallback
"
,
fontName
,
"
url(
"
+
location
.
href
.
split
(
"
#
"
)[
0
]
+
"
assets/play/font/
DroidSansFallback.ttf
"
+
"
)
"
"
url(
"
+
location
.
href
.
split
(
"
#
"
)[
0
]
+
"
assets/play/font/
"
+
fontFile
+
"
)
"
);
);
console
.
log
(
'
start:
'
,
new
Date
().
getTime
())
console
.
log
(
'
start:
'
,
new
Date
().
getTime
())
...
@@ -22,6 +22,9 @@ export async function loadFonts () {
...
@@ -22,6 +22,9 @@ export async function loadFonts () {
console
.
log
(
'
end:
'
,
new
Date
().
getTime
())
console
.
log
(
'
end:
'
,
new
Date
().
getTime
())
document
.
fonts
.
add
(
font
);
document
.
fonts
.
add
(
font
);
document
.
body
.
classList
.
add
(
"
fonts-loaded
"
);
document
.
body
.
classList
.
add
(
"
fonts-loaded
"
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
}
}
...
...
src/app/play/play.component.html
View file @
de1fdac1
<span
style=
"font-family:'BRLNSDB'"
></span>
<span
style=
"font-family:'DroidSansFallback'"
></span>
<span
style=
"font-family:'Aileron-Black'"
></span>
<div
class=
"game-container"
#
wrap
>
<div
class=
"game-container"
#
wrap
>
<canvas
id=
"canvas"
style=
"width: 100%; height: 100%;"
#
canvas
></canvas>
<canvas
id=
"canvas"
style=
"width: 100%; height: 100%;"
#
canvas
></canvas>
...
@@ -6,7 +7,7 @@
...
@@ -6,7 +7,7 @@
<div
#
iframeContent
style=
"position: absolute; top: 0;"
>
<div
#
iframeContent
style=
"position: absolute; top: 0;"
>
<div
*
ngFor=
"let t of templateArr; let i = index"
>
<div
*
ngFor=
"let t of templateArr; let i = index"
>
<iframe
*
ngIf=
"t.isShow"
[
src
]="
t
.
playUrl
||
''"
style=
"width: 100vw; height: 100vh; border: 0px solid #ccc;
padding: 5px;
"
frameborder=
"0"
>
<iframe
*
ngIf=
"t.isShow"
[
src
]="
t
.
playUrl
||
''"
style=
"width: 100vw; height: 100vh; border: 0px solid #ccc; "
frameborder=
"0"
>
</iframe>
</iframe>
</div>
</div>
</div>
</div>
...
...
src/app/play/play.component.ts
View file @
de1fdac1
...
@@ -140,9 +140,10 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -140,9 +140,10 @@ export class PlayComponent implements OnInit, OnDestroy {
async
ngOnInit
()
{
async
ngOnInit
()
{
await
loadFonts
();
// await loadFonts();
const
getData
=
(
<
any
>
window
).
courseware
.
getData
;
const
getData
=
(
<
any
>
window
).
courseware
.
getData
;
getData
((
data
,
aspect
)
=>
{
getData
((
data
,
aspect
)
=>
{
...
@@ -438,12 +439,24 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -438,12 +439,24 @@ export class PlayComponent implements OnInit, OnDestroy {
// 预加载资源
// 预加载资源
this
.
loadResources
().
then
(()
=>
{
this
.
loadResources
().
then
(()
=>
{
// this.setfontData();
// this.setfontData();
console
.
log
(
'
aaaaaa
'
);
loadFonts
(
'
DroidSansFallback
'
,
'
DroidSansFallback.ttf
'
).
then
(()
=>
{
console
.
log
(
'
bbbbb
'
);
loadFonts
(
'
Aileron-Black
'
,
'
Aileron-Black.ttf
'
).
then
(()
=>
{
console
.
log
(
'
cccc
'
);
this
.
addServerListener
();
this
.
addServerListener
();
window
[
'
air
'
].
hideAirClassLoading
(
this
.
KEY
,
this
.
data
);
window
[
'
air
'
].
hideAirClassLoading
(
this
.
KEY
,
this
.
data
);
})
})
});
});
}
}
...
@@ -901,7 +914,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -901,7 +914,7 @@ export class PlayComponent implements OnInit, OnDestroy {
btnLabel
.
fontSize
=
64
;
btnLabel
.
fontSize
=
64
;
btnLabel
.
fontName
=
'
Aileron-Black
'
;
btnLabel
.
fontName
=
'
Aileron-Black
'
;
btnLabel
.
textAlign
=
'
center
'
;
btnLabel
.
textAlign
=
'
center
'
;
btnLabel
.
text
=
'
Sen
t
'
;
btnLabel
.
text
=
'
Sen
d
'
;
btnLabel
.
y
=
5
;
btnLabel
.
y
=
5
;
btnLabel
.
fontColor
=
'
#ffffff
'
;
btnLabel
.
fontColor
=
'
#ffffff
'
;
btn
.
addChild
(
btnLabel
,
3
);
btn
.
addChild
(
btnLabel
,
3
);
...
@@ -980,6 +993,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -980,6 +993,8 @@ export class PlayComponent implements OnInit, OnDestroy {
console
.
log
(
'
rect.height:
'
,
rect
.
height
);
console
.
log
(
'
rect.height:
'
,
rect
.
height
);
colorRect
.
alpha
=
0
;
colorRect
.
alpha
=
0
;
richText
.
addChild
(
colorRect
);
richText
.
addChild
(
colorRect
);
this
.
sentenceEmptyArr
.
push
(
colorRect
);
this
.
sentenceEmptyArr
.
push
(
colorRect
);
...
@@ -1313,6 +1328,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1313,6 +1328,8 @@ export class PlayComponent implements OnInit, OnDestroy {
mapMove
(
event
)
{
mapMove
(
event
)
{
event
.
preventDefault
()
if
(
!
this
.
curMoveItem
)
{
if
(
!
this
.
curMoveItem
)
{
return
;
return
;
}
}
...
@@ -1328,6 +1345,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1328,6 +1345,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
curMoveItem
.
x
+=
this
.
curMoveItem
.
moveOffX
;
this
.
curMoveItem
.
x
+=
this
.
curMoveItem
.
moveOffX
;
this
.
curMoveItem
.
y
+=
this
.
curMoveItem
.
moveOffY
;
this
.
curMoveItem
.
y
+=
this
.
curMoveItem
.
moveOffY
;
}
}
}
}
...
@@ -1350,11 +1369,14 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1350,11 +1369,14 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
checkShowSubTemplateOne
()
{
checkShowSubTemplateOne
()
{
if
(
this
.
submitCount
==
1
)
{
this
.
showSubTemplate
(
1
);
}
else
{
this
.
showSubTemplate
(
0
);
this
.
showSubTemplate
(
0
);
}
// if (this.submitCount == 1) {
// this.showSubTemplate(1);
// } else {
// this.showSubTemplate(0);
// }
}
}
...
@@ -1611,6 +1633,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1611,6 +1633,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
showSubTemplate
(
index
)
{
showSubTemplate
(
index
)
{
console
.
log
(
'
showSubTemplate _
'
,
index
);
const
arr
=
this
.
templateArr
;
const
arr
=
this
.
templateArr
;
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
arr
[
i
].
isShow
=
false
;
arr
[
i
].
isShow
=
false
;
...
@@ -1673,8 +1696,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1673,8 +1696,8 @@ export class PlayComponent implements OnInit, OnDestroy {
// }, 300);
// }, 300);
}
}
if
(
msgData
.
action
===
"
sendR
esult
"
)
{
if
(
msgData
.
action
===
"
temp_send_r
esult
"
)
{
console
.
log
(
'
in temp_send_result __ msgData:
'
,
msgData
);
}
}
...
...
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