/// <summary> /// Init /// </summary> protected void Init(uint batteryId, uint barrelId, uint bulletId) { this.batteryData = Masters.BatteryDB.FindById(batteryId); this.barrelData = Masters.BarrelDB.FindById(barrelId); this.bulletData = Masters.BulletDB.FindById(bulletId); this.fvAttackData = Masters.FvAttackDB.FindById(this.batteryData.fvAttackId); this.turretBase.batteryKey = this.batteryData.key; this.turretBase.barrelKey = this.barrelData.key; this.turretBase.bulletKey = this.bulletData.key; this.loader.Add<GameObject>(SharkDefine.GetBatteryPrefabPath(this.turretBase.batteryKey)); this.loader.Add<GameObject>(SharkDefine.GetBarrelPrefabPath(this.turretBase.barrelKey)); this.loader.Add<BulletBase>(SharkDefine.GetBulletPrefabPath(this.turretBase.bulletKey)); this.fvaAsset = this.loader.Add<FvAttackBase>(SharkDefine.GetFvAttackPrefabPath((FvAttackType)this.fvAttackData.type)); this.fvaBulletAsset = this.loader.Add<BulletBase>(SharkDefine.GetFvAttackBulletPrefabPath(this.fvAttackData.key)); this.loader.Add<Sprite>(SharkDefine.GetFvAttackTypeIconSpritePath((FvAttackType)this.fvAttackData.type)); this.loader.Add<AudioClip>(SharkDefine.GetSeClipPath(this.barrelData.seName)); this.loader.Add<AudioClip>(SharkDefine.GetSeClipPath(this.bulletData.seName)); string fvAttackSeName = SeName.FvAttackSeName[(int)this.fvAttackData.type]; if (!string.IsNullOrEmpty(fvAttackSeName)) { this.loader.Add<AudioClip>(SharkDefine.GetSeClipPath(fvAttackSeName)); } if (this.fvAttackData.type == (uint)FvAttackType.Penetration) { this.fvaPenetrationChargeEffectAsset = this.loader.Add<GameObject>(SharkDefine.GetFVAChargeEffectPrefabPath(this.fvAttackData.key)); } }
/// <summary> /// 必要リソースの読み込み /// </summary> private void Load(Action onCompleted) { var items = Masters.ShopGroupDB .GetList() .SelectMany(x1 => Masters.ShopDB.GetList().FindAll(x2 => x2.shopGroupId == x1.id)) .SelectMany(x1 => Masters.ShopItemDB.GetList().FindAll(x2 => x2.shopItemId == x1.shopItemId)) .Select(x => CommonIconUtility.GetItemInfo(x.itemType, x.itemId)) .Concat(Masters.BillingGroupDB .GetList() .SelectMany(x1 => Masters.BillingDB.GetList().FindAll(x2 => x2.billingGroupId == x1.id)) .SelectMany(x1 => Masters.BillingItemDB.GetList().FindAll(x2 => x2.billingItemId == x1.billingItemId)) .Select(x => CommonIconUtility.GetItemInfo(x.itemType, x.itemId))) .Where(x => !x.IsCommonSprite()) .ToArray(); foreach (var item in items) { if (item is Master.CannonSetData) { var cannonSet = item as Master.CannonSetData; var batteryData = Masters.BatteryDB.FindById(cannonSet.batteryId); var barrelData = Masters.BarrelDB.FindById(cannonSet.barrelId); var bulletData = Masters.BulletDB.FindById(cannonSet.bulletId); var fvaData = Masters.FvAttackDB.FindById(batteryData.fvAttackId); //砲台サムネロード this.assetLoader.Add <Sprite>(SharkDefine.GetTurretSetSpritePath(batteryData.key)); //砲台パーツスプライトロード this.assetLoader.Add <Sprite>(SharkDefine.GetBatterySpritePath(batteryData.key)); this.assetLoader.Add <Sprite>(SharkDefine.GetBarrelSpritePath(barrelData.key)); this.assetLoader.Add <Sprite>(SharkDefine.GetBulletThumbnailPath(bulletData.key)); //砲台パーツプレハブロード this.assetLoader.Add <GameObject>(SharkDefine.GetBatteryPrefabPath(batteryData.key)); this.assetLoader.Add <GameObject>(SharkDefine.GetBarrelPrefabPath(barrelData.key)); this.assetLoader.Add <BulletBase>(SharkDefine.GetBulletPrefabPath(bulletData.key)); //FVAアイコンスプライトロード this.assetLoader.Add <Sprite>(SharkDefine.GetFvAttackTypeIconSpritePath((FvAttackType)fvaData.type)); //シリーズスキルスプライトロード if (batteryData.seriesId == barrelData.seriesId && batteryData.seriesId == bulletData.seriesId) { var serieseData = Masters.TurretSerieseDB.FindById(batteryData.seriesId); var serieseSkillData = Masters.SerieseSkillDB.FindById(serieseData.seriesSkillId); this.assetLoader.Add <Sprite>(SharkDefine.GetSeriesSkillIconSpritePath(serieseSkillData.key)); } } else { var spritePath = item.GetSpritePath(); this.assetLoader.Add <Sprite>(spritePath); } } //読み込み開始 this.assetLoader.Load(onCompleted); }
/// <summary> /// 開く /// </summary> public static void Open(UserInformationDialogContent contentPrefab, TurretViewer turretViewerPrefab) { var selectedTurret = UserData.Get().GetSelectedTurretData(); var batteryData = Masters.BatteryDB.FindById(selectedTurret.batteryMasterId); var barrelData = Masters.BarrelDB.FindById(selectedTurret.barrelMasterId); var bulletData = Masters.BulletDB.FindById(selectedTurret.bulletMasterId); var loader = new AssetListLoader(); loader.Add <GameObject>(SharkDefine.GetBatteryPrefabPath(batteryData.key)); loader.Add <GameObject>(SharkDefine.GetBarrelPrefabPath(barrelData.key)); loader.Add <BulletBase>(SharkDefine.GetBulletPrefabPath(bulletData.key)); //ロード中はタッチブロック SharedUI.Instance.DisableTouch(); //ロード loader.Load(() => { //タッチブロック解除 SharedUI.Instance.EnableTouch(); //砲台表示 var turretViewer = Instantiate(turretViewerPrefab, null, false); turretViewer.BatteryKey = batteryData.key; turretViewer.BarrelKey = barrelData.key; turretViewer.BulletKey = bulletData.key; turretViewer.Reflesh(); turretViewer.StartShot(); //ダイアログ開く var dialog = SharedUI.Instance.ShowSimpleDialog(); dialog.closeButtonEnabled = true; dialog.titleText.text = Masters.LocalizeTextDB.Get("UserInformation"); var content = dialog.AddContent(contentPrefab); content.Set(loader, turretViewer); }); }
/// <summary> /// ロード /// </summary> private void Load() { uint[] batteryIds = UserData.Get().batteryData.Select(x => x.itemId).Distinct().ToArray(); uint[] barrelIds = UserData.Get().barrelData.Select(x => x.itemId).Distinct().ToArray(); uint[] bulletIds = UserData.Get().bulletData.Select(x => x.itemId).Distinct().ToArray(); uint[] accessoryIds = UserData.Get().accessoriesData.Select(x => x.itemId).Distinct().ToArray(); uint[] fvAttackTypes = null; uint[] seriesSkillIds = null; uint[] gearIds = UserData.Get().gearData.Select(x => x.gearId).Distinct().ToArray(); var fvAttackIds = new List <uint>(); var seriesIds = new List <uint>(); foreach (uint id in batteryIds) { //台座スプライトのロード var data = Masters.BatteryDB.FindById(id); this.assetLoader.Add <Sprite>(SharkDefine.GetBatterySpritePath(data.key)); this.assetLoader.Add <GameObject>(SharkDefine.GetBatteryPrefabPath(data.key)); //FVアタックIDを詰める fvAttackIds.Add(data.fvAttackId); //シリーズIDを詰める seriesIds.Add(data.seriesId); } foreach (uint id in barrelIds) { //砲身スプライトのロード var data = Masters.BarrelDB.FindById(id); this.assetLoader.Add <Sprite>(SharkDefine.GetBarrelSpritePath(data.key)); this.assetLoader.Add <GameObject>(SharkDefine.GetBarrelPrefabPath(data.key)); //シリーズIDを詰める seriesIds.Add(data.seriesId); } foreach (uint id in bulletIds) { //砲弾プレハブ、砲弾サムネイルのロード var data = Masters.BulletDB.FindById(id); this.assetLoader.Add <Sprite>(SharkDefine.GetBulletThumbnailPath(data.key)); this.assetLoader.Add <BulletBase>(SharkDefine.GetBulletPrefabPath(data.key)); //シリーズIDを詰める seriesIds.Add(data.seriesId); } foreach (uint id in accessoryIds) { //アクセサリサムネイルのロード var data = Masters.AccessoriesDB.FindById(id); this.assetLoader.Add <Sprite>(SharkDefine.GetAccessoryThumbnailPath(data.key)); } //FVアタックIDからFVアタックタイプに fvAttackTypes = fvAttackIds .Distinct() .Select(id => Masters.FvAttackDB.FindById(id).type) .Distinct() .ToArray(); foreach (uint type in fvAttackTypes) { //FVアタックタイプアイコンのロード this.assetLoader.Add <Sprite>(SharkDefine.GetFvAttackTypeIconSpritePath((FvAttackType)type)); } //砲台シリーズIDからシリーズスキルIDに seriesSkillIds = seriesIds .Distinct() .Select(id => Masters.TurretSerieseDB.FindById(id).seriesSkillId) .Distinct() .ToArray(); foreach (uint id in seriesSkillIds) { //シリーズスキルアイコンのロード var data = Masters.SerieseSkillDB.FindById(id); this.assetLoader.Add <Sprite>(SharkDefine.GetSeriesSkillIconSpritePath(data.key)); } //ロード開始 this.assetLoader.Load(this.OnLoaded); }
/// <summary> /// 台座見た目更新 /// </summary> public void RefleshBattery() { var prefab = AssetManager.FindHandle <GameObject>(SharkDefine.GetBatteryPrefabPath(this.batteryKey)).asset as GameObject; this.RefleshBattery(prefab); }