-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathUnityExtension.cs
76 lines (64 loc) · 2.44 KB
/
UnityExtension.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using Oxide.Core.Extensions;
using Oxide.Core.Unity.Plugins;
using System;
using System.Reflection;
namespace Oxide.Core.Unity
{
/// <summary>
/// The extension class that represents this extension
/// </summary>
public class UnityExtension : Extension
{
internal static Assembly Assembly = Assembly.GetExecutingAssembly();
internal static AssemblyName AssemblyName = Assembly.GetName();
internal static VersionNumber AssemblyVersion = new VersionNumber(AssemblyName.Version.Major, AssemblyName.Version.Minor, AssemblyName.Version.Build);
internal static string AssemblyAuthors = ((AssemblyCompanyAttribute)Attribute.GetCustomAttribute(Assembly, typeof(AssemblyCompanyAttribute), false)).Company;
/// <summary>
/// Gets whether this extension is a core extension
/// </summary>
public override bool IsCoreExtension => true;
/// <summary>
/// Gets the name of this extension
/// </summary>
public override string Name => "Unity";
/// <summary>
/// Gets the author of this extension
/// </summary>
public override string Author => AssemblyAuthors;
/// <summary>
/// Gets the version of this extension
/// </summary>
public override VersionNumber Version => AssemblyVersion;
/// <summary>
/// Initializes a new instance of the UnityExtension class
/// </summary>
/// <param name="manager"></param>
public UnityExtension(ExtensionManager manager) : base(manager)
{
}
/// <summary>
/// Loads this extension
/// </summary>
public override void Load()
{
Interface.Oxide.LogInfo($"Unity version: {UnityEngine.Application.unityVersion}");
Manager.RegisterPluginLoader(new UnityPluginLoader());
Interface.Oxide.RegisterEngineClock(() => UnityScript.RealtimeSinceStartup);
// Register our MonoBehaviour
UnityScript.Create();
}
/// <summary>
/// Loads plugin watchers used by this extension
/// </summary>
/// <param name="pluginDirectory"></param>
public override void LoadPluginWatchers(string pluginDirectory)
{
}
/// <summary>
/// Called when all other extensions have been loaded
/// </summary>
public override void OnModLoad()
{
}
}
}