コード例 #1
0
        public static ISingleton GetInstance(Type type)
        {
            ISingleton singleton = null;

            if (!_singletons.TryGetValue(type, out singleton))
            {
                singleton = CreateInstance(type);

                singleton.Init();

                _singletons.Add(type, singleton);

                DebugEx.Log(ELogType.System, $"Singleton: Create instance, type= {type.Name}.");
            }

            return(singleton);
        }