public BulletPartsInfo(UserGearData data) : base(data)
        {
            if (data.partsServerId == null)
            {
            }
            else
            {
                // パーツデータ取得
                UserPartsData partsData = UserData.Get().bulletData
                                          .Where(x => x.serverId == data.partsServerId)
                                          .First();

                // 本、ギアを装着中のパーツのマスターID
                this.bulletMasterId = partsData.itemId;

                // 本、ギアを装着中のパーツのサーバーID
                this.bulletServerId = partsData.serverId;

                // ギアスロット拡張回数
                this.bulletSlotExpandCount = partsData.gearSlotExpandCount;

                // ギアのマスターデータID
                uint[] bulletGearMasterIds = partsData.gearMasterIds;

                this.bulletGearSize = (uint)bulletGearMasterIds.Length;
                var bulletMaster = Masters.BulletDB.FindById(this.bulletMasterId);

                uint defaultCount = bulletMaster.defaultGearSlotSize;
                this.bulletGearSlotCount = defaultCount + bulletSlotExpandCount;
            }
        }
Exemplo n.º 2
0
    /// <summary>
    /// 装着する、ギア選択ポップアップをセット
    /// </summary>
    public void Setup(
        SimpleDialog dialog,
        UserPartsData partsData,
        uint gearId,
        Action onReflesh)
    {
        this.dialog     = dialog;
        this.partsData  = partsData;
        this.beforeGear = UserData.Get().gearData.FirstOrDefault(x => x.gearId == gearId && x.partsServerId == this.partsData.serverId);
        this.onReflesh  = onReflesh;

        //パーツに装着出来るギアのタイプ
        var gearType = partsData.itemType == (uint)ItemType.Battery ? GearType.Battery
                     : partsData.itemType == (uint)ItemType.Barrel  ? GearType.Barrel
                     : partsData.itemType == (uint)ItemType.Bullet  ? GearType.Bullet
                     : 0;

        //装着可能なギア一覧(パーツタイプが一致し、どのパーツにも装着されていないもの)
        this.freeGears = UserData.Get().gearData
                         .Where(x => x.gearType == (uint)gearType && !x.partsServerId.HasValue)
                         .ToArray();

        // 所持するギアがない場合(Nullエラーため)
        if (this.beforeGear == null && this.freeGears.Length == 0)
        {
            // 固定されている装着ギアパネルが未装着の場合(ギア未所持)
            this.fastenGearViewItemPrefab.SetNotEquippedPanel();
        }
        // 所持するギアがある場合
        else
        {
            // ギア未装着
            if (gearId == 0)
            {
                // 固定されている装着ギアパネルが未装着の場合(ギア所持)
                this.fastenGearViewItemPrefab.SetNotEquippedPanel();
            }
            // ギアを装着してある場合
            else
            {
                // 固定されている装着ギアパネルにデータロッド
                this.fastenGearViewItemPrefab.SetGearData(beforeGear, null);
                this.unEquipGearButton.gameObject.SetActive(true);

                //装着したギアを外すボタンをロードするため、null空間を生成
                //this.freeGears = new UserGearData[] { null }.Concat(this.freeGears).ToArray();
            }
        }

        // ScrollView生成
        this.gearScrollView.Initialize(
            this.gearScrollViewItemPrefab.gameObject,
            this.freeGears.Length,
            this.LoadGearPrefabData
            );
    }
    /// <summary>
    /// 表示構築
    /// </summary>
    public void Set(UserPartsData data, bool isSelected, Action <CustomPartsScrollViewItem> onClick)
    {
        this.partsData = data;

        //アイコン設定
        this.commonIcon.Set(this.partsData.itemType, this.partsData.itemId, true);

        //選択中マークON/OFF
        this.selectedMark.SetActive(isSelected);

        //クリック時処理登録
        this.commonIcon.onClick = () => onClick(this);
    }
Exemplo n.º 4
0
    /// <summary>
    /// ギアスロットセット
    /// </summary>
    private void GearSlotReflesh(UserPartsData data)
    {
        this.isGearLockCount = 0;
        // パーツ別に、情報ロード
        PartsInfoBase partsInfo = null;

        // パーツが台座の場合
        if (data.itemType == (uint)ItemType.Battery)
        {
            partsInfo = new BatteryPartsInfo(data);
        }
        // パーツが砲身の場合
        else if (data.itemType == (uint)ItemType.Barrel)
        {
            partsInfo = new BarrelPartsInfo(data);
        }
        // パーツが台座の場合
        else if (data.itemType == (uint)ItemType.Bullet)
        {
            partsInfo = new BulletPartsInfo(data);
        }

        //装着中ギアを時間順にソート
        var gears = UserData.Get().gearData
                    .Where(x => x.partsServerId == data.serverId && x.gearType == (uint)partsInfo.gearType)
                    .OrderBy(x => x.setDateTime)
                    .ToArray();

        // ギアID取得
        for (int i = 0; i < SharkDefine.MAX_GEAR_SLOT_SIZE; i++)
        {
            uint gearId = 0;
            if (i < gears.Length)
            {
                gearId = gears[i].gearId;

                // 装着中ギアがロックされてたら、カウンター
                if (gears[i].lockFlg > 0)
                {
                    this.isGearLockCount++;
                }
            }

            // ギア取付可能なスロット
            bool isExtended = i < partsInfo.defaultGearSlotSize + data.gearSlotExpandCount;

            // ギアスロットボタンセット
            this.gearSlotObject[i].SetUp(data, gearId, isExtended, this.OnClickGearSlotButton);
        }
    }
Exemplo n.º 5
0
        public BulletPartsInfo(UserPartsData partsData) : base(partsData)
        {
            this.master = Masters.BulletDB.FindById(partsData.itemId);

            var gearCount = partsData.gearMasterIds.Length;

            // 装着中のギアの能力値
            for (int i = 0; i < gearCount; i++)
            {
                this.gearMaster = Masters.GearDB.FindById(partsData.gearMasterIds[i]);

                this.gearFvPointGetValue = +this.gearMaster.fvPoint;
                this.gearBulletSpeed    += this.gearMaster.speed;
                this.gearPower          += this.gearMaster.power;
            }
        }
Exemplo n.º 6
0
    /// <summary>
    /// ギアスロットボタンセット
    /// </summary>
    public void SetUp(
        UserPartsData data,
        uint gearId,
        bool isExtended,
        Action <CustomTurretGearSlotButton> onClick)
    {
        this.partsData  = data;
        this.gearId     = gearId;
        this.isExtended = isExtended;
        this.onClick    = onClick;

        //ギア装着・スロット解除の情報チェック
        this.BeforeGearEquipSlot.SetActive(isExtended);
        this.AfterGearEquipSlot.SetActive(isExtended && gearId > 0);

        //名前、説明文表示切替のリセット
        this.timeCount = 0f;
        this.gearNameText.gameObject.SetActive(true);
        this.info.gameObject.SetActive(false);

        //未装着
        if (gearId == 0)
        {
            this.gearNameText.text = null;
            this.info.text         = null;
        }
        //装備中
        else
        {
            var master = Masters.GearDB.FindById(gearId);
            this.gearIcon.SetRank((Rank)master.rarity);

            // CommonIconをギアに変更
            this.gearIcon.SetGearCommonIcon(true);

            // TODO. ギアデータセット
            var partsType = master.partsType;
            // TODO. ギアCommonIconセット
            var bgSprite   = CommonIconUtility.GetGearBgSprite(partsType);
            var mainSprite = CommonIconUtility.GetGearMainImageSprite(master.key);
            var subSprite  = CommonIconUtility.GetGearSubImageSprite(master.subKey);
            this.gearIcon.SetGearSprite(bgSprite, mainSprite, subSprite);

            this.gearNameText.text = master.name;
            this.info.text         = master.description;
        }
    }
Exemplo n.º 7
0
        public DecorationPartsInfo(UserPartsData partsData) : base(partsData)
        {
            this.master = Masters.AccessoriesDB.FindById(partsData.itemId);

            // 現在パーツと所有するパーツを比較の上、同数
            uint[] DecorationIds = UserData.Get().accessoriesData.Select(x => x.itemId).ToArray();
            for (int i = 0; i < DecorationIds.Length; i++)
            {
                var userPartsIds   = DecorationIds[i].ToString();
                var currentPartIds = partsData.itemId.ToString();

                if (currentPartIds == userPartsIds)
                {
                    this.count++;
                }
            }
        }
Exemplo n.º 8
0
        public BulletPartsInfo(UserPartsData partsData) : base(partsData)
        {
            this.master = Masters.BulletDB.FindById(partsData.itemId);

            // 現在パーツと所有するパーツを比較の上、同数
            uint[] bulletIds = UserData.Get().bulletData.Select(x => x.itemId).ToArray();
            for (int i = 0; i < bulletIds.Length; i++)
            {
                var userPartsIds   = bulletIds[i].ToString();
                var currentPartsId = partsData.itemId.ToString();

                if (currentPartsId == userPartsIds)
                {
                    this.count++;
                }
            }
        }
    /// <summary>
    /// 表示構築
    /// </summary>
    public void Set(UserPartsData data, bool isEquipped, uint isLock, Action <ItemInventoryPartsScrollViewItem> onClick)
    {
        this.partsData = data;
        this.commonIcon.countText.text = null;

        if (data.itemType == (uint)ItemType.Accessory)
        {
            this.commonIcon.gearArea.SetActive(false);
        }

        // 装着中パンネル表示
        this.equippedMark.SetActive(isEquipped);

        //アイコンスプライト切替
        string key    = CommonIconUtility.GetSpriteKey(this.partsData.itemType, this.partsData.itemId);
        string path   = CommonIconUtility.GetSpritePath(this.partsData.itemType, key);
        var    handle = AssetManager.FindHandle <Sprite>(path);

        this.commonIcon.SetIconSprite(handle.asset as Sprite);

        //ランクスプライト切替
        var rank = CommonIconUtility.GetRarity(this.partsData.itemType, this.partsData.itemId);

        this.commonIcon.SetRank(rank);

        this.commonIcon.SetGearSlot(data);

        //クリック時処理登録
        this.commonIcon.onClick = () => onClick(this);

        // ロック情報
        bool isLockCheck = false;

        if (isLock == 1)
        {
            isLockCheck = true;
        }
        else
        {
            isLockCheck = false;
        }

        this.lockImage.gameObject.SetActive(isLockCheck);
    }
Exemplo n.º 10
0
    /// <summary>
    /// パーツロック情報の通信
    /// </summary>
    public static void CallCannonLock(UserPartsData partsData, Action onCompleted)
    {
        var request = new SharkWebRequest <CannonLockResponseData>("cannon/cannonLock");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);
        request.SetRequestParameter(new Dictionary <string, object>
        {
            { "cannonId", partsData.serverId },
            { "cannonType", partsData.itemType }
        });

        request.onSuccess = (response) =>
        {
            partsData.lockFlg = response.tCannon.lockFlg;
            onCompleted?.Invoke();
        };

        request.Send();
    }
Exemplo n.º 11
0
    /// <summary>
    /// ギアスロット設定
    /// </summary>
    public void SetGearSlot(UserPartsData partsData)
    {
        uint defaultCount = partsData.itemType == (uint)ItemType.Battery ? Masters.BatteryDB.FindById(partsData.itemId).defaultGearSlotSize
                          : partsData.itemType == (uint)ItemType.Barrel ? Masters.BarrelDB.FindById(partsData.itemId).defaultGearSlotSize
                          : partsData.itemType == (uint)ItemType.Bullet ? Masters.BulletDB.FindById(partsData.itemId).defaultGearSlotSize
                          : 0;
        uint count = defaultCount + partsData.gearSlotExpandCount;

        int size = partsData.gearMasterIds.Length;

        for (int i = 0; i < this.gearIcon.Length; i++)
        {
            this.gearIcon[i].enabled = i < count;
            if (i < size)
            {
                this.gearOnIcon[i].gameObject.SetActive(true);
            }
            else
            {
                this.gearOnIcon[i].gameObject.SetActive(false);
            }
        }
    }
Exemplo n.º 12
0
 /// <summary>
 /// パーツ情報更新
 /// </summary>
 protected virtual void RefleshPartsInfo(UserPartsData partsData)
 {
 }
Exemplo n.º 13
0
 protected PartsInfoBase(UserPartsData partsData)
 {
 }
    /// <summary>
    /// チェックボックスアイテムセット
    /// </summary>
    public void SetCheckBox(UserPartsData data, bool isEquipped, uint isLock, uint checkFlg, Action <ItemInventoryPartsScrollViewItem> onClick)
    {
        this.partsData = data;
        this.commonIcon.countText.text = null;
        var itemSellId = GetItemSellId();

        if (data.itemType == (uint)ItemType.Accessory)
        {
            this.commonIcon.gearArea.SetActive(false);
        }

        // 装着中パンネル表示
        this.equippedMark.SetActive(isEquipped);

        //アイコンスプライト切替
        string key    = CommonIconUtility.GetSpriteKey(this.partsData.itemType, this.partsData.itemId);
        string path   = CommonIconUtility.GetSpritePath(this.partsData.itemType, key);
        var    handle = AssetManager.FindHandle <Sprite>(path);

        this.commonIcon.SetIconSprite(handle.asset as Sprite);

        //ランクスプライト切替
        var rank = CommonIconUtility.GetRarity(this.partsData.itemType, this.partsData.itemId);

        this.commonIcon.SetRank(rank);

        this.commonIcon.SetGearSlot(data);

        // ロック情報
        this.SetTemplockImage(isLock);

        /// 装着ギアがロックの場合、カウント
        uint[] gearLockCount = UserData.Get().gearData
                               .Where(x => x.partsServerId == data.serverId)
                               .Select(x => x.lockFlg)
                               .ToArray();

        uint count = 0;

        for (int i = 0; i < gearLockCount.Length; i++)
        {
            count += gearLockCount[i];
        }

        // ロックの場合はクリック禁止・イメージ暗く
        if (isLock == 1 || isEquipped || count > 0 || itemSellId == 0)
        {
            this.darkBoxImage.gameObject.SetActive(true);
            this.commonIcon.button.interactable = false;
            this.checkBox.SetActive(false);
        }
        // チェックボックスセット
        else
        {
            this.darkBoxImage.gameObject.SetActive(false);
            this.commonIcon.button.interactable = true;

            this.checkBox.SetActive(true);
            //クリック時処理登録
            this.commonIcon.onClick = () => onClick(this);
        }

        // 初期砲台の場合、分解不可能の案内メッセージ、テキストセット
        if (itemSellId == 0)
        {
            this.defaultCanonText.text = Masters.LocalizeTextDB.Get("CannotDisassembledDefaultCanon");
        }
        else
        {
            this.defaultCanonText.text = null;
        }

        SetTempCheckImage(checkFlg);
    }
Exemplo n.º 15
0
 /// <summary>
 /// パーツ情報更新
 /// </summary>
 protected override void RefleshPartsInfo(UserPartsData partsData)
 {
     this.scene.gearView.Reflesh(partsData);
     this.scene.gearView.GearSlotReflesh(partsData);
 }
Exemplo n.º 16
0
 /// <summary>
 /// 砲台ビューのパーツ切替
 /// </summary>
 protected override void ChangeTurretViewParts(UserPartsData partsData)
 {
     this.scene.turretView.turretData.SetBarrelServerId(partsData.serverId);
 }
Exemplo n.º 17
0
    /// <summary>
    /// ギア Infoセット
    /// </summary>
    public void Reflesh(UserPartsData data)
    {
        PartsInfoBase partsInfo = null;

        if (data.itemType == (uint)ItemType.Battery)
        {
            partsInfo = new BatteryPartsInfo(data);
        }
        else if (data.itemType == (uint)ItemType.Barrel)
        {
            partsInfo = new BarrelPartsInfo(data);
        }
        else if (data.itemType == (uint)ItemType.Bullet)
        {
            partsInfo = new BulletPartsInfo(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;

        // パーツ別各能力
        this.fvPointGetValue = partsInfo.fvPoint;
        this.bulletSpeed     = partsInfo.speed;
        this.power           = partsInfo.power;

        // ギア別各能力
        this.gearFvPointGetValue = partsInfo.gearFvPointGetValue;
        this.gearBulletSpeed     = partsInfo.gearBulletSpeed;
        this.gearPower           = partsInfo.gearPower;

        // Sprite, CommonIcon セット
        var iconSprite = AssetManager.FindHandle <Sprite>(partsInfo.spritePath).asset as Sprite;

        this.partsIcon.SetIconSprite(iconSprite);
        this.partsIcon.SetRank((Rank)partsInfo.rarity);
        this.partsIcon.SetGearSlot(data);

        // 名前、説明
        this.titleNameText.text = partsInfo.titleName;
        this.partsNameText.text = partsInfo.name;
        this.partsInfoText.text = partsInfo.description;

        // FvPゲージ設定
        if (data.itemType == (uint)ItemType.Battery)
        {
            float f;
            if (this.fvPointGetValue + this.gearFvPointGetValue < MAX_FV_POINT_GET_VALUE / 5)
            {
                f = 0.2f;
            }
            else
            {
                f = (float)(this.fvPointGetValue + this.gearFvPointGetValue) / MAX_FV_POINT_GET_VALUE;
            }
            //float f = (float)((this.fvPointGetValue + this.gearFvPointGetValue) - CustomTurretScene.minBatteryFvPoint) / (MAX_FV_POINT_GET_VALUE - CustomTurretScene.minBatteryFvPoint) + 0.2f;
            this.fvPointGetValueGauge.SetGaugeValue(Mathf.Clamp01(f));
            this.powerGauge.SetGaugeValue(Mathf.Clamp01((float)(this.power + this.gearPower) / MAX_POWER));
            this.bulletSpeedGauge.SetGaugeValue(Mathf.Clamp01((float)(this.bulletSpeed + this.gearBulletSpeed) / MAX_BULLET_SPEED));
        }
        // 発射速度ゲージ設定
        else if (data.itemType == (uint)ItemType.Barrel)
        {
            float s;
            if (this.bulletSpeed + this.gearBulletSpeed < MAX_BULLET_SPEED / 5)
            {
                s = 0.2f;
            }
            else
            {
                s = (float)(this.bulletSpeed + this.gearBulletSpeed) / MAX_BULLET_SPEED;
            }
            //float s = (float)((this.bulletSpeed + this.gearBulletSpeed) - CustomTurretScene.minBarrelSpeed) / (MAX_BULLET_SPEED - CustomTurretScene.minBarrelSpeed) + 0.2f;
            this.bulletSpeedGauge.SetGaugeValue(Mathf.Clamp01(s));
            this.powerGauge.SetGaugeValue(Mathf.Clamp01((float)(this.power + this.gearPower) / MAX_POWER));
            this.fvPointGetValueGauge.SetGaugeValue(Mathf.Clamp01((float)(this.fvPointGetValue + this.gearFvPointGetValue) / MAX_FV_POINT_GET_VALUE));
        }
        // 攻撃力ゲージ設定
        else if (data.itemType == (uint)ItemType.Bullet)
        {
            float p;
            if (this.power + this.gearPower < MAX_POWER / 5)
            {
                p = 0.2f;
            }
            else
            {
                p = (float)(this.power + this.gearPower) / MAX_POWER;
            }
            //float p = (float)((this.power + this.gearPower) - CustomTurretScene.minBulletPower) / (MAX_POWER - CustomTurretScene.minBulletPower) + 0.2f;
            this.powerGauge.SetGaugeValue(Mathf.Clamp01(p));
            this.bulletSpeedGauge.SetGaugeValue(Mathf.Clamp01((float)(this.bulletSpeed + this.gearBulletSpeed) / MAX_BULLET_SPEED));
            this.fvPointGetValueGauge.SetGaugeValue(Mathf.Clamp01((float)(this.fvPointGetValue + this.gearFvPointGetValue) / MAX_FV_POINT_GET_VALUE));
        }
    }
Exemplo n.º 18
0
    /// <summary>
    /// まとめて分解確認ダイアログのデータロード
    /// </summary>
    public void Set(uint itemType, List <uint> partsServerIdList)
    {
        // 分解確認テキスト
        this.disassemblyQuestionText.text = Masters.LocalizeTextDB.GetFormat("DisassemblyQuestion", partsServerIdList.Count.ToString());
        List <Master.ItemSellData> getItemList = new List <Master.ItemSellData>();

        // パーツ名検索してリストに追加
        if (itemType == (uint)ItemType.Battery)
        {
            for (int i = 0; i < partsServerIdList.Count; i++)
            {
                // パーツデータ取得
                this.partsData = UserData.Get().batteryData
                                 .Where(x => x.serverId == partsServerIdList[i])
                                 .First();

                // パーツ名リストに追加
                this.partsName.Add(Masters.BatteryDB.FindById(this.partsData.itemId).name);
                // パーツ販売マスターID取得
                var sellItemId = Masters.BatteryDB.FindById(partsData.itemId).itemSellId;
                // パーツ販売データ取得
                this.getItem = Masters.ItemSellDB.GetList().FindAll(x => x.itemSellId == sellItemId).ToArray();

                // パーツ販売データリストに追加
                for (int y = 0; y < this.getItem.Length; y++)
                {
                    getItemList.Add(getItem[y]);
                }

                // パーツのギアマスターID
                var gearId = partsData.gearMasterIds;

                // ギアを装着している場合、ギア名をも検索してリストに追加
                for (int y = 0; y < gearId.Length; y++)
                {
                    // パーツ名前
                    this.partsName.Add(Masters.GearDB.FindById(gearId[y]).name);
                    // ギア販売マスターID取得
                    var sellGearId = Masters.GearDB.FindById(gearId[y]).itemSellId;

                    // ギアの分解時アイテム取得
                    Master.ItemSellData[] getGearItem = Masters.ItemSellDB.GetList().FindAll(x => x.itemSellId == sellGearId).ToArray();

                    // リストに追加
                    for (int z = 0; z < getGearItem.Length; z++)
                    {
                        getItemList.Add(getGearItem[z]);
                    }
                }
            }
        }
        else if (itemType == (uint)ItemType.Barrel)
        {
            for (int i = 0; i < partsServerIdList.Count; i++)
            {
                // パーツデータ取得
                this.partsData = UserData.Get().barrelData
                                 .Where(x => x.serverId == partsServerIdList[i])
                                 .First();

                // パーツ名リストに追加
                this.partsName.Add(Masters.BarrelDB.FindById(this.partsData.itemId).name);
                // パーツ販売マスターID取得
                var sellItemId = Masters.BatteryDB.FindById(partsData.itemId).itemSellId;
                // パーツ販売データ取得
                this.getItem = Masters.ItemSellDB.GetList().FindAll(x => x.itemSellId == sellItemId).ToArray();

                // パーツ販売データリストに追加
                for (int y = 0; y < this.getItem.Length; y++)
                {
                    getItemList.Add(getItem[y]);
                }

                // パーツのギアマスターID
                var gearId = partsData.gearMasterIds;

                // ギアを装着している場合、ギア名をも検索してリストに追加
                for (int y = 0; y < gearId.Length; y++)
                {
                    // パーツ名前
                    this.partsName.Add(Masters.GearDB.FindById(gearId[y]).name);
                    // ギア販売マスターID取得
                    var sellGearId = Masters.GearDB.FindById(gearId[y]).itemSellId;

                    // ギアの分解時アイテム取得
                    Master.ItemSellData[] getGearItem = Masters.ItemSellDB.GetList().FindAll(x => x.itemSellId == sellGearId).ToArray();

                    // リストに追加
                    for (int z = 0; z < getGearItem.Length; z++)
                    {
                        getItemList.Add(getGearItem[z]);
                    }
                }
            }
        }
        else if (itemType == (uint)ItemType.Bullet)
        {
            for (int i = 0; i < partsServerIdList.Count; i++)
            {
                // パーツデータ取得
                this.partsData = UserData.Get().bulletData
                                 .Where(x => x.serverId == partsServerIdList[i])
                                 .First();

                // パーツ名リストに追加
                this.partsName.Add(Masters.BarrelDB.FindById(this.partsData.itemId).name);
                // パーツ販売マスターID取得
                var sellItemId = Masters.BatteryDB.FindById(partsData.itemId).itemSellId;
                // パーツ販売データ取得
                this.getItem = Masters.ItemSellDB.GetList().FindAll(x => x.itemSellId == sellItemId).ToArray();

                // パーツ販売データリストに追加
                for (int y = 0; y < this.getItem.Length; y++)
                {
                    getItemList.Add(getItem[y]);
                }

                // パーツのギアマスターID
                var gearId = partsData.gearMasterIds;

                // ギアを装着している場合、ギア名をも検索してリストに追加
                for (int y = 0; y < gearId.Length; y++)
                {
                    // パーツ名前
                    this.partsName.Add(Masters.GearDB.FindById(gearId[y]).name);
                    // ギア販売マスターID取得
                    var sellGearId = Masters.GearDB.FindById(gearId[y]).itemSellId;

                    // ギアの分解時アイテム取得
                    Master.ItemSellData[] getGearItem = Masters.ItemSellDB.GetList().FindAll(x => x.itemSellId == sellGearId).ToArray();

                    // リストに追加
                    for (int z = 0; z < getGearItem.Length; z++)
                    {
                        getItemList.Add(getGearItem[z]);
                    }
                }
            }
        }
        else if (itemType == (uint)ItemType.Accessory)
        {
            for (int i = 0; i < partsServerIdList.Count; i++)
            {
                // パーツデータ取得
                this.partsData = UserData.Get().accessoriesData
                                 .Where(x => x.serverId == partsServerIdList[i])
                                 .First();

                // パーツ名リストに追加
                this.partsName.Add(Masters.BarrelDB.FindById(this.partsData.itemId).name);
                // パーツ販売マスターID取得
                var sellItemId = Masters.BatteryDB.FindById(partsData.itemId).itemSellId;
                // パーツ販売データ取得
                this.getItem = Masters.ItemSellDB.GetList().FindAll(x => x.itemSellId == sellItemId).ToArray();

                // パーツ販売データリストに追加
                for (int y = 0; y < this.getItem.Length; y++)
                {
                    getItemList.Add(getItem[y]);
                }
            }
        }
        else if (itemType == (uint)ItemType.Gear)
        {
            for (int i = 0; i < partsServerIdList.Count; i++)
            {
                // パーツデータ取得
                this.gearData = UserData.Get().gearData
                                .Where(x => x.serverId == partsServerIdList[i])
                                .First();

                // パーツ名リストに追加
                this.partsName.Add(Masters.GearDB.FindById(this.gearData.gearId).name);
                // パーツ販売マスターID取得
                var sellItemId = Masters.GearDB.FindById(this.gearData.gearId).itemSellId;
                // パーツ販売データ取得
                this.getItem = Masters.ItemSellDB.GetList().FindAll(x => x.itemSellId == sellItemId).ToArray();

                // パーツ販売データリストに追加
                for (int y = 0; y < this.getItem.Length; y++)
                {
                    getItemList.Add(getItem[y]);
                }
            }
        }

        this.getItem = getItemList.ToArray();

        // パーツ名アイテムセット
        this.partsNameScrollView.Initialize(
            this.partsNameItemPrefab.gameObject,
            this.partsName.Count,
            this.OnUpdatePartsScrollViewItem
            );

        this.decompositionScrollView.Initialize(
            this.decompositionItemPrefab.gameObject,
            this.getItem.Length,
            this.OnUpdateDecompositionScrollViewItem

            );
    }
Exemplo n.º 19
0
    /// <summary>
    /// パーツ情報セット
    /// </summary>
    public void SetPartsData(UserPartsData data,  bool isEquipped, Action onReflesh, Action onRefleshDecomposition)
    {
        this.partsData = data;
        this.onReflesh = onReflesh;
        this.onRefleshDecomposition = onRefleshDecomposition;
        this.isEquipped             = isEquipped;

        // パーツアイコンセット
        partsCommonIcon.Set(
            data: data,
            isEquipped: isEquipped,
            isLock: data.lockFlg,
            onClick: null
            );

        // パーツが台座の場合
        if (this.partsData.itemType == (uint)ItemType.Battery)
        {
            partsInfo = new BatteryPartsInfo(data);

            // 台座FVアタックスプライトセット
            this.partsViewFvAttackIconImage.sprite = AssetManager.FindHandle <Sprite>(SharkDefine.GetFvAttackTypeIconSpritePath((FvAttackType)partsInfo.fvType)).asset as Sprite;
            // 台座FVアタック情報セット
            this.partsViewFvAttackNameText.text        = partsInfo.fvName;
            this.partsViewFvAttackDescriptionText.text = partsInfo.fvDescription;
        }
        // パーツが砲身の場合
        else if (this.partsData.itemType == (uint)ItemType.Barrel)
        {
            partsInfo = new BarrelPartsInfo(data);
            this.fvAttackArea.SetActive(false);
        }
        // パーツが砲弾の場合
        else if (this.partsData.itemType == (uint)ItemType.Bullet)
        {
            partsInfo = new BulletPartsInfo(data);
            this.fvAttackArea.SetActive(false);
        }
        // パーツが装飾の場合
        else if (this.partsData.itemType == (uint)ItemType.Accessory)
        {
            partsInfo = new DecorationPartsInfo(data);
        }

        // 同一のパーツ数テキスト
        this.overlapCountText.text = partsInfo.partsCount;

        // パーツ情報セット
        this.partsNameText.text        = partsInfo.name;
        this.partsDescriptionText.text = partsInfo.description;

        // ゲージ
        var config    = Masters.ConfigDB.FindById(1);
        var gearDatas = this.partsData.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   = partsInfo.power + (uint)gearPower;
        uint speed   = partsInfo.speed + (uint)gearSpeed;
        uint fvPoint = partsInfo.fvPoint + (uint)gearFvPoint;

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

        // ゲージ初期化
        float gaugePower   = 0f;
        float gaugeSpeed   = 0f;
        float gaugeFvPoint = 0f;

        if (this.partsData.itemType == (uint)ItemType.Accessory)
        {
            this.fvAttackArea.SetActive(false);
            this.gaugeArea.SetActive(false);
            this.gearsArea.SetActive(false);
        }
        else
        {
            // パーツが砲弾の場合
            if (this.partsData.itemType == (uint)ItemType.Bullet)
            {
                if (power < config.maxBulletPower / 5)
                {
                    gaugePower = 0.2f;
                }
                else
                {
                    gaugePower = (float)power / config.maxBulletPower;
                }

                gaugeSpeed   = (float)speed / config.maxBarrelSpeed;
                gaugeFvPoint = (float)fvPoint / config.maxBatteryFvPoint;
            }
            // パーツが砲身の場合
            else if (this.partsData.itemType == (uint)ItemType.Barrel)
            {
                if (speed < config.maxBarrelSpeed / 5)
                {
                    gaugeSpeed = 0.2f;
                }
                else
                {
                    gaugeSpeed = (float)speed / config.maxBarrelSpeed;
                }

                gaugePower   = (float)power / config.maxBulletPower;
                gaugeFvPoint = (float)fvPoint / config.maxBatteryFvPoint;
            }
            // パーツが台座の場合
            else if (this.partsData.itemType == (uint)ItemType.Battery)
            {
                if (speed < config.maxBatteryFvPoint / 5)
                {
                    gaugeFvPoint = 0.2f;
                }
                else
                {
                    gaugeFvPoint = (float)fvPoint / config.maxBatteryFvPoint;
                }

                gaugePower = (float)power / config.maxBulletPower;
                gaugeSpeed = (float)speed / config.maxBarrelSpeed;
            }

            // ゲージセット
            this.powerGauge.SetGaugeValue(Mathf.Clamp01(gaugePower));
            this.bulletSpeedGauge.SetGaugeValue(Mathf.Clamp01(gaugeSpeed));
            this.fvPointGetCalueGauge.SetGaugeValue(Mathf.Clamp01(gaugeFvPoint));

            // ギアスロットセット
            this.GearSlotReflesh(data);
        }

        // ロックチェック
        if (data.lockFlg == 1)
        {
            this.lockOn.gameObject.SetActive(true);
            this.lockOff.gameObject.SetActive(false);
        }
        else
        {
            this.lockOn.gameObject.SetActive(false);
            this.lockOff.gameObject.SetActive(true);
        }

        // 分解詩修得アイテムマスターID取得(ギアがない場合)
        if (gearDatas.Length == 0)
        {
            this.getItem = Masters.ItemSellDB.GetList().FindAll(x => x.itemSellId == partsInfo.itemSellId).ToArray();

            // 分解詩修得アイテムスクロールビュー
            this.decompositionScrollView.Initialize(
                this.decompositionItemPrefab.gameObject,
                this.getItem.Length,
                this.OnUpdateDecompositionScrollViewItem
                );
        }
        // 分解詩修得アイテムマスターID取得(ギアがある場合)
        else
        {
            // パーツの分解時アイテム取得
            this.getItem = Masters.ItemSellDB.GetList().FindAll(x => x.itemSellId == partsInfo.itemSellId).ToArray();
            // パーツの分解時取得アイテムをリストの変更
            List <Master.ItemSellData> sellDatas = getItem.ToList();

            for (int i = 0; i < gearDatas.Length; i++)
            {
                // ギアの分解時アイテム取得
                Master.ItemSellData[] getGearItem = Masters.ItemSellDB.GetList().FindAll(x => x.itemSellId == gearDatas[i].itemSellId).ToArray();

                // getItemに追加
                for (int y = 0; y < getGearItem.Length; y++)
                {
                    sellDatas.Add(getGearItem[y]);
                }
            }

            // リスト配列に変更
            this.getItem = sellDatas.ToArray();

            // アイコンセット
            this.decompositionScrollView.Initialize(
                this.decompositionItemPrefab.gameObject,
                getItem.Length,
                this.OnUpdateDecompositionScrollViewItem
                );
        }

        // ボタングレーアウトON/OFF
        if (this.partsData.lockFlg == 1 || this.partsData.useFlg || this.isGearLockCount > 0 || partsInfo.itemSellId == 0)
        {
            this.SetGrayout(true);
            this.decompositionButton.interactable = false;
        }
        else
        {
            this.SetGrayout(false);
            this.decompositionButton.interactable = true;
        }

        // 初期砲台の場合、分解不可能の案内メッセージ、テキストセット
        if (partsInfo.itemSellId == 0)
        {
            this.defaultCanonText.text = Masters.LocalizeTextDB.Get("CannotDisassembledDefaultCanon");
        }
        else
        {
            this.defaultCanonText.text = null;
        }
    }
    /// <summary>
    /// セットアップ
    /// </summary>
    public void Setup(
        SimpleDialog dialog,
        UserPartsData partsData,
        UserGearData beforeGear,
        UserGearData afterGear,
        Action onReflesh,
        Action onCancel)
    {
        this.dialog     = dialog;
        this.yesNo      = this.dialog.AddYesNoButton();
        this.partsData  = partsData;
        this.beforeGear = beforeGear;
        this.afterGear  = afterGear;
        this.onReflesh  = onReflesh;
        this.onCancel   = onCancel;

        //キャンセル時処理登録
        this.yesNo.no.onClick = this.Cancel;

        Master.GearData beforeGearData = (this.beforeGear == null) ? null : Masters.GearDB.FindById(beforeGear.gearId);
        Master.GearData afterGearData  = (this.afterGear == null) ? null : Masters.GearDB.FindById(afterGear.gearId);
        this.beforeGearPanel.SetGearData(beforeGearData);
        this.afterGearPanel.SetGearData(afterGearData);

        //所持コイン数テキスト
        long beforeCoin = (long)UserData.Get().coin;

        this.beforeCoinText.text = string.Format("{0:#,0}", beforeCoin);

        //装着
        if (beforeGearData == null)
        {
            this.coinArea.SetActive(false);
            this.confirmText.text        = Masters.LocalizeTextDB.Get("ConfirmGearEquip");
            this.noteRemoveCostText.text = Masters.LocalizeTextDB.GetFormat("NoteGearRemoveCost", afterGearData.rejectCoin);
            this.freeGearRemoveText.text = null;
            this.yesNo.yes.onClick       = this.CallGearSetApi;
        }
        else
        {
            this.noteRemoveCostText.gameObject.SetActive(false);

            // vipでない場合
            if (UserData.Get().vipLevel == 0)
            {
                this.freeGearRemoveText.gameObject.SetActive(false);
            }
            else
            {
                this.freeGearRemoveText.gameObject.SetActive(true);
            }

            if (CustomGearConfirmDialogContent.freeGearRemoveCount > 0)
            {
                // 無料カウントがある場合、beforeCoinはafterCoinTextと同じ
                this.afterCoinText.text = string.Format("{0:#,0}", beforeCoin);
            }
            else
            {
                this.afterCoinText.text = string.Format("{0:#,0}", beforeCoin - beforeGearData.rejectCoin);

                if (beforeCoin - beforeGearData.rejectCoin < 0)
                {
                    this.afterCoinText.color = UIUtility.decreaseColor;
                }
            }

            //外す
            if (afterGearData == null)
            {
                this.confirmText.text        = Masters.LocalizeTextDB.Get("ConfirmGearRemove");
                this.yesNo.yes.onClick       = this.CallGearUnsetApi;
                this.freeGearRemoveText.text = Masters.LocalizeTextDB.GetFormat("FreeGearRemove", CustomGearConfirmDialogContent.freeGearRemoveCount);
            }
            //変更
            else
            {
                this.confirmText.text        = Masters.LocalizeTextDB.Get("ConfirmGearChange");
                this.yesNo.yes.onClick       = this.CallGearChageApi;
                this.freeGearRemoveText.text = Masters.LocalizeTextDB.GetFormat("FreeGearRemove", CustomGearConfirmDialogContent.freeGearRemoveCount);
            }

            //コイン不足・無料回数が0
            if (beforeGearData.rejectCoin > beforeCoin && CustomGearConfirmDialogContent.freeGearRemoveCount <= 0)
            {
                //ボタン押せなくしてグレースケールに
                this.yesNo.yes.button.interactable = false;
                this.yesNo.yes.image.material      = SharedUI.Instance.grayScaleMaterial;
                this.yesNo.yes.text.material       = SharedUI.Instance.grayScaleMaterial;
                this.freeGearRemoveText.text       = Masters.LocalizeTextDB.GetFormat("FreeGearRemove", CustomGearConfirmDialogContent.freeGearRemoveCount);
            }
        }
    }
Exemplo n.º 21
0
 /// <summary>
 /// 砲台ビューのパーツ切替
 /// </summary>
 protected abstract void ChangeTurretViewParts(UserPartsData partsData);