commit
79c5213c1b
13 changed files with 98 additions and 60 deletions
|
@ -53,9 +53,9 @@ namespace MonogameLibrary.UI.Elements
|
|||
|
||||
public override void LoadTexture(ContentManager content)
|
||||
{
|
||||
texture1 = content.Load<Texture2D>("Textures\\GUI\\checkboxs_off");
|
||||
texture2 = content.Load<Texture2D>("Textures\\GUI\\checkboxs_off-on");
|
||||
texture3 = content.Load<Texture2D>("Textures\\GUI\\checkboxs_on");
|
||||
texture1 = content.Load<Texture2D>("Textures/GUI/checkboxs_off");
|
||||
texture2 = content.Load<Texture2D>("Textures/GUI/checkboxs_off-on");
|
||||
texture3 = content.Load<Texture2D>("Textures/GUI/checkboxs_on");
|
||||
base.LoadTexture(content);
|
||||
}
|
||||
public override void Draw(SpriteBatch _spriteBatch)
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace MonogameLibrary.UI.Elements
|
|||
|
||||
public override void LoadTexture(ContentManager content)
|
||||
{
|
||||
texture2 = content.Load<Texture2D>("Textures\\GUI\\switch");
|
||||
texture2 = content.Load<Texture2D>("Textures/GUI/switch");
|
||||
base.LoadTexture(content);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public abstract class AbstractGUI
|
|||
public virtual void LoadContent()
|
||||
{
|
||||
Manager.LoadContent(AppManager.Instance.Content, "Font");
|
||||
mouse = AppManager.Instance.Content.Load<Texture2D>("Textures\\GUI\\mouse");
|
||||
mouse = AppManager.Instance.Content.Load<Texture2D>("Textures/GUI/mouse");
|
||||
}
|
||||
|
||||
public virtual void Update(GameTime gameTime)
|
||||
|
|
|
@ -20,7 +20,7 @@ public class DebugHUD
|
|||
|
||||
public void LoadContent()
|
||||
{
|
||||
_spriteFont = AppManager.Instance.Content.Load<SpriteFont>("Fonts\\Font2");
|
||||
_spriteFont = AppManager.Instance.Content.Load<SpriteFont>("Fonts/Font2");
|
||||
}
|
||||
|
||||
public void Update(GameTime gameTime)
|
||||
|
|
|
@ -22,11 +22,11 @@ public class MainMenuGUI : AbstractGUI
|
|||
int width = AppManager.Instance.CurentScreenResolution.X;
|
||||
int height = AppManager.Instance.CurentScreenResolution.Y;
|
||||
|
||||
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures\\GUI\\background\\mainMenu" };
|
||||
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures/GUI/background/mainMenu" };
|
||||
Elements.Add(menuBackground);
|
||||
menuBackground.LoadTexture(AppManager.Instance.Content);
|
||||
|
||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 5, (int)(width / 4), (int)(height / 20)), text = "ZoFo", fontColor = Color.Black, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"});
|
||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 5, (int)(width / 4), (int)(height / 20)), text = "ZoFo", fontColor = Color.Black, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts/Font"});
|
||||
|
||||
|
||||
Button playButton = new Button(Manager)
|
||||
|
@ -36,7 +36,7 @@ public class MainMenuGUI : AbstractGUI
|
|||
scale = 0.2f,
|
||||
fontColor = Color.White,
|
||||
mainColor = Color.Gray,
|
||||
fontName = "Fonts\\Font"
|
||||
fontName = "Fonts/Font"
|
||||
};
|
||||
playButton.LeftButtonPressed += () =>
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ public class MainMenuGUI : AbstractGUI
|
|||
scale = 0.2f,
|
||||
fontColor = Color.White,
|
||||
mainColor = Color.Gray,
|
||||
fontName = "Fonts\\Font"
|
||||
fontName = "Fonts/Font"
|
||||
};
|
||||
optionButton.LeftButtonPressed += () =>
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ public class MainMenuGUI : AbstractGUI
|
|||
scale = 0.2f,
|
||||
fontColor = Color.White,
|
||||
mainColor = Color.Gray,
|
||||
fontName = "Fonts\\Font"
|
||||
fontName = "Fonts/Font"
|
||||
};
|
||||
exitButton.LeftButtonPressed += () =>
|
||||
{
|
||||
|
|
|
@ -21,24 +21,24 @@ public class OptionsGUI : AbstractGUI
|
|||
int width = AppManager.Instance.CurentScreenResolution.X;
|
||||
int height = AppManager.Instance.CurentScreenResolution.Y;
|
||||
|
||||
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures\\GUI\\background\\options" };
|
||||
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures/GUI/background/options" };
|
||||
Elements.Add(menuBackground);
|
||||
menuBackground.LoadTexture(AppManager.Instance.Content);
|
||||
|
||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 5, (int)(width / 4), (int)(height / 20)), text = "Options", fontColor = Color.Black, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"});
|
||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 5, (int)(width / 4), (int)(height / 20)), text = "Options", fontColor = Color.Black, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts/Font"});
|
||||
|
||||
|
||||
|
||||
Label label_OverallVolume = new Label(Manager)
|
||||
{ fontName = "Fonts\\Font", scale = 0.2f, text = "All Volume", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
|
||||
{ fontName = "Fonts/Font", scale = 0.2f, text = "All Volume", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
|
||||
Elements.Add(label_OverallVolume);
|
||||
|
||||
Label label_OverallVolume_Percent = new Label(Manager)
|
||||
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "", fontColor = Color.Black, rectangle = new Rectangle(width / 2 + width / 10, height / 3, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
|
||||
{ fontName = "Fonts/Font3", scale = 0.4f, text = "", fontColor = Color.Black, rectangle = new Rectangle(width / 2 + width / 10, height / 3, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
|
||||
Elements.Add(label_OverallVolume_Percent);
|
||||
|
||||
var slider_OverallVolume = new Slider(Manager)
|
||||
{ rectangle = new Rectangle(width / 2, height / 3, width / 10, height / 20), indentation = 7, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 };
|
||||
{ rectangle = new Rectangle(width / 2, height / 3, width / 10, height / 20), indentation = 7, textureName = "Textures/GUI/Switch_backgrownd", MinValue = 0, MaxValue = 1 };
|
||||
slider_OverallVolume.SetValue(AppManager.Instance.SettingsManager.MainVolume);
|
||||
slider_OverallVolume.SliderChanged += (newVal) =>
|
||||
{
|
||||
|
@ -50,15 +50,15 @@ public class OptionsGUI : AbstractGUI
|
|||
//--------------------------------------
|
||||
|
||||
Label label_MusicVolume = new Label(Manager)
|
||||
{ fontName = "Fonts\\Font", scale = 0.2f, text = "Music Volume", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 1, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
|
||||
{ fontName = "Fonts/Font", scale = 0.2f, text = "Music Volume", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 1, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
|
||||
Elements.Add(label_MusicVolume);
|
||||
|
||||
Label label_MusicVolume_Percent = new Label(Manager)
|
||||
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "", fontColor = Color.Black, rectangle = new Rectangle(width / 2 + width / 10, height / 3 + (height / 20 + height / 40) * 1, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
|
||||
{ fontName = "Fonts/Font3", scale = 0.4f, text = "", fontColor = Color.Black, rectangle = new Rectangle(width / 2 + width / 10, height / 3 + (height / 20 + height / 40) * 1, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
|
||||
Elements.Add(label_MusicVolume_Percent);
|
||||
|
||||
var slider_MusicVolume = new Slider(Manager)
|
||||
{ rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 1, width / 10, height / 20), indentation = 7, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 };
|
||||
{ rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 1, width / 10, height / 20), indentation = 7, textureName = "Textures/GUI/Switch_backgrownd", MinValue = 0, MaxValue = 1 };
|
||||
slider_MusicVolume.SetValue(AppManager.Instance.SettingsManager.MusicVolume);
|
||||
slider_MusicVolume.SliderChanged += (newVal) =>
|
||||
{
|
||||
|
@ -70,15 +70,15 @@ public class OptionsGUI : AbstractGUI
|
|||
//--------------------------------------
|
||||
|
||||
Label label_EffectsVolume = new Label(Manager)
|
||||
{ fontName = "Fonts\\Font", scale = 0.2f, text = "Effects Volume", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 2, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
|
||||
{ fontName = "Fonts/Font", scale = 0.2f, text = "Effects Volume", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 2, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
|
||||
Elements.Add(label_EffectsVolume);
|
||||
|
||||
Label label_EffectsVolume_Percent = new Label(Manager)
|
||||
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "", fontColor = Color.Black, rectangle = new Rectangle(width / 2 + width / 10, height / 3 + (height / 20 + height / 40) * 2, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
|
||||
{ fontName = "Fonts/Font3", scale = 0.4f, text = "", fontColor = Color.Black, rectangle = new Rectangle(width / 2 + width / 10, height / 3 + (height / 20 + height / 40) * 2, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
|
||||
Elements.Add(label_EffectsVolume_Percent);
|
||||
|
||||
var slider_EffectsVolume = new Slider(Manager)
|
||||
{ rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 2, width / 10, height / 20), indentation = 7, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 };
|
||||
{ rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 2, width / 10, height / 20), indentation = 7, textureName = "Textures/GUI/Switch_backgrownd", MinValue = 0, MaxValue = 1 };
|
||||
slider_EffectsVolume.SetValue(AppManager.Instance.SettingsManager.SoundEffectsVolume);
|
||||
slider_EffectsVolume.SliderChanged += (newVal) =>
|
||||
{
|
||||
|
@ -90,7 +90,7 @@ public class OptionsGUI : AbstractGUI
|
|||
//--------------------------------------
|
||||
|
||||
Label lblSwitchMode = new Label(Manager)
|
||||
{ fontName = "Fonts\\Font", scale = 0.2f, text = "Resolution set", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 3, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
|
||||
{ fontName = "Fonts/Font", scale = 0.2f, text = "Resolution set", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 3, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
|
||||
Elements.Add(lblSwitchMode);
|
||||
|
||||
//var button_left_right_mode = new CheckBox(Manager) { rectangle = new Rectangle(rightBorder - checkboxlength, lblSwitchMode.rectangle.Y - 12, checkboxlength, checkboxlength) };
|
||||
|
@ -99,7 +99,7 @@ public class OptionsGUI : AbstractGUI
|
|||
|
||||
|
||||
Label label_IsFullScreen = new Label(Manager)
|
||||
{ fontName = "Fonts\\Font", scale = 0.2f, text = "Full Screen", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 4, width / 40, width / 40), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
|
||||
{ fontName = "Fonts/Font", scale = 0.2f, text = "Full Screen", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 4, width / 40, width / 40), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
|
||||
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) };
|
||||
|
@ -113,7 +113,7 @@ public class OptionsGUI : AbstractGUI
|
|||
//--------------------------------------
|
||||
|
||||
Button bTExit = new Button(Manager)
|
||||
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"};
|
||||
{ fontName = "Fonts/Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures/GUI/checkboxs_off"};
|
||||
Elements.Add(bTExit);
|
||||
bTExit.LeftButtonPressed += () =>
|
||||
{
|
||||
|
|
|
@ -21,11 +21,11 @@ public class SelectModeMenu : AbstractGUI
|
|||
int width = AppManager.Instance.CurentScreenResolution.X;
|
||||
int height = AppManager.Instance.CurentScreenResolution.Y;
|
||||
|
||||
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures\\GUI\\background\\selectMode" };
|
||||
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures/GUI/background/selectMode" };
|
||||
Elements.Add(menuBackground);
|
||||
menuBackground.LoadTexture(AppManager.Instance.Content);
|
||||
|
||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 6, (int)(width / 4), (int)(height / 20)), text = "Select mode", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"});
|
||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 6, (int)(width / 4), (int)(height / 20)), text = "Select mode", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts/Font"});
|
||||
|
||||
Button singleButton = new Button(Manager)
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ public class SelectModeMenu : AbstractGUI
|
|||
scale = 0.3f,
|
||||
fontColor = Color.White,
|
||||
mainColor = Color.Gray,
|
||||
fontName = "Fonts\\Font"
|
||||
fontName = "Fonts/Font"
|
||||
};
|
||||
singleButton.LeftButtonPressed += () =>
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ public class SelectModeMenu : AbstractGUI
|
|||
scale = 0.3f,
|
||||
fontColor = Color.White,
|
||||
mainColor = Color.Gray,
|
||||
fontName = "Fonts\\Font"
|
||||
fontName = "Fonts/Font"
|
||||
};
|
||||
optionButton.LeftButtonPressed += () =>
|
||||
{
|
||||
|
@ -84,7 +84,7 @@ public class SelectModeMenu : AbstractGUI
|
|||
Elements.Add(optionButton);
|
||||
|
||||
Button bTExit = new Button(Manager)
|
||||
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"};
|
||||
{ fontName = "Fonts/Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures/GUI/checkboxs_off"};
|
||||
Elements.Add(bTExit);
|
||||
bTExit.LeftButtonPressed += () =>
|
||||
{
|
||||
|
|
|
@ -21,11 +21,11 @@ public class SelectingServerGUI : AbstractGUI
|
|||
int width = AppManager.Instance.CurentScreenResolution.X;
|
||||
int height = AppManager.Instance.CurentScreenResolution.Y;
|
||||
|
||||
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures\\GUI\\background\\join" };
|
||||
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures/GUI/background/join" };
|
||||
Elements.Add(menuBackground);
|
||||
menuBackground.LoadTexture(AppManager.Instance.Content);
|
||||
|
||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = "Select server", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"});
|
||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = "Select server", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts/Font"});
|
||||
|
||||
TextBox ipBox = new TextBox(Manager)
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ public class SelectingServerGUI : AbstractGUI
|
|||
fontColor = Color.White,
|
||||
mainColor = Color.Gray,
|
||||
textAligment = MonogameLibrary.UI.Enums.TextAligment.Left,
|
||||
fontName = "Fonts\\Font"
|
||||
fontName = "Fonts/Font"
|
||||
};
|
||||
ipBox.TextChanged += input => {
|
||||
if (input == "ip")
|
||||
|
@ -58,7 +58,7 @@ public class SelectingServerGUI : AbstractGUI
|
|||
scale = 0.3f,
|
||||
fontColor = Color.White,
|
||||
mainColor = Color.Gray,
|
||||
fontName = "Fonts\\Font"
|
||||
fontName = "Fonts/Font"
|
||||
};
|
||||
joinButton.LeftButtonPressed += () =>
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ public class SelectingServerGUI : AbstractGUI
|
|||
scale = 0.3f,
|
||||
fontColor = Color.White,
|
||||
mainColor = Color.Gray,
|
||||
fontName = "Fonts\\Font"
|
||||
fontName = "Fonts/Font"
|
||||
};
|
||||
hostButton.LeftButtonPressed += () =>
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ public class SelectingServerGUI : AbstractGUI
|
|||
Elements.Add(hostButton);
|
||||
|
||||
Button bTExit = new Button(Manager)
|
||||
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"};
|
||||
{ fontName = "Fonts/Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures/GUI/checkboxs_off"};
|
||||
Elements.Add(bTExit);
|
||||
bTExit.LeftButtonPressed += () =>
|
||||
{
|
||||
|
|
|
@ -27,11 +27,11 @@ public class WaitingForPlayersGUI : AbstractGUI
|
|||
int width = AppManager.Instance.CurentScreenResolution.X;
|
||||
int height = AppManager.Instance.CurentScreenResolution.Y;
|
||||
|
||||
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures\\GUI\\background\\Waiting" };
|
||||
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures/GUI/background/Waiting" };
|
||||
Elements.Add(menuBackground);
|
||||
menuBackground.LoadTexture(AppManager.Instance.Content);
|
||||
|
||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = "Waiting", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"});
|
||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = "Waiting", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts/Font"});
|
||||
|
||||
if (isHost)
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ public class WaitingForPlayersGUI : AbstractGUI
|
|||
scale = 0.3f,
|
||||
fontColor = Color.White,
|
||||
mainColor = Color.Gray,
|
||||
fontName = "Fonts\\Font"
|
||||
fontName = "Fonts/Font"
|
||||
};
|
||||
startButton.LeftButtonPressed += () =>
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ public class WaitingForPlayersGUI : AbstractGUI
|
|||
}
|
||||
|
||||
Button bTExit = new Button(Manager)
|
||||
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"};
|
||||
{ fontName = "Fonts/Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures/GUI/checkboxs_off"};
|
||||
Elements.Add(bTExit);
|
||||
bTExit.LeftButtonPressed += () =>
|
||||
{
|
||||
|
|
|
@ -1,8 +1,24 @@
|
|||
using System.Collections.Generic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using ZoFo.GameCore.ZoFo_graphics;
|
||||
|
||||
namespace ZoFo.GameCore.GameObjects.Entities.Interactables;
|
||||
|
||||
public class Door
|
||||
public class Door : Interactable
|
||||
{
|
||||
public bool isOpened;
|
||||
|
||||
public override GraphicsComponent graphicsComponent { get; } = new(new List<string> { "DoorInteraction" }, "DoorInteraction");
|
||||
|
||||
public Door(Vector2 position) : base(position)
|
||||
{
|
||||
graphicsComponent.actionOfAnimationEnd += _ => { isOpened = !isOpened; };
|
||||
}
|
||||
|
||||
public override void OnInteraction()
|
||||
{
|
||||
graphicsComponent.StartAnimation("DoorInteraction", isOpened);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -22,7 +22,7 @@ public class Interactable : Entity
|
|||
AppManager.Instance.server.AddData(new UpdateInteractionReady((sender as Player).Id, isReady));
|
||||
}
|
||||
|
||||
public void OnInteraction()
|
||||
public virtual void OnInteraction()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -86,10 +86,10 @@ public abstract class GameObject
|
|||
if (color is null) color = new Color(1, 0, 0, 0.25f);
|
||||
if (color.Value.A == 255) color = new Color(color.Value, 0.25f);
|
||||
//spriteBatch.Draw(debugTexture,
|
||||
// new Rectangle((_rectangle.X - GraphicsComponent.CameraPosition.X) * GraphicsComponent.scaling,
|
||||
// (_rectangle.Y - GraphicsComponent.CameraPosition.Y) * GraphicsComponent.scaling,
|
||||
// _rectangle.Width * GraphicsComponent.scaling,
|
||||
// _rectangle.Height * GraphicsComponent.scaling), color.Value);
|
||||
// new Rectangle((_rectangle.X - graphicsComponent.CameraPosition.X) * graphicsComponent.scaling,
|
||||
// (_rectangle.Y - graphicsComponent.CameraPosition.Y) * graphicsComponent.scaling,
|
||||
// _rectangle.Width * graphicsComponent.scaling,
|
||||
// _rectangle.Height * graphicsComponent.scaling), color.Value);
|
||||
|
||||
//TODO: debugTexture
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace ZoFo.GameCore.ZoFo_graphics
|
|||
private AnimationContainer currentAnimation;
|
||||
static public int scaling = 1;
|
||||
public int parentId;
|
||||
public bool reverse;
|
||||
public AnimationContainer CurrentAnimation
|
||||
{
|
||||
get
|
||||
|
@ -126,7 +127,7 @@ namespace ZoFo.GameCore.ZoFo_graphics
|
|||
}
|
||||
}
|
||||
|
||||
public void StartAnimation(string startedanimationId)
|
||||
public void StartAnimation(string startedanimationId, bool reverse = false)
|
||||
{
|
||||
/*
|
||||
if (AppManager.Instance.multiPlayerStatus != MultiPlayerStatus.SinglePlayer)
|
||||
|
@ -138,8 +139,13 @@ namespace ZoFo.GameCore.ZoFo_graphics
|
|||
}
|
||||
}
|
||||
*/
|
||||
currentFrame = 0;
|
||||
this.reverse = reverse;
|
||||
|
||||
currentAnimation = animations.Find(x => x.Id == startedanimationId);
|
||||
if (reverse)
|
||||
currentFrame = currentAnimation.FramesCount;
|
||||
else
|
||||
currentFrame = 0;
|
||||
|
||||
buildSourceRectangle();
|
||||
SetInterval();
|
||||
|
@ -154,6 +160,21 @@ namespace ZoFo.GameCore.ZoFo_graphics
|
|||
SetInterval();
|
||||
}
|
||||
|
||||
private void AnimationEnd()
|
||||
{
|
||||
if (!currentAnimation.IsCycle)
|
||||
{
|
||||
if (actionOfAnimationEnd != null)
|
||||
{
|
||||
actionOfAnimationEnd(currentAnimation.Id);
|
||||
}
|
||||
currentAnimation = neitralAnimation;
|
||||
|
||||
}
|
||||
|
||||
currentFrame = 0;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (currentAnimation is null)
|
||||
|
@ -162,21 +183,22 @@ namespace ZoFo.GameCore.ZoFo_graphics
|
|||
}
|
||||
if (interval == 0)
|
||||
{
|
||||
currentFrame++;
|
||||
if (currentAnimation.FramesCount <= currentFrame)
|
||||
if (reverse)
|
||||
{
|
||||
if (!currentAnimation.IsCycle)
|
||||
currentFrame--;
|
||||
if (currentFrame <= 0)
|
||||
{
|
||||
if (actionOfAnimationEnd != null)
|
||||
{
|
||||
actionOfAnimationEnd(currentAnimation.Id);
|
||||
}
|
||||
currentAnimation = neitralAnimation;
|
||||
|
||||
AnimationEnd();
|
||||
reverse = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
currentFrame++;
|
||||
if (currentAnimation.FramesCount <= currentFrame)
|
||||
{
|
||||
AnimationEnd();
|
||||
}
|
||||
|
||||
currentFrame = 0;
|
||||
|
||||
}
|
||||
|
||||
buildSourceRectangle();
|
||||
|
|
Loading…
Add table
Reference in a new issue