Browse Source

Fixes for compile errors on .NET Core

Still has problems running Lua though.
master
Chris Gregan 9 years ago
parent
commit
cdfcd2f1c3
  1. 5
      Assets/Fungus/Scripts/Components/Character.cs
  2. 9
      Assets/Fungus/Thirdparty/FungusLua/Scripts/Components/LuaEnvironment.cs
  3. 7
      Assets/Fungus/Thirdparty/FungusLua/Scripts/Utils/StringSubstituter.cs
  4. 7
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/JSON/JSONObject.cs

5
Assets/Fungus/Scripts/Components/Character.cs

@ -113,8 +113,13 @@ namespace Fungus
/// </summary>
public virtual bool NameStartsWith(string matchString)
{
#if NETFX_CORE
return name.StartsWith(matchString, StringComparison.CurrentCultureIgnoreCase)
|| nameText.StartsWith(matchString, StringComparison.CurrentCultureIgnoreCase);
#else
return name.StartsWith(matchString, true, System.Globalization.CultureInfo.CurrentCulture)
|| nameText.StartsWith(matchString, true, System.Globalization.CultureInfo.CurrentCulture);
#endif
}
/// <summary>

9
Assets/Fungus/Thirdparty/FungusLua/Scripts/Components/LuaEnvironment.cs vendored

@ -179,7 +179,14 @@ namespace Fungus
/// </summary>
public static void RegisterType(string typeName, bool extensionType = false)
{
System.Type t = System.Type.GetType(typeName);
System.Type t = null;
try
{
t = System.Type.GetType(typeName);
}
catch
{}
if (t == null)
{
UnityEngine.Debug.LogWarning("Type not found: " + typeName);

7
Assets/Fungus/Thirdparty/FungusLua/Scripts/Utils/StringSubstituter.cs vendored

@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MarkerMetro.Unity.WinLegacy.Reflection;
namespace Fungus
{
@ -43,9 +44,15 @@ namespace Fungus
public virtual void CacheSubstitutionHandlers()
{
// Use reflection to find all components in the scene that implement ISubstitutionHandler
#if NETFX_CORE
var types = this.GetType().GetAssembly().GetTypes().Where(type => type.IsClass() &&
!type.IsAbstract() &&
typeof(ISubstitutionHandler).IsAssignableFrom(type));
#else
var types = this.GetType().Assembly.GetTypes().Where(type => type.IsClass &&
!type.IsAbstract &&
typeof(ISubstitutionHandler).IsAssignableFrom(type));
#endif
substitutionHandlers.Clear();
foreach (System.Type t in types)

7
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/JSON/JSONObject.cs vendored

@ -14,6 +14,7 @@ using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using MoonSharp.Interpreter.Diagnostics.PerformanceCounters;
/*
* http://www.opensource.org/licenses/lgpl-2.1.php
* JSONObject class v.1.4.1
@ -732,8 +733,10 @@ public class JSONObject {
}
public IEnumerable<string> PrintAsync(bool pretty = false) {
StringBuilder builder = new StringBuilder();
#if !NETFX_CORE
printWatch.Reset();
printWatch.Start();
#endif
foreach(IEnumerable e in StringifyAsync(0, builder, pretty)) {
yield return null;
}
@ -754,11 +757,15 @@ public class JSONObject {
("reached max depth!");
yield break;
}
#if !NETFX_CORE
if(printWatch.Elapsed.TotalSeconds > maxFrameTime) {
printWatch.Reset();
yield return null;
printWatch.Start();
}
#endif
switch(type) {
case Type.BAKED:
builder.Append(str);

Loading…
Cancel
Save