Update basic sample

pull/51/head
hevinci 2022-10-14 12:23:23 +08:00
parent ecd2bb4590
commit 1f26f001e9
6 changed files with 28 additions and 18 deletions

View File

@ -43,13 +43,19 @@ public class BootScene : MonoBehaviour
// 初始化资源系统 // 初始化资源系统
YooAssets.Initialize(); YooAssets.Initialize();
// 创建默认的资源包
var defaultPackage = YooAssets.CreateAssetsPackage("DefaultPackage");
// 设置该资源包为默认的资源包
YooAssets.SetDefaultAssetsPackage(defaultPackage);
// 编辑器下的模拟模式 // 编辑器下的模拟模式
if (PlayMode == EPlayMode.EditorSimulateMode) if (PlayMode == EPlayMode.EditorSimulateMode)
{ {
var createParameters = new EditorSimulateModeParameters(); var createParameters = new EditorSimulateModeParameters();
createParameters.LocationServices = new AddressLocationServices(); createParameters.LocationServices = new AddressLocationServices();
createParameters.SimulatePatchManifestPath = EditorSimulateModeHelper.SimulateBuild("DefaultPackage", true); createParameters.SimulatePatchManifestPath = EditorSimulateModeHelper.SimulateBuild("DefaultPackage", true);
yield return YooAssets.InitializeAsync(createParameters); yield return defaultPackage.InitializeAsync(createParameters);
} }
// 单机运行模式 // 单机运行模式
@ -57,7 +63,7 @@ public class BootScene : MonoBehaviour
{ {
var createParameters = new OfflinePlayModeParameters(); var createParameters = new OfflinePlayModeParameters();
createParameters.LocationServices = new AddressLocationServices(); createParameters.LocationServices = new AddressLocationServices();
yield return YooAssets.InitializeAsync(createParameters); yield return defaultPackage.InitializeAsync(createParameters);
} }
// 联机运行模式 // 联机运行模式
@ -68,7 +74,7 @@ public class BootScene : MonoBehaviour
createParameters.QueryServices = new QueryStreamingAssetsFileServices(); createParameters.QueryServices = new QueryStreamingAssetsFileServices();
createParameters.DefaultHostServer = GetHostServerURL(); createParameters.DefaultHostServer = GetHostServerURL();
createParameters.FallbackHostServer = GetHostServerURL(); createParameters.FallbackHostServer = GetHostServerURL();
yield return YooAssets.InitializeAsync(createParameters); yield return defaultPackage.InitializeAsync(createParameters);
} }
// 运行补丁流程 // 运行补丁流程

View File

@ -16,7 +16,8 @@ public class GameScene1 : MonoBehaviour
void Start() void Start()
{ {
YooAssets.UnloadUnusedAssets(); var package = YooAssets.GetAssetsPackage("DefaultPackage");
package.UnloadUnusedAssets();
// 初始化窗口 // 初始化窗口
InitWindow(); InitWindow();

View File

@ -14,7 +14,8 @@ public class GameScene2 : MonoBehaviour
void Start() void Start()
{ {
YooAssets.UnloadUnusedAssets(); var package = YooAssets.GetAssetsPackage("DefaultPackage");
package.UnloadUnusedAssets();
// 初始化窗口 // 初始化窗口
InitWindow(); InitWindow();

View File

@ -24,7 +24,8 @@ public class FsmUpdateManifest : IFsmNode
yield return new WaitForSecondsRealtime(0.5f); yield return new WaitForSecondsRealtime(0.5f);
// 更新补丁清单 // 更新补丁清单
var operation = YooAssets.UpdateManifestAsync(PatchUpdater.PackageCRC, 30); var package = YooAssets.GetAssetsPackage("DefaultPackage");
var operation = package.UpdateManifestAsync(PatchUpdater.PackageCRC, 30);
yield return operation; yield return operation;
if(operation.Status == EOperationStatus.Succeed) if(operation.Status == EOperationStatus.Succeed)

View File

@ -24,7 +24,8 @@ internal class FsmUpdateStaticVersion : IFsmNode
yield return new WaitForSecondsRealtime(0.5f); yield return new WaitForSecondsRealtime(0.5f);
// 更新资源版本号 // 更新资源版本号
var operation = YooAssets.UpdateStaticVersionAsync(30); var package = YooAssets.GetAssetsPackage("DefaultPackage");
var operation = package.UpdateStaticVersionAsync(30);
yield return operation; yield return operation;
if (operation.Status == EOperationStatus.Succeed) if (operation.Status == EOperationStatus.Succeed)

View File

@ -23,14 +23,14 @@ MonoBehaviour:
AssetTags: level AssetTags: level
ActiveRuleName: EnableGroup ActiveRuleName: EnableGroup
Collectors: Collectors:
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameRes/Entity/Level1 - CollectPath: Assets/Samples/Basic Sample/GameRes/Entity/Level1
CollectorGUID: 724066efe61192e43a0d7e59166b36a4 CollectorGUID: 724066efe61192e43a0d7e59166b36a4
CollectorType: 0 CollectorType: 0
AddressRuleName: AddressByFileName AddressRuleName: AddressByFileName
PackRuleName: PackSeparately PackRuleName: PackSeparately
FilterRuleName: CollectPrefab FilterRuleName: CollectPrefab
AssetTags: level1 AssetTags: level1
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameRes/Entity/Level2 - CollectPath: Assets/Samples/Basic Sample/GameRes/Entity/Level2
CollectorGUID: 8045c1986f0ae964f8b1ea29e3522388 CollectorGUID: 8045c1986f0ae964f8b1ea29e3522388
CollectorType: 0 CollectorType: 0
AddressRuleName: AddressByFileName AddressRuleName: AddressByFileName
@ -42,21 +42,21 @@ MonoBehaviour:
AssetTags: buildin AssetTags: buildin
ActiveRuleName: EnableGroup ActiveRuleName: EnableGroup
Collectors: Collectors:
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameRes/Scene - CollectPath: Assets/Samples/Basic Sample/GameRes/Scene
CollectorGUID: f75e7d64104fb1a48b849b72b84ade4c CollectorGUID: f75e7d64104fb1a48b849b72b84ade4c
CollectorType: 0 CollectorType: 0
AddressRuleName: AddressByFileName AddressRuleName: AddressByFileName
PackRuleName: PackSeparately PackRuleName: PackSeparately
FilterRuleName: CollectScene FilterRuleName: CollectScene
AssetTags: AssetTags:
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameRes/Config - CollectPath: Assets/Samples/Basic Sample/GameRes/Config
CollectorGUID: 44774abdee2b91b45b42f9dadf8c17a4 CollectorGUID: 44774abdee2b91b45b42f9dadf8c17a4
CollectorType: 0 CollectorType: 0
AddressRuleName: AddressByFileName AddressRuleName: AddressByFileName
PackRuleName: PackRawFile PackRuleName: PackRawFile
FilterRuleName: CollectAll FilterRuleName: CollectAll
AssetTags: AssetTags:
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameRes/Music - CollectPath: Assets/Samples/Basic Sample/GameRes/Music
CollectorGUID: e05b02ee4d90ae84a99871ce75288ea2 CollectorGUID: e05b02ee4d90ae84a99871ce75288ea2
CollectorType: 0 CollectorType: 0
AddressRuleName: AddressByFileName AddressRuleName: AddressByFileName
@ -68,28 +68,28 @@ MonoBehaviour:
AssetTags: panel AssetTags: panel
ActiveRuleName: EnableGroup ActiveRuleName: EnableGroup
Collectors: Collectors:
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameRes/Texture - CollectPath: Assets/Samples/Basic Sample/GameRes/Texture
CollectorGUID: 69b046f60ca75f647b2963e0113fd779 CollectorGUID: 69b046f60ca75f647b2963e0113fd779
CollectorType: 0 CollectorType: 0
AddressRuleName: AddressByFileName AddressRuleName: AddressByFileName
PackRuleName: PackCollector PackRuleName: PackCollector
FilterRuleName: CollectAll FilterRuleName: CollectAll
AssetTags: AssetTags:
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameRes/TpAtlas - CollectPath: Assets/Samples/Basic Sample/GameRes/TpAtlas
CollectorGUID: 06e38aac2570d2b4a97c6a90223e5344 CollectorGUID: 06e38aac2570d2b4a97c6a90223e5344
CollectorType: 0 CollectorType: 0
AddressRuleName: AddressByFileName AddressRuleName: AddressByFileName
PackRuleName: PackDirectory PackRuleName: PackDirectory
FilterRuleName: CollectAll FilterRuleName: CollectAll
AssetTags: AssetTags:
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameRes/UIPanel - CollectPath: Assets/Samples/Basic Sample/GameRes/UIPanel
CollectorGUID: 926d3203fcefdb947881a7491496e039 CollectorGUID: 926d3203fcefdb947881a7491496e039
CollectorType: 0 CollectorType: 0
AddressRuleName: AddressByFileName AddressRuleName: AddressByFileName
PackRuleName: PackDirectory PackRuleName: PackDirectory
FilterRuleName: CollectAll FilterRuleName: CollectAll
AssetTags: AssetTags:
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameRes/UISprite - CollectPath: Assets/Samples/Basic Sample/GameRes/UISprite
CollectorGUID: 29f27e4abf667c04b88a3996d8cdadfc CollectorGUID: 29f27e4abf667c04b88a3996d8cdadfc
CollectorType: 0 CollectorType: 0
AddressRuleName: AddressByFileName AddressRuleName: AddressByFileName
@ -101,14 +101,14 @@ MonoBehaviour:
AssetTags: AssetTags:
ActiveRuleName: EnableGroup ActiveRuleName: EnableGroup
Collectors: Collectors:
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameArt/ShaderVariants - CollectPath: Assets/Samples/Basic Sample/GameArt/ShaderVariants
CollectorGUID: 00781758c26692e40a9634ddeac838be CollectorGUID: 00781758c26692e40a9634ddeac838be
CollectorType: 1 CollectorType: 1
AddressRuleName: AddressByFileName AddressRuleName: AddressByFileName
PackRuleName: PackShaderVariants PackRuleName: PackShaderVariants
FilterRuleName: CollectAll FilterRuleName: CollectAll
AssetTags: AssetTags:
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameArt/UIFont - CollectPath: Assets/Samples/Basic Sample/GameArt/UIFont
CollectorGUID: 464727a15e4a7dc4d895346374432399 CollectorGUID: 464727a15e4a7dc4d895346374432399
CollectorType: 2 CollectorType: 2
AddressRuleName: AddressByFileName AddressRuleName: AddressByFileName