Exemplo n.º 1
0
        //インスタンスが利用可能かをチェックする
        void CheckInstanceAvailable()
        {
            for (int i = deactiveInstanceList.Count - 1; i >= 0; i--)
            {
                if (deactiveInstanceList[i] != null)
                {
                    continue;
                }

                T removeInstance = deactiveInstanceList[i];
                deactiveInstanceList.Remove(removeInstance);
                InstanceList.Remove(removeInstance);
            }
        }
Exemplo n.º 2
0
        public void RegisterComponentType <TInst>(DrawComponentsFunc <TInst> drawFunc)
            where TInst : struct, IInstance, IEquatable <TInst>
        {
            // FIXME: Better error
            if (ComponentsDict.ContainsKey(typeof(TInst)))
            {
                throw new Exception($"Instance type already registered! (type: {typeof(TInst)})");
            }

            InstanceList list = InstanceList.Create <TInst>(16);

            ComponentsDict.Add(typeof(TInst), list);
            DrawFuncs.Add((cr, comps) => drawFunc(cr, comps.GetInstances <TInst>()));
            AddFuncDict.Add(typeof(TInst), (list, inst) => list.Add((TInst)inst));
            RemoveFuncDict.Add(typeof(TInst), (list, inst) => list.Remove((TInst)inst));
        }
Exemplo n.º 3
0
        //MaxCountを超えてオブジェクトが生成されている場合は使用していないオブジェクトを破棄する
        void RemoveCheck()
        {
            CheckInstanceAvailable();
            T removeInstance;

            while (0 < deactiveInstanceList.Count)
            {
                if (InstanceList.Count <= maxCount)
                {
                    break;
                }
                removeInstance = deactiveInstanceList[0];
                deactiveInstanceList.Remove(removeInstance);
                InstanceList.Remove(removeInstance);
                Destroy(removeInstance.gameObject);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Closes this YoderZone.NLogConfig.SettingsHelper.
        /// </summary>
        public void Close()
        {
            lock (this.configLock)
            {
                LogManager.ConfigurationChanged -= this.LogManager_ConfigurationChanged;

                if (this.rules != null)
                {
                    foreach (var loggingRule in
                             this.rules.Where(
                                 loggingRule =>
                                 this.Configuration.LoggingRules.Contains(loggingRule.Value)))
                    {
                        this.Configuration.LoggingRules.Remove(loggingRule.Value);
                    }

                    this.Rules.Clear();
                    this.rules = null;
                }

                if (this.targets == null)
                {
                    return;
                }

                foreach (var target in
                         this.targets.Where(
                             target => this.Configuration.ConfiguredNamedTargets.Contains(
                                 target.Value)))
                {
                    this.config.RemoveTarget(target.Key);
                }

                this.targets.Clear();
                this.targets = null;
                InstanceList.Remove(this.ApplicationName);
                LogManager.ReconfigExistingLoggers();
            }
        }