void SetupJavaBindings()
        {
#if UNITY_ANDROID
            AndroidJavaClass playerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");

            if (playerClass == null)
            {
                return;
            }

            AndroidJavaObject activity = playerClass.GetStatic <AndroidJavaObject>("currentActivity");

            if (activity == null)
            {
                return;
            }

            AndroidJavaObject assetManager = activity.Call <AndroidJavaObject>("getAssets");

            if (assetManager == null)
            {
                return;
            }

            Message.Send("GizmoSDK", MessageLevel.DEBUG, $"assetManager {assetManager}");

            SerializeAdapter.SetAssetManagerHandle(System.IntPtr.Zero, assetManager.GetRawObject());
#endif //UNITY_ANDROID
        }
Beispiel #2
0
            public SerializeAdapterStream(SerializeAdapter adapter, bool leaveOpen = false)
            {
                if (!adapter.IsValid())
                {
                    throw new ArgumentException("Invalid SerializeAdapter");
                }

                _adapter   = adapter;
                _leaveOpen = leaveOpen;
            }
Beispiel #3
0
            public static void SendPayload(SerializeAdapter adapter, byte[] payload)
            {
                IntPtr p = Marshal.AllocHGlobal(payload.Length);

                Marshal.Copy(payload, 0, p, payload.Length); // Transfer to unmanaged memory

                Purl_sendPayload(adapter.GetNativeReference(), p, (uint)payload.Length);

                Marshal.FreeHGlobal(p);
            }
Beispiel #4
0
            public static bool ReceiveCommand(SerializeAdapter adapter, out PurlCommand command, out UInt32 payload_length, UInt32 retry = 50)
            {
                PurlCommand result_Command = PurlCommand.UNKNOWN;
                UInt32      result_Length  = 0;

                bool result = Purl_receiveCommand(adapter.GetNativeReference(), ref result_Command, ref result_Length, retry);

                command        = result_Command;
                payload_length = result_Length;

                return(result);
            }
Beispiel #5
0
            public static bool ReceivePurlPayload(SerializeAdapter adapter, ref byte [] payload, UInt32 data_payload_length, UInt32 retry = 50)
            {
                if (payload == null || payload.Length != data_payload_length)
                {
                    payload = new byte[data_payload_length];
                }

                IntPtr p = Marshal.AllocHGlobal((int)data_payload_length);

                bool result = Purl_receivePayload2(adapter.GetNativeReference(), p, data_payload_length, retry);

                Marshal.Copy(p, payload, 0, (int)data_payload_length); // Transfer to managed memory

                Marshal.FreeHGlobal(p);

                return(result);
            }
 public void Read(SerializeAdapter adapter)
 {
     DynamicType_read(GetNativeReference(), adapter.GetNativeReference());
 }
 public void Write(SerializeAdapter adapter)
 {
     DynamicType_write(GetNativeReference(), adapter.GetNativeReference());
 }
Beispiel #8
0
            public static SerializeAdapter GetURLAdapter(string url, SerializeAction action = SerializeAction.INPUT, AdapterFlags flags = AdapterFlags.DEFAULT, string password = "")
            {
                SerializeAdapter adapter = new SerializeAdapter(SerializeAdapter_getURLAdapter(url, action, flags, password));

                return(adapter);
            }
Beispiel #9
0
 public SerializeAdapterStream(string url, Mode mode = Mode.Read) : this(SerializeAdapter.GetURLAdapter(url, (SerializeAdapter.SerializeAction)(mode)), false)
 {
 }
Beispiel #10
0
 public void Read(SerializeAdapter adapter)
 {
     PurlCommandClass_read(GetNativeReference(), adapter.GetNativeReference());
 }
Beispiel #11
0
 public void PushBack(SerializeAdapter adapter)
 {
     PurlCommandClass_pushBack(GetNativeReference(), adapter.GetNativeReference());
 }
Beispiel #12
0
 public uint GetDataSize(SerializeAdapter adapter = null)
 {
     return(PurlCommandClass_getDataSize(GetNativeReference(), adapter?.GetNativeReference() ?? IntPtr.Zero));
 }
Beispiel #13
0
 public static bool ReceivePayload(SerializeAdapter adapter, PurlCommandClass command_payload, UInt32 retry = 50)
 {
     return(Purl_receivePayload(adapter.GetNativeReference(), command_payload.GetNativeReference(), retry));
 }
Beispiel #14
0
 public static void SendPayload(SerializeAdapter adapter, SerializeAdapter payload)
 {
     Purl_sendPayload2(adapter.GetNativeReference(), payload.GetNativeReference());
 }
 public void PushBack(SerializeAdapter adapter)
 {
     DynamicType_pushBack(GetNativeReference(), adapter.GetNativeReference());
 }
Beispiel #16
0
 public void Write(SerializeAdapter adapter)
 {
     PurlCommandClass_write(GetNativeReference(), adapter.GetNativeReference());
 }
 public uint GetDataSize(SerializeAdapter adapter = null)
 {
     return(DynamicType_getDataSize(GetNativeReference(), adapter?.GetNativeReference() ?? IntPtr.Zero));
 }
Beispiel #18
0
 public static void SendCommand(SerializeAdapter adapter, PurlCommand command, UInt32 payload_size = 0, PurlCommandClass command_payload = null)
 {
     Purl_sendCommand(adapter.GetNativeReference(), command, payload_size, command_payload?.GetNativeReference() ?? IntPtr.Zero);
 }