fix no alpha change on lock
This commit is contained in:
parent
ab8afe6fdd
commit
ecd2915b12
@ -129,7 +129,7 @@ class TetrArcade(tetrislogic.TetrisLogic, arcade.Window):
|
|||||||
locale.setlocale(locale.LC_ALL, '')
|
locale.setlocale(locale.LC_ALL, '')
|
||||||
self.highlight_texts = []
|
self.highlight_texts = []
|
||||||
self.tasks = {}
|
self.tasks = {}
|
||||||
|
|
||||||
self.conf = configparser.ConfigParser()
|
self.conf = configparser.ConfigParser()
|
||||||
if self.conf.read(CONF_PATH):
|
if self.conf.read(CONF_PATH):
|
||||||
try:
|
try:
|
||||||
@ -140,7 +140,7 @@ class TetrArcade(tetrislogic.TetrisLogic, arcade.Window):
|
|||||||
else:
|
else:
|
||||||
self.new_conf()
|
self.new_conf()
|
||||||
self.load_conf()
|
self.load_conf()
|
||||||
|
|
||||||
super().__init__()
|
super().__init__()
|
||||||
arcade.Window.__init__(
|
arcade.Window.__init__(
|
||||||
self,
|
self,
|
||||||
@ -157,7 +157,7 @@ class TetrArcade(tetrislogic.TetrisLogic, arcade.Window):
|
|||||||
self.matrix_bg = arcade.Sprite(MATRIX_SPRITE_PATH)
|
self.matrix_bg = arcade.Sprite(MATRIX_SPRITE_PATH)
|
||||||
self.matrix_bg.alpha = MATRIX_BG_ALPHA
|
self.matrix_bg.alpha = MATRIX_BG_ALPHA
|
||||||
self.matrix.sprites = MatrixSprites(self.matrix)
|
self.matrix.sprites = MatrixSprites(self.matrix)
|
||||||
|
|
||||||
def new_conf(self):
|
def new_conf(self):
|
||||||
self.conf["WINDOW"] = {
|
self.conf["WINDOW"] = {
|
||||||
"width": WINDOW_WIDTH,
|
"width": WINDOW_WIDTH,
|
||||||
@ -181,12 +181,12 @@ class TetrArcade(tetrislogic.TetrisLogic, arcade.Window):
|
|||||||
os.makedirs(USER_PROFILE_DIR)
|
os.makedirs(USER_PROFILE_DIR)
|
||||||
with open(CONF_PATH, 'w') as f:
|
with open(CONF_PATH, 'w') as f:
|
||||||
self.conf.write(f)
|
self.conf.write(f)
|
||||||
|
|
||||||
def load_conf(self):
|
def load_conf(self):
|
||||||
self.init_width = int(self.conf["WINDOW"]["width"])
|
self.init_width = int(self.conf["WINDOW"]["width"])
|
||||||
self.init_height = int(self.conf["WINDOW"]["height"])
|
self.init_height = int(self.conf["WINDOW"]["height"])
|
||||||
self.init_fullscreen = self.conf["WINDOW"].getboolean("fullscreen")
|
self.init_fullscreen = self.conf["WINDOW"].getboolean("fullscreen")
|
||||||
|
|
||||||
self.key_map = {
|
self.key_map = {
|
||||||
tetrislogic.State.STARTING: {
|
tetrislogic.State.STARTING: {
|
||||||
getattr(arcade.key, self.conf["KEYBOARD"]["start"]): self.new_game,
|
getattr(arcade.key, self.conf["KEYBOARD"]["start"]): self.new_game,
|
||||||
@ -225,7 +225,7 @@ class TetrArcade(tetrislogic.TetrisLogic, arcade.Window):
|
|||||||
)
|
)
|
||||||
self.game_over_text = """GAME
|
self.game_over_text = """GAME
|
||||||
OVER
|
OVER
|
||||||
|
|
||||||
PRESS
|
PRESS
|
||||||
[{}]
|
[{}]
|
||||||
TO PLAY
|
TO PLAY
|
||||||
@ -278,8 +278,8 @@ class TetrArcade(tetrislogic.TetrisLogic, arcade.Window):
|
|||||||
|
|
||||||
def lock(self):
|
def lock(self):
|
||||||
self.current.sprites.refresh()
|
self.current.sprites.refresh()
|
||||||
super().lock()
|
|
||||||
self.current.sprites.set_alpha(NORMAL_ALPHA)
|
self.current.sprites.set_alpha(NORMAL_ALPHA)
|
||||||
|
super().lock()
|
||||||
|
|
||||||
def on_key_press(self, key, modifiers):
|
def on_key_press(self, key, modifiers):
|
||||||
for key_or_modifier in (key, modifiers):
|
for key_or_modifier in (key, modifiers):
|
||||||
@ -458,7 +458,7 @@ High score could not be saved:
|
|||||||
else:
|
else:
|
||||||
arcade.unschedule(_task)
|
arcade.unschedule(_task)
|
||||||
arcade.schedule(_task, period)
|
arcade.schedule(_task, period)
|
||||||
|
|
||||||
def on_close(self):
|
def on_close(self):
|
||||||
self.save_high_score()
|
self.save_high_score()
|
||||||
super().on_close()
|
super().on_close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user