Пример #1
0
        internal List <Slider> CreateAndReturnCompleteSliderList()
        {
            List <Slider> newList = new List <Slider>();

            // build the list:

            newList = sliderList.Values.ToList();



            var enumerator = sliderNodeList.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    SliderNode value = enumerator.Current.Value;
                    string     key   = enumerator.Current.Key;
                    //var element = enumerator.Current;
                    // loop body goes here



                    //create the list from each subnode
                    List <Slider> listFromNode = value.CreateAndReturnCompleteSliderList();

                    // then, add the objects from the list to our big list.
                    for (int i = 0; i < listFromNode.Count; i++)
                    {
                        newList.Add(listFromNode[i]);
                    }
                }
            }
            finally
            {
                enumerator.Dispose();
            }

            return(newList);
        }
Пример #2
0
        // to-do: add function that lets us grab values from the tree and write values to the tree, with a provided DIR.
        // also need to be able to get a list of all subnodes, or a list of subnodes in a specific DIR.

        /// <summary>
        /// Iterative creation of a list by walking through each subnode and adding it to a list. Returns the list of Sliders.
        /// </summary>
        /// <returns></returns>
        public void UpdateCompleteSliderList()
        {
            List <Slider> newList = new List <Slider>();

            // build the list:

            var enumerator = sliderNodeList.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    SliderNode value = enumerator.Current.Value;
                    string     key   = enumerator.Current.Key;
                    //var element = enumerator.Current;
                    // loop body goes here

                    //create the list from each subnode
                    List <Slider> listFromNode = value.CreateAndReturnCompleteSliderList();

                    // then, add the objects from the list to our big list.
                    for (int i = 0; i < listFromNode.Count; i++)
                    {
                        newList.Add(listFromNode[i].SetIndexInTree(i));
                    }
                }
            }
            catch (System.Exception e)
            {
                Debug.LogError(e.ToString());
            }
            finally
            {
                enumerator.Dispose();
            }

            completeSliderList = newList;
        }