Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
oetzit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
commul
oetzit
Commits
cf2d2ee9
Commit
cf2d2ee9
authored
3 years ago
by
Paolo.Brasolin
Browse files
Options
Downloads
Patches
Plain Diff
fix: #fe avoid texture key overlaps
parent
2395eace
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/src/js/clue.ts
+8
-5
8 additions, 5 deletions
frontend/src/js/clue.ts
with
8 additions
and
5 deletions
frontend/src/js/clue.ts
+
8
−
5
View file @
cf2d2ee9
...
...
@@ -12,10 +12,11 @@ const DESCENDERS = /[AFHJPQYZÄfghjpqsyzß]/;
class
Clue
extends
Phaser
.
GameObjects
.
Sprite
{
word
:
Types
.
Word
;
scene
:
FightScene
;
textureKey
:
string
;
constructor
(
scene
:
FightScene
,
word
:
Types
.
Word
)
{
// TODO: set positions
super
(
scene
,
400
,
300
,
word
.
id
);
super
(
scene
,
400
,
300
,
"
__MISSING
"
);
scene
.
add
.
existing
(
this
);
this
.
setAlpha
(
0
);
...
...
@@ -23,12 +24,14 @@ class Clue extends Phaser.GameObjects.Sprite {
this
.
scene
=
scene
;
this
.
word
=
word
;
// TODO: we could be smarter and fully leverage caching, but meh.
this
.
textureKey
=
`
${
word
.
id
}
-
${
Date
.
now
()}
`
;
this
.
loadTexture
();
}
loadTexture
()
{
// this.scene.textures.remove()
this
.
scene
.
textures
.
addBase64
(
this
.
word
.
id
,
this
.
word
.
image
);
this
.
scene
.
textures
.
addBase64
(
this
.
textureKey
,
this
.
word
.
image
);
this
.
scene
.
textures
.
once
(
"
addtexture
"
,
this
.
showTexture
.
bind
(
this
),
...
...
@@ -45,7 +48,7 @@ class Clue extends Phaser.GameObjects.Sprite {
}
applyTexture
()
{
this
.
setTexture
(
this
.
word
.
id
);
this
.
setTexture
(
this
.
textureKey
);
const
scale
=
(
this
.
estimateWordHeight
()
*
BASE_HEIGHT
)
/
this
.
texture
.
getSourceImage
().
height
;
...
...
@@ -68,8 +71,8 @@ class Clue extends Phaser.GameObjects.Sprite {
delete
()
{
this
.
fadeOut
(()
=>
{
this
.
scene
.
texture
s
.
remove
(
this
.
texture
);
// TODO
this
.
destroy
.
bind
(
this
);
this
.
texture
.
destroy
();
this
.
destroy
(
);
});
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment