/
TON618OFF
/
Unity-Project-RTU
Обзор
Документация
Войти
/
TON618OFF
/
Unity-Project-RTU
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Library/PackageCache/com.unity.visualscripting@1.9.4/Runtime/VisualScripting.Core/Cloning/CloningContext.cs
45 строк
1 KB
TON618OFF
release
03 окт 2024, 22:20
03 окт 2024, 22:20
7c70e9f
Код
Авторство
О чём код?
using System; using System.Collections.Generic; namespace Unity.VisualScripting { public sealed class CloningContext : IPoolable, IDisposable { public Dictionary<object, object> clonings { get; } = new Dictionary<object, object>(ReferenceEqualityComparer.Instance); public ICloner fallbackCloner { get; private set; } public bool tryPreserveInstances { get; private set; } private bool disposed; void IPoolable.New() { disposed = false; } void IPoolable.Free() { disposed = true; clonings.Clear(); } public void Dispose() { if (disposed) { throw new ObjectDisposedException(ToString()); } GenericPool<CloningContext>.Free(this); } public static CloningContext New(ICloner fallbackCloner, bool tryPreserveInstances) { var context = GenericPool<CloningContext>.New(() => new CloningContext()); context.fallbackCloner = fallbackCloner; context.tryPreserveInstances = tryPreserveInstances; return context; } } }