Tencent / puerts

PUER(普洱) Typescript. Let's write your game in UE or Unity with TypeScript.
Other
5.01k stars 699 forks source link

Godot C# GD class convert #1755

Open Avatarchik opened 3 months ago

Avatarchik commented 3 months ago

Hi! I am generating the Godot.GD class, but there is an error in 2 functions during generation, how can I fix this? Cannot use 'System.Span' as a type argument Cannot cast expression of type 'object' to type 'Span'

 [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))]
        internal static void F_BytesToVar(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data)
        {
            try
            {

                {

                    IntPtr v8Value0 = PuertsDLL.GetArgumentValue(info, 0);
                    object argobj0 = null;
                    ;
                    {
                        argobj0 = argobj0 != null ? argobj0 : StaticTranslate<System.Span<byte>>.Get((int)data, isolate, NativeValueApi.GetValueFromArgument, v8Value0, false); System.Span<byte> arg0 = (System.Span<byte>)argobj0;

                        var result = Godot.GD.BytesToVar (arg0);

                        Puerts.ResultHelper.Set((int)data, isolate, info, result);
                    }
                }
            }
            catch (Exception e)
            {
                Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace);
            }
        }
        [Puerts.MonoPInvokeCallback(typeof(Puerts.V8FunctionCallback))]
        internal static void F_BytesToVarWithObjects(IntPtr isolate, IntPtr info, IntPtr self, int paramLen, long data)
        {
            try
            {

                {

                    IntPtr v8Value0 = PuertsDLL.GetArgumentValue(info, 0);
                    object argobj0 = null;
                    ;
                    {
                        argobj0 = argobj0 != null ? argobj0 : StaticTranslate<System.Span<byte>>.Get((int)data, isolate, NativeValueApi.GetValueFromArgument, v8Value0, false); System.Span<byte> arg0 = (System.Span<byte>)argobj0;

                        var result = Godot.GD.BytesToVarWithObjects (arg0);

                        Puerts.ResultHelper.Set((int)data, isolate, info, result);
                    }
                }
            }
            catch (Exception e)
            {
                Puerts.PuertsDLL.ThrowException(isolate, "c# exception:" + e.Message + ",stack:" + e.StackTrace);
            }
        }
chexiongsheng commented 3 months ago

I suggest you temporarily add the APIs involving Span to the generation blacklist.