public void EditorInspector(BuildScenario Config) { if (_list == null) { _list = new ReorderableList(Actions, typeof(IAction), true, true, true, true); _list.drawHeaderCallback = (Rect r) => EditorGUI.LabelField(r, "Actions", EditorStyles.boldLabel); _list.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => Actions[index].EditorListInspector(Config, -1, rect); _list.onAddDropdownCallback = (Rect r, ReorderableList l) => BuilderWindow.AddDropdownCallback <IAction>(r, l); _list.onSelectCallback = BuilderWindow.OnSelectAction; } IsBuilding = EditorGUILayout.Toggle("Is need build", IsBuilding); TargetName = EditorGUILayout.TextField("Target name", TargetName); _list.DoLayoutList(); /* * if(_list.index >= 0 && _list.index < Actions.Count) * { * EditorGUILayout.BeginVertical(EditorStyles.helpBox); * * var elem = Actions[_list.index]; * elem.EditorInspector(Config, -1); * * EditorGUILayout.EndVertical(); * } */ }
public void Do(BuildScenario conf, int target, BuildLog log) { var stack = ""; if (EditorPrefs.HasKey("DefineStack")) { stack = EditorPrefs.GetString("DefineStack"); } var list = stack.Split(new[] { "|" }, StringSplitOptions.RemoveEmptyEntries).ToList(); var define = ""; if (list.Count != 0) { define = list.Last(); } PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, define); if (list.Count != 0) { list.RemoveAt(list.Count - 1); } EditorPrefs.SetString("DefineStack", string.Join("|", list.ToArray())); }
public void Do(BuildScenario conf, int target, BuildLog log) { var path = conf.InterpolateString(Path, target); try { File.WriteAllText(path, UseInterpolation ? conf.InterpolateString(Content, target) : Content); log.Line("create file " + path + " use interpolatio: " + UseInterpolation, "add file action", "info"); } catch { log.Line("dont create file " + path, "add file action", "error"); } }
public void Do(BuildScenario conf, int target, BuildLog log) { var obj = (GameObject)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(TargetGUID), typeof(UnityEngine.GameObject)); var components = obj.GetComponents <Component>(); if (components.Length > ScriptId && ScriptId > 0) { foreach (var changer in OverridedProperty) { log.Line("changing property in prefab " + AssetDatabase.GUIDToAssetPath(TargetGUID), "change prefab property", "info"); changer.ChangeProperty(components[ScriptId]); } } }
public void Do(BuildScenario conf, int target, BuildLog log) { var path = conf.InterpolateString(Path, target); log.Line("start delete files at path: " + path, "delete files", "info"); System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; startInfo.FileName = "cmd.exe"; startInfo.Arguments = "/C del /F /Q " + (Recursively ? "/S " : "") + path; process.StartInfo = startInfo; process.Start(); process.WaitForExit(); log.Line("deleting success. exit code: " + process.ExitCode, "delete files", "info"); }
public void Do(BuildScenario conf, int target, BuildLog log) { var path = conf.InterpolateString(PathFrom, target); var pathto = conf.InterpolateString(PathTo, target); log.Line("start copy files at path from: " + path + " to: " + pathto, "copy files", "info"); System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; startInfo.FileName = "cmd.exe"; startInfo.Arguments = "/C xcopy \"" + path + "\" \"" + pathto + "\" /c /i /s /e /t /y"; process.StartInfo = startInfo; process.Start(); process.WaitForExit(); log.Line("deleting success. exit code: " + process.ExitCode, "copy files", "info"); }
public static void BuildFromConfig() { if (!EditorPrefs.HasKey("PathToBuildConfig")) { Debug.Log("Not setted Path to build config key"); return; } var scenario = BuildScenario.Load(EditorPrefs.GetString("PathToBuildConfig")); scenario.Build++; scenario.Save(EditorPrefs.GetString("PathToBuildConfig")); scenario.Build--; var buildResult = scenario.StartBuild(true); File.WriteAllText(scenario.InterpolateString(scenario.BuildResultPath), buildResult.ToString()); }
public void Do(BuildScenario conf, int target, BuildLog log) { log.Line("running cmd script: " + conf.InterpolateString(Script, target), "run cmd action", "info"); System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; startInfo.FileName = "cmd.exe"; startInfo.Arguments = "/C " + conf.InterpolateString(Script, target); process.StartInfo = startInfo; process.Start(); if (WaitForExit) { log.Line("waiting process id: " + process.Id, "run cmd action", "info"); process.WaitForExit(); log.Line("process id: " + process.Id + " exit with code: " + process.ExitCode, "run cmd action", "info"); } }
public static void BuildTarget(string configPath, string target, int build, bool tcLog = false, bool withLogging = true, string version = null) { var scenario = BuildScenario.Load(configPath); if (version != null) { scenario.Version = version; } Debug.Log("Version: " + scenario.Version); scenario.Build = build; var buildResult = scenario.StartBuild(true, target, tcLog); if (withLogging) { File.WriteAllText(scenario.InterpolateString(scenario.BuildResultPath), buildResult.ToString()); } //scenario.Save(configPath); }
public void Do(BuildScenario conf, int target, BuildLog log) { var targetPath = conf.InterpolateString(Path, target); Directory.CreateDirectory(System.IO.Path.GetDirectoryName(targetPath)); log.Line("building player to " + targetPath + ", target: " + Target.ToString() + ", options: " + Options.ToString(), "Build Action", "info"); var targetBuildOption = new BuildPlayerOptions { target = Target, scenes = Scenes.ToArray(), options = BuildOptions.Development, locationPathName = targetPath }; PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, DefinedSymbols); var res = BuildPipeline.BuildPlayer(targetBuildOption); log.Line("player build successful, errors: " + res, "Build Action", "info"); }
void InitConfig(bool isDefault = false) { try { var _Config = new BuildScenario(); if (!isDefault) { _Config = BuildScenario.Load(PathToBuildConfig); } var targetList = new ReorderableList(_Config.Targets, typeof(BuilderTarget), true, true, true, true); targetList.drawHeaderCallback = (Rect r) => EditorGUI.LabelField(r, "Target list", EditorStyles.boldLabel); targetList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => _Config.Targets[index].EditorListInspector(rect); targetList.onAddCallback = (ReorderableList l) => l.list.Add(new BuilderTarget()); var pre_action_List = new ReorderableList(_Config.ActionsBeforeTargets, typeof(IAction), true, true, true, true); pre_action_List.drawHeaderCallback = (Rect r) => EditorGUI.LabelField(r, "Actions before targets", EditorStyles.boldLabel); pre_action_List.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => _Config.ActionsBeforeTargets[index].EditorListInspector(Config, -1, rect); pre_action_List.onAddDropdownCallback = (Rect r, ReorderableList l) => AddDropdownCallback <IAction>(r, l); pre_action_List.onSelectCallback = OnSelectAction; var post_action_List = new ReorderableList(_Config.ActionsAfterTargets, typeof(IAction), true, true, true, true); post_action_List.drawHeaderCallback = (Rect r) => EditorGUI.LabelField(r, "Actions after targets", EditorStyles.boldLabel); post_action_List.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => _Config.ActionsAfterTargets[index].EditorListInspector(Config, -1, rect); post_action_List.onAddDropdownCallback = (Rect r, ReorderableList l) => AddDropdownCallback <IAction>(r, l); post_action_List.onSelectCallback = OnSelectAction; Config = _Config; _targetList = targetList; _pre_action_List = pre_action_List; _post_action_List = post_action_List; } catch (Exception ex) { EditorUtility.DisplayDialog("Errow", "Error when initialize scenarion from selected file", "Ok", ""); Debug.LogException(ex); } }
public void EditorInspector(BuildScenario conf, int target) { Path = EditorGUILayout.TextField("Path", Path); Target = (BuildTarget)EditorGUILayout.EnumPopup("Build target", Target); Options = (BuildOptions)EditorGUILayout.EnumMaskField("Build obtions", Options); DefinedSymbols = EditorGUILayout.TextField("Defined symbol", DefinedSymbols); if (_scenes == null) { _scenes = new ReorderableList(Scenes, typeof(string), true, true, true, true); _scenes.drawHeaderCallback = (Rect r) => EditorGUI.LabelField(r, "Scenes", EditorStyles.boldLabel); _scenes.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { rect.height -= 2.0f; rect.y += 1.0f; var obj = EditorGUI.ObjectField(rect, AssetDatabase.LoadAssetAtPath(Scenes[index], typeof(SceneAsset)), typeof(SceneAsset), false); Scenes[index] = AssetDatabase.GetAssetPath(obj); }; _scenes.onAddCallback = (ReorderableList l) => l.list.Add(""); } _scenes.DoLayoutList(); }
public void EditorInspector(BuildScenario conf, int target) { if (properties == null) { properties = new ReorderableList(OverridedProperty, typeof(IChangeProperty), true, true, true, true); properties.drawHeaderCallback = (Rect r) => EditorGUI.LabelField(r, "Overrided properties", EditorStyles.boldLabel); properties.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { EditorGUI.LabelField(rect, OverridedProperty[index].GetType().Name); }; properties.onAddDropdownCallback = (Rect r, ReorderableList l) => BuilderWindow.AddDropdownCallback <IChangeProperty>(r, l); } if (!isInit) { var obj = AssetDatabase.LoadAssetAtPath <GameObject>(AssetDatabase.GUIDToAssetPath(TargetGUID)); if (obj != null) { var comps = obj.GetComponents <Component>(); if (comps != null) { targetObj = comps[ScriptId]; } } isInit = true; } var _targetObj = (Component)EditorGUILayout.ObjectField("Target component", targetObj, typeof(Component), false); if (_targetObj != targetObj) { targetObj = _targetObj; if (targetObj == null) { TargetGUID = ""; ScriptId = -1; } else { TargetGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(targetObj.gameObject.GetInstanceID())); short i = 0; foreach (var item in targetObj.gameObject.GetComponents <Component>()) { if (item == targetObj) { ScriptId = i; break; } i++; } } OverridedProperty.Clear(); } properties.DoLayoutList(); if (properties.index >= 0 && OverridedProperty.Count > properties.index) { EditorGUILayout.BeginVertical(EditorStyles.helpBox); OverridedProperty[properties.index].EditorInspector(this); EditorGUILayout.EndVertical(); } }
public void EditorListInspector(BuildScenario conf, int target, Rect rect) { EditorGUI.LabelField(rect, "copy files"); CanAction = EditorGUI.Toggle(new Rect(rect.position + new Vector2(rect.size.x - 20.0f, 0.0f), new Vector2(20.0f, rect.size.y)), CanAction); }
public void EditorInspector(BuildScenario conf, int target) { PathFrom = EditorGUILayout.TextField("From", PathFrom); PathTo = EditorGUILayout.TextField("To", PathTo); }
public void Do(BuildScenario conf, int target, BuildLog log) { var path = conf.InterpolateString(Path, target); Directory.CreateDirectory(path); }
public void EditorInspector(BuildScenario conf, int target) { Path = EditorGUILayout.TextField("Path", Path); UseInterpolation = EditorGUILayout.Toggle("Use interpolation content", UseInterpolation); Content = EditorGUILayout.TextArea(Content, GUILayout.MaxHeight(500.0f)); }
public void EditorInspector(BuildScenario conf, int target) { Path = EditorGUILayout.TextField("Path", Path); }
public void EditorInspector(BuildScenario conf, int target) { Path = EditorGUILayout.TextField("Path", Path); Recursively = EditorGUILayout.Toggle("Recursively", Recursively); }
public void Do(BuildScenario conf, int target, BuildLog log) { PlayerSettings.bundleVersion = conf.Version + "#" + conf.Build; }
public void EditorInspector(BuildScenario conf, int target) { }
public void EditorInspector(BuildScenario conf, int target) { EditorGUILayout.LabelField("Script: "); Script = EditorGUILayout.TextArea(Script, GUILayout.MaxHeight(200.0f)); WaitForExit = EditorGUILayout.Toggle("Wait for exit process", WaitForExit); }