private void PlaySound(string identifier, string soundIdentifier, SoundType soundType, Dictionary <string, SoundElement> soundElements) { if (!IsEnable) { return; } var soundInfo = soundInfos.FirstOrDefault(x => x.Key == soundIdentifier && x.Value.SoundType == soundType).Value; if (soundInfo == null) { return; } Action <SoundElement> onFinishSound = soundElement => { soundElements.Remove(identifier); }; Action <CueInfo> onCueReady = cue => { var soundElement = SoundManagement.SoundManagement.Play(soundType, cue); soundElements.Add(identifier, soundElement); soundElement.OnFinishAsObservable() .Subscribe(_ => onFinishSound(soundElement)) .AddTo(Disposable); }; ExternalResources.GetCueInfo(soundInfo.ResourcePath, soundInfo.CueName) .Subscribe(x => onCueReady(x)) .AddTo(Disposable); }
private static void ApplyAssetBundleName(AssetManagement assetManagement, AssetInfoManifest manifest) { var projectFolders = ProjectFolders.Instance; var externalResourcesPath = projectFolders.ExternalResourcesPath; var shareResourcesPath = projectFolders.ShareResourcesPath; var assetInfos = manifest.GetAssetInfos().ToArray(); var count = assetInfos.Length; using (new AssetEditingScope()) { for (var i = 0; i < count; i++) { var assetInfo = assetInfos[i]; var apply = false; if (assetInfo.IsAssetBundle) { var assetPath = ExternalResources.GetAssetPathFromAssetInfo(externalResourcesPath, shareResourcesPath, assetInfo); apply = assetManagement.SetAssetBundleName(assetPath, assetInfo.AssetBundle.AssetBundleName); } if (apply) { EditorUtility.DisplayProgressBar("ApplyAssetBundleName", assetInfo.ResourcePath, (float)i / count); } } } EditorUtility.ClearProgressBar(); }
protected override void UnregisterReceiver() { base.UnregisterReceiver(); if (ForceUnloadWhenRefCountEmpty && ExternalResources.IsUselessResources(Key)) { ExternalResources.UnloadAsset(Key); } }
private void Register(AnimatedSprite animatedSprite) { SubResources.Register(animatedSprite.Frames); foreach (var frame in animatedSprite.Frames.Animations.SelectMany(a => a.Frames)) { ExternalResources.Register(frame); } }
//has the user take a photo public async void TakePhoto() { if (await UserPermissions.ValidateStoragePermissions() && await UserPermissions.ValidateCameraPermissions()) //check permissions { MediaFile taken = await ExternalResources.TakePhoto(); FinalizePhoto(taken); } }
//asks the user to pic a photo public async void AttachPhoto() { if (await UserPermissions.ValidateStoragePermissions()) //check permissions { MediaFile picked = await ExternalResources.PickPhoto(); FinalizePhoto(picked); } }
//has the user scan a barcode and sets the correct text public async void ScanBarcode(Object sender, EventArgs args) { string result = await ExternalResources.ScanBarcode(); if (result != null) { codeInput.Text = result; } }
public override void ClearDirtyFlags() { base.ClearDirtyFlags(); AssociatedContent.ForEach(c => c.ClearDirtyFlags()); ExternalResources.ForEach(r => r.ClearDirtyFlags()); Weenies.ForEach(w => w.ClearDirtyFlags()); AssociatedLandblocks.ForEach(l => l.ClearDirtyFlags()); }
public ResourceRef TryGetResource(ResourceId id) { var collection = ExternalResources.TryGetValue(id.CollectionId); if (collection == null) { return(null); } return(collection.References.TryGetValue(id.ReferenceId)); }
protected internal static void CallPickerFinishEvent(ExternImgFile p_file) { if (p_file != null) { ExternalResources.AddImageIntoCache(p_file); } if (OnPickerFinish != null) { OnPickerFinish(p_file); } }
protected override void OnContentsUpdate() { Func <AssetInfo, Object> load_asset = info => { var assetPath = ExternalResources.GetAssetPathFromAssetInfo(externalResourcesPath, shareResourcesPath, info); var asset = AssetDatabase.LoadMainAssetAtPath(assetPath); return(asset); }; assets = Contents.Select(x => load_asset(x)).ToArray(); }
public override IEnumerator LoadAsync(Action onComplete, Action onFailed) { if (string.IsNullOrEmpty(resourcesPath)) { onFailed(); yield break; } var updateYield = ExternalResources.UpdateAsset(resourcesPath).ToYieldInstruction(false); yield return(updateYield); if (updateYield.HasError) { onFailed(); yield break; } if (Priority != AssetFileLoadPriority.DownloadOnly) { var loadYield = ExternalResources.LoadAsset <T>(resourcesPath, false).ToYieldInstruction(false); yield return(loadYield); if (loadYield.HasError) { onFailed(); yield break; } Asset = loadYield.Result; OnLoadComplete(Asset); if (Asset == null) { IsLoadError = true; onFailed(); yield break; } } IsLoadEnd = true; onComplete(); }
public void PlayBgm(string soundIdentifier) { if (!IsEnable) { return; } var soundInfo = soundInfos.FirstOrDefault(x => x.Key == soundIdentifier && x.Value.SoundType == SoundType.Bgm).Value; if (soundInfo == null) { return; } ExternalResources.GetCueInfo(soundInfo.ResourcePath, soundInfo.CueName) .Subscribe(x => bgm = SoundManagement.SoundManagement.Play(SoundType.Bgm, x)) .AddTo(Disposable); }
protected override void Apply() { if (ImageComponent != null) { var v_isDownloading = ExternalResources.IsDownloading(Key); if (string.IsNullOrEmpty(Key) || !v_isDownloading || (_canUnregisterOnDisable && v_isDownloading)) //someone called this request before this external image { ExternImgFile v_callback = !ExternalResources.IsLoaded(Key) ? ExternalResources.ReloadSpriteAsync(Key, ApplySprite) : ExternalResources.LoadSpriteAsync(Key, ApplySprite); if (v_callback != null) { if (v_callback.IsProcessing()) { //Reset image if (/*DefaultSprite != null &&*/ Sprite != DefaultSprite) { ApplyDefaultSpriteInImageComponent(); } _canUnregisterOnDisable = false; if (OnRequestDownloadImageCallback != null) { OnRequestDownloadImageCallback.Invoke(); } } else { HandleOnImageLoaded(v_callback); } } } else { if (/*DefaultSprite != null &&*/ Sprite != DefaultSprite) { ApplyDefaultSpriteInImageComponent(); } SetDirty(); } } }
protected override void Apply() { if (AudioSourceComponent != null) { var v_isDownloading = ExternalResources.IsDownloading(Key); if (string.IsNullOrEmpty(Key) || !v_isDownloading || (_canUnregisterOnDisable && v_isDownloading)) //someone called this request before this external image { ExternAudioFile v_callback = !ExternalResources.IsLoaded(Key) ? ExternalResources.ReloadClipAsync(Key, ApplyClip) : ExternalResources.LoadClipAsync(Key, ApplyClip); if (v_callback != null) { if (v_callback.IsProcessing()) { //Reset image if (Clip != null) { ApplyEmptyClipInAudioSourceComponent(); } _canUnregisterOnDisable = false; if (OnRequestDownloadClipCallback != null) { OnRequestDownloadClipCallback.Invoke(); } } else { HandleOnAudioLoaded(v_callback); } } } else { if (Clip != null) { ApplyEmptyClipInAudioSourceComponent(); } SetDirty(); } } }
public MainWindow() { external = new ExternalResources(); external.GetItemsFromPoE("Umaycry", "Big_P"); verifyPending = true; settings = Settings.Load(); LogReader.NewMessage += NewMessageDetected; HubProxy.Initialize(); LocalPlayer.Initialize(); InitializeComponent(); pathTextBox.Text = settings.LogPath; channelTextBox.Text = settings.Channel; accountTextBox.Text = settings.AccountName; characterTextBox.Text = settings.CharacterName; }
public override IEnumerator LoadAsync(Action onComplete, Action onFailed) { if (string.IsNullOrEmpty(resourcesPath)) { onFailed(); yield break; } var updateYield = ExternalResources.UpdateAsset(resourcesPath).ToYieldInstruction(false); yield return(updateYield); if (updateYield.HasError) { onFailed(); yield break; } if (Priority != AssetFileLoadPriority.DownloadOnly) { var cueYield = ExternalResources.GetCueInfo(resourcesPath, soundName).ToYieldInstruction(); while (!cueYield.IsDone) { yield return(null); } CueInfo = cueYield.Result; if (CueInfo == null) { IsLoadError = true; onFailed(); yield break; } } IsLoadEnd = true; onComplete(); }
private void ApplyAssetBundleName(string externalResourcesPath, string shareResourcesPath, AssetInfo assetInfo) { if (assetInfo == null) { return; } if (!assetInfo.IsAssetBundle) { return; } if (assetInfo.AssetBundle == null) { return; } var assetPath = ExternalResources.GetAssetPathFromAssetInfo(externalResourcesPath, shareResourcesPath, assetInfo); assetManagement.SetAssetBundleName(assetPath, assetInfo.AssetBundle.AssetBundleName); }
public virtual void PlayAttackSound(ExternalResources.AttackSounds sounds) { switch (sounds) { default: case ExternalResources.AttackSounds.CliffGetFucked: PlaySound(attackSound_Cliff); break; } }
public virtual void PlayGatherResourcesSound(ExternalResources.ResourceSounds sounds) { switch (sounds) { default: case ExternalResources.ResourceSounds.CliffMining: PlaySound(gatherResourceSound_Cliff); break; } }
protected virtual void UnregisterReceiver() { ExternalResources.UnregisterReceiver(this); }
public virtual void PlayUseSound(ExternalResources.UseSounds sounds) { switch (sounds) { default: case ExternalResources.UseSounds.CliffUsing: PlaySound(useSound_Cliff); break; } }
public override void Unload() { ExternalResources.UnloadAssetBundle(resourcesPath); }
private static IEnumerator CleanCore() { var builder = new StringBuilder(); #if ENABLE_CRIWARE // 未使用の音ファイルを解放. if (SoundManagement.SoundManagement.Exists) { SoundManagement.SoundManagement.Instance.ReleaseAll(); } #endif yield return(null); // キャッシュクリア. ExternalResources.CleanCache(); yield return(null); // その他のキャッシュ. foreach (var cachePath in CachePaths) { if (!Directory.Exists(cachePath)) { continue; } var fs = Directory.GetFiles(cachePath); foreach (var item in fs) { builder.AppendLine(item); try { var cFileInfo = new FileInfo(item); // 読み取り専用属性がある場合は、読み取り専用属性を解除. if ((cFileInfo.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) { cFileInfo.Attributes = FileAttributes.Normal; } File.Delete(item); } catch (Exception ex) { Debug.LogException(ex); } } DirectoryUtility.DeleteEmpty(cachePath); yield return(null); } if (!string.IsNullOrEmpty(builder.ToString())) { builder.Insert(0, "CleanCache :"); Debug.Log(builder.ToString()); } }
public ExternalResourcesController(ExternalResources externalResources) { _externalResources = externalResources; }
protected virtual void UnregisterCustomGetFileFromPathPattern() { ExternalResources.UnregisterCustomImgDownloaderPattern(s_customDownloderPattern); }
protected virtual void RegisterCustomGetFileFromPathPattern() { UnregisterCustomGetFileFromPathPattern(); ExternalResources.RegisterCustomImgDownloaderPattern(s_customDownloderPattern, GetImageFromPath); }
public virtual void PlayDeathSound(ExternalResources.DeathSounds sounds) { switch (sounds) { default: case ExternalResources.DeathSounds.CliffDeath: PlaySound(deathSound_Cliff); break; } }