batframework 1.0.9a3__tar.gz → 1.0.9a4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {batframework-1.0.9a3 → batframework-1.0.9a4}/PKG-INFO +1 -1
- {batframework-1.0.9a3 → batframework-1.0.9a4}/pyproject.toml +1 -1
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/__init__.py +2 -2
- batframework-1.0.9a4/src/batFramework/cutscene.py +44 -0
- batframework-1.0.9a4/src/batFramework/cutsceneManager.py +31 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/enums.py +7 -1
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/manager.py +2 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/renderGroup.py +3 -3
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/sceneManager.py +3 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batframework.egg-info/PKG-INFO +1 -1
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batframework.egg-info/SOURCES.txt +1 -1
- batframework-1.0.9a3/src/batFramework/cutscene.py +0 -129
- batframework-1.0.9a3/src/batFramework/cutsceneBlocks.py +0 -169
- {batframework-1.0.9a3 → batframework-1.0.9a4}/LICENCE +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/README.md +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/setup.cfg +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/action.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/actionContainer.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/animatedSprite.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/animation.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/audioManager.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/camera.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/character.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/constants.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/drawable.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/dynamicEntity.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/easingController.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/entity.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/fontManager.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/__init__.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/animatedLabel.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/button.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/clickableWidget.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/constraints/__init__.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/constraints/constraints.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/container.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/debugger.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/draggableWidget.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/image.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/indicator.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/interactiveWidget.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/label.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/layout.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/meter.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/radioButton.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/root.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/shape.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/slider.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/style.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/styleManager.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/textInput.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/toggle.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/widget.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/particle.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/resourceManager.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/scene.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/scrollingSprite.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/sprite.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/stateMachine.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/templates/__init__.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/templates/character.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/templates/states.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/tileset.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/timeManager.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/transition.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/triggerZone.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/utils.py +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batframework.egg-info/dependency_links.txt +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batframework.egg-info/requires.txt +0 -0
- {batframework-1.0.9a3 → batframework-1.0.9a4}/src/batframework.egg-info/top_level.txt +0 -0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "batframework"
|
7
|
-
version = "1.0.
|
7
|
+
version = "1.0.9a4"
|
8
8
|
description = "Pygame framework for making games easier."
|
9
9
|
readme = "README.md"
|
10
10
|
classifiers = [ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent",]
|
@@ -9,8 +9,8 @@ from .utils import Utils as utils
|
|
9
9
|
from .tileset import Tileset
|
10
10
|
from .timeManager import TimeManager,Timer,SceneTimer
|
11
11
|
from .easingController import EasingController
|
12
|
-
|
13
|
-
import
|
12
|
+
import batFramework.cutscene
|
13
|
+
from .cutsceneManager import CutsceneManager
|
14
14
|
from .audioManager import AudioManager
|
15
15
|
import batFramework.transition as transition
|
16
16
|
from .action import Action
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import batFramework as bf
|
2
|
+
|
3
|
+
class Cutscene:
|
4
|
+
def __init__(self,*cutscenes):
|
5
|
+
self.is_over : bool = False
|
6
|
+
self.sub_cutscenes : list[Cutscene] = list(cutscenes)
|
7
|
+
self.sub_index = -1
|
8
|
+
|
9
|
+
def start(self):
|
10
|
+
if self.sub_cutscenes:
|
11
|
+
self.sub_index = 0
|
12
|
+
self.sub_cutscenes[self.sub_index].start()
|
13
|
+
else:
|
14
|
+
self.end()
|
15
|
+
|
16
|
+
def process_event(self,event):
|
17
|
+
if self.sub_index > 0:
|
18
|
+
self.sub_cutscenes[self.sub_index].process_event(event)
|
19
|
+
|
20
|
+
def update(self,dt):
|
21
|
+
if self.sub_index > 0:
|
22
|
+
self.sub_cutscenes[self.sub_index].update(dt)
|
23
|
+
if self.sub_cutscenes[self.sub_index].is_over:
|
24
|
+
self.sub_index +=1
|
25
|
+
if self.sub_index >= len(self.sub_cutscenes):
|
26
|
+
self.end()
|
27
|
+
|
28
|
+
def end(self):
|
29
|
+
self.is_over = True
|
30
|
+
|
31
|
+
|
32
|
+
class Wait(Cutscene):
|
33
|
+
def __init__(self,duration:float,scene_name:str="global"):
|
34
|
+
super().__init__()
|
35
|
+
self.duration = duration
|
36
|
+
self.scene_name = scene_name
|
37
|
+
def start(self):
|
38
|
+
self.timer = bf.SceneTimer(duration=self.duration,end_callback=self.end,scene_name=self.scene_name)
|
39
|
+
self.timer.start()
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
# class TransitionToScene(bf.Cutscene):
|
44
|
+
# def __init__(self,scene_name:str,)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import batFramework as bf
|
2
|
+
from typing import TYPE_CHECKING,Self
|
3
|
+
import pygame
|
4
|
+
# if TYPE_CHECKING:
|
5
|
+
from .cutscene import Cutscene
|
6
|
+
|
7
|
+
|
8
|
+
class CutsceneManager(metaclass=bf.Singleton):
|
9
|
+
def __init__(self) -> None:
|
10
|
+
self.current_cutscene: Cutscene = None
|
11
|
+
self.manager: bf.Manager = None
|
12
|
+
|
13
|
+
def set_manager(self, manager):
|
14
|
+
self.manager = manager
|
15
|
+
|
16
|
+
def process_event(self, event):
|
17
|
+
if self.current_cutscene is not None:
|
18
|
+
self.current_cutscene.process_event(event)
|
19
|
+
if event.type in bf.enums.playerInput:
|
20
|
+
event.consumed = True
|
21
|
+
|
22
|
+
def play(self,cutscene:Cutscene):
|
23
|
+
if self.current_cutscene is not None:return
|
24
|
+
self.current_cutscene = cutscene
|
25
|
+
cutscene.start()
|
26
|
+
|
27
|
+
def update(self,dt):
|
28
|
+
if self.current_cutscene:
|
29
|
+
self.current_cutscene.update(dt)
|
30
|
+
if self.current_cutscene.is_over:
|
31
|
+
self.current_cutscene = None
|
@@ -1,4 +1,8 @@
|
|
1
1
|
from enum import Enum
|
2
|
+
import pygame
|
3
|
+
|
4
|
+
playerInput = [pygame.KEYDOWN,pygame.MOUSEBUTTONDOWN,pygame.KEYUP,pygame.MOUSEBUTTONUP]
|
5
|
+
|
2
6
|
|
3
7
|
|
4
8
|
class color:
|
@@ -111,4 +115,6 @@ class textMode(Enum):
|
|
111
115
|
ALPHABETICAL = 0
|
112
116
|
NUMERICAL = 1
|
113
117
|
ALPHANUMERICAL = 3
|
114
|
-
|
118
|
+
|
119
|
+
|
120
|
+
|
@@ -74,6 +74,8 @@ class Manager(bf.SceneManager):
|
|
74
74
|
if event.key == pygame.K_p:
|
75
75
|
self.print_status()
|
76
76
|
return
|
77
|
+
self.cutsceneManager.process_event(event)
|
78
|
+
if event.consumed: return
|
77
79
|
super().process_event(event)
|
78
80
|
if not event.consumed:
|
79
81
|
if event.type == pygame.QUIT:
|
@@ -8,13 +8,13 @@ from typing import Self, Iterator, Callable
|
|
8
8
|
"""
|
9
9
|
|
10
10
|
|
11
|
-
class RenderGroup(bf.
|
11
|
+
class RenderGroup(bf.Drawable):
|
12
12
|
def __init__(
|
13
|
-
self, entity_iterator: Callable[[], Iterator[bf.
|
13
|
+
self, entity_iterator: Callable[[], Iterator[bf.Drawable]], blit_flags: int = 0
|
14
14
|
) -> None:
|
15
15
|
super().__init__()
|
16
16
|
self.entity_iterator = entity_iterator
|
17
|
-
self.set_blit_flags(blit_flags)
|
17
|
+
# self.set_blit_flags(blit_flags)
|
18
18
|
self.set_debug_color("white")
|
19
19
|
|
20
20
|
def get_debug_outlines(self):
|
@@ -171,6 +171,9 @@ class SceneManager:
|
|
171
171
|
|
172
172
|
def process_event(self, event: pygame.Event):
|
173
173
|
|
174
|
+
if self.current_transitions and event in bf.enums.playerInput:
|
175
|
+
return
|
176
|
+
|
174
177
|
if event.type in self.shared_events:
|
175
178
|
[s.process_event(event) for s in self.scenes]
|
176
179
|
else:
|
@@ -11,7 +11,7 @@ src/batFramework/camera.py
|
|
11
11
|
src/batFramework/character.py
|
12
12
|
src/batFramework/constants.py
|
13
13
|
src/batFramework/cutscene.py
|
14
|
-
src/batFramework/
|
14
|
+
src/batFramework/cutsceneManager.py
|
15
15
|
src/batFramework/drawable.py
|
16
16
|
src/batFramework/dynamicEntity.py
|
17
17
|
src/batFramework/easingController.py
|
@@ -1,129 +0,0 @@
|
|
1
|
-
import batFramework as bf
|
2
|
-
from typing import TYPE_CHECKING,Self
|
3
|
-
|
4
|
-
class CutsceneBlock: ...
|
5
|
-
|
6
|
-
if TYPE_CHECKING:
|
7
|
-
from .cutsceneBlocks import CutsceneBlock
|
8
|
-
|
9
|
-
|
10
|
-
class Cutscene: ...
|
11
|
-
|
12
|
-
|
13
|
-
class CutsceneManager(metaclass=bf.Singleton):
|
14
|
-
def __init__(self) -> None:
|
15
|
-
self.current_cutscene: Cutscene = None
|
16
|
-
self.cutscenes: list[bf.Cutscene] = []
|
17
|
-
self.manager: bf.Manager = None
|
18
|
-
|
19
|
-
def set_manager(self, manager):
|
20
|
-
self.manager = manager
|
21
|
-
|
22
|
-
def get_flag(self, flag):
|
23
|
-
return None
|
24
|
-
|
25
|
-
def process_event(self, event):
|
26
|
-
if self.current_cutscene:
|
27
|
-
self.current_cutscene.process_event(event)
|
28
|
-
|
29
|
-
def queue(self, *cutscenes):
|
30
|
-
self.cutscenes.extend(cutscenes)
|
31
|
-
if self.current_cutscene is None:
|
32
|
-
self.play(self.cutscenes.pop(0))
|
33
|
-
|
34
|
-
def play(self, cutscene: Cutscene):
|
35
|
-
if self.current_cutscene is None:
|
36
|
-
self.current_cutscene = cutscene
|
37
|
-
self.current_cutscene.on_enter()
|
38
|
-
self.current_cutscene.init_blocks()
|
39
|
-
self.current_cutscene.play()
|
40
|
-
|
41
|
-
def enable_player_control(self) -> None:
|
42
|
-
pass
|
43
|
-
|
44
|
-
def disable_player_control(self) -> None:
|
45
|
-
pass
|
46
|
-
|
47
|
-
def update(self, dt):
|
48
|
-
if not self.current_cutscene is None:
|
49
|
-
self.current_cutscene.update(dt)
|
50
|
-
# print("cutscene manager update")
|
51
|
-
if self.current_cutscene.has_ended():
|
52
|
-
self.current_cutscene.on_exit()
|
53
|
-
self.current_cutscene = None
|
54
|
-
if self.cutscenes:
|
55
|
-
self.play(self.cutscenes.pop(0))
|
56
|
-
else:
|
57
|
-
self.current_cutscene = None
|
58
|
-
|
59
|
-
|
60
|
-
class Cutscene:
|
61
|
-
def __init__(self) -> None:
|
62
|
-
self.cutscene_blocks : list[CutsceneBlock] = []
|
63
|
-
self.block_index = 0
|
64
|
-
self.end_blocks: list[CutsceneBlock] = []
|
65
|
-
self.ended = False
|
66
|
-
|
67
|
-
def on_enter(self):
|
68
|
-
pass
|
69
|
-
|
70
|
-
def on_exit(self):
|
71
|
-
pass
|
72
|
-
|
73
|
-
def init_blocks(self):
|
74
|
-
pass
|
75
|
-
|
76
|
-
def add_blocks(self, *blocks: CutsceneBlock)->Self:
|
77
|
-
self.cutscene_blocks.extend(blocks)
|
78
|
-
return self
|
79
|
-
|
80
|
-
def add_end_blocks(self, *blocks: CutsceneBlock)->Self:
|
81
|
-
_ = [block.set_parent_cutscene(self) for block in blocks]
|
82
|
-
self.end_blocks.extend(blocks)
|
83
|
-
return self
|
84
|
-
|
85
|
-
def get_scene_at(self, index):
|
86
|
-
return bf.CutsceneManager().manager.scenes[index]
|
87
|
-
|
88
|
-
def get_current_scene(self):
|
89
|
-
return bf.CutsceneManager().manager.get_current_scene()
|
90
|
-
|
91
|
-
def set_scene(self, name, index=0):
|
92
|
-
return bf.CutsceneManager().manager.set_scene(name, index)
|
93
|
-
|
94
|
-
def get_scene(self, name):
|
95
|
-
return bf.CutsceneManager().manager.get_scene(name)
|
96
|
-
|
97
|
-
def add_block(self, *blocks: CutsceneBlock):
|
98
|
-
for block in blocks:
|
99
|
-
block.set_parent_cutscene(self)
|
100
|
-
self.cutscene_blocks.append(block)
|
101
|
-
|
102
|
-
def process_event(self, event):
|
103
|
-
if not self.ended and self.block_index < len(self.cutscene_blocks):
|
104
|
-
self.cutscene_blocks[self.block_index].process_event(event)
|
105
|
-
|
106
|
-
def play(self):
|
107
|
-
self.block_index = 0
|
108
|
-
if self.cutscene_blocks:
|
109
|
-
self.cutscene_blocks[self.block_index].start()
|
110
|
-
else:
|
111
|
-
self.ended
|
112
|
-
|
113
|
-
def update(self, dt):
|
114
|
-
if self.ended:
|
115
|
-
return
|
116
|
-
self.cutscene_blocks[self.block_index].update(dt)
|
117
|
-
if self.cutscene_blocks[self.block_index].has_ended():
|
118
|
-
self.block_index += 1
|
119
|
-
if self.block_index == len(self.cutscene_blocks):
|
120
|
-
if not self.end_blocks:
|
121
|
-
self.ended = True
|
122
|
-
return
|
123
|
-
else:
|
124
|
-
self.cutscene_blocks.extend(self.end_blocks)
|
125
|
-
self.end_blocks = []
|
126
|
-
self.cutscene_blocks[self.block_index].start()
|
127
|
-
|
128
|
-
def has_ended(self):
|
129
|
-
return self.ended
|
@@ -1,169 +0,0 @@
|
|
1
|
-
import batFramework as bf
|
2
|
-
from .cutscene import Cutscene, CutsceneManager
|
3
|
-
from .transition import *
|
4
|
-
from typing import Optional,Callable
|
5
|
-
|
6
|
-
# Define the base CutsceneBlock class
|
7
|
-
class CutsceneBlock:
|
8
|
-
"""
|
9
|
-
Base class for cutscene blocks. Represents a unit of action in a cutscene.
|
10
|
-
"""
|
11
|
-
|
12
|
-
# Constructor for the CutsceneBlock
|
13
|
-
def __init__(self) -> None:
|
14
|
-
# Callback function, parent cutscene, and state variables
|
15
|
-
self.callback = None
|
16
|
-
self.parent_cutscene: Cutscene = None
|
17
|
-
self.get_flag = CutsceneManager().get_flag
|
18
|
-
self.ended = False
|
19
|
-
self.started = False
|
20
|
-
|
21
|
-
def get_scene_at(self, index):
|
22
|
-
return bf.CutsceneManager().manager.scenes[index]
|
23
|
-
|
24
|
-
def set_scene(self, name, index=0):
|
25
|
-
return CutsceneManager().manager.set_scene(name, index)
|
26
|
-
|
27
|
-
def get_current_scene(self):
|
28
|
-
return CutsceneManager().manager.get_current_scene()
|
29
|
-
|
30
|
-
def get_scene(self, name):
|
31
|
-
return CutsceneManager().manager.get_scene(name)
|
32
|
-
|
33
|
-
# Set the parent cutscene for this block
|
34
|
-
def set_parent_cutscene(self, parent):
|
35
|
-
"""
|
36
|
-
Set the parent cutscene for this block.
|
37
|
-
|
38
|
-
Args:
|
39
|
-
parent: The parent cutscene object.
|
40
|
-
"""
|
41
|
-
self.parent_cutscene = parent
|
42
|
-
|
43
|
-
# Process an event (placeholder implementation, to be overridden in subclasses)
|
44
|
-
def process_event(self, event):
|
45
|
-
"""
|
46
|
-
Process an event for this cutscene block.
|
47
|
-
|
48
|
-
Args:
|
49
|
-
event: The event to be processed.
|
50
|
-
"""
|
51
|
-
pass
|
52
|
-
|
53
|
-
# Update the block (placeholder implementation, to be overridden in subclasses)
|
54
|
-
def update(self, dt):
|
55
|
-
"""
|
56
|
-
Update the cutscene block.
|
57
|
-
|
58
|
-
Args:
|
59
|
-
dt: Time elapsed since the last update.
|
60
|
-
"""
|
61
|
-
pass
|
62
|
-
|
63
|
-
# Start the block
|
64
|
-
def start(self):
|
65
|
-
"""
|
66
|
-
Start the cutscene block.
|
67
|
-
"""
|
68
|
-
self.started = True
|
69
|
-
|
70
|
-
# Mark the block as ended
|
71
|
-
def end(self):
|
72
|
-
"""
|
73
|
-
Mark the cutscene block as ended.
|
74
|
-
"""
|
75
|
-
self.ended = True
|
76
|
-
|
77
|
-
# Check if the block has ended
|
78
|
-
def has_ended(self):
|
79
|
-
"""
|
80
|
-
Check if the cutscene block has ended.
|
81
|
-
|
82
|
-
Returns:
|
83
|
-
bool: True if the block has ended, False otherwise.
|
84
|
-
"""
|
85
|
-
return self.ended
|
86
|
-
|
87
|
-
|
88
|
-
# Define the ParallelBlock class, a type of CutsceneBlock
|
89
|
-
class ParallelBlock(CutsceneBlock):
|
90
|
-
"""
|
91
|
-
Represents a parallel execution block for multiple Cutscene blocks.
|
92
|
-
"""
|
93
|
-
|
94
|
-
def __init__(self, *blocks) -> None:
|
95
|
-
super().__init__()
|
96
|
-
# List of blocks to run in parallel
|
97
|
-
self.blocks: list[CutsceneBlock] = list(blocks)
|
98
|
-
|
99
|
-
# Start the parallel block (override the base class method)
|
100
|
-
def start(self):
|
101
|
-
super().start()
|
102
|
-
# Start each block in parallel
|
103
|
-
for block in self.blocks:
|
104
|
-
block.start()
|
105
|
-
|
106
|
-
# Process an event for each block in parallel
|
107
|
-
def process_event(self, event):
|
108
|
-
_ = [b.process_event(event) for b in self.blocks]
|
109
|
-
|
110
|
-
# Update each block in parallel
|
111
|
-
def update(self, dt):
|
112
|
-
_ = [b.update(dt) for b in self.blocks]
|
113
|
-
|
114
|
-
# Check if all blocks have ended
|
115
|
-
def has_ended(self):
|
116
|
-
return all(b.has_ended() for b in self.blocks)
|
117
|
-
|
118
|
-
|
119
|
-
# Define the SceneTransitionBlock class, a type of CutsceneBlock
|
120
|
-
class SceneTransitionBlock(CutsceneBlock):
|
121
|
-
"""
|
122
|
-
Represents a scene transition Cutscene block.
|
123
|
-
"""
|
124
|
-
|
125
|
-
# Constructor for SceneTransitionBlock
|
126
|
-
def __init__(
|
127
|
-
self, scene, transition: Transition = Fade(0.1), index: int = 0
|
128
|
-
) -> None:
|
129
|
-
super().__init__()
|
130
|
-
# Target scene, transition type, duration, and additional keyword arguments
|
131
|
-
self.target_scene = scene
|
132
|
-
self.transition = transition
|
133
|
-
self.index = index
|
134
|
-
# Timer to handle the end of the transition
|
135
|
-
self.timer = bf.Timer(transition.duration, self.end)
|
136
|
-
|
137
|
-
# Start the scene transition block
|
138
|
-
def start(self):
|
139
|
-
"""
|
140
|
-
Start the scene transition block.
|
141
|
-
"""
|
142
|
-
super().start()
|
143
|
-
# Initiate the scene transition
|
144
|
-
if self.get_current_scene().name == self.target_scene:
|
145
|
-
self.end()
|
146
|
-
return
|
147
|
-
CutsceneManager().manager.transition_to_scene(
|
148
|
-
self.target_scene, self.transition, self.index
|
149
|
-
)
|
150
|
-
# Start the timer to handle the end of the transition
|
151
|
-
self.timer.start()
|
152
|
-
|
153
|
-
class DelayBlock(CutsceneBlock):
|
154
|
-
def __init__(self, duration) -> None:
|
155
|
-
super().__init__()
|
156
|
-
self.timer = bf.Timer(duration=duration, end_callback=self.end)
|
157
|
-
|
158
|
-
def start(self):
|
159
|
-
super().start()
|
160
|
-
self.timer.start()
|
161
|
-
|
162
|
-
class FunctionBlock(CutsceneBlock):
|
163
|
-
def __init__(self, func : Optional[Callable]) -> None:
|
164
|
-
self.function = func
|
165
|
-
|
166
|
-
def start(self):
|
167
|
-
super().start()
|
168
|
-
if self.function : self.function()
|
169
|
-
self.end()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{batframework-1.0.9a3 → batframework-1.0.9a4}/src/batFramework/gui/constraints/constraints.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{batframework-1.0.9a3 → batframework-1.0.9a4}/src/batframework.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|