calling c# methods from construct 2

Get help using Construct 2

Post » Wed Oct 09, 2013 2:33 pm

So first off...I'm new to Construct 2 by like 3 days and so far Im really stoked about it. I've see some stuff about ajax and rumors of .net wrappers, but I can't seem to find a straight forward tutorial on how to call .net from construct.

I have a puzzle game I wrote in c# that has all the logic in a dll. I want to use Construct as the UI and keep my logic in the dll. Is this possible or am I wasting my time?
B
5
Posts: 8
Reputation: 366

Post » Wed Oct 09, 2013 2:45 pm

@thagr8stone it sounds like it would be quicker to redo in Construct 2. If you check out my Windows Phone plugin you can see how I've called C# methods from Construct 2.
Moderator
B
72
S
14
G
11
Posts: 900
Reputation: 11,920

Post » Wed Oct 09, 2013 2:53 pm

Umm...I it would be "faster" to whip together a new UI in construct...it took weeks to get the logic right and I just want to put a nice slick UI on it. I'm sure there are some pieces I'll have to convert (timers, UI clicks, etc) but really calling the dll is the best way to do what I want to do.
B
5
Posts: 8
Reputation: 366

Post » Wed Oct 09, 2013 3:35 pm

Any reason you're not just using a C# UI library? It seems a bit OTT to load an HTML game framework, superimpose it over your game via a WebView and then bridge HTML and native code manually.

If you want to do this without a plugin, you could use the 'Execute JavaScript' Browser action to call native code from the webview.
Moderator
B
72
S
14
G
11
Posts: 900
Reputation: 11,920

Post » Wed Oct 09, 2013 3:41 pm

Actually this is just to do a POC for my boss. If I had my way I would have just done all this in Xamarin Studio and went on with my life but I'm not in charge...
B
5
Posts: 8
Reputation: 366

Post » Wed Oct 09, 2013 3:48 pm

Create a restful service in C#, perhaps even a selfhosted WebAPI application (removes the dependency on IIS) that feeds data back and forth via JSON, and wrap your DLL method calls into the appropriate web api calls, which would then get called via the AJAX plugin. Seems rather straight forward actually...
B
14
S
6
G
1
Posts: 143
Reputation: 1,795

Post » Wed Oct 09, 2013 4:10 pm

@wizaerd sounds like he has a better understanding of what to do :)
Moderator
B
72
S
14
G
11
Posts: 900
Reputation: 11,920

Post » Wed Oct 09, 2013 5:59 pm

LOL after a bit of reading @wizaerd way idea seems like the best approach. It wouls be better if I could just load the dll directly but the web service way seems to be doing the trick. Thanks guys!
B
5
Posts: 8
Reputation: 366

Post » Wed Oct 09, 2013 6:25 pm

I agree with thehen as you already know the logic, and C2 makes implementing that much easier than regular code.

I do remember reading about this:thing a while back. Another kind of wizardry all together.
Image ImageImage
B
168
S
50
G
163
Posts: 8,221
Reputation: 105,061

Post » Wed Oct 09, 2013 7:18 pm

You could have a look at sharpkit, a c# to javascript compiler, if you don't mind pushing the logic onto the client.
B
7
S
1
Posts: 74
Reputation: 1,232

Next

Return to How do I....?

Who is online

Users browsing this forum: wenwen11212016 and 9 guests