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
a97aba04
Commit
a97aba04
authored
2 years ago
by
Paolo Brasolin
Browse files
Options
Downloads
Patches
Plain Diff
refactor: #fe shift all backend usage to FightScene
parent
4ed8ea39
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#24556
failed
2 years ago
Stage: setup
Stage: check
Stage: build
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/js/fight_scene.ts
+19
-2
19 additions, 2 deletions
frontend/src/js/fight_scene.ts
frontend/src/js/foe.ts
+3
-16
3 additions, 16 deletions
frontend/src/js/foe.ts
with
22 additions
and
18 deletions
frontend/src/js/fight_scene.ts
+
19
−
2
View file @
a97aba04
...
...
@@ -260,7 +260,24 @@ export default class FightScene extends MainScene {
}
async
spawnFoe
(
length
:
number
,
timeout
:
number
)
{
// TODO: this is a terrible pattern
await
new
Foe
(
this
,
timeout
).
initialize
(
length
);
const
beWord
=
(
await
backend
.
createWordChoice
({
ocr_transcript_length_min
:
length
,
ocr_transcript_length_max
:
length
,
})
).
data
;
const
beClue
=
(
await
backend
.
createClue
(
this
.
beGame
.
id
,
{
word_id
:
beWord
.
id
,
began_at
:
new
Date
().
toISOString
(),
began_at_gmtm
:
this
.
getGameTime
(),
})
).
data
;
if
(
!
this
.
scene
.
isActive
())
return
;
const
foe
=
new
Foe
(
this
,
timeout
);
foe
.
initialize
(
length
,
beWord
,
beClue
);
}
}
This diff is collapsed.
Click to expand it.
frontend/src/js/foe.ts
+
3
−
16
View file @
a97aba04
...
...
@@ -3,7 +3,6 @@ import Clue from "./clue";
import
Critter
from
"
./critter
"
;
import
FightScene
from
"
./fight_scene
"
;
import
backend
from
"
./backend
"
;
import
*
as
Types
from
"
../../../backend/src/types
"
;
class
Foe
{
...
...
@@ -23,21 +22,9 @@ class Foe {
this
.
duration
=
duration
;
}
async
initialize
(
length
:
number
)
{
this
.
beWord
=
(
await
backend
.
createWordChoice
({
ocr_transcript_length_min
:
length
,
ocr_transcript_length_max
:
length
,
})
).
data
;
if
(
!
this
.
scene
.
scene
.
isActive
())
return
;
this
.
beClue
=
(
await
backend
.
createClue
(
this
.
scene
.
beGame
.
id
,
{
word_id
:
this
.
beWord
.
id
,
began_at
:
new
Date
().
toISOString
(),
began_at_gmtm
:
this
.
scene
.
getGameTime
(),
})
).
data
;
initialize
(
length
:
number
,
beWord
:
Types
.
Word
,
beClue
:
Types
.
Clue
)
{
this
.
beWord
=
beWord
;
this
.
beClue
=
beClue
;
this
.
clue
=
new
Clue
(
this
.
scene
,
this
.
beWord
,
this
.
duration
);
// TODO: this is the time to reach a collision w/player, but maybe we should just use the transversal of the full screen.
...
...
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