예제 #1
0
        /// <summary>
        /// Recursively creates builds.
        /// </summary>
        /// <param name="results">List of statuses indicating the results</param>
        /// <returns></returns>
        public override BuildPlayersResult Build()
        {
            // Setup variables
            BuildPlayersResult        results          = SetupResults();
            Stack <GroupBuildSetting> embeddedSettings = new Stack <GroupBuildSetting>();

            // Go through all the parents
            IChildBuildSetting checkParent = parentSetting as IChildBuildSetting;

            while (checkParent != null)
            {
                // Check if the parent is a group build setting
                if (checkParent is GroupBuildSetting)
                {
                    embeddedSettings.Push((GroupBuildSetting)checkParent);
                }

                // Go to the parent of the current setting we're reviewing
                checkParent = checkParent.parentSetting as IChildBuildSetting;
            }

            // Go through the stack
            Stack <BuildPlayersResult.GroupBuildScope> embeddedScopes = new Stack <BuildPlayersResult.GroupBuildScope>(embeddedSettings.Count);

            while (embeddedSettings.Count > 0)
            {
                embeddedScopes.Push(new BuildPlayersResult.GroupBuildScope(results, embeddedSettings.Pop()));
            }
            Build(results);
            while (embeddedScopes.Count > 0)
            {
                embeddedScopes.Pop().Dispose();
            }
            return(results);
        }
예제 #2
0
        protected static IChildBuildSetting RemoveSetting(List <IChildBuildSetting> allSettings, int index)
        {
            // Grab the return value
            IChildBuildSetting returnChild = allSettings[index];

            // Reset parent
            returnChild.Parent = null;

            // Remove the element
            allSettings.RemoveAt(index);
            return(returnChild);
        }
 public void Add(IChildBuildSetting addSetting)
 {
     AddSetting(this, allSettings, addSetting);
 }
예제 #4
0
 protected static void AddSetting(IBuildSetting parent, List <IChildBuildSetting> allSettings, IChildBuildSetting setting)
 {
     setting.Parent = parent;
     allSettings.Add(setting);
 }