Chapter
progature.engine.components.Chapter
Chapter(index, name, levels=None, is_complete=False)
Chapter component contains chapter data of each chapter in game, This Class is universal interface for Chapter all over the app. We just work with this class when we intract with our Chapters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index |
int
|
The index of each chapter inside chapter list in "".json"" file |
required |
name |
string
|
The name of chapter. |
required |
levels |
Pot[Level] or None
|
levels of each chapter. |
None
|
is_complete |
bool
|
Status of chapter completion |
False
|
index
instance-attribute
index = index
name
instance-attribute
name = name
levels
property
writable
levels
is_complete
instance-attribute
is_complete = is_complete
as_dict
as_dict()
Returns the dict representation of Chapter object.
Returns:
| Type | Description |
|---|---|
dict
|
The representation of the |
Examples:
>>> c = Chapter("INDEX", "NAME", "IS_COMPLETE", "LEVELS")
>>> c.as_dict()
{
"index": INDEX,
"name": NAME,
"is_complete": IS_COMPLETE,
"levels": LEVELS,
}