在浏览器中作为插件运行 C# 应用程序

发布于 2024-08-20 07:16:51 字数 205 浏览 4 评论 0原文

我有一个用 C# 编写的小型 2D 游戏引擎,使用 DirectX。是否可以以某种方式将其作为插件在浏览器中运行?例如 Flash 等,您访问一个有游戏的网站,它会要求您安装某个插件,然后您可以使用鼠标和键盘输入在浏览器中玩游戏。 我已经搜索了几个小时,但我仍然不知道我在寻找什么。到目前为止,我主要关注 Internet Explorer,但还有插件、附加组件、扩展等,我不知道我真正需要什么。

I have a small 2D game engine written in C#, using DirectX. Is it possible to somehow run it in a browser as a plugin? Like for example Flash and others, where you go to a site with a game and it will ask you to install a certain plugin and then you can play the game in the browser, with mouse and keyboard input.
I have searched around for hours and I still don't know what I'm looking for. I have so far primarily focused on Internet Explorer, but there are plugins, addons, extensions, etc I don't know what I need really.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

残龙傲雪 2024-08-27 07:16:51

是的,我认为这是可能的。

例如,我有一个 HTML 页面,其中包含如下元素:

<object id="simpleControl1"
classid="http:RenderTextProject5.dll#RenderTextProject.ScrollableControl"
height="300"
width="300">
</object>

'classid' 属性值具有以下含义/语法:

  • RenderTextProject5.dll 是已编译的 .NET 程序集的文件名
  • RenderTextProject.ScrollableControl 是一个类的限定名称(命名空间加类名),该类是 System.Windows.Forms.Control 的子类,

然后我可以看到在浏览器中呈现的控件。

我使用的是 IE(IE8,但它也曾经适用于 IE6),并且我的计算机上安装了 .NET 框架(但我认为我不需要在客户端计算机上安装 RenderTextProject5 程序集)。

可能还有其他一些警告(例如我需要在内联网安全区域中运行)。

请参阅富客户端的回归:.NET 增强客户端中的代码访问安全性和分发功能- 侧面应用程序

Yes I think it is possible.

For example, I have an HTML page which includes an element like this:

<object id="simpleControl1"
classid="http:RenderTextProject5.dll#RenderTextProject.ScrollableControl"
height="300"
width="300">
</object>

The 'classid' attribute value has the following meaning/syntax:

  • RenderTextProject5.dll is the filename of a compiled .NET assembly
  • RenderTextProject.ScrollableControl is the qualified name (namespace plus classname) of a class which subclasses System.Windows.Forms.Control

I can then see the control being rendered in the browser.

I'm using IE (IE8, but it used to work with IE6 too), and I have the .NET framework installed on my machine (but I think I needn't have the RenderTextProject5 assembly installed on the client machine).

There may be some other caveats too (e.g. I needed to run in the Intranet security zone).

See Return of the Rich Client: Code Access Security and Distribution Features in .NET Enhance Client-Side Apps.

败给现实 2024-08-27 07:16:51

寻找 Silverlight.. 它可能不完全是您所需要的,但它是一个浏览器插件功能运行 C# 代码;)

Look for Silverlight.. It is maybe not exactly what you need but it is a browser plugin capable of running C# code ;)

高跟鞋的旋律 2024-08-27 07:16:51

有一个相对较新的插件,名为 Unity。它有点复杂,因为它本身就是一个 dev/3D 创作环境,但据我所知使用 C# 作为其语言。但是我不知道纯 2D 编程是否可行(好吧,可以使用正交 3d 来解决吗?)。

基本版本最近可以免费下载,也许值得一试。

There is a relatively new plugin called Unity. It is a bit more complex, as it is a dev/3D authoring environment on its own, but uses C# as its language as far as I know. However I don't know if pure 2D programming is possible (well, may be worked around using ortho 3d?).

The basic version is free to download recently, maybe worth a check.

执笏见 2024-08-27 07:16:51

无需使用插件即可在 Web 浏览器中运行 C# 应用程序。例如,可以使用 JSIL 将 C# 应用程序编译为 JavaScript 应用程序。

It is possible to run C# applications in a web browser without using plugins. For example, C# applications can be compiled into JavaScript applications using JSIL.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文