mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-03-30 01:33:20 -07:00
APQuest: Various fixes (#6079)
* Import Buffer from typing_extensions instead of collections.abc for 3.11 compat * always re-set sound volumes before playing * fix game window scaling if parent is vertical * make default volume lower
This commit is contained in:
@@ -77,7 +77,7 @@ class APQuestGrid(GridLayout):
|
||||
parent_width, parent_height = self.parent.size
|
||||
|
||||
self_width_according_to_parent_height = parent_height * 12 / 11
|
||||
self_height_according_to_parent_width = parent_height * 11 / 12
|
||||
self_height_according_to_parent_width = parent_width * 11 / 12
|
||||
|
||||
if self_width_according_to_parent_height > parent_width:
|
||||
self.size = parent_width, self_height_according_to_parent_width
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import pkgutil
|
||||
from collections.abc import Buffer
|
||||
from enum import Enum
|
||||
from io import BytesIO
|
||||
from typing import Literal, NamedTuple, Protocol, cast
|
||||
|
||||
from kivy.uix.image import CoreImage
|
||||
from typing_extensions import Buffer
|
||||
|
||||
from CommonClient import logger
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import asyncio
|
||||
import pkgutil
|
||||
from asyncio import Task
|
||||
from collections.abc import Buffer
|
||||
from pathlib import Path
|
||||
from typing import cast
|
||||
|
||||
from kivy import Config
|
||||
from kivy.core.audio import Sound, SoundLoader
|
||||
from typing_extensions import Buffer
|
||||
|
||||
from CommonClient import logger
|
||||
|
||||
@@ -85,7 +85,7 @@ class SoundManager:
|
||||
|
||||
def ensure_config(self) -> None:
|
||||
Config.adddefaultsection("APQuest")
|
||||
Config.setdefault("APQuest", "volume", 50)
|
||||
Config.setdefault("APQuest", "volume", 30)
|
||||
self.set_volume_percentage(Config.getint("APQuest", "volume"))
|
||||
|
||||
async def sound_manager_loop(self) -> None:
|
||||
@@ -149,6 +149,7 @@ class SoundManager:
|
||||
continue
|
||||
|
||||
if sound_name == audio_filename:
|
||||
sound.volume = self.volume_percentage / 100
|
||||
sound.play()
|
||||
self.update_background_music()
|
||||
higher_priority_sound_is_playing = True
|
||||
@@ -213,6 +214,7 @@ class SoundManager:
|
||||
# It ends up feeling better if this just always continues playing quietly after being started.
|
||||
# Even "fading in at a random spot" is better than restarting the song after a jingle / math trap.
|
||||
if self.game_started and song.state == "stop":
|
||||
song.volume = self.current_background_music_volume * self.volume_percentage / 100
|
||||
song.play()
|
||||
song.seek(0)
|
||||
continue
|
||||
@@ -228,6 +230,7 @@ class SoundManager:
|
||||
|
||||
if self.current_background_music_volume != 0:
|
||||
if song.state == "stop":
|
||||
song.volume = self.current_background_music_volume * self.volume_percentage / 100
|
||||
song.play()
|
||||
song.seek(0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user