BundleHelper
Coding Style wiki
BundleHelper 是 AssetLoader 的編輯器(Editor)輔助工具,用於輸出 App 配置檔(AppConfig)、補丁配置檔(PatchConfig)、資源包(Bundles)與 CDN 佈署配置檔(CdnConfig),並提供群組/DLC 參數字串的解析與轉換,便於命令列(CI/CD)整合。
| 命名空間 | OxGFrame.AssetLoader.Editor |
| 類型 | public static class |
| 原始碼 | BundleHelper.cs |
using OxGFrame.AssetLoader.Editor;
注意 本類別僅供 Unity Editor 環境使用。
方法總覽
輸出 (Exporter)
| 方法 | 說明 |
|---|---|
| ExportAppConfig | 輸出 App 配置檔(預設 AppInfo.json)至指定路徑(通常為 StreamingAssets)。 |
| ExportConfigsAndAppBundles | 輸出配置檔(AppConfig / PatchConfig)與最新 App Bundles 至 CDN 輸出路徑。 |
| ExportAppBundles | 僅輸出最新 App Bundles(不含配置檔)。 |
| ExportIndividualDlcBundles | 輸出獨立版本控管的 DLC Bundles。 |
| ExportBundleUrlConfig | 輸出 CDN 佈署配置檔(預設 CdnConfig.dat),支援加密。 |
解析與轉換 (Parser & Converter)
| 方法 | 說明 |
|---|---|
| ParsingGroupInfosByArgs | 將字串參數解析為 GroupInfo 清單。 |
| ConvertGroupInfosToArgs | 將 GroupInfo 清單轉換回字串參數。 |
| ParsingDlcInfosByArgs | 將字串參數解析為 DlcInfo 清單。 |
| ConvertDlcInfosToArgs | 將 DlcInfo 清單轉換回字串參數。 |
提醒 上述輸出作業亦可透過編輯器選單 OxGFrame → AssetLoader → Export Bundle And Config Generator 開啟視窗工具執行(對應 ExportAppConfigToStreamingAssets、ExportConfigsAndAppBundlesForCDN、ExportAppBundlesWithoutConfigsForCDN、ExportIndividualDLCBundlesForCDN 四種作業類型)。
ExportAppConfig
public static void ExportAppConfig(string productName, string appVersion, string outputPath, bool activeBuildTarget, BuildTarget buildTarget)
參數
| 參數 | 型別 | 說明 |
|---|---|---|
| productName | string | 產品名稱(寫入 AppConfig 的 PRODUCT_NAME)。 |
| appVersion | string | 主程式版本。空值時自動使用 Application.version。 |
| outputPath | string | 輸出目錄路徑(通常為 Application.streamingAssetsPath)。 |
| activeBuildTarget | bool | 是否使用當前編輯器的目標平台作為 PLATFORM。 |
| buildTarget | BuildTarget |