Files
Project-M/Assets/_Project/Scripts/Simulation/Connection/ConnectionConfig.cs
T
Luis Gonzalez e851d5f8e9 Co-Op Layer
2026-06-01 10:48:18 -07:00

36 lines
1.3 KiB
C#

using Unity.Collections;
using Unity.Entities;
namespace ProjectM.Simulation
{
/// <summary>
/// Connection intent for the M4 LAN host/join flow. Lives in Simulation so both the server and
/// client worlds can read it. A UI (<c>ConnectionUI</c>) — or, in the editor, the auto-host system —
/// writes the desired <see cref="Mode"/> + endpoint and sets <see cref="Requested"/> true; the
/// per-world ConnectionControlSystem turns it into a netcode <c>NetworkStreamRequestListen</c> /
/// <c>NetworkStreamRequestConnect</c> and clears <see cref="Requested"/>. Direct IP/LAN only for now —
/// Unity Relay is deferred to a later pass. Created per-world as a singleton.
/// </summary>
public enum ConnectionMode : byte
{
None,
Host,
Join,
}
public struct ConnectionConfig : IComponentData
{
/// <summary>What to do with this world's network stream.</summary>
public ConnectionMode Mode;
/// <summary>Dotted IPv4 to connect to (Join). Ignored for Host (binds AnyIpv4).</summary>
public FixedString64Bytes Address;
/// <summary>Listen/connect port.</summary>
public ushort Port;
/// <summary>Set true to request the control system act on Mode this frame; it clears the flag.</summary>
public bool Requested;
}
}