예제 #1
0
        /// <summary>Get the tokens which are defined for a specific content pack. This returns a reference to the list, which can be held for a live view of the tokens. If the content pack isn't currently tracked, this will add it.</summary>
        /// <param name="contentPack">The content pack to manage.</param>
        public ModTokenContext TrackLocalTokens(IContentPack contentPack)
        {
            if (!this.LocalTokens.TryGetValue(contentPack, out ModTokenContext localTokens))
            {
                this.LocalTokens[contentPack] = localTokens = new ModTokenContext(this);
                foreach (IToken token in this.GetLocalTokens(contentPack))
                {
                    localTokens.Add(token);
                }
            }

            return(localTokens);
        }
예제 #2
0
        /// <summary>Get the tokens which are defined for a specific content pack. This returns a reference to the list, which can be held for a live view of the tokens. If the content pack isn't currently tracked, this will add it.</summary>
        /// <param name="contentPack">The content pack to manage.</param>
        public ModTokenContext TrackLocalTokens(IContentPack contentPack)
        {
            if (!this.LocalTokens.TryGetValue(contentPack, out ModTokenContext localTokens))
            {
                this.LocalTokens[contentPack] = localTokens = new ModTokenContext(this);
                foreach (IValueProvider valueProvider in this.GetLocalValueProviders(contentPack))
                {
                    localTokens.Add(new GenericToken(valueProvider));
                }
            }

            return(localTokens);
        }
예제 #3
0
        /// <summary>Get the tokens which are defined for a specific content pack. This returns a reference to the list, which can be held for a live view of the tokens. If the content pack isn't currently tracked, this will add it.</summary>
        /// <param name="contentPack">The content pack to manage.</param>
        public ModTokenContext TrackLocalTokens(IContentPack contentPack)
        {
            string scope = contentPack.Manifest.UniqueID;

            if (!this.LocalTokens.TryGetValue(contentPack, out ModTokenContext localTokens))
            {
                this.LocalTokens[contentPack] = localTokens = new ModTokenContext(scope, this);
                foreach (IValueProvider valueProvider in this.GetLocalValueProviders(contentPack))
                {
                    localTokens.Add(new GenericToken(valueProvider, scope));
                }
            }

            return(localTokens);
        }