/// <summary> /// タイトルで汎用ウィンドウのAssetBundle読み込みを行う. /// </summary> /// <param name="multiplier"></param> /// <returns></returns> public IEnumerator PreLoad(AssetBundlerMultiplier multiplier) { if (multiplier != null) { var assetBundlePathList = MasterFinder <MasterDataAssetBundlePath> .Instance. SelectWhere(" where category = ? ", MasterDataDefineLabel.ASSETBUNDLE_CATEGORY.GENERALWINDOW); yield return(null); for (int i = 0; i < assetBundlePathList.Count; i++) { multiplier.Add( AssetBundler.Create().Set(assetBundlePathList[i].name, (result) => { #if BUILD_TYPE_DEBUG if (result.AssetBundle != null) { Debug.Log("GeneralWindowProvider:asset download success:" + result.AssetBundle.name); } #endif //BUILD_TYPE_DEBUG } , null ) ); yield return(null); } } yield return(null); }
public void setup(uint boss_id, Camera mainCamera, float angle) { // var assetBundler = AssetBundler.Create(); assetBundler.SetAsUnitTexture( boss_id, (asset) => { var tex2D = asset.GetUncompressedTexture2D(); if (render != null && tex2D != null) { render.sprite = Sprite.Create(tex2D, new Rect(0, 0, tex2D.width, tex2D.height), new Vector2(0.5f, 0.5f)); } }) .Load(); // GetComponentInChildren <BillboardSprite>().setup(mainCamera); // transform.localRotation = Quaternion.Euler(0, angle, 0); if (angle == 0) { bLog = true; } }
public void SetCharaID(uint unCharaID, bool _reset = false) { m_AutoSetCharaID = unCharaID; if (_reset) { ResetTexture(); } m_AssetBundler = AssetBundler.Create(). SetAsUnitTexture( unCharaID, (o) => { UpdateWithTexture(GetTexture(o)); }, (str) => { Texture2D texture = new Texture2D(16, 16, TextureFormat.ARGB32, false); Color[] cols = new Color[256]; for (int i = 0; i < 256; i++) { cols[i] = Color.green; } texture.SetPixels(0, 0, 16, 16, cols); texture.Apply(); UpdateWithTexture(texture); }). Load(); }
public void SetUpData(MasterDataGeneralWindow master) { int fix_id = (int)master.fix_id; m_fix_id = fix_id; string assetName = master.char_img; if (m_Image == null) { return; } m_Image.color = m_Image.color.WithAlpha(0); RectTransform ImageRect = m_Image.GetComponent <RectTransform>(); ImageRect.anchoredPosition = new Vector2(master.char_offset_x, master.char_offset_y); AssetBundler asset = AssetBundler.Create().Set(AssetBundleName, (o) => { SetSprite(o.GetTexture2D(assetName, TextureWrapMode.Clamp), o.GetTexture(assetName + "_mask", TextureWrapMode.Clamp), fix_id); }, (str) => { }) .Load(); }
public void OnClickUnit() { Reset(); LocalSaveManagerRN.Instance.QualitySetting = qualitySetting; LocalSaveManagerRN.Instance.Save(); UnitIconImageProvider.Instance.Get( unitId, sprite => { image01.sprite = sprite; }); AssetBundler.Create().SetAsUnitTexture(unitId, (o) => { foreach (Object obj in o.AssetBundle.LoadAllAssets()) { Debug.LogError("OBK:" + obj); } rawImage.texture = o.GetTexture2D(TextureWrapMode.Clamp); image02.sprite = o.GetAssetAll <Sprite>().FirstOrDefault(s => s.name.Contains("uncompressed")); }).Load(); }
public AssetBundler CreatetIcon() { Sprite defaultSpite = IconImage; IconImage = null; string assetName = string.Format("icon{0:D2}", m_EpisodeId); #if BUILD_TYPE_DEBUG Debug.Log("ASSETNAME:" + assetName + " FIX:" + masterDataAreaCategory.fix_id); #endif string assetbundleName = MasterDataUtil.GetMasterDataAreamapBackgroundName(masterDataAreaCategory.background); return(AssetBundler.Create().Set(assetbundleName, assetName, (o) => { Sprite sprite = o.AssetBundle.LoadAsset <Sprite>(assetName); if (sprite != null) { IconImage = sprite; } else { IconImage = defaultSpite; } }, (error) => { IconImage = defaultSpite; })); }
override public AssetBundler LoadAsset(string name, System.Action <AssetBundle> callback) { Debug.Assert(m_cache != null, "m_cache not set"); if (m_assetbundles.ContainsKey(name)) { callback(m_assetbundles[name]); return(null); } #if true return(AssetBundler.Create().Set(name, (response) => { m_assetbundles[name] = response.AssetBundle; callback(m_assetbundles[name]); })); #else #if UNITY_IOS string path = Application.streamingAssetsPath + "/UnitIconPack/iOS/" + name; #else string path = Application.streamingAssetsPath + "/UnitIconPack/Android/" + name; #endif AssetBundle assetbundle = AssetBundle.LoadFromFile(path); if (assetbundle == null) { Debug.LogError("AssetBundle None! - " + " , path:" + path); } else { m_assetbundles[name] = assetbundle; callback(m_assetbundles[name]); } return(null); #endif }
//複数のAssetBundleを並行して取得する場合 public void OnClickMultiple() { Reset(); AssetBundlerMultiplier multiplier = AssetBundlerMultiplier.Create(); multiplier.Add(AssetBundler.Create().Set("iconpackpanel", (o) => { image01.sprite = o.GetSprites()[0]; // image01.sprite = o.GetAsset<>() })).Load(); multiplier.Add(AssetBundler.Create().SetAsUnitTexture(unitId, (o) => { rawImage.texture = o.GetTexture2D(TextureWrapMode.Clamp); })).Load(); multiplier.Load(() => { #if BUILD_TYPE_DEBUG Debug.Log("FINISH"); #endif }, () => { #if BUILD_TYPE_DEBUG Debug.Log("ERROR"); #endif }); }
public TutorialDialog SetTutorialType(FLAG_TYPE _type) { this.type = _type; SetLoading(true); AssetBundler.Create(). Set(string.Format("tutorial_{0:D4}", (int)type), (o) => { Sprite[] sprits = o.GetAssetAll <Sprite>(); if (sprits != null && sprits.Length > 0) { SetSprits(sprits); } else { Error(); } SetLoading(false); SetUpButtons(); }, (s) => { SetLoading(false); Error(); }). Load(); return(this); }
//シンプル public void OnClickEpisode() { Reset(); LocalSaveManagerRN.Instance.QualitySetting = qualitySetting; LocalSaveManagerRN.Instance.Save(); // image01.sprite = ResidentResourceUtil.GetCharaIcon(unitId); AssetBundler.Create().Set("Areamap_" + episodeId, "Background", (o) => { // Sprite[] sprites = o.AssetBundle.LoadAssetWithSubAssets<Sprite>("tex_episode_perform_l_000"+episodeId); // image01.sprite = sprites[0]; foreach (Object obj in o.AssetBundle.LoadAllAssets()) { Debug.LogError("OBK:" + obj); } rawImage.texture = o.AssetBundle.LoadAsset <Texture>("Background"); Debug.LogError("SPRIH:" + o.AssetBundle.LoadAsset <Sprite>("icon01")); image01.overrideSprite = o.AssetBundle.LoadAsset <Sprite>("icon01"); image02.sprite = o.AssetBundle.LoadAsset <Sprite>("icon02"); image03.sprite = o.AssetBundle.LoadAsset <Sprite>("icon03"); image04.sprite = o.AssetBundle.LoadAsset <Sprite>("icon04"); image05.sprite = o.AssetBundle.LoadAsset <Sprite>("icon05"); image06.sprite = o.AssetBundle.LoadAsset <Sprite>("icon06"); }).Load(); }
//シンプル public void OnClickHero() { Reset(); LocalSaveManagerRN.Instance.QualitySetting = qualitySetting; LocalSaveManagerRN.Instance.Save(); // image01.sprite = ResidentResourceUtil.GetCharaIcon(unitId); AssetBundler.Create().Set("hero_000" + heroId, "Hero_0" + heroId, (o) => { // Sprite[] sprites = o.AssetBundle.LoadAssetWithSubAssets<Sprite>("tex_hero_perform_l_000"+heroId); // image01.sprite = sprites[0]; foreach (Object obj in o.AssetBundle.LoadAllAssets()) { Debug.LogError("OBK:" + obj); } // image01.sprite = o.AssetBundle.LoadAsset<Sprite>("Hero_0" + heroId); // context.Hero = o.AssetBundle.LoadAsset<Sprite>("Hero_0" + heroId); // context.Hero_mask = o.AssetBundle.LoadAsset<Texture>("Hero_0" + heroId +"_mask"); string assetName = string.Format("tex_hero_perform_l_{0:D4}", (int)heroId); context.Hero = o.AssetBundle.LoadAsset <Sprite>(assetName); context.Hero_mask = o.GetTexture(assetName + "_mask", TextureWrapMode.Clamp); }).Load(); }
/// <summary> /// 背景画像のロード /// </summary> /// <param name="fix_id"></param> public void SetMapID(uint fix_id) { if (fix_id == 0) { IsLoading = true; return; } m_fix_id = fix_id; Type = ResourceType.MAP; m_AssetBundleName = string.Format("background_{0:D4}", fix_id); m_AssetName = string.Format("background_{0:D4}", fix_id); m_AssetBundler = AssetBundler.Create().Set(m_AssetBundleName, m_AssetName, typeof(Sprite), (o) => { m_Sprite = o.GetAsset <Sprite>(); IsLoading = true; }, (str) => { IsLoading = true; IsFail = true; }) .Load(); }
public void SetDetail(PacketStructHero heroData) { ClearView(); if (heroData == null || heroData.hero_id == 0) { return; } MasterDataHero heroMaster = MasterFinder <MasterDataHero> .Instance.Find((int)heroData.hero_id); if (heroMaster == null) { return; } SetUpHeroName(heroData.hero_id); // 名前 MessageText = heroMaster.detail; // 詳細テキスト AssetBundler.Create().Set("hero_" + heroData.hero_id.ToString("0000"), "hero_" + heroData.hero_id.ToString("0000"), (o) => { Sprite[] sprite = o.AssetBundle.LoadAssetWithSubAssets <Sprite>("hero_" + heroData.hero_id.ToString("0000")); HeroImage = sprite[4]; }).Load(); //------------------------------------------------------------------ // グレードの設定 //------------------------------------------------------------------ m_GradeNum = heroData.level; MasterDataHeroLevel nextHeroLevelMaster = MasterFinder <MasterDataHeroLevel> .Instance.Find((int)heroData.level + 1); if (nextHeroLevelMaster != null) { m_NextGradeNum = nextHeroLevelMaster.exp_next_total - heroData.exp; } else { m_NextGradeNum = 0; } //------------------------------------------------------------------ // イラストレーター名 //------------------------------------------------------------------ /* * MasterDataIllustrator illustratorMaster = MasterFinder<MasterDataIllustrator>.Instance.Find((int)heroMaster.illustrator_id); * if (illustratorMaster != null) * { * IllustratorText = illustratorMaster.name; * } */ //------------------------------------------------------------------ // スキルの設定 //------------------------------------------------------------------ List <UnitSkillContext> skillList = new List <UnitSkillContext>(); UnitSkillContext skill = new UnitSkillContext(); skill.setupHeroSkill((uint)heroMaster.default_skill_id, 0, 0, true); skillList.Add(skill); Skills = skillList; }
/// <summary> /// MAP背景画像を設定する. /// </summary> /// <param name="category">リージョンカテゴリ</param> /// <param name="fixId">MasterDataRegionのfix_id</param> private void SetAreaBackground(MasterDataDefineLabel.REGION_CATEGORY category, uint fixId, Action action) { if (m_AreaSelect == null) { return; } // デフォルトの背景を設定する. Sprite defaultSprite = null; switch (m_CurrentRegionMaster.category) { case MasterDataDefineLabel.REGION_CATEGORY.STORY: defaultSprite = m_AreaSelect.backgroundSprites[0]; break; case MasterDataDefineLabel.REGION_CATEGORY.MATERIAL: defaultSprite = m_AreaSelect.backgroundSprites[1]; break; case MasterDataDefineLabel.REGION_CATEGORY.EVENT: defaultSprite = m_AreaSelect.backgroundSprites[2]; break; } var assetBundleName = string.Format("AreaBackGround_{0}", fixId); // 該当ファイルがAssetBundlePathMasterに存在しない場合は、カテゴリ毎のデフォルト画像を設定する. var assetBundlePath = MasterDataUtil.GetMasterDataAssetBundlePath(assetBundleName); if (assetBundlePath != null) { AssetBundler.Create().Set( assetBundleName, (o) => { m_AreaSelect.BackGroundImage = o.GetAsset <Sprite>(); if (action != null) { action(); } }, (s) => { m_AreaSelect.BackGroundImage = defaultSprite; if (action != null) { action(); } } ).Load(); } else { m_AreaSelect.BackGroundImage = defaultSprite; if (action != null) { action(); } } }
IEnumerator CreateLoadResource(Action <AssetBundlerMultiplier> finishAction, List <int> categories = null) { AssetBundlerMultiplier mlutiplier = AssetBundlerMultiplier.Create(); if (categories != null && categories.Count > 0) { for (int i = 0; i < categories.Count; i++) { List <MasterDataAssetBundlePath> assetBundlePathList = MasterFinder <MasterDataAssetBundlePath> .Instance. SelectWhere(" where category = ? ", categories[i]); #if BUILD_TYPE_DEBUG Debug.Log("CALL SceneTitle#LoadTitleDownload Count:" + assetBundlePathList.Count); #endif yield return(null); for (int j = 0; j < assetBundlePathList.Count; j++) { AssetBundler aber = AssetBundler.Create().Set(assetBundlePathList[j].name.ToLower()).SkipCreateCache(); mlutiplier.Add(aber); yield return(null); } ; } yield return(null); } yield return(UnitIconImageProvider.Instance.LoadIconPacks(mlutiplier)); yield return(null); yield return(ReplaceAssetManager.Instance.downloadReplaceAssetbundle(mlutiplier)); yield return(null); yield return(AreaBackgroundProvider.Instance.PreLoadAreaBackground(mlutiplier)); yield return(null); yield return(GeneralWindowProvider.Instance.PreLoad(mlutiplier)); yield return(null); mlutiplier.RegisterProgressAction( (float progress) => { float progressPercent = progress * 100; LoadingManager.Instance.Progress(progressPercent); if (MovieManager.Instance != null) { MovieManager.Instance.setPercent(progressPercent); } }); finishAction(mlutiplier); }
public void setupIcon() { AreaDataList.Clear(); var model = new AreaSelectListItemModel(0); model.OnAppeared += () => { model.ShowTitle(); }; if (IsIconView == false) { model.isActive = true; } else { model.isActive = false; } AreaDataContext newArea = new AreaDataContext(model); if (newArea != null) { newArea.m_AreaIndex = masters[currentIndex].fix_id; newArea.IsViewFlag = false; newArea.IsAreaNew = false; newArea.Title = masters[currentIndex].area_cate_name; newArea.PosX = 0; newArea.PosY = 0; // アセットバンドルの読み込み string assetBundleName = string.Format("areamapicon_{0}", masters[currentIndex].fix_id); // インジケーターを表示 LoadingManager.Instance.RequestLoadingStart(LOADING_TYPE.GUARD); AssetBundler.Create(). Set(assetBundleName, (o) => { newArea.IconImage = o.GetAsset <Sprite>(); newArea.IconImage_mask = o.GetTexture(newArea.IconImage.name + "_mask", TextureWrapMode.Clamp); LoadingManager.Instance.RequestLoadingFinish(LOADING_TYPE.GUARD); AreaDataList.Add(newArea); }, (s) => { newArea.IconImage = ResourceManager.Instance.Load("maeishoku_icon"); LoadingManager.Instance.RequestLoadingFinish(LOADING_TYPE.GUARD); }).Load(); } else { LoadingManager.Instance.RequestLoadingFinish(LOADING_TYPE.GUARD); } idInputField.text = masters[currentIndex].fix_id.ToString(); }
public AssetBundler Create(string assetbundleName, Action finish = null, Action fail = null) { return(AssetBundler.Create().Set(assetbundleName, "Background", (o) => { if (image != null) { image.overrideSprite = o.AssetBundle.LoadAsset <Sprite>("Background"); image.enabled = true; if (SetNativeSize == true) { image.SetNativeSize(); } } else if (rawImage != null) { rawImage.texture = o.GetTexture("Background", TextureWrapMode.Clamp); rawImage.enabled = true; if (SetNativeSize == true) { rawImage.SetNativeSize(); } } if (finish != null) { finish(); } }, (error) => { if (image != null) { image.overrideSprite = Resources.Load <Sprite>("Default/BG_color"); image.enabled = true; if (SetNativeSize == true) { image.SetNativeSize(); } } else if (rawImage != null) { rawImage.texture = Resources.Load("Default/BG_color") as Texture; rawImage.enabled = true; if (SetNativeSize == true) { rawImage.SetNativeSize(); } } if (fail != null) { fail(); } } )); }
public void OnHeroSelect(int index) { if (m_decision == true) { return; } if (m_select == true) { return; } if (m_CurrentIndex == index) { return; } if (m_finishDecision == true) { return; } m_select = true; int fix_id = index + 1; string hero_name = String.Format("hero_{0:D4}", fix_id); string hero_perfom_name = String.Format("tex_hero_perform_l_{0:D4}", fix_id); string hero_mask_name = String.Format("tex_hero_perform_l_{0:D4}_mask", fix_id); AssetBundler.Create().Set(hero_name, hero_perfom_name, (o) => { Sprite[] herosprites = o.AssetBundle.LoadAssetWithSubAssets <Sprite>(hero_perfom_name); Texture maskTextue = o.GetTexture(hero_mask_name, TextureWrapMode.Clamp); m_HeroImage[index] = herosprites[0]; m_HeroImage_mask[index] = maskTextue; m_HeroInAnimation.Play("FreamOut"); m_SelectHeroInAnim.Play("SelectHeroOut"); setHeroColor(m_CurrentIndex, false); m_CurrentIndex = index; setHeroColor(m_CurrentIndex, true); setHeroName(-1); TutorialHeroSelectFSM.Instance.SendFsmNegativeEvent(); }, (str) => { }) .Load(); SoundUtil.PlaySE(SEID.SE_MENU_OK); }
//シンプル public void OnClickSimple() { Reset(); AssetBundler.Create().Set("iconpackpanel", (o) => { image01.sprite = o.GetSprites()[0]; // image01.sprite = o.GetAsset<>() }).Load(); AssetBundler.Create().SetAsUnitTexture(unitId, (o) => { rawImage.texture = o.GetTexture2D("tex_chara_l_001", TextureWrapMode.Clamp); }).Load(); }
//ステータス変化を検知してAssetを取得したい場合 //※基本、これはソースが汚くなるので使わない //※既存ソースにこっちの方が組み込みやすい場合のみ使用する public void OnClickWaitChangeStatus() { if (aber != null) { return; } Reset(); aber = AssetBundler.Create(); aber.Set("iconpackpanel"); aber.DisableAutoDestoryOnSuccess(); aber.Load(); }
public override bool PageSwitchEventEnableBefore(bool bBack = false) { bool bEnable = base.PageSwitchEventEnableBefore(); // アセットバンドルの読み込み if (!m_bStartLoadImg) { m_bStartLoadImg = true; uint currentHeroID = MasterDataUtil.GetCurrentHeroID(); string assetname = string.Format("tex_hero_perform_l_{0:D4}", currentHeroID); AssetBundler.Create().Set(string.Format("hero_{0:D4}", currentHeroID), assetname, (o) => { Texture2D texture = o.GetTexture2D(assetname, TextureWrapMode.Clamp); if (texture != null) { m_HeroImage = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero); m_HeroImage_mask = o.GetTexture(assetname + "_mask", TextureWrapMode.Clamp); } if (m_HomeMenu != null) { m_HomeMenu.HeroImage = m_HeroImage; m_HomeMenu.HeroImage_mask = m_HeroImage_mask; } m_bEndLoadImg = true; }, (s) => { m_bEndLoadImg = true; }).Load(); } #if false//トピック情報を表示するボタンは削除されたので情報取得APIもコメントアウトする。 if (!m_bStartApi) { ServerDataUtilSend.SendPacketAPI_GetTopicInfo() .setSuccessAction(_data => { m_RecvData = _data.GetResult <RecvGetTopicInfo>().result.Clone <RecvGetTopicInfoValue>(); m_bEndApi = true; }) .SendStart(); m_bStartApi = true; } bEnable = !m_bEndApi && !m_bEndLoadImg; #else bEnable = !m_bEndLoadImg; #endif return(bEnable); }
private void LoadFromAssetBundle(string dataPath, System.Action <AudioClip> callback) { AssetBundler.Create().SetAsAudioClip("pack_se", dataPath, (clip) => { if (clip == null) { Debug.LogError("NOT_FOUND_SEID from assetbundle (will try to load from resources) path:" + dataPath); LoadSync(dataPath, callback); } else { callback(clip); } }).Load(); }
public void SetUpParamChara(int index) { //-------------------------------- // アクセス番号決定 //-------------------------------- if (index >= m_CharaMasterArray.Length) { index = 0; } if (index < 0) { index = m_CharaMasterArray.Length - 1; } MasterDataParamChara charaMaster = m_CharaMasterArray[index]; m_CurrentCharaMaster = charaMaster; m_Index = index; m_DebugPartyOffset.NameText = charaMaster.name; m_DebugPartyOffset.m_IdInputField.text = charaMaster.fix_id.ToString(); m_DebugPartyOffset.m_NoInputField.text = charaMaster.draw_id.ToString(); m_DebugPartyOffset.SetupUV(m_OffsetXArray[m_Index, (int)CurrentUVTarget] , m_OffsetYArray[m_Index, (int)CurrentUVTarget] , m_TilingArray[m_Index, (int)CurrentUVTarget] ); m_DebugPartyOffset.SetupAdjustUV(charaMaster.img_2_offsetX * 0.001f, charaMaster.img_2_offsetY * 0.001f, charaMaster.img_2_tiling * 0.001f); m_DebugPartyOffset.CheckAdjustUV(); AssetBundler.Create().SetAsUnitTexture(charaMaster.fix_id, (o) => { Texture2D tex = o.GetTexture2D(TextureWrapMode.Clamp); m_DebugPartyOffset.ThirdUnitMaterial.SetTexture("_MainTex", tex); foreach (GlobalDefine.PartyCharaIndex charaIndex in Enum.GetValues(typeof(GlobalDefine.PartyCharaIndex))) { SetUpUVParam(charaIndex); } }, (s) => { m_DebugPartyOffset.ThirdUnitMaterial.SetTexture("_MainTex", null); }).Load(); }
public void OnClickAny() { Reset(); LocalSaveManagerRN.Instance.QualitySetting = qualitySetting; LocalSaveManagerRN.Instance.Save(); AssetBundler.Create().Set(any.ToLower(), any.ToLower(), (o) => { int index = 0; foreach (Sprite obj in o.AssetBundle.LoadAllAssets <Sprite>()) { Debug.LogError("OBK:" + obj); imageList[index].overrideSprite = obj; ++index; } }).Load(); }
protected override void PageSwitchSetting(bool initalize) { base.PageSwitchSetting(initalize); //-------------------------------- // オブジェクトの取得 //-------------------------------- m_HeroPreview = m_CanvasObj.GetComponentInChildren <HeroPreview>(); m_HeroPreview.SetSizeParfect(new Vector2(0, -254)); m_HeroPreview.OnClickViewAction = OnClickPreview; int currentHeroID = 0; if (UserDataAdmin.Instance.m_StructHeroList.Length > MainMenuParam.m_HeroCurrentInex) { PacketStructHero heroData = UserDataAdmin.Instance.m_StructHeroList[MainMenuParam.m_HeroCurrentInex]; currentHeroID = heroData.hero_id; } // アセットバンドルの読み込み LoadingManager.Instance.RequestLoadingStart(LOADING_TYPE.ASSETBUNDLE); AssetBundler.Create(). Set(string.Format("hero_{0:D4}", currentHeroID), (o) => { Sprite[] sprites = o.AssetBundle.LoadAssetWithSubAssets <Sprite>(string.Format("tex_hero_stand_l_{0:D4}", currentHeroID)); Texture maskTextue = o.GetTexture(string.Format("tex_hero_stand_l_{0:D4}_mask", currentHeroID), TextureWrapMode.Clamp); m_HeroPreview.UnitImage = ImageUtil.GetSprite(sprites, "body"); m_HeroPreview.UnitImage_mask = maskTextue; // インジケーターを閉じる LoadingManager.Instance.RequestLoadingFinish(LOADING_TYPE.ASSETBUNDLE); }, (str) => { // インジケーターを閉じる LoadingManager.Instance.RequestLoadingFinish(LOADING_TYPE.ASSETBUNDLE); }). Load(); }
/// <summary> /// 主人公画像のロード開始 /// </summary> /// <param name="fix_id"></param> private void LoadHero(uint fix_id) { int heroId = (int)fix_id; m_AssetBundleName = string.Format("hero_{0:D4}", heroId); m_AssetName = string.Format("tex_hero_stand_l_{0:D4}", heroId); m_AssetBundler = AssetBundler.Create().Set(m_AssetBundleName, m_AssetName, typeof(Texture2D), (o) => { m_Texture = o.GetTexture2D(m_AssetName, TextureWrapMode.Clamp); m_Texture_mask = o.GetTexture2D(m_AssetName + "_mask", TextureWrapMode.Clamp); IsLoading = true; }, (str) => { IsLoading = true; IsFail = true; }) .Load(); }
public AssetBundler setup(uint boss_id) { m_bSetup = false; AssetBundler assetBundler = AssetBundler.Create(); assetBundler.SetAsUnitTexture( boss_id, (asset) => { var tex2D = asset.GetUncompressedTexture2D(); if (tex2D != null) { SpriteImage = Sprite.Create(tex2D, new Rect(0, 0, tex2D.width, tex2D.height), new Vector2(0.5f, 0.5f)); SpriteColor = new Color(1, 1, 1, 1); SpriteSizeX = tex2D.GetUnitTextureWidth(); SpriteSizeY = tex2D.GetUnitTextureHeight(); } m_bSetup = true; }); return(assetBundler); }
private IEnumerator RepeatGet() { while (cMasterDataChara == null) { yield return(new WaitForEndOfFrame()); //---------------------------------------- // マスターデータ取得 //---------------------------------------- cMasterDataChara = MasterDataUtil.GetCharaParamFromID(m_AutoSetCharaID); if (cMasterDataChara == null) { Debug.LogError("CharaID Error! - " + m_AutoSetCharaID); } else { m_AssetBundler = AssetBundler.Create(). SetAsUnitTexture( m_AutoSetCharaID, (o) => { if (m_UseUncompressed) { Set(o.GetUncompressedTexture2D()); } else { Set(o.GetTexture2D(TextureWrapMode.Clamp)); } }, (str) => { m_Ready = true; }). Load(); } } }
override public AssetBundler LoadAsset(string name, System.Action <UIAtlas> callback) { Debug.Assert(m_cache != null, "m_cache not set"); var cachedAtlas = m_cache.GetAtlas(name); if (cachedAtlas != null) { callback(cachedAtlas); return(null); } return(AssetBundler.Create().Set(name, typeof(Sprite), (operation) => { UIAtlas atlas = operation.GetUIAtlas(); callback(atlas); if (atlas != null) { m_cache.Register(name, atlas); } })); }
override public AssetBundler LoadAsset(string name, System.Action <Sprite> callback) { Debug.Assert(m_cache != null, "m_cache not set"); var cachedSprite = m_cache.GetSprite(name); if (cachedSprite != null) { callback(cachedSprite); return(null); } return(AssetBundler.Create().Set(name, typeof(Sprite), (operation) => { var sprite = operation.GetSprite(); callback(sprite); if (sprite != null) { m_cache.Register(name, sprite); } })); }