| | 1 | | using System; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | namespace DCL |
| | 5 | | { |
| | 6 | | public class PluginInfo |
| | 7 | | { |
| 35 | 8 | | public bool isEnabled => instance != null; |
| | 9 | | public string flag; |
| | 10 | | public PluginBuilder builder; |
| | 11 | | public IPlugin instance; |
| | 12 | | public bool enableOnInit = false; |
| | 13 | |
|
| | 14 | | public void Enable() |
| | 15 | | { |
| 10 | 16 | | if ( isEnabled ) |
| 0 | 17 | | return; |
| | 18 | |
|
| | 19 | | try |
| | 20 | | { |
| 10 | 21 | | instance = builder.Invoke(); |
| 10 | 22 | | enableOnInit = false; |
| 10 | 23 | | } |
| | 24 | | catch (Exception e) |
| | 25 | | { |
| 0 | 26 | | Debug.LogException(e); |
| 0 | 27 | | } |
| 10 | 28 | | } |
| | 29 | |
|
| | 30 | | public void Disable() |
| | 31 | | { |
| 11 | 32 | | if ( !isEnabled ) |
| 1 | 33 | | return; |
| | 34 | |
|
| 10 | 35 | | instance.Dispose(); |
| 10 | 36 | | instance = null; |
| 10 | 37 | | } |
| | 38 | | } |
| | 39 | | } |