Update engine subproject commit to f382fc98eadc4a489689e51e88748b616661a560-dirty; adjust plant genetics for optimal temperature and hardiness traits, enhance terrain scatter probabilities, and improve UI localization for connection status. Refactor multiplayer scene to implement exponential backoff for reconnections and streamline game initialization in web client.
This commit is contained in:
@@ -16,24 +16,33 @@ public class LittleSimWebGame : Game
|
||||
/// <summary>Контекст ядра движка, общий со сценами и системами.</summary>
|
||||
public EngineContext Context { get; } = new EngineContext();
|
||||
|
||||
private readonly Uri _server;
|
||||
private GraphicsDeviceManager _graphics;
|
||||
private SpriteBatch _spriteBatch = null!;
|
||||
private Texture2D _pixel = null!;
|
||||
private WorldViewScene _scene = null!;
|
||||
|
||||
/// <summary>Игра, подключающаяся к серверу <paramref name="server"/>.</summary>
|
||||
public LittleSimWebGame(Uri server)
|
||||
/// <summary>Игра-наблюдатель: мира не создаёт, ждёт <see cref="Connect"/> из UI.</summary>
|
||||
public LittleSimWebGame()
|
||||
{
|
||||
_server = server;
|
||||
_graphics = new GraphicsDeviceManager(this);
|
||||
Content.RootDirectory = "Content";
|
||||
}
|
||||
|
||||
/// <summary>Состояние соединения со сценой-наблюдателем — читает оверлей подключения.</summary>
|
||||
public ConnectionStatus Status => _scene?.Status ?? ConnectionStatus.Idle;
|
||||
|
||||
/// <summary>Число реплицированных жителей — для статуса в оверлее.</summary>
|
||||
public int EntityCount => _scene?.EntityCount ?? 0;
|
||||
|
||||
/// <summary>Подключиться к серверу <paramref name="server"/> (вызывается из Blazor-оверлея).</summary>
|
||||
public void Connect(Uri server) => _scene?.Connect(server);
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
Context.Scenes.Switch(new WorldViewScene(_server, () => _spriteBatch, () => _pixel));
|
||||
_scene = new WorldViewScene(() => _spriteBatch, () => _pixel);
|
||||
Context.Scenes.Switch(_scene);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user