Beispiel #1
0
        private void Awake()
        {
            if (instance == null)
            {
                FARLogger.Debug($"MonoSingleton {this} is awake");
                instance = this as T;
                OnAwake();
            }

            else
            {
                FARLogger.Trace($"{this} is a MonoSingleton but an instance already exists, destroying self");
                destroyingDuplicate = true;
                Destroy(this);
            }
        }
Beispiel #2
0
        private void InitTask()
        {
            Assembly[] assemblies = ReflectionUtils.LoadedAssemblies;
            var        types      = new List <Type>(ReflectionUtils.GetTypes(assemblies));

            AddonTypes.AddRange(ReflectionUtils.FindAttribute <FARAddonAttribute>(types));
            ReloadableTypes.AddRange(ReflectionUtils.FindTypes <IReloadable>(types, true));

            if (AddonTypes.Count == 0)
            {
                FARLogger.Trace("No FARAddon types found");
            }
            if (ReloadableTypes.Count == 0)
            {
                FARLogger.Trace("No IReloadable types found");
            }

            // sort by descending priority order
            AddonTypes.Sort((x, y) => y.First.Priority.CompareTo(x.First.Priority));

            // output some debug information
            FARLogger.TraceFormat(TraceMessage());
        }