Class: Pindo::TaskSystem::UnityYooAssetTask

Inherits:
UnityTask show all
Defined in:
lib/pindo/module/task/model/unity/unity_yoo_asset_task.rb

Overview

Unity YooAsset 资源构建任务用于构建 YooAsset 资源包

Instance Attribute Summary collapse

Attributes inherited from UnityTask

#project_path, #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

Instance Method Summary collapse

Methods inherited from UnityTask

#before_retry, default_retry_count, default_retry_delay, default_retry_mode, task_type, task_type_name, #unity_helper

Methods inherited from PindoTask

#before_retry, #cancel, #cancelled?, #check_cancelled!, #data_param, default_retry_count, default_retry_delay, default_retry_mode, #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_type

Constructor Details

#initialize(platform, options = {}) ⇒ UnityYooAssetTask

Returns a new instance of UnityYooAssetTask.

Parameters:

  • platform (String)

    目标平台 (‘ios’, ‘android’, ‘web’)

  • options (Hash) (defaults to: {})

    额外选项

    • :project_path [String] Unity 项目路径(默认当前目录)



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/pindo/module/task/model/unity/unity_yoo_asset_task.rb', line 19

def initialize(platform, options = {})
  @platform = platform
  @unity_exe_path = nil  # 将在 do_work 中自动查找

  name = case platform
         when 'ios', 'ipa'
           "YooAsset打包iOS平台资源"
         when 'android', 'apk'
           "YooAsset打包Android平台资源"
         when 'web', 'html'
           "YooAsset打包WebGL平台资源"
         else
           "YooAsset打包#{platform.upcase}资源"
         end

  # 传递 project_path 给基类
  options[:project_path] ||= Dir.pwd
  super(name, options)
end

Instance Attribute Details

#platformObject (readonly)

Returns the value of attribute platform.



9
10
11
# File 'lib/pindo/module/task/model/unity/unity_yoo_asset_task.rb', line 9

def platform
  @platform
end

Class Method Details

.task_keyObject

任务键



12
13
14
# File 'lib/pindo/module/task/model/unity/unity_yoo_asset_task.rb', line 12

def self.task_key
  :unity_yoo_asset
end

Instance Method Details

#validateObject



39
40
41
42
43
44
45
46
47
48
# File 'lib/pindo/module/task/model/unity/unity_yoo_asset_task.rb', line 39

def validate
  super

  # 验证 Unity 工程是否存在
  unless unity_helper.unity_project?(@unity_root_path)
    raise Informative, "当前目录不是 Unity 工程:#{@unity_root_path}"
  end

  true
end