Ink.Parsed.Expression.GenerateConstantIntoContainer C# (CSharp) Method

GenerateConstantIntoContainer() public method

public GenerateConstantIntoContainer ( Runtime container ) : void
container Runtime
return void
        public void GenerateConstantIntoContainer(Runtime.Container container)
        {
            if( _prototypeRuntimeConstantExpression == null ) {
                _prototypeRuntimeConstantExpression = new Runtime.Container ();
                GenerateIntoContainer (_prototypeRuntimeConstantExpression);
            }

            foreach (var runtimeObj in _prototypeRuntimeConstantExpression.content) {
                container.AddContent (runtimeObj.Copy());
            }
        }

Usage Example

        public override void GenerateIntoContainer(Runtime.Container container)
        {
            Expression constantValue = null;

            // If it's a constant reference, just generate the literal expression value
            // It's okay to access the constants at code generation time, since the
            // first thing the ExportRuntime function does it search for all the constants
            // in the story hierarchy, so they're all available.
            if (story.constants.TryGetValue(name, out constantValue))
            {
                constantValue.GenerateConstantIntoContainer(container);
                isConstantReference = true;
                return;
            }

            _runtimeVarRef = new Runtime.VariableReference(name);

            // List item reference?
            // Path might be to a list (listName.listItemName or just listItemName)
            if (path.Count == 1 || path.Count == 2)
            {
                string listItemName = null;
                string listName     = null;

                if (path.Count == 1)
                {
                    listItemName = path [0];
                }
                else
                {
                    listName     = path [0];
                    listItemName = path [1];
                }

                var listItem = story.ResolveListItem(listName, listItemName, this);
                if (listItem)
                {
                    isListItemReference = true;
                }
            }

            container.AddContent(_runtimeVarRef);
        }
All Usage Examples Of Ink.Parsed.Expression::GenerateConstantIntoContainer