public static void Generate() { var projectPath = Directory.GetParent(Application.dataPath); // Strips off Assets string projectName = projectPath.Name; string projectLocationPath = Directory.GetParent(projectPath.FullName).FullName; using (var writer = new ConstantsWriter(projectName, extension: ".sublime-project", spacesPerIndent: 2, path: projectLocationPath)) { writer.WriteLine("{"); // open main writer.Indent(); writer.WriteLine("\"folders\":"); writer.WriteLine("[ {{ \"folder_exclude_patterns\": [ \"{0}{1}Library\" ]", projectName, Path.DirectorySeparatorChar); writer.Indent(); writer.WriteLine(", \"file_exclude_patterns\": [ \"*.meta\" ]"); writer.WriteLine(", \"path\": \".\""); writer.WriteLine("}"); // close folder_exclude_patterns writer.UnIndent(); writer.WriteLine("]"); // close folders writer.WriteLine(", \"solution_file\": \"{0}{1}{0}.sln\"", projectName, Path.DirectorySeparatorChar); writer.UnIndent(); writer.WriteLine("}"); // close main } }
public static void Generate() { var projectPath = Directory.GetParent(Application.dataPath); // Strips off Assets string projectName = projectPath.Name; string projectLocationPath = Directory.GetParent(projectPath.FullName).FullName; using (var writer = new ConstantsWriter(projectName, extension: ".sublime-project", spacesPerIndent: 2, path: projectLocationPath)) { writer.WriteLine("{"); // open main writer.Indent(); writer.WriteLine("\"folders\":"); writer.WriteLine("[ {{ \"folder_exclude_patterns\": [ \"{0}{1}Library\" ]", projectName, Path.DirectorySeparatorChar); writer.Indent(); writer.WriteLine(", \"file_exclude_patterns\": [ \"*.meta\" ]"); writer.WriteLine(", \"path\": \".\""); writer.WriteLine("}"); // close folder_exclude_patterns writer.UnIndent(); writer.WriteLine("]"); // close folders writer.WriteLine(", \"solution_file\": \"{0}{1}{0}.sln\"", projectName, Path.DirectorySeparatorChar); writer.UnIndent(); writer.WriteLine("}"); // close main } SyncMonoDevelop(); }
public static void Generate() { using (var writer = new ConstantsWriter(_name)) { writer.WriteLine("namespace " + _name + " {"); // open namespace writer.Indent(); writer.WriteLine("public static class Players {"); // open players writer.Indent(); foreach (var playerIdToName in PlayerIdsToNames) { int playerId = playerIdToName.Key; string playerName = playerIdToName.Value; writer.WriteLine("public const int {0} = {1};", ConstantsWriter.MakeSafeForCode(playerName), playerId); } writer.UnIndent(); writer.WriteLine("}"); // close players writer.WriteLine(); writer.WriteLine("public static class Actions {"); // open actions writer.Indent(); foreach (var categoryToActions in CategoriesToActions) { var category = categoryToActions.Key; var actions = categoryToActions.Value; writer.WriteLine(); WriteCategorySummary(writer, category); writer.WriteLine("public static class " + category.name + " {"); // open category writer.Indent(); foreach (var action in actions) { writer.WriteLine(); WriteActionSummary(writer, action); writer.WriteLine("public const int {0} = {1};", ConstantsWriter.MakeSafeForCode(action.name), action.id); } writer.UnIndent(); writer.WriteLine("}"); // close category writer.UnIndent(); writer.WriteLine("}"); // close actions } writer.UnIndent(); writer.Write("}"); // close namespace } }
public static void Generate() { using (var writer = new ConstantsWriter(_name)) { writer.WriteLine("namespace UnityAnimationConstants {"); writer.Indent(); foreach (var animatorToParams in AnimatorsToParameters) { var animatorName = ConstantsWriter.MakeSafeForCode(animatorToParams.Key); writer.WriteLine("namespace {0} {1}", animatorName, "{"); writer.Indent(); writer.WriteLine("public static class Parameters {"); writer.Indent(); foreach (var param in animatorToParams.Value) { writer.WriteLine("public const int {0} = {1};", ConstantsWriter.MakeSafeForCode(param.name), param.nameHash); } writer.UnIndent(); writer.WriteLine("}"); writer.UnIndent(); writer.WriteLine("}"); } writer.UnIndent(); writer.WriteLine("}"); } }
public static void Generate() { using (var writer = new ConstantsWriter(_name)) { writer.WriteLine("namespace UnityAudioConstants {"); writer.Indent(); foreach (var mixerToParams in MixersToParameterNames) { var mixerName = ConstantsWriter.MakeSafeForCode(mixerToParams.Key); writer.WriteLine("namespace {0} {1}", mixerName, "{"); writer.Indent(); writer.WriteLine("public static class ExposedAudioParameters {"); writer.Indent(); foreach (var paramName in mixerToParams.Value) { writer.WriteLine("public const string {0} = \"{1}\";", ConstantsWriter.MakeSafeForCode(paramName), paramName); } writer.UnIndent(); writer.WriteLine("}"); writer.UnIndent(); writer.WriteLine("}"); } writer.UnIndent(); writer.WriteLine("}"); } }
public static void Generate () { using (var writer = new ConstantsWriter(_name)) { writer.WriteLine("namespace UnityAnimationConstants {"); writer.Indent(); foreach (var animatorToParams in AnimatorsToParameters) { var animatorName = ConstantsWriter.MakeSafeForCode(animatorToParams.Key); writer.WriteLine("namespace {0} {1}", animatorName, "{"); writer.Indent(); writer.WriteLine("public static class Parameters {"); writer.Indent(); foreach (var param in animatorToParams.Value) { writer.WriteLine("public const int {0} = {1};", ConstantsWriter.MakeSafeForCode(param.name), param.nameHash); } writer.UnIndent(); writer.WriteLine("}"); writer.UnIndent(); writer.WriteLine("}"); } writer.UnIndent(); writer.WriteLine("}"); } }
private static void WriteCategorySummary(ConstantsWriter writer, InputCategory ic) { writer.WriteLine("/// <summary>"); writer.WriteLine("/// Descriptive Name: {0}", ic.descriptiveName); writer.WriteLine("/// ID: {0}", ic.id); writer.WriteLine("/// </summary>"); }
private static void WriteActionSummary(ConstantsWriter writer, InputAction action) { writer.WriteLine("/// <summary>"); writer.WriteLine("/// Descriptive Name: {0}", action.descriptiveName); writer.WriteLine("/// Type: {0}", action.type); if (action.type == InputActionType.Axis) { writer.WriteLine("/// Positive Axis: {0}", action.positiveDescriptiveName); writer.WriteLine("/// Negative Axis: {0}", action.negativeDescriptiveName); } writer.WriteLine("/// </summary>"); }
public static void Generate() { var projectPath = Directory.GetParent(Application.dataPath); // Strips off Assets string projectLocationPath = Directory.GetParent(projectPath.FullName).FullName; using (var writer = new ConstantsWriter("", extension: ".gitignore", spacesPerIndent: 2, path: projectLocationPath, includeHeader: false)) { writer.WriteLine("# =============== #"); writer.WriteLine("# Unity generated #"); writer.WriteLine("# =============== #"); writer.WriteLine(); writer.WriteLine("*/[Ll]ibrary/"); writer.WriteLine("*/[Tt]emp/"); writer.WriteLine("*/[Oo]bj/"); writer.WriteLine("*/[Bb]uild/"); writer.WriteLine(); writer.WriteLine("#Unity3D Generated File On Crash Reports"); writer.WriteLine("sysinfo.txt"); writer.WriteLine(); writer.WriteLine("# ===================================== #"); writer.WriteLine("# Visual Studio / MonoDevelop generated #"); writer.WriteLine("# ===================================== #"); writer.WriteLine("ExportedObj/"); writer.WriteLine("*.svd"); writer.WriteLine("*.userprefs"); writer.WriteLine("*.csproj"); writer.WriteLine("*.pidb"); writer.WriteLine("*.suo"); writer.WriteLine("*.sln"); writer.WriteLine("*.user"); writer.WriteLine("*.unityproj"); writer.WriteLine("*.booproj"); writer.WriteLine(); writer.WriteLine("# ============ #"); writer.WriteLine("# OS generated #"); writer.WriteLine("# ============ #"); writer.WriteLine(".DS_Store"); writer.WriteLine(".DS_Store?"); writer.WriteLine("._*"); writer.WriteLine(".Spotlight-V100"); writer.WriteLine(".Trashes"); writer.WriteLine("Icon\r\r"); writer.WriteLine("ehthumbs.db"); writer.WriteLine("Thumbs.db"); writer.WriteLine(); writer.WriteLine("*.sublime-workspace"); writer.WriteLine("*.sublime-project"); } }
public static void Generate() { var projectPath = Directory.GetParent(Application.dataPath); // Strips off Assets string projectLocationPath = Directory.GetParent(projectPath.FullName).FullName; using (var writer = new ConstantsWriter("", extension: ".gitignore", spacesPerIndent: 2, path: projectLocationPath, includeHeader: false)) { writer.WriteLine("# =============== #"); writer.WriteLine("# Unity generated #"); writer.WriteLine("# =============== #"); writer.WriteLine(); writer.WriteLine("*/[Ll]ibrary/"); writer.WriteLine("*/[Tt]emp/"); writer.WriteLine("*/[Oo]bj/"); writer.WriteLine("*/[Bb]uild/"); writer.WriteLine(); writer.WriteLine("#Unity3D Generated File On Crash Reports"); writer.WriteLine("sysinfo.txt"); writer.WriteLine(); writer.WriteLine("# ===================================== #"); writer.WriteLine("# Visual Studio / MonoDevelop generated #"); writer.WriteLine("# ===================================== #"); writer.WriteLine("ExportedObj/"); writer.WriteLine("*.svd"); writer.WriteLine("*.userprefs"); writer.WriteLine("*.csproj"); writer.WriteLine("*.pidb"); writer.WriteLine("*.suo"); writer.WriteLine("*.sln"); writer.WriteLine("*.user"); writer.WriteLine("*.unityproj"); writer.WriteLine("*.booproj"); writer.WriteLine(); writer.WriteLine("# ============ #"); writer.WriteLine("# OS generated #"); writer.WriteLine("# ============ #"); writer.WriteLine(".DS_Store"); writer.WriteLine(".DS_Store?"); writer.WriteLine("._*"); writer.WriteLine(".Spotlight-V100"); writer.WriteLine(".Trashes"); writer.WriteLine("Icon\r\r"); writer.WriteLine("ehthumbs.db"); writer.WriteLine("Thumbs.db"); writer.WriteLine(); writer.WriteLine("*.sublime-workspace"); writer.WriteLine("*.sublime-project"); } }
public static void Generate () { using (var writer = new ConstantsWriter(_name)) { writer.WriteLine("namespace " + _name + " {"); // open namespace writer.Indent(); writer.WriteLine("public static class Levels {"); // open levels writer.Indent(); foreach (var sceneIdToName in SceneIdsToNames) { var id = sceneIdToName.Key; var name = sceneIdToName.Value; writer.WriteLine("public const int {0} = {1};", ConstantsWriter.MakeSafeForCode(name), id); } writer.WriteLine("public enum E {"); // open levels enum writer.Indent(); foreach (var sceneIdToName in SceneIdsToNames) { var id = sceneIdToName.Key; var name = sceneIdToName.Value; writer.WriteLine("{0} = {1},", ConstantsWriter.MakeSafeForCode(name), id); } writer.UnIndent(); writer.WriteLine("};"); // close levels enum writer.WriteLine(); writer.UnIndent(); writer.WriteLine("}"); // close levels writer.WriteLine(); // Write out the tags writer.WriteLine("public static class Tags {"); writer.Indent(); foreach (var tag in UnityEditorInternal.InternalEditorUtility.tags) { writer.WriteLine("/// <summary>"); writer.WriteLine("/// Name of tag '{0}'.", tag); writer.WriteLine("/// </summary>"); writer.WriteLine("public const string {0} = \"{1}\";", ConstantsWriter.MakeSafeForCode(tag), tag); } writer.UnIndent(); writer.WriteLine("}"); writer.WriteLine(); // Write out sorting layers // var sortingLayerNames = UnityToolbag.SortingLayerHelper.sortingLayerNames; // if (sortingLayerNames != null) { // writer.WriteLine("public static class SortingLayers {"); // writer.Indent(); // foreach (var name in sortingLayerNames) { // int id = UnityToolbag.SortingLayerHelper.GetSortingLayerIDForName(name); // writer.WriteLine("/// <summary>"); // writer.WriteLine("/// ID of sorting layer '{0}'.", name); // writer.WriteLine("/// </summary>"); // writer.WriteLine("public const int {0} = {1};", ConstantsWriter.MakeSafeForCode(name), id); // } // writer.UnIndent(); // writer.WriteLine("}"); // writer.WriteLine(); // } // Write out layers writer.WriteLine("public static class Layers {"); writer.Indent(); for (int i = 0; i < 32; i++) { string layer = UnityEditorInternal.InternalEditorUtility.GetLayerName(i); if (!string.IsNullOrEmpty(layer)) { writer.WriteLine("/// <summary>"); writer.WriteLine("/// Index of layer '{0}'.", layer); writer.WriteLine("/// </summary>"); writer.WriteLine("public const int {0} = {1};", ConstantsWriter.MakeSafeForCode(layer), i); } } writer.WriteLine(); for (int i = 0; i < 32; i++) { string layer = UnityEditorInternal.InternalEditorUtility.GetLayerName(i); if (!string.IsNullOrEmpty(layer)) { writer.WriteLine("/// <summary>"); writer.WriteLine("/// Bitmask of layer '{0}'.", layer); writer.WriteLine("/// </summary>"); writer.WriteLine("public const int {0}Mask = 1 << {1};", ConstantsWriter.MakeSafeForCode(layer), i); } } writer.UnIndent(); writer.WriteLine("}"); writer.WriteLine(); writer.UnIndent(); writer.Write("}"); // close namespace } }
public static void Generate() { using (var writer = new ConstantsWriter(_name)) { writer.WriteLine("namespace " + _name + " {"); // open namespace writer.Indent(); writer.WriteLine("public static class Levels {"); // open levels writer.Indent(); foreach (var sceneIdToName in SceneIdsToNames) { var id = sceneIdToName.Key; var name = sceneIdToName.Value; writer.WriteLine("public const int {0} = {1};", ConstantsWriter.MakeSafeForCode(name), id); } writer.WriteLine("public enum E {"); // open levels enum writer.Indent(); foreach (var sceneIdToName in SceneIdsToNames) { var id = sceneIdToName.Key; var name = sceneIdToName.Value; writer.WriteLine("{0} = {1},", ConstantsWriter.MakeSafeForCode(name), id); } writer.UnIndent(); writer.WriteLine("};"); // close levels enum writer.WriteLine(); writer.UnIndent(); writer.WriteLine("}"); // close levels writer.WriteLine(); // Write out the tags writer.WriteLine("public static class Tags {"); writer.Indent(); foreach (var tag in UnityEditorInternal.InternalEditorUtility.tags) { writer.WriteLine("/// <summary>"); writer.WriteLine("/// Name of tag '{0}'.", tag); writer.WriteLine("/// </summary>"); writer.WriteLine("public const string {0} = \"{1}\";", ConstantsWriter.MakeSafeForCode(tag), tag); } writer.UnIndent(); writer.WriteLine("}"); writer.WriteLine(); // Write out sorting layers // var sortingLayerNames = UnityToolbag.SortingLayerHelper.sortingLayerNames; // if (sortingLayerNames != null) { // writer.WriteLine("public static class SortingLayers {"); // writer.Indent(); // foreach (var name in sortingLayerNames) { // int id = UnityToolbag.SortingLayerHelper.GetSortingLayerIDForName(name); // writer.WriteLine("/// <summary>"); // writer.WriteLine("/// ID of sorting layer '{0}'.", name); // writer.WriteLine("/// </summary>"); // writer.WriteLine("public const int {0} = {1};", ConstantsWriter.MakeSafeForCode(name), id); // } // writer.UnIndent(); // writer.WriteLine("}"); // writer.WriteLine(); // } // Write out layers writer.WriteLine("public static class Layers {"); writer.Indent(); for (int i = 0; i < 32; i++) { string layer = UnityEditorInternal.InternalEditorUtility.GetLayerName(i); if (!string.IsNullOrEmpty(layer)) { writer.WriteLine("/// <summary>"); writer.WriteLine("/// Index of layer '{0}'.", layer); writer.WriteLine("/// </summary>"); writer.WriteLine("public const int {0} = {1};", ConstantsWriter.MakeSafeForCode(layer), i); } } writer.WriteLine(); for (int i = 0; i < 32; i++) { string layer = UnityEditorInternal.InternalEditorUtility.GetLayerName(i); if (!string.IsNullOrEmpty(layer)) { writer.WriteLine("/// <summary>"); writer.WriteLine("/// Bitmask of layer '{0}'.", layer); writer.WriteLine("/// </summary>"); writer.WriteLine("public const int {0}Mask = 1 << {1};", ConstantsWriter.MakeSafeForCode(layer), i); } } writer.UnIndent(); writer.WriteLine("}"); writer.WriteLine(); writer.UnIndent(); writer.Write("}"); // close namespace } }