Beispiel #1
0
        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());
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
            }
        }