Permalink
Browse files

Started conversion to MoonSharp 2.0 / VS Code

  • Loading branch information...
1 parent e651e10 commit 30ec871d75ba31a7057a4a49dfb21d15807e3a35 @chrisgregan chrisgregan committed Oct 18, 2016
Showing 577 changed files with 40,593 additions and 8,143 deletions.
View
@@ -0,0 +1,36 @@
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "Unity Editor",
+ "type": "unity",
+ "request": "launch"
+ },
+ {
+ "name": "Windows Player",
+ "type": "unity",
+ "request": "launch"
+ },
+ {
+ "name": "OSX Player",
+ "type": "unity",
+ "request": "launch"
+ },
+ {
+ "name": "Linux Player",
+ "type": "unity",
+ "request": "launch"
+ },
+ {
+ "name": "iOS Player",
+ "type": "unity",
+ "request": "launch"
+ },
+ {
+ "name": "Android Player",
+ "type": "unity",
+ "request": "launch"
+
+ }
+ ]
+}
View
@@ -0,0 +1,57 @@
+{
+ "files.exclude":
+ {
+ "**/.DS_Store":true,
+ "**/.git":true,
+ "**/.gitignore":true,
+ "**/.gitattributes":true,
+ "**/.gitmodules":true,
+ "**/.svn":true,
+ "**/*.booproj":true,
+ "**/*.pidb":true,
+ "**/*.suo":true,
+ "**/*.user":true,
+ "**/*.userprefs":true,
+ "**/*.unityproj":true,
+ "**/*.dll":true,
+ "**/*.exe":true,
+ "**/*.pdf":true,
+ "**/*.mid":true,
+ "**/*.midi":true,
+ "**/*.wav":true,
+ "**/*.gif":true,
+ "**/*.ico":true,
+ "**/*.jpg":true,
+ "**/*.jpeg":true,
+ "**/*.png":true,
+ "**/*.psd":true,
+ "**/*.tga":true,
+ "**/*.tif":true,
+ "**/*.tiff":true,
+ "**/*.3ds":true,
+ "**/*.3DS":true,
+ "**/*.fbx":true,
+ "**/*.FBX":true,
+ "**/*.lxo":true,
+ "**/*.LXO":true,
+ "**/*.ma":true,
+ "**/*.MA":true,
+ "**/*.obj":true,
+ "**/*.OBJ":true,
+ "**/*.asset":true,
+ "**/*.cubemap":true,
+ "**/*.flare":true,
+ "**/*.mat":true,
+ "**/*.meta":true,
+ "**/*.prefab":true,
+ "**/*.unity":true,
+ "build/":true,
+ "Build/":true,
+ "Library/":true,
+ "library/":true,
+ "obj/":true,
+ "Obj/":true,
+ "ProjectSettings/":true, "temp/":true,
+ "Temp/":true
+ }
+}
@@ -1,15 +1,15 @@
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
-using UnityEngine;
+using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using System.Diagnostics;
using System.Linq;
using MoonSharp.Interpreter;
using MoonSharp.Interpreter.Loaders;
-using MoonSharp.RemoteDebugger;
+using MoonSharp.VsCodeDebugger;
namespace Fungus
{
@@ -30,9 +30,9 @@ public class LuaEnvironment : MonoBehaviour
protected Script interpreter;
/// <summary>
- /// Instance of remote debugging service when debugging option is enabled.
+ /// Instance of VS Code debug server when debugging option is enabled.
/// </summary>
- protected RemoteDebuggerService remoteDebuggerService;
+ protected MoonSharpVsCodeDebugServer debugServer;
/// <summary>
/// Flag used to avoid startup dependency issues.
@@ -45,6 +45,17 @@ protected virtual void Start()
}
/// <summary>
+ /// This function is called when the MonoBehaviour will be destroyed.
+ /// </summary>
+ protected virtual void OnDestroy()
+ {
+ if (debugServer != null)
+ {
+ debugServer.Detach(interpreter);
+ }
+ }
+
+ /// <summary>
/// Register all Lua files in the project so they can be accessed at runtime.
/// </summary>
protected virtual void InitLuaScriptFiles()
@@ -114,22 +125,16 @@ protected virtual IEnumerator RunUnityCoroutineImpl(IEnumerator coroutine)
yield return StartCoroutine(coroutine);
}
- protected virtual void ActivateRemoteDebugger(Script script)
+ protected virtual void ActivateVSCodeDebugger(Script script)
{
- #if UNITY_STANDALONE
- if (remoteDebuggerService == null)
- {
- remoteDebuggerService = new RemoteDebuggerService();
+ // Create the debugger server
+ debugServer = new MoonSharpVsCodeDebugServer();
- // the last boolean is to specify if the script is free to run
- // after attachment, defaults to false
- remoteDebuggerService.Attach(script, gameObject.name, false);
- }
+ // Start the debugger server
+ debugServer.Start();
- // start the web-browser at the correct url. Replace this or just
- // pass the url to the user in some way.
- Process.Start(remoteDebuggerService.HttpUrlStringLocalHost);
- #endif
+ // Attach the script to the debugger
+ debugServer.AttachToScript(script, gameObject.name);
}
/// <summary>
@@ -256,10 +261,12 @@ public virtual void InitEnvironment()
initializer.Initialize();
}
+ #if UNITY_STANDALONE
if (remoteDebugger)
{
- ActivateRemoteDebugger(interpreter);
+ ActivateVSCodeDebugger(interpreter);
}
+ #endif
initialised = true;
}
@@ -1,8 +1,8 @@
fileFormatVersion: 2
-guid: 483efc3d00eeb41e99e9472ecf3c3bd4
+guid: 1d146bab99f9448b882add0b6413c8eb
folderAsset: yes
-timeCreated: 1454345352
-licenseType: Free
+timeCreated: 1475786115
+licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: fe983e267963641219d60f73a36907ce
+folderAsset: yes
+timeCreated: 1475786652
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 71b4d33685e4746ca9cfe341d75910d9
+folderAsset: yes
+timeCreated: 1476112669
+licenseType: Pro
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
Oops, something went wrong.

0 comments on commit 30ec871

Please sign in to comment.