using NBC.Network;

namespace NBC;

public static class SessionHelper
{
    /// <summary>
    /// 创建一个网络会话
    /// </summary>
    /// <param name="scene"></param>
    /// <param name="address">远程服务器地址</param>
    /// <param name="onConnectComplete">当连接成功执行的委托，可为空</param>
    /// <param name="onConnectFail">当连接超时或失败执行的委托，可为空</param>
    /// <param name="onConnectDisconnect">当连接断开执行的委托，可为空</param>
    /// <returns></returns>
    public static Session CreateSession(Scene scene, string address, Action onConnectComplete, Action onConnectFail,
        Action onConnectDisconnect)
    {
        return scene.Connect(
            address,
            NetworkProtocolType.KCP,
            onConnectComplete,
            onConnectFail,
            onConnectDisconnect,
            false, 5000);
    }
}