28 lines
1.2 KiB
C#
28 lines
1.2 KiB
C#
using ExitGames.Client.Photon;
|
|
using ExitGames.Client.Photon.StructWrapping;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace PhotonLogger.Core;
|
|
|
|
public class OperationNormalizer
|
|
{
|
|
public static Dictionary<byte, object> NormalizeDictionaryValues(Dictionary<byte, object> inDict)
|
|
{
|
|
var dictionary = new Dictionary<byte, object>(inDict);
|
|
|
|
foreach (KeyValuePair<byte, object> entry in inDict)
|
|
{
|
|
var key = entry.Key;
|
|
var value = entry.Value;
|
|
if (value.GetType() == typeof(Vector2)) dictionary[key] = "StubVector2";
|
|
else if (value.GetType() == typeof(Vector3)) dictionary[key] = "StubVector3";
|
|
else if (value is Dictionary<byte, object>) dictionary[key] = NormalizeDictionaryValues((Dictionary<byte, object>)value);
|
|
else if (value is ParameterDictionary) dictionary[key] = NormalizeDictionaryValues(new Dictionary<byte, object>((ParameterDictionary)value));
|
|
else if (value is StructWrapper<byte>) dictionary[key] = "a byte that must be unwrapped";
|
|
else if (value is StructWrapper<bool>) dictionary[key] = "a bool that must be unwrapped";
|
|
}
|
|
|
|
return dictionary;
|
|
}
|
|
} |