Merge pull request #29 from progtime-net/UpdateSettings
Update settings
This commit is contained in:
commit
1ca4f29729
14 changed files with 92 additions and 28 deletions
|
@ -24,6 +24,10 @@ namespace MonogameLibrary.UI.Elements
|
|||
private bool isChecked;
|
||||
HoverState hoverState = HoverState.None;
|
||||
public bool GetChecked { get { return isChecked; } }
|
||||
public void SetIsChecked(bool isChecked)
|
||||
{
|
||||
this.isChecked=isChecked;
|
||||
}
|
||||
public bool InteractUpdate(MouseState mouseState, MouseState prevmouseState)
|
||||
{
|
||||
if (rectangle.Intersects(new Rectangle(mouseState.Position, Point.Zero)))
|
||||
|
|
|
@ -34,6 +34,56 @@
|
|||
/processorParam:TextureFormat=Compressed
|
||||
/build:Fonts/Font3.spritefont
|
||||
|
||||
#begin sounds/Loot.wav
|
||||
/importer:WavImporter
|
||||
/processor:SoundEffectProcessor
|
||||
/processorParam:Quality=Best
|
||||
/build:sounds/Loot.wav
|
||||
|
||||
#begin sounds/Odevanie odezdi.wav
|
||||
/importer:WavImporter
|
||||
/processor:SoundEffectProcessor
|
||||
/processorParam:Quality=Best
|
||||
/build:sounds/Odevanie odezdi.wav
|
||||
|
||||
#begin sounds/Pieot wodichky.wav
|
||||
/importer:WavImporter
|
||||
/processor:SoundEffectProcessor
|
||||
/processorParam:Quality=Best
|
||||
/build:sounds/Pieot wodichky.wav
|
||||
|
||||
#begin sounds/Sshetchik geigera.wav
|
||||
/importer:WavImporter
|
||||
/processor:SoundEffectProcessor
|
||||
/processorParam:Quality=Best
|
||||
/build:sounds/Sshetchik geigera.wav
|
||||
|
||||
#begin sounds/Tabletki 2.wav
|
||||
/importer:WavImporter
|
||||
/processor:SoundEffectProcessor
|
||||
/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
|
||||
/processorParam:Quality=Best
|
||||
/build:sounds/Zombi napal.wav
|
||||
|
||||
#begin sounds/Zombi stoit.wav
|
||||
/importer:WavImporter
|
||||
/processor:SoundEffectProcessor
|
||||
/processorParam:Quality=Best
|
||||
/build:sounds/Zombi stoit.wav
|
||||
|
||||
#begin Textures/GUI/checkboxs_off.png
|
||||
|
||||
#begin Textures/GUI/background/base.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
|
@ -92,9 +142,9 @@
|
|||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:Textures/GUI/checkboxs_off-on.png
|
||||
/build:Textures/GUI/checkboxs_off.png
|
||||
|
||||
#begin Textures/GUI/checkboxs_off.png
|
||||
#begin Textures/GUI/checkboxs_off-on.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
/processorParam:ColorKeyColor=255,0,255,255
|
||||
|
@ -104,7 +154,7 @@
|
|||
/processorParam:ResizeToPowerOfTwo=False
|
||||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:Textures/GUI/checkboxs_off.png
|
||||
/build:Textures/GUI/checkboxs_off-on.png
|
||||
|
||||
#begin Textures/GUI/checkboxs_on.png
|
||||
/importer:TextureImporter
|
||||
|
@ -142,18 +192,6 @@
|
|||
/processorParam:TextureFormat=Color
|
||||
/build:Textures/GUI/mouse.png
|
||||
|
||||
#begin Textures/GUI/Switch_backgrownd.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/GUI/Switch_backgrownd.png
|
||||
|
||||
#begin Textures/GUI/switch.png
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
|
@ -166,3 +204,15 @@
|
|||
/processorParam:TextureFormat=Color
|
||||
/build:Textures/GUI/switch.png
|
||||
|
||||
#begin Textures/GUI/Switch_backgrownd.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/GUI/Switch_backgrownd.png
|
||||
|
||||
|
|
BIN
ZoFo/Content/sounds/Loot.wav
Normal file
BIN
ZoFo/Content/sounds/Loot.wav
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/Odevanie odezdi.wav
Normal file
BIN
ZoFo/Content/sounds/Odevanie odezdi.wav
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/Pieot wodichky.wav
Normal file
BIN
ZoFo/Content/sounds/Pieot wodichky.wav
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/Sshetchik geigera.wav
Normal file
BIN
ZoFo/Content/sounds/Sshetchik geigera.wav
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/Tabletki 2.wav
Normal file
BIN
ZoFo/Content/sounds/Tabletki 2.wav
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/Tabletki.mp3
Normal file
BIN
ZoFo/Content/sounds/Tabletki.mp3
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/Zombi napal.wav
Normal file
BIN
ZoFo/Content/sounds/Zombi napal.wav
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/Zombi stoit.wav
Normal file
BIN
ZoFo/Content/sounds/Zombi stoit.wav
Normal file
Binary file not shown.
|
@ -35,9 +35,10 @@ public class OptionsGUI : AbstractGUI
|
|||
|
||||
var slider_OverallVolume = new Slider(Manager)
|
||||
{ rectangle = new Rectangle(width / 2, height / 3, width / 10, height / 20), indentation = 4, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 };
|
||||
slider_OverallVolume.SetValue(AppManager.Instance.SettingsManager.MainVolume);
|
||||
slider_OverallVolume.SliderChanged += (newVal) =>
|
||||
{
|
||||
|
||||
AppManager.Instance.SettingsManager.SetMainVolume(newVal);
|
||||
};
|
||||
Elements.Add(slider_OverallVolume);
|
||||
|
||||
|
@ -47,9 +48,10 @@ public class OptionsGUI : AbstractGUI
|
|||
|
||||
var slider_MusicVolume = new Slider(Manager)
|
||||
{ rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 1, width / 10, height / 20), indentation = 4, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 };
|
||||
slider_MusicVolume.SetValue(AppManager.Instance.SettingsManager.MusicVolume);
|
||||
slider_MusicVolume.SliderChanged += (newVal) =>
|
||||
{
|
||||
|
||||
AppManager.Instance.SettingsManager.SetMusicVolume(newVal);
|
||||
};
|
||||
Elements.Add(slider_MusicVolume);
|
||||
|
||||
|
@ -60,9 +62,10 @@ public class OptionsGUI : AbstractGUI
|
|||
|
||||
var slider_EffectsVolume = new Slider(Manager)
|
||||
{ rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 2, width / 10, height / 20), indentation = 4, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 };
|
||||
slider_EffectsVolume.SetValue(AppManager.Instance.SettingsManager.SoundEffectsVolume);
|
||||
slider_EffectsVolume.SliderChanged += (newVal) =>
|
||||
{
|
||||
|
||||
AppManager.Instance.SettingsManager.SetSoundEffectsVolume(newVal);
|
||||
};
|
||||
Elements.Add(slider_EffectsVolume);
|
||||
|
||||
|
@ -80,9 +83,10 @@ public class OptionsGUI : AbstractGUI
|
|||
Elements.Add(label_IsFullScreen);
|
||||
|
||||
var button_FullScreen = new CheckBox(Manager) { rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 4, width / 40, width / 40) };
|
||||
button_FullScreen.SetIsChecked(AppManager.Instance.SettingsManager.IsFullScreen);
|
||||
button_FullScreen.Checked += (newCheckState) =>
|
||||
{
|
||||
|
||||
AppManager.Instance.SettingsManager.SetIsFullScreen(newCheckState);
|
||||
};
|
||||
Elements.Add(button_FullScreen);
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@ namespace ZoFo.GameCore.GameManagers
|
|||
|
||||
public InputManager InputManager;
|
||||
public ItemManager.ItemManager ItemManager;
|
||||
public SettingsManager SettingsManager;
|
||||
public SoundManager SoundManager;
|
||||
|
||||
public AnimationBuilder animationBuilder { get; set; }
|
||||
|
||||
|
@ -53,8 +55,11 @@ namespace ZoFo.GameCore.GameManagers
|
|||
|
||||
Instance = this;
|
||||
InputManager = new InputManager();
|
||||
|
||||
|
||||
SettingsManager = new SettingsManager();
|
||||
SettingsManager.LoadSettings();
|
||||
SoundManager = new SoundManager();
|
||||
SoundManager.LoadSounds();
|
||||
|
||||
|
||||
currentGUI = new MainMenuGUI();
|
||||
debugHud = new DebugHUD();
|
||||
|
|
|
@ -20,12 +20,12 @@ namespace ZoFo.GameCore.GameManagers
|
|||
|
||||
public void LoadSounds() // метод для загрузки звуков из папки
|
||||
{
|
||||
var k = Directory.GetFiles("../../..//Content//sounds").Where(x => x.EndsWith("mp3"));
|
||||
var k = Directory.GetFiles("../../..//Content//sounds").Where(x => x.EndsWith("wav"));
|
||||
|
||||
if (k.Count() > 0)
|
||||
{
|
||||
|
||||
string[] soundFiles = k.Select(x => x.Split("\\").Last().Split("/").Last().Replace(".mp3", "")).ToArray();// папка со звуками там где exe
|
||||
string[] soundFiles = k.Select(x => x.Split("\\").Last().Split("/").Last().Replace(".wav", "")).ToArray();// папка со звуками там где exe
|
||||
foreach (var soundFile in soundFiles)
|
||||
{
|
||||
Sounds.Add(soundFile, AppManager.Instance.Content.Load<SoundEffect>("sounds//" + soundFile));
|
||||
|
@ -42,7 +42,7 @@ namespace ZoFo.GameCore.GameManagers
|
|||
public void StartAmbientSound(string soundName) // запустить звук у которого нет позиции
|
||||
{
|
||||
var sound = new Sound(Sounds[soundName].CreateInstance(), Vector2.One, true);
|
||||
// ждать пока настройки появятся sound.SoundEffect.Volume = sound.baseVolume * AppManager.Instance.SettingsManager.MusicVolume * AppManager.Instance.SettingsManager.MainVolume;
|
||||
sound.SoundEffect.Volume = sound.baseVolume * AppManager.Instance.SettingsManager.MusicVolume * AppManager.Instance.SettingsManager.MainVolume;
|
||||
sound.SoundEffect.IsLooped = false;
|
||||
|
||||
sound.SoundEffect.Play();
|
||||
|
@ -57,7 +57,7 @@ namespace ZoFo.GameCore.GameManagers
|
|||
{
|
||||
var sound = new Sound(Sounds[soundName].CreateInstance(), soundPos, false) { baseVolume = baseVolume, basePich = pitch };
|
||||
sound.SoundEffect.IsLooped = false;
|
||||
//ждать пока настройки появятся sound.SoundEffect.Volume = sound.baseVolume * AppManager.Instance.SettingsManager.SoundEffectsVolume * AppManager.Instance.SettingsManager.MainVolume;
|
||||
sound.SoundEffect.Volume = sound.baseVolume * AppManager.Instance.SettingsManager.SoundEffectsVolume * AppManager.Instance.SettingsManager.MainVolume;
|
||||
sound.SoundEffect.Pitch = pitch;
|
||||
sound.SoundEffect.Play();
|
||||
PlayingSounds.Add(sound);
|
||||
|
@ -78,7 +78,7 @@ namespace ZoFo.GameCore.GameManagers
|
|||
{
|
||||
for (int i = 0; i < PlayingSounds.Count; i++)
|
||||
{
|
||||
//PlayingSounds[i].UpdateVolume(Vector2.Zero);
|
||||
PlayingSounds[i].UpdateVolume(Vector2.Zero);
|
||||
if (PlayingSounds[i].SoundEffect.State == SoundState.Stopped)
|
||||
{
|
||||
PlayingSounds.Remove(PlayingSounds[i]);
|
||||
|
@ -114,14 +114,14 @@ namespace ZoFo.GameCore.GameManagers
|
|||
SoundEffect = soundEffect;
|
||||
Position = position;
|
||||
}
|
||||
/*/public void UpdateVolume(Vector2 playerPos)
|
||||
public void UpdateVolume(Vector2 playerPos)
|
||||
{
|
||||
if (isAmbient)
|
||||
SoundEffect.Volume = baseVolume * AppManager.Instance.SettingsManager.MusicVolume * AppManager.Instance.SettingsManager.MainVolume;
|
||||
else
|
||||
SoundEffect.Volume = baseVolume * AppManager.Instance.SettingsManager.SoundEffectsVolume * AppManager.Instance.SettingsManager.MainVolume;// * (float)Math.Clamp(1 - GetDistanceVol(playerPos),0,1);
|
||||
|
||||
}/*/
|
||||
}
|
||||
|
||||
public double GetDistanceVol(Vector2 playerPos) // получение дистанции до объедка от игрока
|
||||
{
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
<ProjectReference Include="..\MonogameLibrary\MonogameLibrary.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Content\sounds\Zombie\" />
|
||||
<Folder Include="Content\Textures\GUI\" />
|
||||
</ItemGroup>
|
||||
<Target Name="RestoreDotnetTools" BeforeTargets="Restore">
|
||||
|
|
Loading…
Add table
Reference in a new issue