latest dev

This commit is contained in:
_Bastler 2021-11-30 17:43:22 +01:00
parent ee6443670a
commit 2366011238
6 changed files with 12 additions and 16 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -15,15 +15,12 @@
let unsubscriberFileStore: Unsubscriber | null = null;
let unsubscriberVolumeStore: Unsubscriber | null = null;
let volume: number = 1;
let decreaseWhileTalking: boolean = true;
onMount(() => {
volume = localUserStore.getAudioPlayerVolume();
let volume = Math.min(localUserStore.getAudioPlayerVolume(), get(audioManagerVolumeStore).volume);
audioManagerVolumeStore.setVolume(volume);
audioManagerVolumeStore.setMuted(localUserStore.getAudioPlayerMuted());
changeVolume();
loadAudioSettings();
unsubscriberFileStore = audioManagerFileStore.subscribe(() => {
HTMLAudioPlayer.pause();
@ -43,6 +40,7 @@
HTMLAudioPlayer.volume = audioManager.volume;
HTMLAudioPlayer.muted = audioManager.muted;
HTMLAudioPlayer.loop = audioManager.loop;
updateVolumeUI();
})
})
@ -55,11 +53,12 @@
}
})
function changeVolume() {
function updateVolumeUI() {
if (get(audioManagerVolumeStore).muted) {
audioPlayerVolumeIcon.classList.add('muted');
audioPlayerVol.value = "0";
} else {
let volume = HTMLAudioPlayer.volume;
audioPlayerVol.value = "" + volume;
audioPlayerVolumeIcon.classList.remove('muted');
if (volume < 0.3) {
@ -78,21 +77,14 @@
const muted = !get(audioManagerVolumeStore).muted;
audioManagerVolumeStore.setMuted(muted);
localUserStore.setAudioPlayerMuted(muted);
changeVolume();
}
function loadAudioSettings() {
audioManagerVolumeStore.setVolume(localUserStore.getAudioPlayerVolume());
audioManagerVolumeStore.setMuted(localUserStore.getAudioPlayerMuted());
}
function setVolume() {
volume = parseFloat(audioPlayerVol.value);
let volume = parseFloat(audioPlayerVol.value);
audioManagerVolumeStore.setVolume(volume);
localUserStore.setAudioPlayerVolume(volume);
audioManagerVolumeStore.setMuted(false);
localUserStore.setAudioPlayerMuted(false);
changeVolume();
}
function disallowKeys() {
@ -208,4 +200,4 @@
display: none;
}
}
</style>
</style>

View File

@ -1,7 +1,7 @@
export interface CompanionResourceDescriptionInterface {
name: string;
img: string;
behaviour: "dog" | "cat";
behaviour: "dog" | "cat" | "butterfly" | "chicken" | "bird";
}
export const COMPANION_RESOURCES: CompanionResourceDescriptionInterface[] = [
@ -11,4 +11,8 @@ export const COMPANION_RESOURCES: CompanionResourceDescriptionInterface[] = [
{ name: "cat1", img: "resources/characters/pipoya/Cat 01-1.png", behaviour: "cat" },
{ name: "cat2", img: "resources/characters/pipoya/Cat 01-2.png", behaviour: "cat" },
{ name: "cat3", img: "resources/characters/pipoya/Cat 01-3.png", behaviour: "cat" },
{ name: "butterfly1", img: "resources/characters/pipoya/Butterfly 01-1.png", behaviour: "butterfly" },
{ name: "chicken1", img: "resources/characters/pipoya/Chicken 01-1.png", behaviour: "chicken" },
{ name: "bird1", img: "resources/characters/pipoya/Bird 01-1.png", behaviour: "bird" },
{ name: "pokemon1", img: "resources/characters/pipoya/Pika 01-1.png", behaviour: "cat" },
];