Files
ShrinkNetwork.Integration.E…/ShrinkNetworkEventRequestOutcome.cs
T
cneicy 05bfe9c430
Publish UPM package / publish (push) Failing after 1s
chore: initialize standalone UPM package
2026-08-26 02:50:38 +08:00

32 lines
1.1 KiB
C#

#nullable enable
using ShrinkEventBus;
namespace ShrinkNetwork.Integration
{
public readonly struct ShrinkNetworkEventRequestOutcome
{
public ShrinkNetworkEventRequestOutcome(int errorCode, string errorMessage, EventResult result, bool isCanceled)
{
ErrorCode = errorCode;
ErrorMessage = errorMessage ?? string.Empty;
Result = result;
IsCanceled = isCanceled;
}
public int ErrorCode { get; }
public string ErrorMessage { get; }
public EventResult Result { get; }
public bool IsCanceled { get; }
public bool IsSuccess => ErrorCode == 0;
internal static ShrinkNetworkEventRequestOutcome FromResponse(ShrinkNetworkEventResultResponse response)
{
return new ShrinkNetworkEventRequestOutcome(
response?.ErrorCode ?? ShrinkRpcErrorCode.InvalidResponse,
response?.ErrorMessage ?? "Network event request returned an invalid response.",
response?.Result ?? EventResult.DEFAULT,
response?.IsCanceled ?? false);
}
}
}