diff --git a/Assets/Plugins/libbase64.so.0 b/Assets/Plugins/libbase64.so.0 new file mode 100755 index 0000000..1bcb927 Binary files /dev/null and b/Assets/Plugins/libbase64.so.0 differ diff --git a/Assets/Plugins/libbase64.so.0.meta b/Assets/Plugins/libbase64.so.0.meta new file mode 100644 index 0000000..5251507 --- /dev/null +++ b/Assets/Plugins/libbase64.so.0.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 546eea41f021b0e30be6a8984dc504bf +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/libcloud_point_rpc.so b/Assets/Plugins/libcloud_point_rpc.so new file mode 100755 index 0000000..64273eb Binary files /dev/null and b/Assets/Plugins/libcloud_point_rpc.so differ diff --git a/Assets/Plugins/libcloud_point_rpc.so.meta b/Assets/Plugins/libcloud_point_rpc.so.meta new file mode 100644 index 0000000..79a0329 --- /dev/null +++ b/Assets/Plugins/libcloud_point_rpc.so.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 2 +guid: c7282f05b709777cf86ba53a43c687f9 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: Linux + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/libglog.so b/Assets/Plugins/libglog.so new file mode 100755 index 0000000..61aa477 Binary files /dev/null and b/Assets/Plugins/libglog.so differ diff --git a/Assets/Plugins/libglog.so.meta b/Assets/Plugins/libglog.so.meta new file mode 100644 index 0000000..42cc681 --- /dev/null +++ b/Assets/Plugins/libglog.so.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 7311fb89543f24ef39ff5642731aa3dd +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/libtest_cloud_point.so b/Assets/Plugins/libtest_cloud_point.so new file mode 100755 index 0000000..804a5b6 Binary files /dev/null and b/Assets/Plugins/libtest_cloud_point.so differ diff --git a/Assets/Plugins/libtest_cloud_point.so.meta b/Assets/Plugins/libtest_cloud_point.so.meta new file mode 100644 index 0000000..231362b --- /dev/null +++ b/Assets/Plugins/libtest_cloud_point.so.meta @@ -0,0 +1,29 @@ +fileFormatVersion: 2 +guid: 5ccfd5b5d9b42d0268d684657b2bd0a0 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: Linux + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/libyaml-cpp.so.0.8 b/Assets/Plugins/libyaml-cpp.so.0.8 new file mode 100755 index 0000000..132187b Binary files /dev/null and b/Assets/Plugins/libyaml-cpp.so.0.8 differ diff --git a/Assets/Plugins/libyaml-cpp.so.0.8.meta b/Assets/Plugins/libyaml-cpp.so.0.8.meta new file mode 100644 index 0000000..d3cf7f2 --- /dev/null +++ b/Assets/Plugins/libyaml-cpp.so.0.8.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: e052c6dbd313d545285cfcf5594e4f75 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index c7ecc1e..ed50532 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.12731749, g: 0.13414757, b: 0.1210787, a: 1} + m_IndirectSpecularColor: {r: 0.12731704, g: 0.13414729, b: 0.121078685, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -2235,6 +2235,51 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1682170430} m_CullTransparentMesh: 1 +--- !u!1 &1686741892 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1686741893} + - component: {fileID: 1686741894} + m_Layer: 0 + m_Name: MinimalRpcServer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1686741893 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1686741892} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1686741894 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1686741892} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3efe38e5bed73a892bb160f847afd04f, type: 3} + m_Name: + m_EditorClassIdentifier: + configPath: config.yml --- !u!1 &2021891224 GameObject: m_ObjectHideFlags: 0 @@ -2428,3 +2473,4 @@ SceneRoots: - {fileID: 763126626} - {fileID: 670812665} - {fileID: 409312061} + - {fileID: 1686741893} diff --git a/Assets/Scripts/CrpcApi.cs b/Assets/Scripts/CrpcApi.cs index 078d0c4..248e83f 100644 --- a/Assets/Scripts/CrpcApi.cs +++ b/Assets/Scripts/CrpcApi.cs @@ -55,6 +55,9 @@ namespace CloudPointRpc [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] public static extern void crpc_init(byte[] configPath); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] + public static extern void crpc_init_with_address(byte[] ip, int port); + [DllImport(DllName, CallingConvention = CallingConvention.Cdecl)] public static extern void crpc_deinit(); @@ -144,5 +147,11 @@ namespace CloudPointRpc var bytes = Encoding.UTF8.GetBytes(configPath + '\0'); CrpcServerApi.crpc_init(bytes); } + + public static void CrpcInitWithAddress(string ip, int port) + { + var bytes = Encoding.UTF8.GetBytes(ip + '\0'); + CrpcServerApi.crpc_init_with_address(bytes, port); + } } } diff --git a/Assets/Scripts/MinimalRpcServer.cs b/Assets/Scripts/MinimalRpcServer.cs new file mode 100644 index 0000000..d212ac2 --- /dev/null +++ b/Assets/Scripts/MinimalRpcServer.cs @@ -0,0 +1,29 @@ +using System; +using UnityEngine; +using CloudPointRpc; + +public class MinimalRpcServer : MonoBehaviour +{ + [SerializeField] private string serverIp = "127.0.0.1"; + [SerializeField] private int serverPort = 9095; + + private static CrpcTestApi.RpcStringCallback _pingCallback; + + [AOT.MonoPInvokeCallback(typeof(CrpcTestApi.RpcStringCallback))] + private static IntPtr OnPing(IntPtr rpcStringPtr) + { + var req = new RpcString(rpcStringPtr); + Debug.Log($"[MinimalRpcServer] ping received: {req.Data}"); + return new RpcString("\"pong\"").Handle; + } + + void Start() + { + _pingCallback = OnPing; + CrpcTestExtensions.CrpcInitWithAddress(serverIp, serverPort); + CrpcTestExtensions.CrpcAddMethod(_pingCallback, "ping"); + Debug.Log($"[MinimalRpcServer] TCP server started on {serverIp}:{serverPort}, ping registered"); + } + + void OnDestroy() => CrpcServerApi.crpc_deinit(); +} diff --git a/Assets/Scripts/MinimalRpcServer.cs.meta b/Assets/Scripts/MinimalRpcServer.cs.meta new file mode 100644 index 0000000..a305449 --- /dev/null +++ b/Assets/Scripts/MinimalRpcServer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3efe38e5bed73a892bb160f847afd04f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/config.yml b/config.yml new file mode 100644 index 0000000..fc904fb --- /dev/null +++ b/config.yml @@ -0,0 +1,3 @@ +server: + ip: "127.0.0.1" + port: 9095