Class: Pindo::TaskSystem::UnityTask
- Defined in:
- lib/pindo/module/task/model/unity_task.rb
Overview
Unity 任务基类所有 Unity 相关任务的父类,提供通用的 Unity 操作和配置
Direct Known Subclasses
UnityConfigTask, UnityExportTask, UnityUpdateTask, UnityYooAssetTask
Instance Attribute Summary collapse
-
#project_path ⇒ Object
readonly
Returns the value of attribute project_path.
-
#unity_root_path ⇒ Object
readonly
Returns the value of attribute unity_root_path.
Attributes inherited from PindoTask
#callbacks_setup, #context, #created_at, #data_dependencies, #dependencies, #error, #finished_at, #id, #max_retry_count, #metadata, #name, #priority, #result, #retry_count, #retry_delay, #retry_mode, #started_at, #status, #task_key, #task_manager, #type
Class Method Summary collapse
- .default_retry_count ⇒ Object
- .default_retry_delay ⇒ Object
-
.default_retry_mode ⇒ Object
Unity 任务默认重试配置.
-
.task_type ⇒ Object
Unity 任务类型.
-
.task_type_name ⇒ Object
Unity 任务类型显示名称.
Instance Method Summary collapse
-
#before_retry ⇒ Object
重试前清理 Unity 进程.
-
#initialize(name, options = {}) ⇒ UnityTask
constructor
A new instance of UnityTask.
-
#unity_helper ⇒ Object
获取 Unity Helper.
-
#validate ⇒ Object
验证 Unity 项目路径.
Methods inherited from PindoTask
#cancel, #cancelled?, #check_cancelled!, #data_param, #do_task, #execution_time, #finished?, #get_all_data_params, #get_all_data_params_by_key, #get_all_dependencies_results, #get_data_param, #get_data_param_by_key, #get_dependency_result, #get_dependency_task, #on, #primary_data_param, #reset_for_retry, #retryable?, #running?, #should_retry?, task_key
Constructor Details
#initialize(name, options = {}) ⇒ UnityTask
Returns a new instance of UnityTask.
12 13 14 15 16 17 |
# File 'lib/pindo/module/task/model/unity_task.rb', line 12 def initialize(name, = {}) @project_path = [:project_path] ? File.([:project_path]) : nil @unity_root_path = [:unity_root_path] || @project_path super(name, ) end |
Instance Attribute Details
#project_path ⇒ Object (readonly)
Returns the value of attribute project_path.
10 11 12 |
# File 'lib/pindo/module/task/model/unity_task.rb', line 10 def project_path @project_path end |
#unity_root_path ⇒ Object (readonly)
Returns the value of attribute unity_root_path.
10 11 12 |
# File 'lib/pindo/module/task/model/unity_task.rb', line 10 def unity_root_path @unity_root_path end |
Class Method Details
.default_retry_count ⇒ Object
34 35 36 |
# File 'lib/pindo/module/task/model/unity_task.rb', line 34 def self.default_retry_count 2 # Unity 任务默认重试 2 次 end |
.default_retry_delay ⇒ Object
38 39 40 |
# File 'lib/pindo/module/task/model/unity_task.rb', line 38 def self.default_retry_delay 15 # Unity 任务默认延迟 15 秒重试 end |
.default_retry_mode ⇒ Object
Unity 任务默认重试配置
30 31 32 |
# File 'lib/pindo/module/task/model/unity_task.rb', line 30 def self.default_retry_mode RetryMode::DELAYED end |
.task_type ⇒ Object
Unity 任务类型
20 21 22 |
# File 'lib/pindo/module/task/model/unity_task.rb', line 20 def self.task_type :unity end |
.task_type_name ⇒ Object
Unity 任务类型显示名称
25 26 27 |
# File 'lib/pindo/module/task/model/unity_task.rb', line 25 def self.task_type_name "Unity操作" end |
Instance Method Details
#before_retry ⇒ Object
重试前清理 Unity 进程
63 64 65 66 |
# File 'lib/pindo/module/task/model/unity_task.rb', line 63 def before_retry super cleanup_unity_processes end |
#unity_helper ⇒ Object
获取 Unity Helper
58 59 60 |
# File 'lib/pindo/module/task/model/unity_task.rb', line 58 def unity_helper @unity_helper ||= Pindo::Unity::UnityHelper.share_instance end |
#validate ⇒ Object
验证 Unity 项目路径
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/pindo/module/task/model/unity_task.rb', line 43 def validate super unless File.directory?(@project_path) raise Informative, "Unity 项目路径不存在: #{@project_path}" end unless File.directory?(@unity_root_path) raise Informative, "Unity 根目录不存在: #{@unity_root_path}" end true end |