Skip to content
This repository has been archived by the owner on Aug 15, 2022. It is now read-only.

Quality of life improvements for use in stand-alone servers #393

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ public enum ForgeAcceptableFieldTypes
QUATERNION = 15,
COLOR = 16,
//OBJECT_ARRAY = 17, //Unsupported
//BYTE_ARRAY = 18
//BYTE_ARRAY = 18,
DOTNET_VECTOR2 = 19,
DOTNET_VECTOR3 = 20,
DOTNET_VECTOR4 = 21,
DOTNET_QUATERNION = 22,
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ public enum ForgeAcceptableRPCTypes
QUATERNION = 15,
COLOR = 16,
//OBJECT_ARRAY = 17,
BYTE_ARRAY = 18
BYTE_ARRAY = 18,
DOTNET_VECTOR2 = 19,
DOTNET_VECTOR3 = 20,
DOTNET_VECTOR4 = 21,
DOTNET_QUATERNION = 22,
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using BeardedManStudios.Templating;
using SimpleJSONEditor;
using System;
using Numerics = System.Numerics;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -85,6 +86,14 @@ public static ForgeClassFieldRPCValue GetClassField(FieldInfo field, Type t, boo
type = ForgeAcceptableRPCTypes.VECTOR3;
else if (fieldType == typeof(Vector4))
type = ForgeAcceptableRPCTypes.VECTOR4;
else if (fieldType == typeof(Numerics.Vector2))
type = ForgeAcceptableRPCTypes.DOTNET_VECTOR2;
else if (fieldType == typeof(Numerics.Vector3))
type = ForgeAcceptableRPCTypes.DOTNET_VECTOR3;
else if (fieldType == typeof(Numerics.Vector4))
type = ForgeAcceptableRPCTypes.DOTNET_VECTOR4;
else if (fieldType == typeof(Numerics.Quaternion))
type = ForgeAcceptableRPCTypes.DOTNET_QUATERNION;
else if (fieldType == typeof(string))
type = ForgeAcceptableRPCTypes.STRING;
//else if (fieldType == typeof(object[]))
Expand Down Expand Up @@ -133,6 +142,14 @@ public static Type GetTypeFromAcceptable(ForgeAcceptableRPCTypes type)
return typeof(Vector3);
case ForgeAcceptableRPCTypes.VECTOR4:
return typeof(Vector4);
case ForgeAcceptableRPCTypes.DOTNET_VECTOR2:
return typeof(Numerics.Vector2);
case ForgeAcceptableRPCTypes.DOTNET_VECTOR3:
return typeof(Numerics.Vector3);
case ForgeAcceptableRPCTypes.DOTNET_VECTOR4:
return typeof(Numerics.Vector4);
case ForgeAcceptableRPCTypes.DOTNET_QUATERNION:
return typeof(Numerics.Quaternion);
case ForgeAcceptableRPCTypes.STRING:
return typeof(string);
//case ForgeAcceptableRPCTypes.OBJECT_ARRAY:
Expand Down Expand Up @@ -180,6 +197,14 @@ public static ForgeAcceptableRPCTypes GetTypeFromAcceptable(string val)
return ForgeAcceptableRPCTypes.VECTOR3;
case "vector4":
return ForgeAcceptableRPCTypes.VECTOR4;
case "dotnetvector2":
return ForgeAcceptableRPCTypes.DOTNET_VECTOR2;
case "dotnetvector3":
return ForgeAcceptableRPCTypes.DOTNET_VECTOR3;
case "dotnetvector4":
return ForgeAcceptableRPCTypes.DOTNET_VECTOR4;
case "dotnetquaternion":
return ForgeAcceptableRPCTypes.DOTNET_QUATERNION;
case "string":
return ForgeAcceptableRPCTypes.STRING;
//case "object[]":
Expand All @@ -196,4 +221,4 @@ public override string ToString()
return string.Format("[ Name: {0}, Value: {1}, Type: {2}, IsNetObj: {3}]", FieldRPCName, FieldRPCValue, FieldType, IsNetworkedObject);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System;
using System.Reflection;
using UnityEngine;
using Numerics = System.Numerics;

namespace BeardedManStudios.Forge.Networking.UnityEditor
{
Expand Down Expand Up @@ -78,6 +79,14 @@ public static ForgeClassFieldValue GetClassField(FieldInfo field, Type t, bool i
type = ForgeAcceptableFieldTypes.VECTOR3;
else if (fieldType == typeof(Vector4))
type = ForgeAcceptableFieldTypes.VECTOR4;
else if (fieldType == typeof(Numerics.Vector2))
type = ForgeAcceptableFieldTypes.DOTNET_VECTOR2;
else if (fieldType == typeof(Numerics.Vector3))
type = ForgeAcceptableFieldTypes.DOTNET_VECTOR3;
else if (fieldType == typeof(Numerics.Vector4))
type = ForgeAcceptableFieldTypes.DOTNET_VECTOR4;
else if (fieldType == typeof(Numerics.Quaternion))
type = ForgeAcceptableFieldTypes.DOTNET_QUATERNION;
//else if (fieldType == typeof(string))
// type = ForgeAcceptableFieldTypes.STRING; //Unsupported
//else if (fieldType == typeof(object[]))
Expand Down Expand Up @@ -126,6 +135,14 @@ public static Type GetTypeFromAcceptable(ForgeAcceptableFieldTypes type)
return typeof(Vector3);
case ForgeAcceptableFieldTypes.VECTOR4:
return typeof(Vector4);
case ForgeAcceptableFieldTypes.DOTNET_VECTOR2:
return typeof(Numerics.Vector2);
case ForgeAcceptableFieldTypes.DOTNET_VECTOR3:
return typeof(Numerics.Vector3);
case ForgeAcceptableFieldTypes.DOTNET_VECTOR4:
return typeof(Numerics.Vector4);
case ForgeAcceptableFieldTypes.DOTNET_QUATERNION:
return typeof(Numerics.Quaternion);
//case ForgeAcceptableFieldTypes.STRING: //Unsupported
// return typeof(string);
//case ForgeAcceptableFieldTypes.OBJECT_ARRAY: //Unsupported
Expand Down Expand Up @@ -158,6 +175,18 @@ public static string GetInterpolateFromAcceptable(string baseTypeString, ForgeAc
case ForgeAcceptableFieldTypes.QUATERNION:
returnValue = "InterpolateQuaternion";
break;
case ForgeAcceptableFieldTypes.DOTNET_VECTOR2:
returnValue = "InterpolateDotnetVector2";
break;
case ForgeAcceptableFieldTypes.DOTNET_VECTOR3:
returnValue = "InterpolateDotnetVector3";
break;
case ForgeAcceptableFieldTypes.DOTNET_VECTOR4:
returnValue = "InterpolateDotnetVector4";
break;
case ForgeAcceptableFieldTypes.DOTNET_QUATERNION:
returnValue = "InterpolateDotnetQuaternion";
break;
default:
returnValue = "Interpolated<" + baseTypeString + ">";
break;
Expand All @@ -177,6 +206,10 @@ public static bool IsInterpolatable(ForgeAcceptableFieldTypes type)
case ForgeAcceptableFieldTypes.VECTOR3:
case ForgeAcceptableFieldTypes.VECTOR4:
case ForgeAcceptableFieldTypes.QUATERNION:
case ForgeAcceptableFieldTypes.DOTNET_VECTOR2:
case ForgeAcceptableFieldTypes.DOTNET_VECTOR3:
case ForgeAcceptableFieldTypes.DOTNET_VECTOR4:
case ForgeAcceptableFieldTypes.DOTNET_QUATERNION:
returnValue = true;
break;
}
Expand Down Expand Up @@ -220,6 +253,14 @@ public static ForgeAcceptableFieldTypes GetTypeFromAcceptable(string val)
return ForgeAcceptableFieldTypes.VECTOR3;
case "vector4":
return ForgeAcceptableFieldTypes.VECTOR4;
case "dotnetvector2":
return ForgeAcceptableFieldTypes.DOTNET_VECTOR2;
case "dotnetvector3":
return ForgeAcceptableFieldTypes.DOTNET_VECTOR3;
case "dotnetvector4":
return ForgeAcceptableFieldTypes.DOTNET_VECTOR4;
case "dotnetquaternion":
return ForgeAcceptableFieldTypes.DOTNET_QUATERNION;
//case "string":
// return ForgeAcceptableFieldTypes.STRING; //Unsupported
//case "object[]":
Expand All @@ -237,4 +278,4 @@ public override string ToString()
return string.Format("[ Name: {0}, Value: {1}, Type: {2}, IsNetObj: {3}]", FieldName, FieldValue, FieldType, IsNetworkedObject);
}
}
}
}
11 changes: 10 additions & 1 deletion ForgeUnity/Assets/BeardedManStudios/Editor/ForgeClassRPCValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Text;
using UnityEditor;
using UnityEngine;
using Numerics = System.Numerics;

namespace BeardedManStudios.Forge.Networking.UnityEditor
{
Expand Down Expand Up @@ -81,6 +82,14 @@ public static ForgeAcceptableRPCTypes GetATypeFromPInfo(ParameterInfo pInfo)
type = ForgeAcceptableRPCTypes.VECTOR3;
else if (fieldType == typeof(Vector4))
type = ForgeAcceptableRPCTypes.VECTOR4;
else if (fieldType == typeof(Numerics.Vector2))
type = ForgeAcceptableRPCTypes.DOTNET_VECTOR2;
else if (fieldType == typeof(Numerics.Vector3))
type = ForgeAcceptableRPCTypes.DOTNET_VECTOR3;
else if (fieldType == typeof(Numerics.Vector4))
type = ForgeAcceptableRPCTypes.DOTNET_VECTOR4;
else if (fieldType == typeof(Numerics.Quaternion))
type = ForgeAcceptableRPCTypes.DOTNET_QUATERNION;
else if (fieldType == typeof(string))
type = ForgeAcceptableRPCTypes.STRING;
//else if (fieldType == typeof(object[]))
Expand All @@ -93,4 +102,4 @@ public static ForgeAcceptableRPCTypes GetATypeFromPInfo(ParameterInfo pInfo)
return type;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Text;
using UnityEditor;
using UnityEngine;
using Numerics = System.Numerics;

namespace BeardedManStudios.Forge.Networking.UnityEditor
{
Expand Down Expand Up @@ -67,6 +68,14 @@ public static ForgeAcceptableRPCTypes GetATypeFromPInfo(ParameterInfo pInfo)
type = ForgeAcceptableRPCTypes.VECTOR3;
else if (fieldType == typeof(Vector4))
type = ForgeAcceptableRPCTypes.VECTOR4;
else if (fieldType == typeof(Numerics.Vector2))
type = ForgeAcceptableRPCTypes.DOTNET_VECTOR2;
else if (fieldType == typeof(Numerics.Vector3))
type = ForgeAcceptableRPCTypes.DOTNET_VECTOR3;
else if (fieldType == typeof(Numerics.Vector4))
type = ForgeAcceptableRPCTypes.DOTNET_VECTOR4;
else if (fieldType == typeof(Numerics.Quaternion))
type = ForgeAcceptableRPCTypes.DOTNET_QUATERNION;
else if (fieldType == typeof(string))
type = ForgeAcceptableRPCTypes.STRING;
//else if (fieldType == typeof(object[]))
Expand All @@ -79,4 +88,4 @@ public static ForgeAcceptableRPCTypes GetATypeFromPInfo(ParameterInfo pInfo)
return type;
}
}
}
}
Loading