update
This commit is contained in:
@@ -4,8 +4,7 @@ using Newtonsoft.Json;
|
||||
using Photon.Realtime;
|
||||
using PhotonLogger.Core;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
[HarmonyPatch]
|
||||
@@ -15,21 +14,24 @@ public class OnEventPatch
|
||||
public class SerializableEventData
|
||||
{
|
||||
public byte Code { get; set; }
|
||||
public NonAllocDictionary<byte, object> Parameters { get; set; }
|
||||
public Dictionary<byte, object> Parameters { get; set; }
|
||||
}
|
||||
|
||||
static MethodInfo TargetMethod() => typeof(LoadBalancingClient).GetRuntimeMethod("OnEvent", [ typeof(EventData) ]);
|
||||
|
||||
static void Postfix(ref EventData photonEvent)
|
||||
static void Postfix(ref EventData photonEvent, ref LoadBalancingClient __instance)
|
||||
{
|
||||
var newMsg = new Message
|
||||
{
|
||||
Time = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
|
||||
Type = MessageType.Event,
|
||||
Server = __instance.CurrentServerAddress,
|
||||
Data = new SerializableEventData
|
||||
{
|
||||
Code = photonEvent.Code,
|
||||
Parameters = photonEvent.Parameters.paramDict
|
||||
Parameters = OperationNormalizer.NormalizeDictionaryValues(
|
||||
new Dictionary<byte, object>(photonEvent.Parameters.paramDict)
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -5,12 +5,8 @@ using Newtonsoft.Json;
|
||||
using Photon.Realtime;
|
||||
using PhotonLogger.Core;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using static UnityEngine.UIElements.UIR.Implementation.UIRStylePainter;
|
||||
|
||||
namespace PhotonLogger.Patches;
|
||||
|
||||
@@ -20,7 +16,7 @@ internal class SerializableOperationResponse
|
||||
public byte OperationCode { get; set; }
|
||||
public short ReturnCode { get; set; }
|
||||
public string DebugMessage { get; set; }
|
||||
public NonAllocDictionary<byte, object> Parameters { get; set; }
|
||||
public Dictionary<byte, object> Parameters { get; set; }
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
@@ -28,18 +24,21 @@ public class OperationResponsePatch
|
||||
{
|
||||
static MethodInfo TargetMethod() => AccessTools.Method(typeof(LoadBalancingClient), nameof(LoadBalancingClient.OnOperationResponse));
|
||||
|
||||
static void Postfix(ref OperationResponse operationResponse)
|
||||
static void Postfix(ref OperationResponse operationResponse, ref LoadBalancingClient __instance)
|
||||
{
|
||||
var newMsg = new Message
|
||||
{
|
||||
Time = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
|
||||
Type = MessageType.OperationResponse,
|
||||
Server = __instance.CurrentServerAddress,
|
||||
Data = new SerializableOperationResponse
|
||||
{
|
||||
OperationCode = operationResponse.OperationCode,
|
||||
ReturnCode = operationResponse.ReturnCode,
|
||||
DebugMessage = operationResponse.DebugMessage,
|
||||
Parameters = operationResponse.Parameters.paramDict
|
||||
Parameters = OperationNormalizer.NormalizeDictionaryValues(
|
||||
new Dictionary<byte, object>(operationResponse.Parameters.paramDict)
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -62,12 +61,13 @@ public class OperationRequestDictPatch
|
||||
{
|
||||
static MethodInfo TargetMethod() => typeof(PhotonPeer).GetRuntimeMethod("SendOperation", [ typeof(byte), typeof(Dictionary<byte, object>), typeof(SendOptions) ]);
|
||||
|
||||
static void Postfix(ref byte operationCode, ref Dictionary<byte, object> operationParameters)
|
||||
static void Postfix(ref byte operationCode, ref Dictionary<byte, object> operationParameters, ref PhotonPeer __instance)
|
||||
{
|
||||
var newMsg = new Message
|
||||
{
|
||||
Time = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
|
||||
Type = MessageType.OperationRequest,
|
||||
Server = __instance.ServerAddress,
|
||||
Data = new SerializableOperationRequest
|
||||
{
|
||||
OperationCode = operationCode,
|
||||
@@ -87,16 +87,19 @@ public class OperationRequestParamDictPatch
|
||||
{
|
||||
static MethodInfo TargetMethod() => typeof(PhotonPeer).GetRuntimeMethod("SendOperation", [ typeof(byte), typeof(ParameterDictionary), typeof(SendOptions) ]);
|
||||
|
||||
static void Postfix(ref byte operationCode, ref ParameterDictionary operationParameters)
|
||||
static void Postfix(ref byte operationCode, ref ParameterDictionary operationParameters, ref PhotonPeer __instance)
|
||||
{
|
||||
var newMsg = new Message
|
||||
{
|
||||
Time = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
|
||||
Type = MessageType.OperationRequest,
|
||||
Server = __instance.ServerAddress,
|
||||
Data = new SerializableOperationRequest
|
||||
{
|
||||
OperationCode = operationCode,
|
||||
Parameters = new Dictionary<byte, object>(operationParameters.paramDict)
|
||||
Parameters = OperationNormalizer.NormalizeDictionaryValues(
|
||||
new Dictionary<byte, object>(operationParameters.paramDict)
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user