Bugfixy, odstranění nepoužívaných tříd CameraSystem a ITargetingEnemy, přidání dedikované třídy ReturnToMenuElement, předělání pathfinding algoritmu z DFS na BFS, přesun správy obtížnosti do abstraktní třídy Enemy, přidání scriptů pro kompilaci na aplikaci nevyžadující dotnet
This commit is contained in:
parent
ceac37920b
commit
e5d746d597
24 changed files with 258 additions and 138 deletions
40
ONDClient/GUI/ReturnToMenuElement.cs
Normal file
40
ONDClient/GUI/ReturnToMenuElement.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using MonoGameLibrary.Input;
|
||||
|
||||
namespace ONDClient.GUI;
|
||||
|
||||
public class ReturnToMenuElement : TextUIElement{
|
||||
private bool listening = false;
|
||||
private InputListenerHook inputHook;
|
||||
|
||||
public ReturnToMenuElement(Point corner1, SpriteFont font, Alignment alignment = Alignment.CENTER) : base(corner1, font, alignment, false) {
|
||||
Visible = false;
|
||||
Text = "Press Space to return to main menu";
|
||||
inputHook = new InputListenerHook(false);
|
||||
InputManager.AddListener("return-to-menu",Keys.Space, () => {
|
||||
UIManager.DisplayMainMenu();
|
||||
listening = false;
|
||||
Visible = false;
|
||||
Client.Disconnect();
|
||||
},
|
||||
InputTiming.PRESS, inputHook);
|
||||
}
|
||||
|
||||
public override void Update() {
|
||||
if ((Client.State == Client.ConnectionState.IDLE || Client.State == Client.ConnectionState.DISCONNECTED || Client.State == Client.ConnectionState.ACCEPTED) &&
|
||||
(Screen.CurrentScreen.Label == UIManager.ScreenTypes.LOADING || Screen.CurrentScreen.Label == UIManager.ScreenTypes.LOSE || Screen.CurrentScreen.Label == UIManager.ScreenTypes.WIN)){
|
||||
if (!listening){
|
||||
listening = true;
|
||||
Visible = true;
|
||||
inputHook.Enabled = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Visible = false;
|
||||
listening = false;
|
||||
inputHook.Enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue