コード例 #1
0
ファイル: ConversionUtils.cs プロジェクト: trihards/SDmatch3
        internal static ResponseStatus ConvertResponseStatus(Status.ResponseStatus status)
        {
            switch (status)
            {
            case Status.ResponseStatus.VALID:
                return(ResponseStatus.Success);

            case Status.ResponseStatus.VALID_BUT_STALE:
                return(ResponseStatus.SuccessWithStale);

            case Status.ResponseStatus.ERROR_INTERNAL:
                return(ResponseStatus.InternalError);

            case Status.ResponseStatus.ERROR_LICENSE_CHECK_FAILED:
                return(ResponseStatus.LicenseCheckFailed);

            case Status.ResponseStatus.ERROR_NOT_AUTHORIZED:
                return(ResponseStatus.NotAuthorized);

            case Status.ResponseStatus.ERROR_TIMEOUT:
                return(ResponseStatus.Timeout);

            case Status.ResponseStatus.ERROR_VERSION_UPDATE_REQUIRED:
                return(ResponseStatus.VersionUpdateRequired);

            default:
                throw new InvalidOperationException("Unknown status: " + status);
            }
        }
コード例 #2
0
ファイル: ConversionUtils.cs プロジェクト: trihards/SDmatch3
        internal static CommonStatusCodes ConvertResponseStatusToCommonStatus(Status.ResponseStatus status)
        {
            switch (status)
            {
            case Status.ResponseStatus.VALID:
                return(CommonStatusCodes.Success);

            case Status.ResponseStatus.VALID_BUT_STALE:
                return(CommonStatusCodes.SuccessCached);

            case Status.ResponseStatus.ERROR_INTERNAL:
                return(CommonStatusCodes.InternalError);

            case Status.ResponseStatus.ERROR_LICENSE_CHECK_FAILED:
                return(CommonStatusCodes.LicenseCheckFailed);

            case Status.ResponseStatus.ERROR_NOT_AUTHORIZED:
                return(CommonStatusCodes.AuthApiAccessForbidden);

            case Status.ResponseStatus.ERROR_TIMEOUT:
                return(CommonStatusCodes.Timeout);

            case Status.ResponseStatus.ERROR_VERSION_UPDATE_REQUIRED:
                return(CommonStatusCodes.ServiceVersionUpdateRequired);

            default:
                Debug.LogWarning("Unknown ResponseStatus: " + status +
                                 ", defaulting to CommonStatusCodes.Error");
                return(CommonStatusCodes.Error);
            }
        }
        private static SavedGameRequestStatus AsRequestStatus(Status.ResponseStatus status)
        {
            switch (status)
            {
            case Status.ResponseStatus.ERROR_INTERNAL:
                return(SavedGameRequestStatus.InternalError);

            case Status.ResponseStatus.ERROR_LICENSE_CHECK_FAILED:
                Logger.e("User attempted to use the game without a valid license.");
                return(SavedGameRequestStatus.AuthenticationError);

            case Status.ResponseStatus.ERROR_NOT_AUTHORIZED:
                Logger.e("User was not authorized (they were probably not logged in).");
                return(SavedGameRequestStatus.AuthenticationError);

            case Status.ResponseStatus.ERROR_TIMEOUT:
                return(SavedGameRequestStatus.TimeoutError);

            case Status.ResponseStatus.VALID:
            case Status.ResponseStatus.VALID_BUT_STALE:
                return(SavedGameRequestStatus.Success);

            default:
                Logger.e("Unknown status: " + status);
                return(SavedGameRequestStatus.InternalError);
            }
        }
コード例 #4
0
        internal static void InternalLeaveRoomCallback(Status.ResponseStatus response, IntPtr data)
        {
            Logger.d("Entering internal callback for InternalLeaveRoomCallback");

            Action <Status.ResponseStatus> callback =
                Callbacks.IntPtrToTempCallback <Action <Status.ResponseStatus> >(data);

            if (callback == null)
            {
                return;
            }

            try {
                callback(response);
            } catch (Exception e) {
                Logger.e("Error encountered executing InternalLeaveRoomCallback. " +
                         "Smothering to avoid passing exception into Native: " + e);
            }
        }