Exemple #1
0
        // Need to do this to ensure that we don't use multiple different prefabs
        // with the same singleton ID
        public void MarkResource(SingletonId id, string resourcePath)
        {
            ResourceMarkInfo markInfo;

            if (_resourceMarks.TryGetValue(id, out markInfo))
            {
                if (markInfo.ResourcePath != resourcePath)
                {
                    throw new ZenjectBindException(
                              "Attempted to use multiple different resource paths with ToSinglePrefabResource using the same type/identifier: '{0}' / '{1}'"
                              .Fmt(id.ConcreteType, id.ConcreteIdentifier));
                }
            }
            else
            {
                markInfo = new ResourceMarkInfo()
                {
                    ResourcePath = resourcePath,
                };
                _resourceMarks.Add(id, markInfo);
            }

            markInfo.RefCount += 1;
        }
        // Need to do this to ensure that we don't use multiple different prefabs
        // with the same singleton ID
        public void MarkResource(SingletonId id, string resourcePath)
        {
            ResourceMarkInfo markInfo;

            if (_resourceMarks.TryGetValue(id, out markInfo))
            {
                if (markInfo.ResourcePath != resourcePath)
                {
                    throw new ZenjectBindException(
                        "Attempted to use multiple different resource paths with ToSinglePrefabResource using the same type/identifier: '{0}' / '{1}'"
                        .Fmt(id.ConcreteType, id.ConcreteIdentifier));
                }
            }
            else
            {
                markInfo = new ResourceMarkInfo()
                {
                    ResourcePath = resourcePath,
                };
                _resourceMarks.Add(id, markInfo);
            }

            markInfo.RefCount += 1;
        }