feat: IMonoGameContentLoader
This commit is contained in:
parent
8a0a0289f9
commit
b1582ab5c2
|
@ -0,0 +1,8 @@
|
||||||
|
using Microsoft.Xna.Framework.Content;
|
||||||
|
|
||||||
|
namespace Pong.Behaviours;
|
||||||
|
|
||||||
|
public interface IMonoGameContentLoader
|
||||||
|
{
|
||||||
|
void LoadContent(ContentManager content);
|
||||||
|
}
|
|
@ -27,6 +27,7 @@ public class GamePong : Game
|
||||||
private GameManager gameManager = null!;
|
private GameManager gameManager = null!;
|
||||||
private BehaviourCacher<IDisplayableSprite> displayableCacher = null!;
|
private BehaviourCacher<IDisplayableSprite> displayableCacher = null!;
|
||||||
private BehaviourCacher<IDisplayableShape> displayableShapeCacher = null!;
|
private BehaviourCacher<IDisplayableShape> displayableShapeCacher = null!;
|
||||||
|
private BehaviourCacher<IMonoGameContentLoader> monoGameContentLoaderCacher = null!;
|
||||||
private MonoGameCamera2DBehaviour cameraBehaviour = null!;
|
private MonoGameCamera2DBehaviour cameraBehaviour = null!;
|
||||||
|
|
||||||
private PongManagerBehaviour pongManager = null!;
|
private PongManagerBehaviour pongManager = null!;
|
||||||
|
@ -52,6 +53,7 @@ public class GamePong : Game
|
||||||
gameManager = new();
|
gameManager = new();
|
||||||
displayableCacher = new(gameManager);
|
displayableCacher = new(gameManager);
|
||||||
displayableShapeCacher = new(gameManager);
|
displayableShapeCacher = new(gameManager);
|
||||||
|
monoGameContentLoaderCacher = new(gameManager);
|
||||||
physicsEngine = new PhysicsEngine2DCacher(gameManager) { IterationPerStep = 3 };
|
physicsEngine = new PhysicsEngine2DCacher(gameManager) { IterationPerStep = 3 };
|
||||||
|
|
||||||
gameManager.Initialize();
|
gameManager.Initialize();
|
||||||
|
@ -154,6 +156,11 @@ public class GamePong : Game
|
||||||
pongManager.BehaviourController.AddBehaviour<NetworkClient>().Connect("127.0.0.1", 8888);
|
pongManager.BehaviourController.AddBehaviour<NetworkClient>().Connect("127.0.0.1", 8888);
|
||||||
Window.Title = $"Pong - Client -> 127.0.0.1";
|
Window.Title = $"Pong - Client -> 127.0.0.1";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var contentLoader in monoGameContentLoaderCacher)
|
||||||
|
{
|
||||||
|
contentLoader.LoadContent(Content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update(GameTime gameTime)
|
protected override void Update(GameTime gameTime)
|
||||||
|
|
Loading…
Reference in New Issue