简体   繁体   English

脚本#包装WebGL?

[英]Script# Wrap WebGL?

How would one go about wrapping WebGL in Script#. 如何将WebGL包装在Script#中。

I tried to add stuff to the source code but get compile errors I don't understand. 我试图在源代码中添加内容,但出现了我不理解的编译错误。

[ScriptIgnoreNamespace]
    [ScriptImport]
    [ScriptName("webGL")]
    public sealed class WebGL
    {
        [ScriptName("fooGL")]
        public void Foo(string test)
        {

        }
    }

Error 1 The base class or interface 'System.FormatException' in assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' referenced by type 'System.UriFormatException' could not be resolved c:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\System.dll Web 错误1无法解析类型'System.UriFormatException'引用的程序集'mscorlib,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'中的基类或接口'System.FormatException'c:\\ Windows \\ Microsoft。 NET \\ Framework \\ v2.0.50727 \\ System.dll Web

Or is there a way better way to add WebGL support as a lib rather then adding it directly to the main source? 还是有更好的方法将WebGL支持添加为lib,而不是直接将其添加到主要源中?

EDIT: Looks like that compiler error was coming from VS from auto adding System.dll to the project and it shouldn't be. 编辑:看起来该编译器错误来自VS,原因是VS是自动将System.dll添加到项目中,而不应该这样。 After removing it now compiles. 删除后,现在可以编译。 So now the question is what is the best way to wrap a javaScript API in Script# ?? 所以现在的问题是,在Script#中包装javaScript API的最佳方法是什么?

You should look at the S# source on github for how wrappers are written. 您应该查看github上的S#源代码,了解包装器的编写方式。 They're simply classes tagged with ScriptImport attribute and the internal methods/properties have empty values/bodies. 它们只是带有ScriptImport属性标记的类,内部方法/属性具有空值/实体。

Look at the source here . 这里查看源代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM