Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Agdbentures
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
Service Desk
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
Admin message
GitLab upgrade completed. Current version is 17.8.2.
Show more breadcrumbs
CORSE
Agdbentures
Commits
cdcac13d
Commit
cdcac13d
authored
9 months ago
by
Noe-genevois
Browse files
Options
Downloads
Patches
Plain Diff
canceled wrong change
parent
009b9ee7
No related branches found
Branches containing commit
No related tags found
1 merge request
!65
Progress manager optimization
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
archives/level_controller.py
+7
-7
7 additions, 7 deletions
archives/level_controller.py
with
7 additions
and
7 deletions
archives/level_controller.py
+
7
−
7
View file @
cdcac13d
...
...
@@ -43,13 +43,13 @@ class LevelController:
self
.
levels_script_dir
=
os
.
path
.
join
(
self
.
levels_dir
,
"
scripts
"
)
# load past progress from file
progress
=
[]
self
.
progress
=
[]
self
.
__load_progress
()
# compute next level to do
self
.
current_level_number
=
0
if
progress
:
self
.
current_level_number
=
LEVEL_LIST
.
index
(
progress
[
-
1
])
+
1
if
self
.
progress
:
self
.
current_level_number
=
LEVEL_LIST
.
index
(
self
.
progress
[
-
1
])
+
1
# Debug option to go to a specific level
if
DEBUG_LEVEL
!=
-
1
:
self
.
current_level_number
=
DEBUG_LEVEL
...
...
@@ -67,7 +67,7 @@ class LevelController:
with
open
(
os
.
path
.
join
(
self
.
saves_dir
,
"
progress.txt
"
),
"
r
"
,
encoding
=
"
utf-8
"
)
as
progress_file
:
progress
=
[
name
.
strip
()
for
name
in
progress_file
.
readlines
()]
self
.
progress
=
[
name
.
strip
()
for
name
in
progress_file
.
readlines
()]
except
FileNotFoundError
:
# We do nothing if no progress file is found
pass
...
...
@@ -77,12 +77,12 @@ class LevelController:
with
open
(
os
.
path
.
join
(
self
.
saves_dir
,
"
progress.txt
"
),
"
w
"
,
encoding
=
"
utf-8
"
)
as
progress_file
:
for
name
in
progress
:
for
name
in
self
.
progress
:
print
(
name
,
file
=
progress_file
)
def
clear_progress
(
self
):
"""
Clears the current progress and saves it into the progress file
"""
progress
=
[]
self
.
progress
=
[]
self
.
__save_progress
()
# level loading and success
...
...
@@ -131,7 +131,7 @@ class LevelController:
def
unlock_next_level
(
self
):
"""
Updates progress and saves it
"""
# add the current level to the progress
progress
.
append
(
self
.
current_level_name
)
self
.
progress
.
append
(
self
.
current_level_name
)
# load the next level
self
.
current_level_number
+=
1
self
.
current_level_name
=
LEVEL_LIST
[
self
.
current_level_number
]
...
...
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