diff --git a/Oxide.Unity.sln b/Oxide.Unity.sln
index e1730db..d88b3c5 100644
--- a/Oxide.Unity.sln
+++ b/Oxide.Unity.sln
@@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2008
MinimumVisualStudioVersion = 15.0
-Project("{AC016865-AE43-4FEF-BD68-8B9AEFDA0B1A}") = "Oxide.Unity", "Oxide.Unity\Oxide.Unity.csproj", "{52C26C5B-23E5-48A2-B403-5FF5C898E91A}"
+Project("{AC016865-AE43-4FEF-BD68-8B9AEFDA0B1A}") = "Oxide.Unity", "src\Oxide.Unity.csproj", "{52C26C5B-23E5-48A2-B403-5FF5C898E91A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/Oxide.Unity/Dependencies/UnityEngine.dll b/src/Dependencies/UnityEngine.dll
similarity index 100%
rename from Oxide.Unity/Dependencies/UnityEngine.dll
rename to src/Dependencies/UnityEngine.dll
diff --git a/Oxide.Unity/ExtensionMethods.cs b/src/ExtensionMethods.cs
similarity index 94%
rename from Oxide.Unity/ExtensionMethods.cs
rename to src/ExtensionMethods.cs
index ec920e5..026368b 100644
--- a/Oxide.Unity/ExtensionMethods.cs
+++ b/src/ExtensionMethods.cs
@@ -16,7 +16,7 @@ public static class ExtensionMethods
///
public static Vector3 ToVector3(this string vector3)
{
- var split = vector3.Split(',').Select(Convert.ToSingle).ToArray();
+ float[] split = vector3.Split(',').Select(Convert.ToSingle).ToArray();
return split.Length == 3 ? new Vector3(split[0], split[1], split[2]) : Vector3.zero;
}
diff --git a/Oxide.Unity/Logging/UnityLogger.cs b/src/Logging/UnityLogger.cs
similarity index 99%
rename from Oxide.Unity/Logging/UnityLogger.cs
rename to src/Logging/UnityLogger.cs
index 949b1f6..3fce8aa 100644
--- a/Oxide.Unity/Logging/UnityLogger.cs
+++ b/src/Logging/UnityLogger.cs
@@ -1,6 +1,5 @@
using System.Threading;
using UnityEngine;
-
using Logger = Oxide.Core.Logging.Logger;
using LogType = Oxide.Core.Logging.LogType;
diff --git a/Oxide.Unity/Oxide.Unity.csproj b/src/Oxide.Unity.csproj
similarity index 89%
rename from Oxide.Unity/Oxide.Unity.csproj
rename to src/Oxide.Unity.csproj
index a1bbdc2..5ebe1df 100644
--- a/Oxide.Unity/Oxide.Unity.csproj
+++ b/src/Oxide.Unity.csproj
@@ -20,10 +20,12 @@
-->
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client
/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/2.0-api
+ Oxide.Core.Unity
+
-
+
Dependencies\UnityEngine.dll
@@ -32,7 +34,7 @@
- Oxide
+ References
diff --git a/Oxide.Unity/Plugins/UnityCore.cs b/src/Plugins/UnityCore.cs
similarity index 100%
rename from Oxide.Unity/Plugins/UnityCore.cs
rename to src/Plugins/UnityCore.cs
diff --git a/Oxide.Unity/Plugins/UnityPluginLoader.cs b/src/Plugins/UnityPluginLoader.cs
similarity index 100%
rename from Oxide.Unity/Plugins/UnityPluginLoader.cs
rename to src/Plugins/UnityPluginLoader.cs
diff --git a/Oxide.Unity/UnityExtension.cs b/src/UnityExtension.cs
similarity index 100%
rename from Oxide.Unity/UnityExtension.cs
rename to src/UnityExtension.cs
diff --git a/Oxide.Unity/UnityScript.cs b/src/UnityScript.cs
similarity index 63%
rename from Oxide.Unity/UnityScript.cs
rename to src/UnityScript.cs
index e035ec6..c29d02e 100644
--- a/Oxide.Unity/UnityScript.cs
+++ b/src/UnityScript.cs
@@ -24,13 +24,16 @@ private void Awake()
{
oxideMod = Interface.Oxide;
- var eventInfo = typeof(Application).GetEvent("logMessageReceived");
+ EventInfo eventInfo = typeof(Application).GetEvent("logMessageReceived");
if (eventInfo == null)
{
// Unity 4
- var logCallbackField = typeof(Application).GetField("s_LogCallback", BindingFlags.Static | BindingFlags.NonPublic);
- var logCallback = logCallbackField?.GetValue(null) as Application.LogCallback;
- if (logCallback == null) Interface.Oxide.LogWarning("No Unity application log callback is registered");
+ FieldInfo logCallbackField = typeof(Application).GetField("s_LogCallback", BindingFlags.Static | BindingFlags.NonPublic);
+ Application.LogCallback logCallback = logCallbackField?.GetValue(null) as Application.LogCallback;
+ if (logCallback == null)
+ {
+ Interface.Oxide.LogWarning("No Unity application log callback is registered");
+ }
#pragma warning disable 0618
Application.RegisterLogCallback((message, stack_trace, type) =>
@@ -42,7 +45,7 @@ private void Awake()
else
{
// Unity 5
- var handleException = Delegate.CreateDelegate(eventInfo.EventHandlerType, this, "LogMessageReceived");
+ Delegate handleException = Delegate.CreateDelegate(eventInfo.EventHandlerType, this, "LogMessageReceived");
eventInfo.GetAddMethod().Invoke(null, new object[] { handleException });
}
}
@@ -51,7 +54,11 @@ private void Awake()
private void OnDestroy()
{
- if (oxideMod.IsShuttingDown) return;
+ if (oxideMod.IsShuttingDown)
+ {
+ return;
+ }
+
oxideMod.LogWarning("The Oxide Unity Script was destroyed (creating a new instance)");
oxideMod.NextTick(Create);
}
@@ -65,9 +72,12 @@ private void OnApplicationQuit()
}
}
- private void LogMessageReceived(string message, string stackTrace, LogType type)
+ private static void LogMessageReceived(string message, string stackTrace, LogType type)
{
- if (type == LogType.Exception) RemoteLogger.Exception(message, stackTrace);
+ if (type == LogType.Exception)
+ {
+ RemoteLogger.Exception(message, stackTrace);
+ }
}
}
}