Beispiel #1
0
        public override void GenerateIntoContainer(Runtime.Container container)
        {
            var runtimeRawList = new Runtime.InkList();

            if (itemIdentifierList != null)
            {
                foreach (var itemIdentifier in itemIdentifierList)
                {
                    var nameParts = itemIdentifier?.name.Split('.');

                    string listName     = null;
                    string listItemName = null;
                    if (nameParts.Length > 1)
                    {
                        listName     = nameParts [0];
                        listItemName = nameParts [1];
                    }
                    else
                    {
                        listItemName = nameParts [0];
                    }

                    var listItem = story.ResolveListItem(listName, listItemName, this);
                    if (listItem == null)
                    {
                        if (listName == null)
                        {
                            Error("Could not find list definition that contains item '" + itemIdentifier + "'");
                        }
                        else
                        {
                            Error("Could not find list item " + itemIdentifier);
                        }
                    }
                    else
                    {
                        if (listName == null)
                        {
                            listName = ((ListDefinition)listItem.parent).identifier?.name;
                        }
                        var item = new Runtime.InkListItem(listName, listItem.name);

                        if (runtimeRawList.ContainsKey(item))
                        {
                            Warning("Duplicate of item '" + itemIdentifier + "' in list.");
                        }
                        else
                        {
                            runtimeRawList [item] = listItem.seriesValue;
                        }
                    }
                }
            }

            container.AddContent(new Runtime.ListValue(runtimeRawList));
        }
Beispiel #2
0
        public override Runtime.Object GenerateRuntimeObject()
        {
            var initialValues = new Runtime.InkList();

            foreach (var itemDef in itemDefinitions)
            {
                if (itemDef.inInitialList)
                {
                    var item = new Runtime.InkListItem(this.name, itemDef.name);
                    initialValues [item] = itemDef.seriesValue;
                }
            }

            // Set origin name, so
            initialValues.SetInitialOriginName(name);

            return(new Runtime.ListValue(initialValues));
        }