public static SMGroupedSceneConfigurationOperation Build(SMGroupedSceneConfiguration configuration) { SMGroupedSceneConfigurationOperation result = new SMGroupedSceneConfigurationOperation(); result.firstScreen = configuration.firstScreen; result.firstScreenAfterLevel = configuration.firstScreenAfterLevel; result.actionAfterGroup = configuration.actionAfterGroup; result.firstScreenAfterGroup = configuration.firstScreenAfterGroup; result.screens.AddRange(configuration.screens); int numberOfGroups = configuration.groups.Length; for (int i = 0; i < numberOfGroups; i++) { string group = configuration.groups[i]; result.groups.Add(group); int startOfGroup = configuration.groupOffset[i]; int endOfGroup = (i + 1 == numberOfGroups) /* last group ?*/ ? configuration.levels.Length : configuration.groupOffset[i + 1]; int length = endOfGroup - startOfGroup; string[] temp = new string[length]; Array.Copy(configuration.levels, startOfGroup, temp, 0, length); result.levels.Add(group, new List <string>(temp)); } return(result); }
/// <summary> /// Makes the currently selected scene the first screen after each group of the game. /// </summary> private void ChangeToWorkflowAction(WorkflowActionEnum action) { BeforeChange("Change action after group"); SMGroupedSceneConfigurationOperation.Build(Target).ActionAfterGroup(action).Apply(Target); SyncBuildSettingsIfRequired(); EditorUtility.SetDirty(Target); }
/// <summary> /// Drop scenes from the scene list into the level list or move levels inside the level list /// </summary> private void DropScenesInLevels(IList <int> sceneIndices, int index, Type dragSource) { if (dragSource.Equals(typeof(SMSceneListDragSource))) { BeforeChange("Add scenes as level"); IList <string> selectedScenes = ListOperation <string> .FilterList(scenes, sceneIndices); SMGroupedSceneConfigurationOperation.Build(Target).Level(selectedScenes, SelectedGroup) .MoveLevelToPosition(selectedScenes, index, SelectedGroup).Apply(Target); RebuildLevelOfCurrentGroup(); levelListData.SetSelectedItems(currentGroupLevels, selectedScenes); SyncBuildSettingsIfRequired(); } else { BeforeChange("Move level"); IList <string> selectedLevel = ListOperation <string> .FilterList(currentGroupLevels, sceneIndices); SMGroupedSceneConfigurationOperation.Build(Target).MoveLevelToPosition(selectedLevel, index, SelectedGroup) .Apply(Target); RebuildLevelOfCurrentGroup(); levelListData.SetSelectedItems(currentGroupLevels, selectedLevel); } EditorUtility.SetDirty(Target); }
private void RenameGroup(string name) { BeforeChange("Rename group"); SMGroupedSceneConfigurationOperation.Build(Target).RenameGroup(name, SelectedGroup).Apply(Target); groupListData.SetSelectedItems(Target.groups, new string[] { name }); levelListData.ClearSelection(); EditorUtility.SetDirty(Target); }
/// <summary> /// Removes the group from the configuration /// </summary> private void RemoveGroup() { BeforeChange("Remove group"); SMGroupedSceneConfigurationOperation.Build(Target).RemoveGroup(SelectedGroup).Apply(Target); groupListData.ClearSelection(); levelListData.ClearSelection(); EditorUtility.SetDirty(Target); }
/// <summary> /// Move groups inside the group list /// </summary> private void DropGroup(int group, int index) { BeforeChange("Move group"); string selectedGroup = Target.groups[group]; SMGroupedSceneConfigurationOperation.Build(Target).MoveGroupToPosition(selectedGroup, index).Apply(Target); RebuildLevelOfCurrentGroup(); groupListData.SetSelectedItem(Target.groups, selectedGroup); EditorUtility.SetDirty(Target); }
/// <summary> /// Moves the selected level one position down. /// </summary> private void MoveDown() { BeforeChange("Move level down"); IList <string> selectedLevels = levelListData.GetSelectedItems(currentGroupLevels); SMGroupedSceneConfigurationOperation.Build(Target).MoveLevelDown(selectedLevels, SelectedGroup).Apply(Target); RebuildLevelOfCurrentGroup(); levelListData.SetSelectedItems(currentGroupLevels, selectedLevels); EditorUtility.SetDirty(Target); }
private void ChangeToLevel() { BeforeChange("Change scenes to level"); IList <string> selectedScenes = sceneListData.GetSelectedItems(scenes); SMGroupedSceneConfigurationOperation.Build(Target).Level(selectedScenes, SelectedGroup).Apply(Target); levelListData.ClearSelection(); SyncBuildSettingsIfRequired(); EditorUtility.SetDirty(Target); }
/// <summary> /// Drop levels from the level list into the scene list /// </summary> private void DropLevelInScenes(IList <int> levelIndices) { BeforeChange("Remove levels"); IList <string> selectedLevels = ListOperation <string> .FilterList(currentGroupLevels, levelIndices); SMGroupedSceneConfigurationOperation.Build(Target).Ignore(selectedLevels).Apply(Target); RebuildLevelOfCurrentGroup(); sceneListData.SetSelectedItems(scenes, selectedLevels); levelListData.ClearSelection(); SyncBuildSettingsIfRequired(); EditorUtility.SetDirty(Target); }
/// <summary> /// Makes the currently selected scene the first screen after each group of the game. /// </summary> private void ChangeToFirstScreenAfterGroup() { string scene = scenes[sceneListData.First]; if (Target.firstScreenAfterGroup != scene) { BeforeChange("Change scene to be first screen after group"); SMGroupedSceneConfigurationOperation.Build(Target).FirstScreenAfterGroup(scene).Apply(Target); SyncBuildSettingsIfRequired(); EditorUtility.SetDirty(Target); } }
protected override void FixInvalidScenes() { SMGroupedSceneConfigurationOperation.Build(Target).Ignore(invalidScreens).Ignore(invalidLevels).Apply(Target); }
public static void AddConfiguration() { var configuration = CreateConfiguration <SMGroupedSceneConfiguration>(); SMGroupedSceneConfigurationOperation.Build(configuration).AddGroup("Default").Apply(configuration); }