public void UpdateLevelGroup_Ideal_ShouldInsertSuccessfully() { // #1 Insert // arrange var levelGroupService = ContainerManager.ResolveUnregistered <LevelGroupService>(); var group = new LevelGroup() { Name = "Group test", PV = 100 }; // act levelGroupService.InsertLevelGroup(group); // assert Assert.Greater(group.Id, 0); // id will be generated when inserting successfully // #2 Update // arrange var savedGroup = levelGroupService.GetLevelGroupById(group.Id); savedGroup.Name = "Updated group"; savedGroup.PV = 120; // act levelGroupService.UpdateLevelGroup(savedGroup); var updatedGroup = levelGroupService.GetLevelGroupById(group.Id); // assert Assert.AreEqual("Updated group", updatedGroup.Name); Assert.AreEqual(120, updatedGroup.PV); // clean up CleanUp(levelGroupService, group); }
/* Method to update the tab pane contents. */ void tab_update(LevelGroup lg) { EventHandler updateHandler = delegate(object sender, EventArgs args) { tab_update(lg); }; FormClosedEventHandler formClosedHandler = delegate(object sender, FormClosedEventArgs args) { tab_update(lg); }; Module[] modlist = course.getModules(lg.level); /* Remove controls... */ foreach (ModuleControlGroup mcg in lg.levelControlGroups) { mcg.removeControls(); } lg.levelControlGroups.Clear(); lg.credits = Course.sumModuleCredit(modlist); //Point cur = lg.tabpanel.Location; Point cur = new Point(0, 0); foreach (Module m in modlist) { ModuleControlGroup mcg = new ModuleControlGroup(formClosedHandler, updateHandler, course, lg.level, 120 - lg.credits, m, lg.tabpanel); mcg.addControls(cur, out cur); lg.levelControlGroups.Add(mcg); } }
/// <summary> /// Reset values and remove any spawned level components /// </summary> private void CleanUp() { // Reset to default values mLevelSwitchPulse = LevelGroupSwitchTime; mCurrentLevelGroup = StartingLevelGroup; mNumLevelSwitches = 0; // Clean out some other values mLastCenterPosition = Vector3.zero; // Clear out all components LevelComponent currentComponent; while (mLevelComponentQueue.Count > 0) { currentComponent = mLevelComponentQueue.Dequeue(); currentComponent.Destroy(); } // go through all level groups and reset foreach (LevelGroup lvGroup in LevelGroups) { lvGroup.Reset(); } }
void Awake() { LoadGameData(); SceneManager.LoadScene(levelGroups[0].sceneName, LoadSceneMode.Additive); currentGroup = levelGroups[0]; }
IEnumerator WaitToFillGroup(long numberOf, LevelGroup currentGroup, int stageNumber, List <GameObject> floorGameobjects, List <int> ids) { yield return(StartCoroutine(LoadAllAssetsByKey(numberOf, currentGroup, stageNumber))); DoGameobjectsFillUp(currentGroup, floorGameobjects, ids); Debug.Log(currentGroup.LevelGroupScenes[0]); }
private IEnumerator UnloadCurrentScene(LevelGroup newGroup, int caseNumber) { AsyncOperation async = SceneManager.UnloadSceneAsync(currentGroup.sceneName); yield return(async); StartCoroutine(LoadNextScene(newGroup, caseNumber)); }
private IEnumerator LoadNextScene(LevelGroup newGroup, int caseNumber) { AsyncOperation async = SceneManager.LoadSceneAsync(newGroup.sceneName, LoadSceneMode.Additive); yield return(async); LoadCase(PMWrapper.currentLevel, caseNumber); }
public void OnPMCaseSwitched(int caseNumber) { LevelGroup newGroup = GetGroup(PMWrapper.currentLevel); if (currentGroup.sceneName != newGroup.sceneName) { StartCoroutine(UnloadCurrentScene(newGroup, caseNumber)); currentGroup = newGroup; } else { LoadCase(PMWrapper.currentLevel, caseNumber); } }
public override void OnInspectorGUI() { serializedObject.Update(); list.DoLayoutList(); serializedObject.ApplyModifiedProperties(); LevelGroup myScript = (LevelGroup)target; myScript.folderName = EditorGUILayout.TextField("Folder Name", myScript.folderName); if (GUILayout.Button("Sync List")) { myScript.SyncList(); } }
void backToMap() { if (transitionState.overworldParent.activeSelf) { startP = camTrans.position; lerpTimer.turnTimerOn(); } else { int groupId = transitionState.levelObjects[(int)transitionState.currentLevelType].GetComponent <BoardLogic>().groupId; LevelGroup group = transitionState.levelGroups[groupId]; TransitionState.OverworldTransLevelData data = new TransitionState.OverworldTransLevelData(transitionState.currentLevelType, group.GetPos(transitionState)); transitionState.SetTransition_(transitionState.BackToWorldTransition, data); } }
public void Awake() { levelObjects = new GameObject[(int)LevelType.LEVEL_COUNT]; saveStates = new SaveState[(int)LevelType.LEVEL_COUNT]; levelGroups = new LevelGroup[(int)LevelType.LEVEL_COUNT]; for (int i = 0; i < levelGroups.Length; ++i) { levelGroups[i] = new LevelGroup(); } LoadSaveFile(); overworldStars = new ClickLevel[(int)LevelType.LEVEL_COUNT]; levelPosInOverworld = new Vector3[(int)LevelType.LEVEL_COUNT]; DontDestroyOnLoad(gameObject); }
/// <summary> /// Transitions to random new level group. /// </summary> private void TransitionToRandomNewLevelGroup() { // Cut to a new, different level that has the proper level ID. // Update our level switches mNumLevelSwitches++; // Pull out all levels that are 'legal' to switch to List <LevelGroup> potentialLevels = new List <LevelGroup>(); foreach (LevelGroup levelGroup in LevelGroups) { if (levelGroup != mCurrentLevelGroup && // Don't switch to the current group levelGroup.levelGroupDifficulty <= mNumLevelSwitches) // Dont switch to a group that is a higher 'level' then us { potentialLevels.Add(levelGroup); } } if (potentialLevels.Count > 0) { // Choose a random level int randomIndex = Random.Range(0, potentialLevels.Count); LevelGroup newLevelGroup = potentialLevels[randomIndex]; LevelGroup.eLevelGroupID currentGroupID = mCurrentLevelGroup.LevelGroupID; LevelGroup.eLevelGroupID newGroupID = newLevelGroup.LevelGroupID; // Transition! mCurrentLevelGroup = newLevelGroup; Debug.Log("Transitioning to level " + newLevelGroup.LevelGroupID); // Now that we succesfully transitioned, determine if there is a level transition component. foreach (LevelTransitionComponent currentTransition in LevelTransitionGroups) { if (currentTransition.FromGroupID == currentGroupID && currentTransition.ToGroupID == newGroupID) { // Push this component nowww PushAndInstantiateRandomComponent(currentTransition); } } } else { Debug.LogError("No other levels to switch to. Perhaps there are no other level groups, or we havent reached a new " + "level number yet? Current number transitions: " + mNumLevelSwitches); } }
public MainPage() { state = new GPAState(); fileexists = state.load(filepath); course = state.getCourse(); InitializeComponent(); level4Group = new LevelGroup(Level.LEVEL_4, Tab4ModulePanel); level5Group = new LevelGroup(Level.LEVEL_5, Tab5ModulePanel); level6Group = new LevelGroup(Level.LEVEL_6, Tab6ModulePanel); level4SummaryGroups = new List<SummaryModuleGroup>(); level5SummaryGroups = new List<SummaryModuleGroup>(); level6SummaryGroups = new List<SummaryModuleGroup>(); tabControl1.Selected += new TabControlEventHandler(tabControl1_Selected); }
public MainPage() { state = new GPAState(); fileexists = state.load(filepath); course = state.getCourse(); InitializeComponent(); level4Group = new LevelGroup(Level.LEVEL_4, Tab4ModulePanel); level5Group = new LevelGroup(Level.LEVEL_5, Tab5ModulePanel); level6Group = new LevelGroup(Level.LEVEL_6, Tab6ModulePanel); level4SummaryGroups = new List <SummaryModuleGroup>(); level5SummaryGroups = new List <SummaryModuleGroup>(); level6SummaryGroups = new List <SummaryModuleGroup>(); tabControl1.Selected += new TabControlEventHandler(tabControl1_Selected); }
public async Task <JsonResult> AddLevelGroup([FromBody] LevelGroup levelGroup) { try { _context.Add(levelGroup); await _context.SaveChangesAsync(); return(Json(new ApiMessage { HasError = false, Message = "Success" })); } catch (Exception e) { return(Json(new ApiMessage { HasError = true, Message = e.Message })); } }
private void DoGameobjectsFillUp(LevelGroup currentGroup, List <GameObject> floorGameobjects, List <int> ids) { foreach (int id in ids) { Debug.LogWarning("ids:" + id); } Debug.LogWarning(currentGroup.levelName); foreach (GameObject ob in currentGroup.LevelGroupScenes) { Debug.LogWarning("currentGroup.LevelGroupScenes:" + ob); } for (int i = 0; i < currentGroup.LevelGroupScenes.Count; i++) { for (int j = 0; j < ids.Count; j++) { if (currentGroup.LevelGroupScenes[i].GetComponent <Room>().GetId == ids[j]) { floorGameobjects.Add(currentGroup.LevelGroupScenes[i]); } } } }
private void LoadLevel(int level) { var levelPrefab = Resources.Load <Transform>("LevelGroup/LevelGroup_" + level); if (levelPrefab == null) { //通关 GameWin(); return; } if (CurrLevelGroup != null) { Destroy(CurrLevelGroup.gameObject); } var lg = Instantiate(levelPrefab); CurrLevelGroup = lg.GetComponent <LevelGroup>(); var playerBorn = lg.GetComponentInChildren <PlayerBornPoint>(); PlayerRobot.GetComponent <Robot.RobotCharacterController>().Teleport( playerBorn.transform.position, playerBorn.transform.rotation); Destroy(playerBorn.gameObject); }
/// <summary> /// Combines multiple templates into a single level group. /// </summary> /// <param name="templateNames">The comma-delimited string of template names.</param> public LevelGroup[] Build(string templateNames) { // First check if the group has already been built LevelGroup[] combinedGroups; if (_templates.TryGetValue(templateNames, out combinedGroups)) return combinedGroups; if (_cache.TryGetValue(templateNames, out combinedGroups)) return combinedGroups; // This list exists to preserve the order of groups. // An ordered dictionary would work too, but this is easier. var groupNames = new List<string>(); var groupMap = new Dictionary<string, List<Level>>(); var defaultGroup = new List<Level>(); string[] splitTemplateNames = templateNames.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string templateName in splitTemplateNames) { // Get the template that we're building off of LevelGroup[] groups; if (!_templates.TryGetValue(templateName, out groups)) throw new ConfigLoadException("Attempting to use undefined level template: " + templateName); foreach (LevelGroup group in groups) { string groupName = group.Name; if (groupName == null) { defaultGroup.AddRange(group); } else { List<Level> levels; // Check if the group already exists. // If so, just keep appending to that group, // otherwise, create a new group. if (!groupMap.TryGetValue(groupName, out levels)) { levels = new List<Level>(); groupMap.Add(groupName, levels); groupNames.Add(groupName); } // We won't check for duplicate levels here, // since it adds too much complexity and isn't // really that large of an issue anyways. levels.AddRange(group); } } } // Make sure we're not combining templates with and without groups if (defaultGroup.Count > 0 && groupNames.Count > 0) throw new ConfigLoadException("Cannot combine templates unless either all or none have groups"); if (defaultGroup.Count > 0) { // All templates have no groups combinedGroups = new[] { new LevelGroup(null, defaultGroup.ToArray()) }; } else { // All templates have groups // Convert each level list to a LevelGroup object combinedGroups = new LevelGroup[groupNames.Count]; for (int i = 0; i < combinedGroups.Length; ++i) { string groupName = groupNames[i]; Level[] groupLevels = groupMap[groupName].ToArray(); combinedGroups[i] = new LevelGroup(groupName, groupLevels); } } // Add the group to the cache for faster future processing _cache.Add(templateNames, combinedGroups); return combinedGroups; }
public void DeserializeSeed(string seed) { string s1 = seed.Substring(0, 2); string s2 = seed.Substring(2, 2); string s3 = seed.Substring(4, 2); string s4 = seed.Substring(6, 2); string s5 = seed.Substring(8, 2); seed = seed.Substring(10); string lvl1 = seed.Substring(0, System.Convert.ToInt16(s1) * 2); seed = seed.Substring(System.Convert.ToInt16(s1) * 2); string lvl2 = seed.Substring(0, System.Convert.ToInt16(s2) * 2); seed = seed.Substring(System.Convert.ToInt16(s2) * 2); string lvl3 = seed.Substring(0, System.Convert.ToInt16(s3) * 2); seed = seed.Substring(System.Convert.ToInt16(s3) * 2); string lvl4 = seed.Substring(0, System.Convert.ToInt16(s4) * 2); seed = seed.Substring(System.Convert.ToInt16(s4) * 2); string lvl5 = seed.Substring(0, System.Convert.ToInt16(s5) * 2); print(lvl1); print(lvl2); print(lvl3); print(lvl4); print(lvl5); List <int> lvl1_int = new List <int>(); int internalCounter = 1; int len = lvl1.Length; for (int i = 0; i < len; i++) { if (internalCounter == 2) { lvl1_int.Add(int.Parse(lvl1.Substring(0, internalCounter))); lvl1 = lvl1.Substring(internalCounter); internalCounter = 0; } internalCounter++; } LevelGroup groupLabelOne = new LevelGroup(); scenesFloorOne = new List <GameObject>(); StartCoroutine(WaitToFillGroup(long.Parse(s1), groupLabelOne, 1, scenesFloorOne, lvl1_int)); print("lvl1int: " + lvl1_int); List <int> lvl2_int = new List <int>(); internalCounter = 1; len = lvl2.Length; for (int i = 0; i < len; i++) { if (internalCounter == 2) { lvl2_int.Add(int.Parse(lvl2.Substring(0, internalCounter))); lvl2 = lvl2.Substring(internalCounter); internalCounter = 0; } internalCounter++; } LevelGroup groupLabelTwo = new LevelGroup(); scenesFloorTwo = new List <GameObject>(); StartCoroutine(WaitToFillGroup(long.Parse(s2), groupLabelTwo, 2, scenesFloorTwo, lvl2_int)); print("lvl2int: " + lvl2_int); List <int> lvl3_int = new List <int>(); internalCounter = 1; len = lvl3.Length; for (int i = 0; i < len; i++) { if (internalCounter == 2) { lvl3_int.Add(int.Parse(lvl3.Substring(0, internalCounter))); lvl3 = lvl3.Substring(internalCounter); internalCounter = 0; } internalCounter++; } LevelGroup groupLabelThree = new LevelGroup(); scenesFloorThree = new List <GameObject>(); StartCoroutine(WaitToFillGroup(long.Parse(s3), groupLabelThree, 3, scenesFloorThree, lvl3_int)); print("lvl3int: " + lvl3_int); List <int> lvl4_int = new List <int>(); internalCounter = 1; len = lvl4.Length; for (int i = 0; i < len; i++) { if (internalCounter == 2) { lvl4_int.Add(int.Parse(lvl4.Substring(0, internalCounter))); lvl4 = lvl4.Substring(internalCounter); internalCounter = 0; } internalCounter++; } LevelGroup groupLabelFour = new LevelGroup(); scenesFloorFour = new List <GameObject>(); StartCoroutine(WaitToFillGroup(long.Parse(s4), groupLabelFour, 4, scenesFloorFour, lvl4_int)); print("lvl4int: " + lvl4_int); List <int> lvl5_int = new List <int>(); internalCounter = 1; len = lvl5.Length; for (int i = 0; i < len; i++) { if (internalCounter == 2) { lvl5_int.Add(int.Parse(lvl5.Substring(0, internalCounter))); lvl5 = lvl5.Substring(internalCounter); internalCounter = 0; } internalCounter++; } LevelGroup groupLabelFive = new LevelGroup(); scenesFloorFive = new List <GameObject>(); StartCoroutine(WaitToFillGroup(long.Parse(s5), groupLabelFive, 5, scenesFloorFive, lvl5_int)); print("lvl5int: " + lvl5_int); }
///<sumary> ///Will load all objects that match the given key.If this key is an Addressable label, it will load all assets marked with that label ///</sumary> public IEnumerator LoadAllAssetsByKey(long numberOf, LevelGroup currentGroup, int stageNumber) { AsyncOperationHandle <IList <GameObject> > loadFirsts = Addressables.LoadAssetsAsync <GameObject>("StartRoom", asset => { }); // AsyncOperationHandle<IList<GameObject>> loadBosses = Addressables.LoadAssetsAsync<GameObject>("BossRoom", asset => { }); AsyncOperationHandle <IList <GameObject> > loadWithSingleKeyHandle = Addressables.LoadAssetsAsync <GameObject>("Stage" + stageNumber, asset => { }); yield return(loadFirsts); // yield return loadBosses; yield return(loadWithSingleKeyHandle); // IList<GameObject> stageFirstsResult = loadFirsts.Result; // IList<GameObject> stageBossesResult = loadBosses.Result; // IList<GameObject> stageAllScenesResult = loadWithSingleKeyHandle.Result; IList <GameObject> stageAllScenesResult = fakeAdresseables.GetStagePrefabs(stageNumber); IList <GameObject> stageFirstsResult = fakeAdresseables.GetStageFirstPrefabs(); // IList<GameObject> stageBossesResult = loadBosses.Result; if (stageFirstsResult.Count > 1) { stageFirstsResult.Shuffle(); } // if (stageBossesResult.Count > 1) // stageBossesResult.Shuffle(); if (numberOf > stageAllScenesResult.Count) { numberOf = stageAllScenesResult.Count; } for (int i = 0; i < numberOf; i++) { if (currentGroup.LevelGroupScenes.Contains(stageAllScenesResult[i])) { Debug.Log("ALREADY IN"); } else { currentGroup.LevelGroupScenes.Add(stageAllScenesResult[i]); } } currentGroup.LevelGroupScenes.Shuffle(); GameObject firstScene, bossScene; foreach (GameObject first in stageFirstsResult) { if (currentGroup.LevelGroupScenes.Contains(first)) { firstScene = first; currentGroup.LevelGroupScenes.Remove(first); currentGroup.LevelGroupScenes.Insert(0, firstScene); firstScene.GetComponent <Room>().SetisStartingRoom = true; break; } } // foreach (GameObject boss in stageBossesResult) // { // if (currentGroup.LevelGroupScenes.Contains(boss)) // { // bossScene = boss; // currentGroup.LevelGroupScenes.Remove(boss); // currentGroup.LevelGroupScenes.Add(bossScene); // bossScene.GetComponent<Room>().SetIsBossRoom = true; // break; // } // } }
/// <summary> /// Constructs a new course object. /// </summary> /// <param name="name">The name of the course.</param> /// <param name="credits">The credit value of the course.</param> /// <param name="groups">An array containing the level groups of the course.</param> /// <param name="scoreTable">The table that maps scores to GPA values.</param> public StaticCourse(string name, double credits, LevelGroup[] groups, ScoreTable scoreTable) { if (name == null) throw new ArgumentNullException("name"); if (credits <= 0) throw new ArgumentOutOfRangeException("credits"); if (groups == null) throw new ArgumentNullException("groups"); if (groups.Length == 0) throw new ArgumentException("Must provide at least one level group"); if (scoreTable == null) throw new ArgumentNullException("scoreTable"); _name = name; _credits = credits; _groups = groups; _scoreTable = scoreTable; LevelGroup group = groups[0]; _selectedLevelGroup = group; _selectedLevel = group.LevelCount > 0 ? group[0] : null; NameTranslator = x => x; }
private static void LoadCourse(XElement courseConfigElement, Course course) { // Sub-course DynamicCourse dynamicCourse = course as DynamicCourse; if (dynamicCourse != null) { string selectedCourseStr = XmlHelper.GetElementValueOrDefault(courseConfigElement, "selected"); if (selectedCourseStr != null) { StaticCourse selected = dynamicCourse.Courses.FirstOrDefault(c => c.RawName == selectedCourseStr); if (selected != null) { dynamicCourse.SelectedCourse = selected; } } } // Enabled string enabledStr = XmlHelper.GetElementValueOrDefault(courseConfigElement, "enabled"); bool enabled; if (bool.TryParse(enabledStr, out enabled)) { course.Enabled = enabled; } // Group if (course.GroupCount > 0) { string groupStr = XmlHelper.GetElementValueOrDefault(courseConfigElement, "group"); if (groupStr != null) { LevelGroup group = course.FirstOrDefault(g => g.RawName == groupStr); if (group != null) { course.SelectedLevelGroup = group; } } } // Level if (course.SelectedLevelGroup.LevelCount > 0) { string levelStr = XmlHelper.GetElementValueOrDefault(courseConfigElement, "level"); if (levelStr != null) { Level level = course.SelectedLevelGroup.FirstOrDefault(l => l.RawName == levelStr); if (level != null) { course.SelectedLevel = level; } } } // Score string scoreStr = XmlHelper.GetElementValueOrDefault(courseConfigElement, "score"); if (scoreStr != null) { course.Score = scoreStr; } }
/* Method to update the tab pane contents. */ void tab_update(LevelGroup lg) { EventHandler updateHandler = delegate(object sender, EventArgs args) { tab_update(lg); }; FormClosedEventHandler formClosedHandler = delegate(object sender, FormClosedEventArgs args) { tab_update(lg); }; Module[] modlist = course.getModules(lg.level); /* Remove controls... */ foreach (ModuleControlGroup mcg in lg.levelControlGroups) { mcg.removeControls(); } lg.levelControlGroups.Clear(); lg.credits = Course.sumModuleCredit(modlist); //Point cur = lg.tabpanel.Location; Point cur = new Point(0, 0); foreach(Module m in modlist) { ModuleControlGroup mcg = new ModuleControlGroup(formClosedHandler, updateHandler, course, lg.level, 120 - lg.credits, m, lg.tabpanel); mcg.addControls(cur, out cur); lg.levelControlGroups.Add(mcg); } }
private void FillUpSceneGroups(int numberOf, LevelGroup currentGroup) //aquí es donde aparecería lo "procedural" en el stageNumber.... { Debug.Log(currentGroup.levelName + ":" + sceneGroups.IndexOf(currentGroup) + 1); StartCoroutine(DataController.Instance.LoadAllAssetsByKey(numberOf, currentGroup, (sceneGroups.IndexOf(currentGroup) + 1))); }
public void InsertLevelGroup(LevelGroup group) { _levelGroupRepository.Insert(@group); }
public string GroupName(LevelGroup group) { return GetLocalizedString(LocalizedStrings.GroupName, group.Name); }
public JsonResult AddLevelGroup(string BigLevel, string ProjectID, string SmallLevel) { LevelGroup p = new LevelGroup(); p.BigLevel = BigLevel; p.SmallLevel = SmallLevel; p.ProjectOid = Int32.Parse(ProjectID); try { new LevelGroupDao().Insert(p); } catch (Exception e) { return Json(e.Message); } return Json("插入成功"); }
public void UpdateLevelGroup(LevelGroup group) { _levelGroupRepository.Update(group); }
public string GroupName(LevelGroup group) { return(GetLocalizedString(LocalizedStrings.GroupName, group.Name)); }
private void CleanUp(ILevelGroupService levelGroupService, LevelGroup group) { levelGroupService.DeleteLevelGroup(group.Id); }
/// <summary> /// Combines multiple templates into a single level group. /// </summary> /// <param name="templateNames">The comma-delimited string of template names.</param> public LevelGroup[] Build(string templateNames) { // First check if the group has already been built LevelGroup[] combinedGroups; if (_templates.TryGetValue(templateNames, out combinedGroups)) { return(combinedGroups); } if (_cache.TryGetValue(templateNames, out combinedGroups)) { return(combinedGroups); } // This list exists to preserve the order of groups. // An ordered dictionary would work too, but this is easier. var groupNames = new List <string>(); var groupMap = new Dictionary <string, List <Level> >(); var defaultGroup = new List <Level>(); string[] splitTemplateNames = templateNames.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string templateName in splitTemplateNames) { // Get the template that we're building off of LevelGroup[] groups; if (!_templates.TryGetValue(templateName, out groups)) { throw new ConfigLoadException("Attempting to use undefined level template: " + templateName); } foreach (LevelGroup group in groups) { string groupName = group.Name; if (groupName == null) { defaultGroup.AddRange(group); } else { List <Level> levels; // Check if the group already exists. // If so, just keep appending to that group, // otherwise, create a new group. if (!groupMap.TryGetValue(groupName, out levels)) { levels = new List <Level>(); groupMap.Add(groupName, levels); groupNames.Add(groupName); } // We won't check for duplicate levels here, // since it adds too much complexity and isn't // really that large of an issue anyways. levels.AddRange(group); } } } // Make sure we're not combining templates with and without groups if (defaultGroup.Count > 0 && groupNames.Count > 0) { throw new ConfigLoadException("Cannot combine templates unless either all or none have groups"); } if (defaultGroup.Count > 0) { // All templates have no groups combinedGroups = new[] { new LevelGroup(null, defaultGroup.ToArray()) }; } else { // All templates have groups // Convert each level list to a LevelGroup object combinedGroups = new LevelGroup[groupNames.Count]; for (int i = 0; i < combinedGroups.Length; ++i) { string groupName = groupNames[i]; Level[] groupLevels = groupMap[groupName].ToArray(); combinedGroups[i] = new LevelGroup(groupName, groupLevels); } } // Add the group to the cache for faster future processing _cache.Add(templateNames, combinedGroups); return(combinedGroups); }