/// <summary> /// 异步更新资源版本号 /// </summary> public UpdateStaticVersionOperation UpdateStaticVersionAsync(int timeout) { var operation = new HostPlayModeUpdateStaticVersionOperation(this, timeout); OperationSystem.StartOperaiton(operation); return(operation); }
/// <summary> /// 异步更新资源包裹 /// </summary> public UpdatePackageOperation UpdatePackageAsync(int resourceVersion, int timeout) { var operation = new HostPlayModeUpdatePackageOperation(this, resourceVersion, timeout); OperationSystem.StartOperaiton(operation); return(operation); }
/// <summary> /// 异步卸载子场景 /// </summary> public UnloadSceneOperation UnloadAsync() { // 如果句柄无效 if (IsValid == false) { string error = $"{nameof(SceneOperationHandle)} is invalid."; var operation = new UnloadSceneOperation(error); OperationSystem.StartOperaiton(operation); return(operation); } // 如果是主场景 if (IsMainScene()) { string error = $"Cannot unload main scene. Use {nameof(YooAssets.LoadSceneAsync)} method to change the main scene !"; YooLogger.Error(error); var operation = new UnloadSceneOperation(error); OperationSystem.StartOperaiton(operation); return(operation); } // 卸载子场景 Scene sceneObject = SceneObject; AssetSystem.UnloadSubScene(Provider); { var operation = new UnloadSceneOperation(sceneObject); OperationSystem.StartOperaiton(operation); return(operation); } }
private static RawFileOperation GetRawFileInternal(AssetInfo assetInfo, string copyPath) { if (assetInfo.IsInvalid) { YooLogger.Warning(assetInfo.Error); RawFileOperation operation = new CompletedRawFileOperation(assetInfo.Error, copyPath); OperationSystem.StartOperaiton(operation); return(operation); } BundleInfo bundleInfo = _bundleServices.GetBundleInfo(assetInfo); if (_playMode == EPlayMode.EditorSimulateMode) { RawFileOperation operation = new EditorPlayModeRawFileOperation(bundleInfo, copyPath); OperationSystem.StartOperaiton(operation); return(operation); } else if (_playMode == EPlayMode.OfflinePlayMode) { RawFileOperation operation = new OfflinePlayModeRawFileOperation(bundleInfo, copyPath); OperationSystem.StartOperaiton(operation); return(operation); } else if (_playMode == EPlayMode.HostPlayMode) { RawFileOperation operation = new HostPlayModeRawFileOperation(bundleInfo, copyPath); OperationSystem.StartOperaiton(operation); return(operation); } else { throw new NotImplementedException(); } }
private InstantiateOperation InstantiateAsyncInternal(Vector3 position, Quaternion rotation, Transform parent, bool setPositionRotation) { InstantiateOperation operation = new InstantiateOperation(this, position, rotation, parent, setPositionRotation); OperationSystem.StartOperaiton(operation); return(operation); }
/// <summary> /// 开始下载 /// </summary> public void BeginDownload() { if (_steps == ESteps.None) { OperationSystem.StartOperaiton(this); } }
/// <summary> /// 异步初始化 /// </summary> public InitializationOperation InitializeAsync(bool locationToLower, string simulatePatchManifestPath) { _locationToLower = locationToLower; var operation = new EditorSimulateModeInitializationOperation(this, simulatePatchManifestPath); OperationSystem.StartOperaiton(operation); return(operation); }
/// <summary> /// 异步初始化 /// </summary> public InitializationOperation InitializeAsync(bool locationToLower) { _locationToLower = locationToLower; var operation = new OfflinePlayModeInitializationOperation(this); OperationSystem.StartOperaiton(operation); return(operation); }
/// <summary> /// 异步初始化 /// </summary> public InitializationOperation InitializeAsync(bool locationToLower, bool clearCacheWhenDirty, string defaultHostServer, string fallbackHostServer) { _locationToLower = locationToLower; _clearCacheWhenDirty = clearCacheWhenDirty; _defaultHostServer = defaultHostServer; _fallbackHostServer = fallbackHostServer; var operation = new HostPlayModeInitializationOperation(this); OperationSystem.StartOperaiton(operation); return(operation); }
/// <summary> /// 创建资源包裹下载器,用于下载更新指定资源版本所有的资源包文件 /// </summary> /// <param name="resourceVersion">指定更新的资源版本</param> /// <param name="timeout">超时时间</param> public static UpdatePackageOperation UpdatePackageAsync(int resourceVersion, int timeout = 60) { DebugCheckInitialize(); if (_playMode == EPlayMode.EditorSimulateMode) { var operation = new EditorPlayModeUpdatePackageOperation(); OperationSystem.StartOperaiton(operation); return(operation); } else if (_playMode == EPlayMode.OfflinePlayMode) { var operation = new OfflinePlayModeUpdatePackageOperation(); OperationSystem.StartOperaiton(operation); return(operation); } else if (_playMode == EPlayMode.HostPlayMode) { return(_hostPlayModeImpl.UpdatePackageAsync(resourceVersion, timeout)); } else { throw new NotImplementedException(); } }
/// <summary> /// 开启一个异步操作 /// </summary> /// <param name="operation">异步操作对象</param> public static void StartOperaiton(GameAsyncOperation operation) { OperationSystem.StartOperaiton(operation); }