Merge pull request #95 from progtime-net/AddSoundToGUI
Add sound to g UI
This commit is contained in:
commit
ae47b8697c
16 changed files with 103 additions and 16 deletions
|
@ -56,6 +56,30 @@
|
|||
#begin MapData/TileSets/TilesetNature.tsj
|
||||
/copy:MapData/TileSets/TilesetNature.tsj
|
||||
|
||||
#begin sounds/Background menu music.wav
|
||||
/importer:WavImporter
|
||||
/processor:SoundEffectProcessor
|
||||
/processorParam:Quality=Best
|
||||
/build:sounds/Background menu music.wav
|
||||
|
||||
#begin sounds/Background music.wav
|
||||
/importer:WavImporter
|
||||
/processor:SoundEffectProcessor
|
||||
/processorParam:Quality=Best
|
||||
/build:sounds/Background music.wav
|
||||
|
||||
#begin sounds/Button click.wav
|
||||
/importer:WavImporter
|
||||
/processor:SoundEffectProcessor
|
||||
/processorParam:Quality=Best
|
||||
/build:sounds/Button click.wav
|
||||
|
||||
#begin sounds/Craft sound.wav
|
||||
/importer:WavImporter
|
||||
/processor:SoundEffectProcessor
|
||||
/processorParam:Quality=Best
|
||||
/build:sounds/Craft sound.wav
|
||||
|
||||
#begin sounds/Loot.wav
|
||||
/importer:WavImporter
|
||||
/processor:SoundEffectProcessor
|
||||
|
@ -98,6 +122,18 @@
|
|||
/processorParam:Quality=Best
|
||||
/build:sounds/Zombi stoit.wav
|
||||
|
||||
#begin sounds/zombie sound 2.wav
|
||||
/importer:WavImporter
|
||||
/processor:SoundEffectProcessor
|
||||
/processorParam:Quality=Best
|
||||
/build:sounds/zombie sound 2.wav
|
||||
|
||||
#begin sounds/zombie sound.wav
|
||||
/importer:WavImporter
|
||||
/processor:SoundEffectProcessor
|
||||
/processorParam:Quality=Best
|
||||
/build:sounds/zombie sound.wav
|
||||
|
||||
#begin Textures/Animations/player_down_idle.animation
|
||||
/copy:Textures/Animations/player_down_idle.animation
|
||||
|
||||
|
|
BIN
ZoFo/Content/sounds/Background menu music.wav
Normal file
BIN
ZoFo/Content/sounds/Background menu music.wav
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/Background music.wav
Normal file
BIN
ZoFo/Content/sounds/Background music.wav
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/Button click.wav
Normal file
BIN
ZoFo/Content/sounds/Button click.wav
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/Craft sound.wav
Normal file
BIN
ZoFo/Content/sounds/Craft sound.wav
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/zombie sound 2.wav
Normal file
BIN
ZoFo/Content/sounds/zombie sound 2.wav
Normal file
Binary file not shown.
BIN
ZoFo/Content/sounds/zombie sound.wav
Normal file
BIN
ZoFo/Content/sounds/zombie sound.wav
Normal file
Binary file not shown.
|
@ -142,6 +142,7 @@ public class BaseGUI : AbstractGUI
|
|||
ItemDisplayButtonsList.Add(temp);
|
||||
temp.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.SoundManager.StartAmbientSound("Craft sound");
|
||||
AppManager.Instance.playerData.CraftItem(item.Key);
|
||||
AppManager.Instance.SetGUI(new BaseGUI());
|
||||
};
|
||||
|
@ -163,7 +164,9 @@ public class BaseGUI : AbstractGUI
|
|||
textureName = "Textures\\GUI\\checkboxs_off"
|
||||
};
|
||||
Elements.Add(bTExit);
|
||||
bTExit.LeftButtonPressed += () => { AppManager.Instance.SetGUI(new MainMenuGUI()); };
|
||||
bTExit.LeftButtonPressed += () => { AppManager.Instance.SetGUI(new MainMenuGUI());
|
||||
AppManager.Instance.SoundManager.StartAmbientSound("Button click");
|
||||
};
|
||||
}
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
|
|
|
@ -27,11 +27,13 @@ public class HUD : AbstractGUI
|
|||
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "| |", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width - width / 30 - width / 40, height / 30, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"};
|
||||
Elements.Add(pauseButton);
|
||||
pauseButton.LeftButtonPressed += () =>
|
||||
{
|
||||
{
|
||||
AppManager.Instance.SoundManager.StartAmbientSound("Button click");
|
||||
AppManager.Instance.SetGUI(new PauseGUI());
|
||||
//AppManager.Instance.SetGUI(new FinishingGUI());
|
||||
overlayGUI = new PauseGUI();
|
||||
overlayGUI.Initialize();
|
||||
overlayGUI.LoadContent();
|
||||
overlayGUI.LoadContent();
|
||||
};
|
||||
Button invButton = new Button(Manager)
|
||||
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "inv", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width - width / 30 - width / 40, height / 15 + width / 40, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"};
|
||||
|
|
|
@ -40,7 +40,7 @@ public class MainMenuGUI : AbstractGUI
|
|||
};
|
||||
playButton.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.SoundManager.StartAmbientSound("Loot");
|
||||
AppManager.Instance.SoundManager.StartAmbientSound("Button click");
|
||||
AppManager.Instance.SetGUI(new SelectModeMenu());
|
||||
};
|
||||
Elements.Add(playButton);
|
||||
|
@ -55,6 +55,7 @@ public class MainMenuGUI : AbstractGUI
|
|||
};
|
||||
baseButton.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.SoundManager.StartAmbientSound("Button click");
|
||||
AppManager.Instance.SetGUI(new BaseGUI());
|
||||
};
|
||||
Elements.Add(baseButton);
|
||||
|
@ -69,7 +70,7 @@ public class MainMenuGUI : AbstractGUI
|
|||
};
|
||||
optionButton.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.SoundManager.StartAmbientSound("Loot");
|
||||
AppManager.Instance.SoundManager.StartAmbientSound("Button click");
|
||||
AppManager.Instance.SetGUI(new OptionsGUI());
|
||||
};
|
||||
Elements.Add(optionButton);
|
||||
|
|
|
@ -43,6 +43,7 @@ public class OptionsGUI : AbstractGUI
|
|||
label_OverallVolume_Percent.text = Math.Round(slider_OverallVolume.GetSliderValue * 100) + "%";
|
||||
slider_OverallVolume.SliderChanged += (newVal) =>
|
||||
{
|
||||
|
||||
label_OverallVolume_Percent.text = Math.Round(slider_OverallVolume.GetSliderValue * 100) + "%";
|
||||
AppManager.Instance.SettingsManager.SetMainVolume(newVal);
|
||||
};
|
||||
|
@ -64,6 +65,7 @@ public class OptionsGUI : AbstractGUI
|
|||
label_MusicVolume_Percent.text = Math.Round(slider_MusicVolume.GetSliderValue * 100) + "%";
|
||||
slider_MusicVolume.SliderChanged += (newVal) =>
|
||||
{
|
||||
|
||||
label_MusicVolume_Percent.text = Math.Round(slider_MusicVolume.GetSliderValue * 100) + "%";
|
||||
AppManager.Instance.SettingsManager.SetMusicVolume(newVal);
|
||||
};
|
||||
|
@ -85,6 +87,7 @@ public class OptionsGUI : AbstractGUI
|
|||
label_EffectsVolume_Percent.text = Math.Round(slider_EffectsVolume.GetSliderValue * 100) + "%";
|
||||
slider_EffectsVolume.SliderChanged += (newVal) =>
|
||||
{
|
||||
|
||||
label_EffectsVolume_Percent.text = Math.Round(slider_EffectsVolume.GetSliderValue * 100) + "%";
|
||||
AppManager.Instance.SettingsManager.SetSoundEffectsVolume(newVal);
|
||||
};
|
||||
|
@ -109,6 +112,7 @@ public class OptionsGUI : AbstractGUI
|
|||
button_FullScreen.SetIsChecked(AppManager.Instance.SettingsManager.IsFullScreen);
|
||||
button_FullScreen.Checked += (newCheckState) =>
|
||||
{
|
||||
AppManager.Instance.SoundManager.StartAmbientSound("Button click");
|
||||
AppManager.Instance.SettingsManager.SetIsFullScreen(newCheckState);
|
||||
};
|
||||
Elements.Add(button_FullScreen);
|
||||
|
@ -120,6 +124,7 @@ public class OptionsGUI : AbstractGUI
|
|||
Elements.Add(bTExit);
|
||||
bTExit.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.SoundManager.StartAmbientSound("Button click");
|
||||
AppManager.Instance.SetGUI(new MainMenuGUI());
|
||||
};
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ public class PauseGUI : AbstractGUI
|
|||
};
|
||||
continueButton.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.SoundManager.StartAmbientSound("Button click");
|
||||
AppManager.Instance.SetGUI(new HUD());
|
||||
};
|
||||
Elements.Add(continueButton);
|
||||
|
@ -45,6 +46,9 @@ public class PauseGUI : AbstractGUI
|
|||
};
|
||||
exitButton.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.SoundManager.StopAllSounds();
|
||||
AppManager.Instance.SoundManager.StartAmbientSound("Button click");
|
||||
AppManager.Instance.SoundManager.StartAmbientSound("Background menu music");
|
||||
AppManager.Instance.SetGUI(new MainMenuGUI());
|
||||
};
|
||||
Elements.Add(exitButton);
|
||||
|
|
|
@ -38,6 +38,9 @@ public class SelectModeMenu : AbstractGUI
|
|||
};
|
||||
singleButton.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.SoundManager.StopAllSounds();
|
||||
AppManager.Instance.SoundManager.StartAmbientSound("Background music");
|
||||
AppManager.Instance.SoundManager.StartAmbientSound("Button click");
|
||||
// single
|
||||
Server server = new Server();
|
||||
Client client = new Client();
|
||||
|
@ -68,6 +71,7 @@ public class SelectModeMenu : AbstractGUI
|
|||
};
|
||||
optionButton.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.SoundManager.StartAmbientSound("Button click");
|
||||
AppManager.Instance.SetGUI(new SelectingServerGUI());
|
||||
// multi
|
||||
|
||||
|
@ -80,6 +84,9 @@ public class SelectModeMenu : AbstractGUI
|
|||
Elements.Add(bTExit);
|
||||
bTExit.LeftButtonPressed += () =>
|
||||
{
|
||||
|
||||
AppManager.Instance.SoundManager.StartAmbientSound("Button click");
|
||||
|
||||
AppManager.Instance.SetGUI(new MainMenuGUI());
|
||||
};
|
||||
}
|
||||
|
|
|
@ -62,12 +62,14 @@ namespace ZoFo.GameCore.GameManagers
|
|||
ItemManager = new ItemManager.ItemManager();
|
||||
Instance = this;
|
||||
InputManager = new InputManager();
|
||||
SoundManager = new SoundManager();
|
||||
SoundManager.LoadSounds();
|
||||
SettingsManager = new SettingsManager();
|
||||
SettingsManager.LoadSettings();
|
||||
SoundManager = new SoundManager();
|
||||
|
||||
AssetManager = new AssetManager();
|
||||
SoundManager.LoadSounds();
|
||||
|
||||
|
||||
SoundManager.StartAmbientSound("Background menu music");
|
||||
|
||||
currentGUI = new MainMenuGUI();
|
||||
debugHud = new DebugHUD();
|
||||
|
|
|
@ -28,18 +28,21 @@ namespace ZoFo.GameCore.GameManagers
|
|||
public void SetMainVolume(float volume)
|
||||
{
|
||||
settingsContainer.MainVolume = volume;
|
||||
//AppManager.Instance.SoundManager.Update();
|
||||
// AppManager.Instance.SoundManager.Update();
|
||||
SaveSettings();
|
||||
}
|
||||
public void SetMusicVolume(float volume)
|
||||
{
|
||||
settingsContainer.MusicVolume = volume;
|
||||
//AppManager.Instance.SoundManager.Update();
|
||||
|
||||
SaveSettings();
|
||||
|
||||
}
|
||||
public void SetSoundEffectsVolume(float volume)
|
||||
{
|
||||
settingsContainer.SoundEffectsVolume = volume;
|
||||
// AppManager.Instance.SoundManager.Update();
|
||||
SaveSettings();
|
||||
|
||||
}
|
||||
|
@ -68,6 +71,7 @@ namespace ZoFo.GameCore.GameManagers
|
|||
}
|
||||
public void SaveSettings()
|
||||
{
|
||||
AppManager.Instance.SoundManager.Update();
|
||||
using (StreamWriter streamWriter = new StreamWriter("GameSettings.txt"))
|
||||
{
|
||||
string _str = JsonConvert.SerializeObject(settingsContainer);
|
||||
|
|
|
@ -43,17 +43,38 @@ namespace ZoFo.GameCore.GameObjects
|
|||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (isDying) return;
|
||||
Vector2 duration = Vector2.Normalize(
|
||||
AppManager.Instance.server.players[0].position - position
|
||||
{
|
||||
if (isDying) return;
|
||||
float m = 10000000;
|
||||
int j = -1;
|
||||
for (int i = 0; i < AppManager.Instance.server.players.Count; i++)
|
||||
{
|
||||
var player = AppManager.Instance.server.players[i];
|
||||
if (m > (player.position.X - position.X) * (player.position.X - position.X) + (player.position.Y - position.Y) * (player.position.Y - position.Y))
|
||||
{
|
||||
m = (player.position.X - position.X) * (player.position.X - position.X) + (player.position.Y - position.Y) * (player.position.Y - position.Y);
|
||||
j = i;
|
||||
}
|
||||
}
|
||||
Vector2 duration = Vector2.Zero;
|
||||
if (m<= 130000)
|
||||
{
|
||||
duration = Vector2.Normalize(
|
||||
AppManager.Instance.server.players[j].position - position
|
||||
);
|
||||
if (new Random().Next(0, 1000) == 0)
|
||||
{
|
||||
AppManager.Instance.SoundManager.StartSound("zombie sound", position, AppManager.Instance.server.players[0].position, pitch: new Random().Next(-1, 2) * (float)new Random().NextDouble());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (!isAttacking) { velocity += new Vector2(duration.X * speed, duration.Y * speed); }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
public void OnPlayerClose(GameObject sender)
|
||||
{
|
||||
|
@ -61,6 +82,8 @@ namespace ZoFo.GameCore.GameObjects
|
|||
|
||||
if(!isAttacking)
|
||||
{
|
||||
|
||||
AppManager.Instance.SoundManager.StartSound("Zombi napal", position, AppManager.Instance.server.players[0].position,pitch:new Random().Next(-1,2)*(float)new Random().NextDouble());
|
||||
StartAnimation("zombie_attack");
|
||||
isAttacking = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue