refactor: ContentLoaderCacher Action

This commit is contained in:
Syntriax 2024-02-05 12:37:23 +03:00
parent d5a904fe8f
commit 70ac012a83
1 changed files with 2 additions and 5 deletions

View File

@ -56,6 +56,8 @@ public class GamePong : Game
monoGameContentLoaderCacher = new(gameManager); monoGameContentLoaderCacher = new(gameManager);
physicsEngine = new PhysicsEngine2DCacher(gameManager) { IterationPerStep = 3 }; physicsEngine = new PhysicsEngine2DCacher(gameManager) { IterationPerStep = 3 };
monoGameContentLoaderCacher.OnCached += (_, cached) => cached.LoadContent(Content);
gameManager.Initialize(); gameManager.Initialize();
base.Initialize(); base.Initialize();
@ -156,11 +158,6 @@ 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)