Exemple #1
0
    /// <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);
    }
Exemple #2
0
 string IItemInfo.GetSpritePath() => SharkDefine.GetBarrelSpritePath(this.key);
Exemple #3
0
 public override string GetSpritePath(string key)
 {
     return(SharkDefine.GetBarrelSpritePath(key));
 }
    /// <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);
    }
Exemple #5
0
    /// <summary>
    /// 表示更新
    /// </summary>
    public void Reflesh(UserTurretData data)
    {
        //ゲージ最大値設定
        var config                 = Masters.ConfigDB.FindById(1);
        var MAX_POWER              = config.maxBulletPower;
        var MAX_BULLET_SPEED       = config.maxBarrelSpeed;
        var MAX_FV_POINT_GET_VALUE = config.maxBatteryFvPoint;

        // マスターデータ
        var batteryData   = Masters.BatteryDB.FindById(data.batteryMasterId);
        var barrelData    = Masters.BarrelDB.FindById(data.barrelMasterId);
        var bulletData    = Masters.BulletDB.FindById(data.bulletMasterId);
        var accessoryData = Masters.AccessoriesDB.FindById(data.accessoryMasterId);
        var fvAttackData  = Masters.FvAttackDB.FindById(batteryData.fvAttackId);

        // 現在のパーツ
        var batteryPartsData = UserData.Get().batteryData.First(x => x.serverId == data.batteryServerId);
        var barrelPartsData  = UserData.Get().barrelData.First(x => x.serverId == data.barrelServerId);
        var bulletPartsData  = UserData.Get().bulletData.First(x => x.serverId == data.bulletServerId);

        // 装着中のギアを配列に合併
        var gearDatas = batteryPartsData.gearMasterIds
                        .Concat(barrelPartsData.gearMasterIds)
                        .Concat(bulletPartsData.gearMasterIds)
                        .Select(gearId => Masters.GearDB.FindById(gearId))
                        .ToArray();

        // 能力値別に合算
        var gearPower   = gearDatas.Select(x => (long)x.power).Sum();
        var gearSpeed   = gearDatas.Select(x => (long)x.speed).Sum();
        var gearFvPoint = gearDatas.Select(x => (long)x.fvPoint).Sum();

        // パーツ能力値デとギア能力値を合併
        uint power           = bulletData.power + (uint)gearPower;
        uint bulletSpeed     = barrelData.speed + (uint)gearSpeed;
        uint fvPointGetValue = batteryData.fvPoint + (uint)gearFvPoint;

        Debug.LogFormat("power : {0}, bulletSpeed : {1}, fvPointGetValue{2} : {2}", power, bulletSpeed, fvPointGetValue);

        var fvAttackIconSprite = AssetManager.FindHandle <Sprite>(SharkDefine.GetFvAttackTypeIconSpritePath((FvAttackType)fvAttackData.type)).asset as Sprite;
        var batterySprite      = AssetManager.FindHandle <Sprite>(SharkDefine.GetBatterySpritePath(batteryData.key)).asset as Sprite;
        var barrelSprite       = AssetManager.FindHandle <Sprite>(SharkDefine.GetBarrelSpritePath(barrelData.key)).asset as Sprite;
        var bulletSprite       = AssetManager.FindHandle <Sprite>(SharkDefine.GetBulletThumbnailPath(bulletData.key)).asset as Sprite;
        var accessorySprite    = AssetManager.FindHandle <Sprite>(SharkDefine.GetAccessoryThumbnailPath(accessoryData.key)).asset as Sprite;

        //攻撃力ゲージ設定
        //float p = (float)(power - CustomTurretScene.minBulletPower) / (MAX_POWER - CustomTurretScene.minBulletPower) + 0.2f;
        float p;

        if (power < MAX_POWER / 5)
        {
            p = 0.2f;
        }
        else
        {
            p = (float)power / MAX_POWER;
        }
        this.powerGauge.SetGaugeValue(Mathf.Clamp01(p));
        this.partsPowerGauge.SetGaugeValue(Mathf.Clamp01(p));

        //発射速度ゲージ設定
        //p = (float)(bulletSpeed - CustomTurretScene.minBarrelSpeed) / (MAX_BULLET_SPEED - CustomTurretScene.minBarrelSpeed) + 0.2f;
        if (bulletSpeed < MAX_BULLET_SPEED / 5)
        {
            p = 0.2f;
        }
        else
        {
            p = (float)bulletSpeed / MAX_BULLET_SPEED;
        }
        this.bulletSpeedGauge.SetGaugeValue(Mathf.Clamp01(p));
        this.partsBulletSpeedGauge.SetGaugeValue(Mathf.Clamp01(p));

        //FVポイント獲得値ゲージ設定
        //p = (float)(fvPointGetValue - CustomTurretScene.minBatteryFvPoint) / (MAX_FV_POINT_GET_VALUE - CustomTurretScene.minBatteryFvPoint) + 0.2f;
        if (fvPointGetValue < MAX_FV_POINT_GET_VALUE / 5)
        {
            p = 0.2f;
        }
        else
        {
            p = (float)fvPointGetValue / MAX_FV_POINT_GET_VALUE;
        }
        this.fvPointGetValueGauge.SetGaugeValue(Mathf.Clamp01(p));
        this.partsfvPointGetCalueGauge.SetGaugeValue(Mathf.Clamp01(p));

        //パーツページのFVアタック名、アイコン画像、説明文設定
        this.partsViewFvAttackNameText.text        = fvAttackData.name;
        this.partsViewFvAttackIconImage.sprite     = AssetManager.FindHandle <Sprite>(SharkDefine.GetFvAttackTypeIconSpritePath((FvAttackType)fvAttackData.type)).asset as Sprite;
        this.partsViewFvAttackDescriptionText.text = fvAttackData.description;

        //砲台ページのFVアタック名、アイコン画像、説明文設定
        this.turretViewFvAttackNameText.text        = fvAttackData.name;
        this.turretViewFvAttackIconImage.sprite     = AssetManager.FindHandle <Sprite>(SharkDefine.GetFvAttackTypeIconSpritePath((FvAttackType)fvAttackData.type)).asset as Sprite;
        this.turretViewFvAttackDescriptionText.text = fvAttackData.description;

        //セットスキル発動
        if (batteryData.seriesId == barrelData.seriesId && batteryData.seriesId == bulletData.seriesId)
        {
            var seriesData      = Masters.TurretSerieseDB.FindById(batteryData.seriesId);
            var seriesSkillData = Masters.SerieseSkillDB.FindById(seriesData.seriesSkillId);

            //パーツページのセットスキル名、説明文、アイコン画像設定
            this.partsViewSetSkillIconImage.enabled    = true;
            this.partsViewSetSkillIconImage.sprite     = AssetManager.FindHandle <Sprite>(SharkDefine.GetSeriesSkillIconSpritePath(seriesSkillData.key)).asset as Sprite;
            this.partsViewSetSkillNameText.text        = seriesSkillData.name;
            this.partsViewSetSkillDescriptionText.text = seriesSkillData.description;

            //砲台ページのセットスキル名、説明文、アイコン画像設定
            this.turretViewSetSkillIconImage.enabled    = true;
            this.turretViewSetSkillIconImage.sprite     = AssetManager.FindHandle <Sprite>(SharkDefine.GetSeriesSkillIconSpritePath(seriesSkillData.key)).asset as Sprite;
            this.turretViewSetSkillNameText.text        = seriesSkillData.name;
            this.turretViewSetSkillDescriptionText.text = seriesSkillData.description;
        }
        //セットスキル不発
        else
        {
            //パーツページのセットスキル名、説明文、アイコン画像非表示
            this.partsViewSetSkillIconImage.enabled    = false;
            this.partsViewSetSkillNameText.text        = null;
            this.partsViewSetSkillDescriptionText.text = null;

            //砲台ページのセットスキル名、説明文、アイコン画像非表示
            this.turretViewSetSkillIconImage.enabled    = false;
            this.turretViewSetSkillNameText.text        = null;
            this.turretViewSetSkillDescriptionText.text = null;
        }

        //パーツページ台座アイコン
        this.partsViewBatteryIcon.SetIconSprite(batterySprite);
        this.partsViewBatteryIcon.SetRank((Rank)batteryData.rarity);
        this.partsViewBatteryIcon.SetGearSlot(batteryPartsData);

        //パーツページ砲身アイコン
        this.partsViewBarrelIcon.SetIconSprite(barrelSprite);
        this.partsViewBarrelIcon.SetRank((Rank)barrelData.rarity);
        this.partsViewBarrelIcon.SetGearSlot(barrelPartsData);

        //パーツページ砲弾アイコン
        this.partsViewBulletIcon.SetIconSprite(bulletSprite);
        this.partsViewBulletIcon.SetRank((Rank)bulletData.rarity);
        this.partsViewBulletIcon.SetGearSlot(bulletPartsData);

        //パーツページアクセサリアイコン
        this.partsViewAccessoryIcon.SetIconSprite(accessorySprite);
        this.partsViewAccessoryIcon.SetRank((Rank)accessoryData.rarity);

        //砲台ページ台座アイコン
        this.turretViewBatteryIcon.SetIconSprite(batterySprite);
        this.turretViewBatteryIcon.SetRank((Rank)batteryData.rarity);
        this.turretViewBatteryIcon.SetGearSlot(batteryPartsData);

        //砲台ページ砲身アイコン
        this.turretViewBarrelIcon.SetIconSprite(barrelSprite);
        this.turretViewBarrelIcon.SetRank((Rank)barrelData.rarity);
        this.turretViewBarrelIcon.SetGearSlot(barrelPartsData);

        //砲台ページ砲弾アイコン
        this.turretViewBulletIcon.SetIconSprite(bulletSprite);
        this.turretViewBulletIcon.SetRank((Rank)bulletData.rarity);
        this.turretViewBulletIcon.SetGearSlot(bulletPartsData);

        //砲台ページアクセサリアイコン
        this.turretViewAccessoryIcon.SetIconSprite(accessorySprite);
        this.turretViewAccessoryIcon.SetRank((Rank)accessoryData.rarity);
    }