NetworkFixCommit
This commit is contained in:
parent
f870a2f129
commit
590cf8184d
8 changed files with 31 additions and 17 deletions
|
@ -18,6 +18,7 @@ namespace MonogameLibrary.UI.Base
|
|||
public string textureName = "";
|
||||
public Rectangle rectangle = new Rectangle(0, 0, 10, 10);
|
||||
public Color mainColor = Color.White;
|
||||
public bool sus = true;
|
||||
|
||||
public DrawableUIElement(UIManager manager, int layerIndex = 0, string textureName = "")
|
||||
{
|
||||
|
@ -29,6 +30,7 @@ namespace MonogameLibrary.UI.Base
|
|||
{
|
||||
if (textureName == "")
|
||||
{
|
||||
sus = false;
|
||||
texture = new Texture2D(Manager.GraphicsDevice, 1, 1);
|
||||
texture.SetData<Color>(new Color[] { mainColor });
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public class Bar : DrawableUIElement
|
|||
public float percent = 0.5f;
|
||||
private DrawableUIElement barInside;
|
||||
public Color inColor;
|
||||
public string inTextureName;
|
||||
public string inTextureName = "";
|
||||
|
||||
public Bar(UIManager manager, int layerIndex = 0, string textureName = "") : base(manager, layerIndex, textureName)
|
||||
{
|
||||
|
@ -30,8 +30,7 @@ public class Bar : DrawableUIElement
|
|||
{
|
||||
rectangle = new Rectangle(rectangle.X + rectangle.Height / 8, rectangle.Y + rectangle.Height / 8,
|
||||
(int)((rectangle.Width - rectangle.Height / 4) * percent), rectangle.Height / 8 * 7),
|
||||
mainColor = inColor,
|
||||
textureName = inTextureName
|
||||
mainColor = inColor
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,9 @@ public class HUD : AbstractGUI
|
|||
int height = AppManager.Instance.CurentScreenResolution.Y;
|
||||
|
||||
Button pauseButton = new Button(Manager)
|
||||
{ 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"};
|
||||
{ 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.LoadTexture(AppManager.Instance.Content);
|
||||
pauseButton.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.SetGUI(new FinishingGUI());
|
||||
|
@ -34,8 +35,9 @@ public class HUD : AbstractGUI
|
|||
//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"};
|
||||
{ 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"};
|
||||
Elements.Add(invButton);
|
||||
invButton.LoadTexture(AppManager.Instance.Content);
|
||||
invButton.LeftButtonPressed += () =>
|
||||
{
|
||||
overlayGUI = new InventoryGUI();
|
||||
|
|
|
@ -72,6 +72,7 @@ public class WaitingForPlayersGUI : AbstractGUI
|
|||
waitButton.LeftButtonPressed += () =>
|
||||
{
|
||||
// start
|
||||
AppManager.Instance.SetGUI(new HUD());
|
||||
// ваш код здесь
|
||||
};
|
||||
Elements.Add(waitButton);
|
||||
|
|
|
@ -139,6 +139,8 @@ namespace ZoFo.GameCore.GameManagers
|
|||
switch (gamestate)
|
||||
{
|
||||
case GameState.ClientPlaying:
|
||||
client.Draw(_spriteBatch);
|
||||
break;
|
||||
case GameState.HostPlaying:
|
||||
client.Draw(_spriteBatch);
|
||||
break;
|
||||
|
|
|
@ -83,7 +83,6 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
|||
if (AppManager.Instance.gamestate != GameState.HostPlaying)
|
||||
{
|
||||
AppManager.Instance.ChangeState(GameState.ClientPlaying);
|
||||
AppManager.Instance.SetGUI(new HUD());
|
||||
}
|
||||
SendAcknowledgement(Dgramm.DatagrammId);
|
||||
}
|
||||
|
|
|
@ -40,12 +40,15 @@ namespace ZoFo.GameCore.GameObjects
|
|||
|
||||
public void StartAnimation(string animationId)
|
||||
{
|
||||
(graphicsComponent as Graphics.AnimatedGraphicsComponent).StartAnimation(animationId);
|
||||
AppManager.Instance.server.AddData(new GameManagers.NetworkManager.Updates.ServerToClient.UpdateAnimation()
|
||||
if (AppManager.Instance.gamestate == GameState.HostPlaying)
|
||||
{
|
||||
animationId = animationId,
|
||||
IdEntity = Id
|
||||
});
|
||||
(graphicsComponent as Graphics.AnimatedGraphicsComponent).StartAnimation(animationId);
|
||||
AppManager.Instance.server.AddData(new GameManagers.NetworkManager.Updates.ServerToClient.UpdateAnimation()
|
||||
{
|
||||
animationId = animationId,
|
||||
IdEntity = Id
|
||||
});
|
||||
}
|
||||
}
|
||||
public override void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
|
|
|
@ -70,13 +70,19 @@ namespace ZoFo.GameCore.GameObjects
|
|||
}
|
||||
public void EndAttack(string a)
|
||||
{
|
||||
var damagedPlayers=AppManager.Instance.server.collisionManager.GetPlayersInZone(collisionComponent.triggerRectangle.SetOrigin(position));
|
||||
//TODO ДАМАЖИТЬ ИГРОКОВ В ЗОНЕ
|
||||
if (damagedPlayers.Length>0) { DebugHUD.DebugLog("End of" + a);
|
||||
foreach (var item in damagedPlayers)
|
||||
item.TakeDamage(5);
|
||||
if (AppManager.Instance.gamestate == GameState.HostPlaying)
|
||||
{
|
||||
var damagedPlayers = AppManager.Instance.server.collisionManager.GetPlayersInZone(collisionComponent.triggerRectangle.SetOrigin(position));
|
||||
//TODO ДАМАЖИТЬ ИГРОКОВ В ЗОНЕ
|
||||
if (damagedPlayers.Length > 0)
|
||||
{
|
||||
DebugHUD.DebugLog("End of" + a);
|
||||
foreach (var item in damagedPlayers)
|
||||
item.TakeDamage(5);
|
||||
}
|
||||
isAttacking = false;
|
||||
}
|
||||
isAttacking = false;
|
||||
|
||||
}
|
||||
|
||||
public override void Die()
|
||||
|
|
Loading…
Add table
Reference in a new issue