/// <summary> /// バックログのデータのコンストラクタ /// </summary> /// <param name="text">テキスト</param> /// <param name="characterName">キャラ名</param> /// <param name="voiceFile">ボイスファイル</param> public AdvBacklog(string text, string characterName, AssetFile voiceFile, string characterLabel ) { this.text = text; this.characterName = characterName; this.voiceFile = voiceFile; this.CharacterLabel = characterLabel; }
public void Can_be_created_from_coffee_file_name() { var target = new AssetFile(@"C:\Project\path1\Path1_a\Asset1.coffee", @"C:\project"); Assert.AreEqual(@"C:\Project\path1\Path1_a\Asset1.coffee", target.OriginalFile); Assert.AreEqual(@"c:/project/path1/path1_a/asset1.coffee", target.File); Assert.AreEqual("path1/path1_a", target.Path); Assert.AreEqual("path1/path1_a/asset1", target.Name); Assert.AreEqual(".coffee", target.Extension); Assert.AreEqual(AssetType.Js, target.Type); }
public void Can_be_created_from_js_file_name() { var target = new AssetFile(@"C:\Project\path1\Asset1.js", @"C:\project"); Assert.AreEqual(@"C:\Project\path1\Asset1.js", target.OriginalFile); Assert.AreEqual(@"c:/project/path1/asset1.js", target.File); Assert.AreEqual(@"path1", target.Path); Assert.AreEqual("path1/asset1", target.Name); Assert.AreEqual(".js", target.Extension); Assert.AreEqual(true, target.HasName("path1/asset1")); Assert.AreEqual(true, target.HasName("path1/asset1.js")); Assert.AreEqual(false, target.HasName("path1/asset1.js.coffee")); Assert.AreEqual(AssetType.Js, target.Type); }
public void Can_tell_if_it_is_in_the_given_tree() { var target = new AssetFile(@"C:\Project\path1\a\a1\asset1.js", @"C:\project"); // ideal paths Assert.AreEqual(true, target.IsInTree("path1")); Assert.AreEqual(true, target.IsInTree("path1/a")); Assert.AreEqual(true, target.IsInTree("path1/a/a1")); // not-ideal paths Assert.AreEqual(true, target.IsInTree(@"Path1\")); Assert.AreEqual(true, target.IsInTree(@"path1\A")); Assert.AreEqual(true, target.IsInTree(@"path1/A\A1")); // wrong paths Assert.AreEqual(false, target.IsInTree("a\a1")); Assert.AreEqual(false, target.IsInTree(@"path2")); Assert.AreEqual(false, target.IsInTree(@"Projects")); Assert.AreEqual(false, target.IsInTree("path1/a/a1/asset1")); }
/// <summary> /// バックログ追加 /// </summary> /// <param name="text">テキスト</param> /// <param name="characteName">キャラ名</param> /// <param name="voiceFile">ボイスファイル(nullでも良い)</param> public void Add(string text, AdvCharacterInfo characteInfo, AssetFile voiceFile) { AdvBacklog log; if (characteInfo == null) { log = new AdvBacklog(text, "", voiceFile, ""); } else { log = new AdvBacklog(text, characteInfo.NameText, voiceFile, characteInfo.Label); } backlogs.Add(log); if (backlogs.Count > MaxLog) { backlogs.RemoveAt(0); } }
private void displayAssetDefinition() { assetNameTextBox.Text = assetDefinition.Name; descriptionTextBox.Text = assetDefinition.Description; assetTypeComboBox.Text = AssetTypeDesc.AssetTypeEnumName(assetDefinition.TypeEnum); setupCategoryComboBox(assetDefinition.TypeEnum); setCategory(assetDefinition.Category); createControlsForAssetType(assetDefinition.TypeEnum); int fileIndex = 0; foreach (FileDescControls desc in allControls) { if (fileIndex >= assetDefinition.Files.Count) { break; } AssetTypeFileDesc d = desc.desc; AssetFile file = assetDefinition.Files[fileIndex]; if (desc.useTextBox) { if (d.FileTypeEnum == file.FileTypeEnum) { desc.textBox.Text = file.TargetFile; fileIndex++; } } else { while (fileIndex < assetDefinition.Files.Count) { file = assetDefinition.Files[fileIndex]; if (d.FileTypeEnum != file.FileTypeEnum) { break; } desc.listBox.Items.Add(file.TargetFile); fileIndex++; } } } }
//ボイスの再生 IEnumerator CoPlayVoice(string voiceFileName, string charcterLabel) { AssetFile file = AssetFileManager.Load(voiceFileName, this); if (file == null) { Debug.LogError("Backlog voiceFile is NULL"); yield break; } while (!file.IsLoadEnd) { yield return(0); } SoundManager manager = SoundManager.GetInstance(); if (manager) { manager.PlayVoice(charcterLabel, file); } file.Unuse(this); }
//指定のファイル名をロードして鳴らす IEnumerator CoLoadAndPlayFile(string path, float volume, bool isLoop, bool isStreaming, Func <float> callbackMasterVolume) { if (!string.IsNullOrEmpty(path)) { AssetFile file = AssetFileManager.GetFileCreateIfMissing(path); if (isStreaming) { file.AddLoadFlag(AssetFileLoadFlags.Streaming); } AssetFileManager.Load(file, this); while (!file.IsLoadEnd) { yield return(0); } SoundStream stream = Play(file.Sound, 0.1f, volume, isLoop, isStreaming, callbackMasterVolume); stream.FadeIn(0.1f); file.AddReferenceComponet(stream.gameObject); file.Unuse(this); } isLoading = false; }
/// <summary> /// 起動時の初期化 /// </summary> /// <param name="settingData">設定データ</param> public void BootInit(AdvBootSetting settingData) { //ファイルマネージャーにバージョンの登録 foreach (AdvTextureSettingData data in List) { data.BootInit(settingData); { AssetFile file = AssetFileManager.GetFileCreateIfMissing(data.FilePath); file.Version = data.Version; file.SpriteInfo.pivot = data.Pivot; file.SpriteInfo.scale = data.Scale; } if (!string.IsNullOrEmpty(data.ThumbnailPath)) { AssetFile file = AssetFileManager.GetFileCreateIfMissing(data.ThumbnailPath); file.Version = data.ThumbnailVersion; } } }
private void anyTextBox_DragOver(object sender, DragEventArgs e) { TextBox targetTextBox = (TextBox)sender; if (!e.Data.GetDataPresent(typeof(System.String))) { e.Effect = DragDropEffects.None; return; } string value = (string)e.Data.GetData(DataFormats.StringFormat); Object tag = targetTextBox.Tag; if (targetTextBox.Text == value || (tag != null && !AssetFile.AllExtensionsForEnum(((FileDescControls)tag).desc.FileTypeEnum). Contains(Path.GetExtension(value).ToLower()))) { e.Effect = DragDropEffects.None; return; } e.Effect = DragDropEffects.Copy; }
/// <summary> /// 起動時の初期化 /// </summary> /// <param name="settingData">設定データ</param> public void BootInit(AdvBootSetting settingData) { BootInit(); foreach (AdvSoundSettingData data in List) { data.BootInit(settingData); AssetFile file = AssetFileManager.GetFileCreateIfMissing(data.FilePath); if (file != null) { file.Version = data.Version; //ロードタイプをストリーミングにする場合、 //oggはUnityのバグがあるのでストリーム読み込みを無効にする //バグの内容は、曲の長さがとれず一度鳴らすと終了しなくなるというもの。 if (data.IsStreaming && !ExtensionUtil.CheckExtention(data.FilePath, ExtensionUtil.Ogg)) { file.AddLoadFlag(AssetFileLoadFlags.Streaming); } } } }
public override void DeserializeAsset(AssetFile assetFile, StreamReader stream) { m_toolTip = stream.ReadString32(); m_debugUnlocalizedTooltip = stream.ReadString32(); m_savedStatusTypesForTooltips = new SerializedVector <StatusType>(assetFile, stream); m_shortToolTip = stream.ReadString32(); m_rewardString = stream.ReadString32(); m_sequencePrefab = new SerializedComponent(assetFile, stream); m_abilityName = stream.ReadString32(); m_flavorText = stream.ReadString32(); m_ultimate = stream.ReadBoolean(); stream.AlignTo(); m_previewVideo = stream.ReadString32(); m_expectedSequencePrefixForEditor = stream.ReadString32(); m_cooldown = stream.ReadInt32(); m_maxStocks = stream.ReadInt32(); m_stockRefreshDuration = stream.ReadInt32(); m_refillAllStockOnRefresh = stream.ReadBoolean(); stream.AlignTo(); m_initialStockAmount = stream.ReadInt32(); m_stockConsumedOnCast = stream.ReadInt32(); m_abilityManagedStockCount = stream.ReadBoolean(); stream.AlignTo(); m_runPriority = (AbilityPriority)stream.ReadInt32(); m_freeAction = stream.ReadBoolean(); stream.AlignTo(); m_techPointsCost = stream.ReadInt32(); m_techPointInteractions = new SerializedVector <TechPointInteraction>(assetFile, stream); m_actionAnimType = (ActorModelData.ActionAnimationType)stream.ReadInt32(); m_rotationVisibilityMode = (RotationVisibilityMode)stream.ReadInt32(); m_movementAdjustment = (MovementAdjustment)stream.ReadInt32(); m_movementSpeed = stream.ReadSingle(); m_movementDuration = stream.ReadSingle(); m_cameraBoundsMinHeight = stream.ReadSingle(); m_targetData = new SerializedArray <TargetData>(assetFile, stream); m_tags = new SerializedVector <AbilityTags>(assetFile, stream); m_statusWhenRequested = new SerializedVector <StatusType>(assetFile, stream); m_chainAbilities = new SerializedVector <SerializedMonoBehaviour>(assetFile, stream); m_targeterTemplateSwaps = new SerializedVector <TargeterTemplateSwapData>(assetFile, stream); }
private void anyListBox_DragOver(object sender, DragEventArgs e) { ListBox targetListBox = (ListBox)sender; if (!e.Data.GetDataPresent(typeof(System.String))) { e.Effect = DragDropEffects.None; return; } string value = (string)e.Data.GetData(DataFormats.StringFormat); Object tag = targetListBox.Tag; if (targetListBox.Items.Contains(value) || (tag != null && !AssetFile.AllExtensionsForEnum(((FileDescControls)tag).desc.FileTypeEnum). Contains(Path.GetExtension(value).ToLower()))) { e.Effect = DragDropEffects.None; return; } e.Effect = DragDropEffects.Copy; indexOfTargetItem = targetListBox.IndexFromPoint(targetListBox.PointToClient(new Point(e.X, e.Y))); }
public void DeserializeAsset(AssetFile assetFile, StreamReader stream) { m_width = stream.ReadSingle(); // float32 m_bidirectional = stream.ReadBoolean(); stream.AlignTo(); // bool m_blocksVision = (BlockingRules)stream.ReadInt32(); // valuetype BlockingRules m_blocksAbilities = (BlockingRules)stream.ReadInt32(); // valuetype BlockingRules m_blocksMovement = (BlockingRules)stream.ReadInt32(); // valuetype BlockingRules m_blocksMovementOnCrossover = (BlockingRules)stream.ReadInt32(); // valuetype BlockingRules m_blocksPositionTargeting = (BlockingRules)stream.ReadInt32(); // valuetype BlockingRules m_considerAsCover = stream.ReadBoolean(); stream.AlignTo(); // bool m_maxDuration = stream.ReadInt32(); // int32 m_barrierSequencePrefabs = new SerializedVector <SerializedGameObject>(assetFile, stream); // class [mscorlib]System.Collections.Generic.List`1<class [UnityEngine]UnityEngine.GameObject> m_onEnemyMovedThrough = new GameplayResponseForActor(assetFile, stream); // class GameplayResponseForActor m_onAllyMovedThrough = new GameplayResponseForActor(assetFile, stream); // class GameplayResponseForActor m_removeAtTurnEndIfEnemyMovedThrough = stream.ReadBoolean(); stream.AlignTo(); // bool m_removeAtTurnEndIfAllyMovedThrough = stream.ReadBoolean(); stream.AlignTo(); // bool m_removeAtPhaseEndIfEnemyMovedThrough = stream.ReadBoolean(); stream.AlignTo(); // bool m_removeAtPhaseEndIfAllyMovedThrough = stream.ReadBoolean(); stream.AlignTo(); // bool m_maxHits = stream.ReadInt32(); // int32 m_endOnCasterDeath = stream.ReadBoolean(); stream.AlignTo(); // bool m_responseOnShotBlock = new BarrierResponseOnShot(assetFile, stream); // class BarrierResponseOnShot }
public void caches_the_content_plan_from_the_planner() { var jsFile = new AssetFile("script.js") { FullPath = "something" }; var thePlan = new ContentPlan("something", new AssetFile[] { jsFile }); MockFor <IContentPlanner>().Expect(x => x.BuildPlanFor(thePlan.Name)) .Return(thePlan) .Repeat.Once(); ClassUnderTest.PlanFor(thePlan.Name).ShouldBeTheSameAs(thePlan); ClassUnderTest.PlanFor(thePlan.Name).ShouldBeTheSameAs(thePlan); ClassUnderTest.PlanFor(thePlan.Name).ShouldBeTheSameAs(thePlan); ClassUnderTest.PlanFor(thePlan.Name).ShouldBeTheSameAs(thePlan); ClassUnderTest.PlanFor(thePlan.Name).ShouldBeTheSameAs(thePlan); ClassUnderTest.PlanFor(thePlan.Name).ShouldBeTheSameAs(thePlan); MockFor <IContentPlanner>().VerifyAllExpectations(); }
/// <summary> /// 引用计数减少 (正常卸载引用) /// </summary> public void SubRefNum() { Count--; for (int i = 0; i < Filelist.Count; i++) { AssetFile assetfile = Filelist[i]; assetfile.SubRefNum(); } if (Count <= 0) { if (assetbundle != null) { assetbundle.Unload(true); assetbundle = null; } Filelist.Clear(); onDestory(this); } }
//key=type/name private void LoadAsset(string line) { if (line.Trim().IsEmpty()) { return; } if (!line.Contains("=")) { line = Guid.NewGuid().ToString() + "=" + line; } var parts = line.Split('='); var key = parts.First(); var stringPath = parts.Last(); var @override = stringPath.EndsWith("!override"); if (@override) { stringPath = stringPath.Replace("!override", ""); } var path = new AssetPath(stringPath); if (path.Package.IsEmpty()) { path = new AssetPath("application:" + stringPath); } var file = new AssetFile(path.Name) { Override = @override }; _files[key] = file; _callback(path, file); }
/// <summary> /// StringGridの一行からデータ初期化 /// </summary> /// <param name="row">初期化するためのデータ</param> /// <returns>成否</returns> public override bool InitFromStringGridRow(StringGridRow row, AdvBootSetting bootSetting) { string key = AdvCommandParser.ParseScenarioLabel(row, AdvColumnName.ScenarioLabel); InitKey(key); this.title = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Title, ""); this.thumbnailName = AdvParser.ParseCell <string>(row, AdvColumnName.Thumbnail); this.thumbnailVersion = AdvParser.ParseCellOptional <int>(row, AdvColumnName.ThumbnailVersion, 0); this.category = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Categolly, ""); this.RowData = row; this.thumbnailPath = bootSetting.ThumbnailDirInfo.FileNameToPath(thumbnailName); //ファイルマネージャーにバージョンの登録 AssetFile file = AssetFileManager.GetFileCreateIfMissing(this.ThumbnailPath); if (file != null) { file.Version = this.ThumbnailVersion; } return(true); }
/// <summary> /// StringGridの一行からデータ初期化 /// </summary> /// <param name="row">初期化するためのデータ</param> /// <returns>成否</returns> public override bool InitFromStringGridRow(StringGridRow row, AdvBootSetting bootSetting) { if (row.IsEmptyOrCommantOut) { return(false); } this.RowData = row; string key = AdvParser.ParseCell <string>(row, AdvColumnName.Label); if (string.IsNullOrEmpty(key)) { return(false); } else { InitKey(key); this.type = AdvParser.ParseCell <SoundType>(row, AdvColumnName.Type); this.fileName = AdvParser.ParseCell <string>(row, AdvColumnName.FileName); this.isStreaming = AdvParser.ParseCellOptional <bool>(row, AdvColumnName.Streaming, false); this.version = AdvParser.ParseCellOptional <int>(row, AdvColumnName.Version, 0); this.title = AdvParser.ParseCellOptional <string>(row, AdvColumnName.Title, ""); this.filePath = FileNameToPath(fileName, bootSetting); AssetFile file = AssetFileManager.GetFileCreateIfMissing(this.FilePath, this.RowData); if (file != null) { file.Version = this.Version; //ロードタイプをストリーミングにする場合、 if (this.IsStreaming) { file.AddLoadFlag(AssetFileLoadFlags.Streaming); } } return(true); } }
private void BuildSubFiles(AssetDirectory directory) { DirectoryInfo direction = new DirectoryInfo(directory.Path); FileInfo[] files = direction.GetFiles(); for (int i = 0; i < files.Length; i++) { if (files[i].Name.EndsWith(".meta")) { continue; } AssetFile file = new AssetFile(files[i].Name); directory.AddChild(file); _assetDatas.AllAssetFiles.Add(file); string[] test = AssetDatabase.GetDependencies(file.Path, false); _dependenciesDic.Add(file.Path, test); EditorUtility.DisplayProgressBar("Loading Asset Datas", file.Name, (float)(_progressValue++) / _progressTotal); } }
/// <summary> /// 处理完全匹配 /// </summary> /// <param name="displayNameSimplified"></param> /// <param name="matchAssetFileList"></param> private void DoPerfectMatch(string displayNameSimplified, List <AssetFile> matchAssetFileList) { if (displayNameSimplified.Length >= config.perfectMatch.minCharCount)//如果显示名称大于等于要求的字符数 { int count = 0; AssetFile assetFile = null; for (int j = 0; j < matchAssetFileList.Count; j++) { AssetFile item = matchAssetFileList[j]; if (item.displayNameSimplified == displayNameSimplified) { assetFile = item; count++; } } if (count == 1) //如果只有一个完全匹配项 { matchAssetFileList.Clear(); //排除掉其他可能 matchAssetFileList.Add(assetFile); //记录当前的 } } }
public void DeserializeAsset(AssetFile assetFile, StreamReader stream) { m_onAbility = (AbilityData.ActionType)stream.ReadInt32(); m_additionalAbilities = new SerializedVector <AbilityData.ActionType> (assetFile, stream); // class [mscorlib]System.Collections.Generic.List`1<valuetype AbilityData/ActionType> m_modAmountType = (ModAmountType)stream.ReadInt32(); m_baseValue = stream.ReadSingle(); m_finalAdd = stream.ReadSingle(); m_minReduction = stream.ReadInt32(); m_maxReduction = stream.ReadInt32(); m_stockAbilities = new SerializedVector <AbilityData.ActionType> (assetFile, stream); // class [mscorlib]System.Collections.Generic.List`1<valuetype AbilityData/ActionType> m_stockBaseValue = stream.ReadInt32(); m_stockFinalAdd = stream.ReadInt32(); m_refreshProgressBaseValue = stream.ReadInt32(); m_refreshProgressFinalAdd = stream.ReadInt32(); m_resetRefreshProgress = stream.ReadBoolean(); stream.AlignTo(); }
public async Task <Media> UploadAsync(string appId, AssetFile file, CancellationToken ct = default) { Guard.NotNullOrEmpty(appId, nameof(appId)); Guard.NotNull(file, nameof(file)); var media = new Media { AppId = appId, FileName = file.FileName, FileSize = file.FileSize, MimeType = file.MimeType, Metadata = new MediaMetadata() }; foreach (var metadataSource in mediaMetadataSources) { await metadataSource.EnhanceAsync(media, file); } var infos = new List <string>(); foreach (var metadataSource in mediaMetadataSources) { infos.AddRange(metadataSource.Format(media)); } media.FileInfo = string.Join(", ", infos); using (var stream = file.OpenRead()) { await mediaFileStore.UploadAsync(appId, media, stream, ct); } await mediaRepository.UpsertAsync(media, ct); return(media); }
public void DeserializeAsset(AssetFile assetFile, StreamReader stream) { m_durationMod = new AbilityModPropertyInt(assetFile, stream); m_widthMod = new AbilityModPropertyFloat(assetFile, stream); m_bidirectionalMod = new AbilityModPropertyBool(assetFile, stream); m_maxHitsMod = new AbilityModPropertyInt(assetFile, stream); m_blocksVisionMod = new AbilityModPropertyBlockingRules(assetFile, stream); m_blocksAbilitiesMod = new AbilityModPropertyBlockingRules(assetFile, stream); m_blocksMovementMod = new AbilityModPropertyBlockingRules(assetFile, stream); m_blocksMovementOnCrossoverMod = new AbilityModPropertyBlockingRules(assetFile, stream); m_blocksPositionTargetingMod = new AbilityModPropertyBlockingRules(assetFile, stream); m_considerAsCoverMod = new AbilityModPropertyBool(assetFile, stream); m_enemyMoveThroughDamageMod = new AbilityModPropertyInt(assetFile, stream); m_enemyMoveThroughEnergyMod = new AbilityModPropertyInt(assetFile, stream); m_enemyMoveThroughEffectMod = new AbilityModPropertyEffectInfo(assetFile, stream); m_allyMoveThroughHealMod = new AbilityModPropertyInt(assetFile, stream); m_allyMoveThroughEnergyMod = new AbilityModPropertyInt(assetFile, stream); m_allyMoveThroughEffectMod = new AbilityModPropertyEffectInfo(assetFile, stream); m_removeOnTurnEndIfEnemyCrossed = new AbilityModPropertyBool(assetFile, stream); m_removeOnTurnEndIfAllyCrossed = new AbilityModPropertyBool(assetFile, stream); m_removeOnPhaseEndIfEnemyCrossed = new AbilityModPropertyBool(assetFile, stream); m_removeOnPhaseEndIfAllyCrossed = new AbilityModPropertyBool(assetFile, stream); m_removeOnCasterDeath = new AbilityModPropertyBool(assetFile, stream); m_healOnOwnerForShotBlock = new AbilityModPropertyInt(assetFile, stream); m_energyGainOnOwnerForShotBlock = new AbilityModPropertyInt(assetFile, stream); m_effectOnOwnerForShotBlock = new AbilityModPropertyEffectInfo(assetFile, stream); m_damageOnEnemyForShotBlock = new AbilityModPropertyInt(assetFile, stream); m_energyLossOnEnemyForShotBlock = new AbilityModPropertyInt(assetFile, stream); m_effectOnEnemyForShotBlock = new AbilityModPropertyEffectInfo(assetFile, stream); m_onEnemyCrossHitSequenceOverride = new AbilityModPropertySequenceOverride(assetFile, stream); m_onAllyCrossHitSequenceOverride = new AbilityModPropertySequenceOverride(assetFile, stream); m_useBarrierSequenceOverride = stream.ReadBoolean(); stream.AlignTo(); m_barrierSequenceOverrides = new SerializedVector <SerializedGameObject>(assetFile, stream); m_responseOnShotSequenceOverride = new AbilityModPropertySequenceOverride(assetFile, stream); m_useShooterPosAsReactionSequenceTargetPosMod = new AbilityModPropertyBool(assetFile, stream); }
/// <summary> /// 收集资源文件数字范围 /// </summary> private void CollectAssetFileNumberRanage(List <AssetFile> assetFileList) { //收集文件中数字开始和结束的索引列表 for (int i = 0; i < assetFileList.Count; i++) { AssetFile assetFile = assetFileList[i]; Ranage ranage = null; string displayName = assetFile.displayName; List <Ranage> numberRanageList = assetFile.numberRanageList; numberRanageList.Clear(); for (int j = 0; j < displayName.Length; j++) { char c = displayName[j]; if (c >= '0' && c <= '9')//如果这个字符是数字 { if (ranage == null) { ranage = new Ranage(); ranage.assetFile = assetFile; ranage.start = j; } } else //如果这个字符不是数字 { if (ranage != null) { ranage.end = j; ranage.text = displayName.Substring(ranage.start, ranage.end - ranage.start); numberRanageList.Add(ranage); ranage = null; } } } } }
protected IEnumerator CoLoadGraphic(GraphicInfoList graphic, Action OnComplete) { IsLoading = true; //直前のファイルがあればそれを削除 foreach (var item in this.GetComponents <AssetFileReference>()) { Destroy(item); } foreach (var item in graphic.InfoList) { AssetFile file = AssetFileManager.Load(item.File, this); file.AddReferenceComponet(this.gameObject); file.Unuse(this); } while (!graphic.IsLoadEnd) { yield return(0); } OnComplete(); IsLoading = false; }
public void get_content_invokes_the_corrent_asset_transformer_against_the_content_of_the_inner_source() { var theTransformerFoundFromThePipeline = MockFor <ITransformer>(); var thePipeline = MockFor <IContentPipeline>(); var files = new AssetFile[0]; var theInnerContents = "inner contents"; var theInnerContentSource = MockFor <IContentSource>(); theInnerContentSource.Stub(x => x.Files).Return(files); theInnerContentSource.Stub(x => x.GetContent(thePipeline)).Return(theInnerContents); thePipeline.Stub(x => x.GetTransformer <StubTransformer>()).Return(theTransformerFoundFromThePipeline); var theTransformedContents = "transformed contents"; theTransformerFoundFromThePipeline.Stub(x => x.Transform(theInnerContents, files)).Return(theTransformedContents); ClassUnderTest.GetContent(thePipeline).ShouldEqual(theTransformedContents); }
void LoadNextFile() { AssetFile next = null; foreach (AssetFile file in loadWaitFileList) { if (next == null) { next = file; } else { if (file.Priority < next.Priority) { next = file; } } } if (next != null) { loadWaitFileList.Remove(next); AddLoadFile(next); } }
//章別に分かれたシナリオをロードする IEnumerator LoadChaptersAsync(string rootDir) { //動的に作成 AdvImportScenarios scenarios = ScriptableObject.CreateInstance <AdvImportScenarios>(); foreach (string chapterName in ChapterNames) { string url = FilePathUtil.Combine(rootDir, chapterName) + ".chapter.asset"; AssetFile file = AssetFileManager.Load(url, this); while (!file.IsLoadEnd) { yield return(null); } AdvChapterData chapter = file.UnityObject as AdvChapterData; if (scenarios == null) { Debug.LogError(url + " is not scenario file"); yield break; } scenarios.AddChapter(chapter); } this.Scenarios = scenarios; }
//ロードの必要があるファイルを追加 public AssetFile AddLoadFile(AssetFile file) { if (loadFileList == null) loadFileList = new List<AssetFile>(); loadFileList.Add(file); return file; }
/// <summary> /// ファイルのダウンロードだけする /// ロードの優先順位は一番低い /// バックグラウンドでファイルのダウンロードをする。 /// デバイスストレージに保存可能ならファイルをキャッシュしておく /// ロードしたアセットはメモリにもキャッシュにもしておくが /// メモリキャッシュはメモリが枯渇すると揮発するので、その場合は再ロードに時間がかかる /// </summary> /// <param name="file">ダウンロードするファイル</param> static public void Download(AssetFile file) { GetInstance().DownloadSub(file as AssetFileWork); }
/// <summary> /// テクスチャファイルを設定 /// </summary> /// <param name="file">テクスチャファイル</param> /// <param name="pixelsToUnits">スプライトを作成する際の、座標1.0単位辺りのピクセル数</param> public void SetTextureFile(AssetFile file) { //直前のファイルがあればそれを削除 ClearTextureFile(); this.textureFile = file; this.path = file.FileName; textureFile.AddReferenceComponet(this.gameObject); StartCoroutine(CoWaitTextureFileLoading()); }
/// <summary> /// テクスチャファイルをクリア /// </summary> public void ClearTextureFile() { RawImage.texture = null; AssetFileReference reference = this.GetComponent<AssetFileReference>(); if (reference != null) { Destroy(reference); } this.textureFile = null; }
public override void DeserializeAsset(AssetFile assetFile, StreamReader stream) { m_combatRange = stream.ReadSingle(); m_idealRange = stream.ReadSingle(); m_retreatFromRange = stream.ReadSingle(); }
/// <summary> /// ファイルのバックグラウンドロード /// すぐには使わないが、そのうち使うであろうファイルに使用すること /// ロードの優先順位は三番目に高い /// 事前にロードをかけてロード時間を短縮しておくのが主な用途。 /// </summary> /// <param name="file">バックグラウンドロードするファイル</param> /// <param name="referenceObj">ファイルを参照するオブジェクト</param> static public AssetFile BackGroundLoad(AssetFile file, System.Object referenceObj) { return GetInstance().BackGroundLoadSub(file as AssetFileWork, referenceObj); }
public bool IsForFile(AssetFile file) { return true; }
//************ SE ************// /// <summary> /// SEの再生 /// </summary> /// <param name="file">サウンドファイル</param> /// <returns>再生をしているサウンドストリーム</returns> public void PlaySe(AssetFile file) { PlaySe(file, DefaultVolume); }
public void PlayVoice(string charcterLabel, AssetFile file, float fadeTime) { CurrentVoiceCharacterLabel = charcterLabel; System.Play(IdVoice, file, DefaultVolume, false, fadeTime, true, () => GetMasterVolume(IdVoice)); }
//************ Voice ************// public void PlayVoice(string charcterLabel, AssetFile file) { PlayVoice(charcterLabel, file, DefaultVoiceFadeTime); }
/// <summary> /// ファイルの先行ロード /// もうすぐ使うファイルに使用すること /// ロードの優先順位は二番目に高い /// 事前にロードをかけてロード時間を短縮しておくのが主な用途 /// </summary> /// <param name="file">先行ロードするファイル</param> /// <param name="referenceObj">ファイルを参照するオブジェクト</param> static public void Preload(AssetFile file, System.Object referenceObj) { GetInstance().PreloadSub(file as AssetFileWork, referenceObj); }
public void DeserializeAsset(AssetFile assetFile, StreamReader stream) { operation = (ModOp)stream.ReadInt32(); value = stream.ReadInt32(); }
/// <summary> /// ファイルをリロードする /// </summary> /// <param name="file">リロードするファイル</param> static public void ReloadFile(AssetFile file) { GetInstance().ReloadFileSub(file as AssetFileWork); }
public void PlaySe(AssetFile file, float volume) { AudioSource audio = PlaySeSub(file.Sound, volume); if (audio) { file.AddReferenceComponet (audio.gameObject); } }
AssetFile errorFile; // ロードエラーしたファイル // ロードエラー時のデフォルトコールバック void CallbackFileLoadError(AssetFile file) { errorFile = file; string errorMsg = file.LoadErrorMsg + "\n" + file.FileName; Debug.LogError(errorMsg); if (SystemUi.GetInstance() != null) { //リロードを促すダイアログを表示 SystemUi.GetInstance().OpenDialog1Button( errorMsg, LanguageSystemText.LocalizeText(SystemText.Retry), OnCloseFileLoadErrorDialog); AssetFileManager.SetActive(false); } else if (LegacyUiSystemUi.GetInstance() != null) { //リロードを促すダイアログを表示 LegacyUiSystemUi.GetInstance().OpenDialog1Button( errorMsg, LanguageSystemText.LocalizeText(SystemText.Retry), this.gameObject, "OnCloseFileLoadErrorDialog"); AssetFileManager.SetActive(false); } else { AssetFileManager.ReloadFile(errorFile); } }
/// <summary> /// SE再生 /// </summary> /// <param name="file">サウンドファイル</param> /// <param name="volume">再生ボリューム</param> /// <returns>再生をしているサウンドストリーム</returns> public void PlaySe(AssetFile file, float volume) { System.PlaySe(file, volume*GetMasterVolume(IdSe) ); }
public bool IsForFile(AssetFile file) { return file.Extensions.Any(i => i == _extension); }
public void Play(string streamName, AssetFile file, float volume, bool isLoop, float fadeTime, bool isReplay, Func<float> callbackMasterVolume) { bool isStreaming = (file.LoadFlags & AssetFileLoadFlags.Streaming) == AssetFileLoadFlags.Streaming; SoundStream stream = PlaySub(streamName, file.Sound, volume, isLoop, isStreaming, fadeTime, isReplay, callbackMasterVolume); file.AddReferenceComponet(stream.gameObject); }
public bool IsForFile(AssetFile file) { return file.Extension == ".js"; }
public AbilityModPropertyBlockingRules(AssetFile assetFile, StreamReader stream) { DeserializeAsset(assetFile, stream); }
public void PlayBgm(AssetFile file) { PlayBgm(file, DefaultFadeTime ); }
//ボイスの再生 IEnumerator CoPlayVoice( AdvEngine engine, AssetFile voiceFile, string charcterLabel) { if (voiceFile == null) { Debug.LogError("Backlog voiceFile is NULL"); } AssetFileManager.Load(voiceFile, this); while (!voiceFile.IsReadyStreaming) { yield return 0; } engine.SoundManager.PlayVoice(charcterLabel, voiceFile); voiceFile.Unuse(this); }
public void PlayBgm(AssetFile file, float fadeTime) { System.Play( IdBgm, file, DefaultVolume, true, fadeTime, false, ()=>GetMasterVolume(IdBgm) ); }
internal void Play(string label, string cameraName, AssetFile file, bool loop, bool cancel) { }
//************ 環境音 ************// public void PlayAmbience(AssetFile file, bool isLoop) { PlayAmbience(file, isLoop, DefaultFadeTime); }
public BotController(AssetFile assetFile, StreamReader stream) { DeserializeAsset(assetFile, stream); }
public void PlayAmbience(AssetFile file, bool isLoop, float fadeTime) { System.Play(IdAmbience, file, DefaultVolume, isLoop, fadeTime, false, () => GetMasterVolume(IdAmbience)); }
protected virtual void ChangeReference(AssetFile file, GameObject go) { //直前のファイルがあればそれを削除 go.RemoveComponents <AssetFileReference>(); file.AddReferenceComponent(go); }
/// <summary> /// 初期化 /// </summary> /// <param name="file">参照するファイル</param> public void Init(AssetFile file) { this.file = file; this.file.Use(this); }