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();
// 创建默认的资源包
var defaultPackage = YooAssets.CreateAssetsPackage("DefaultPackage");
// 设置该资源包为默认的资源包
YooAssets.SetDefaultAssetsPackage(defaultPackage);
// 编辑器下的模拟模式
if (PlayMode == EPlayMode.EditorSimulateMode)
{
var createParameters = new EditorSimulateModeParameters();
createParameters.LocationServices = new AddressLocationServices();
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();
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.DefaultHostServer = 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()
{
YooAssets.UnloadUnusedAssets();
var package = YooAssets.GetAssetsPackage("DefaultPackage");
package.UnloadUnusedAssets();
// 初始化窗口
InitWindow();

View File

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

View File

@ -24,7 +24,8 @@ public class FsmUpdateManifest : IFsmNode
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;
if(operation.Status == EOperationStatus.Succeed)

View File

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

View File

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