Merge pull request #44 from progtime-net/FixSound

FinalFix
This commit is contained in:
Andrey 2024-08-17 12:08:49 +03:00 committed by GitHub
commit 3784e24497
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 41 additions and 38 deletions

View file

@ -73,12 +73,6 @@
/processorParam:Quality=Best
/build:sounds/Tabletki 2.wav
#begin sounds/Tabletki.mp3
/importer:Mp3Importer
/processor:SongProcessor
/processorParam:Quality=Best
/build:sounds/Tabletki.mp3
#begin sounds/Zombi napal.wav
/importer:WavImporter
/processor:SoundEffectProcessor
@ -91,18 +85,6 @@
/processorParam:Quality=Best
/build:sounds/Zombi stoit.wav
#begin Textures/AnimationTextures/Character/hr-level1_idle_gun.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Character/hr-level1_idle_gun.png
#begin Textures/AnimationTextures/Character/hr-level1_idle.png
/importer:TextureImporter
/processor:TextureProcessor
@ -115,6 +97,18 @@
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Character/hr-level1_idle.png
#begin Textures/AnimationTextures/Character/hr-level1_idle_gun.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Character/hr-level1_idle_gun.png
#begin Textures/AnimationTextures/Character/hr-level1_mining_tool-1.png
/importer:TextureImporter
/processor:TextureProcessor
@ -139,18 +133,6 @@
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Character/hr-level1_mining_tool-2.png
#begin Textures/AnimationTextures/Character/hr-level1_running_gun.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Character/hr-level1_running_gun.png
#begin Textures/AnimationTextures/Character/hr-level1_running.png
/importer:TextureImporter
/processor:TextureProcessor
@ -163,6 +145,18 @@
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Character/hr-level1_running.png
#begin Textures/AnimationTextures/Character/hr-level1_running_gun.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/AnimationTextures/Character/hr-level1_running_gun.png
#begin Textures/AnimationTextures/unicorn.png
/importer:TextureImporter
/processor:TextureProcessor

Binary file not shown.

View file

@ -40,6 +40,7 @@ public class MainMenuGUI : AbstractGUI
};
playButton.LeftButtonPressed += () =>
{
AppManager.Instance.SoundManager.StartAmbientSound("Loot");
AppManager.Instance.SetGUI(new SelectModeMenu());
};
Elements.Add(playButton);
@ -54,6 +55,7 @@ public class MainMenuGUI : AbstractGUI
};
optionButton.LeftButtonPressed += () =>
{
AppManager.Instance.SoundManager.StartAmbientSound("Loot");
AppManager.Instance.SetGUI(new OptionsGUI());
};
Elements.Add(optionButton);

View file

@ -6,7 +6,7 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using System.Linq;
using DangerousD.GameCore.Graphics;
using Newtonsoft.Json;
using Microsoft.Xna.Framework.Media;
@ -20,23 +20,28 @@ namespace ZoFo.GameCore.GameManagers
public void LoadSounds() // метод для загрузки звуков из папки
{
var k = Directory.GetFiles("../../..//Content//sounds").Where(x => x.EndsWith("wav"));
//List<string> sounds = AppManager.Instance.Content.Load<List<string>>("sounds/");
var k = Directory.GetFiles(Directory.GetCurrentDirectory() + "//Content//sounds").Where(x => x.EndsWith("xnb"));
if (k.Count() > 0)
{
string[] soundFiles = k.Select(x => x.Split("\\").Last().Split("/").Last().Replace(".wav", "")).ToArray();// папка со звуками там где exe
string[] soundFiles = k.Select(x => x.Split("\\").Last().Split("/").Last().Replace(".xnb", "")).ToArray();// папка со звуками там где exe
foreach (var soundFile in soundFiles)
{
Sounds.Add(soundFile, AppManager.Instance.Content.Load<SoundEffect>("sounds//" + soundFile));
}
}
if (k.Count() > 0)
/*/if (sounds.Count() > 0)
{
foreach (var soundFile in sounds)
{
Sounds.Add(soundFile, AppManager.Instance.Content.Load<SoundEffect>("sounds/" + soundFile));
}
}/*/
}
}
public void StartAmbientSound(string soundName) // запустить звук у которого нет позиции

View file

@ -11,8 +11,11 @@
<ApplicationIcon>Icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Content\sounds\Zombie\**" />
<Compile Remove="GameCore\GameObjects\BaseClasses\**" />
<EmbeddedResource Remove="Content\sounds\Zombie\**" />
<EmbeddedResource Remove="GameCore\GameObjects\BaseClasses\**" />
<None Remove="Content\sounds\Zombie\**" />
<None Remove="GameCore\GameObjects\BaseClasses\**" />
</ItemGroup>
<ItemGroup>
@ -32,7 +35,6 @@
<ProjectReference Include="..\MonogameLibrary\MonogameLibrary.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Content\sounds\Zombie\" />
<Folder Include="Content\Textures\GUI\" />
</ItemGroup>
<Target Name="RestoreDotnetTools" BeforeTargets="Restore">