/// <summary>
    /// 分解リストスクロールビューアイテムセット
    /// </summary>
    public void Set(uint itemType, uint itemId, uint itemNum)
    {
        var itemInfo = CommonIconUtility.GetItemInfo(itemType, itemId);

        this.commonIcon.Set(itemInfo, false);
        this.commonIcon.SetCountText(itemNum);
    }
    /// <summary>
    /// 表示構築
    /// </summary>
    public void Set(UserGearData data, bool isEquipped, uint isLock, Action <ItemInventoryGearScrollViewItem> onClick)
    {
        this.gearData = data;
        // CommonIconをギアに変更
        this.commonIcon.SetGearCommonIcon(true);
        var gearMaster = Masters.GearDB.FindById(data.gearId);

        // ランクスプライト切替
        var rank = CommonIconUtility.GetRarity((uint)ItemType.Gear, this.gearData.gearId);

        this.commonIcon.SetRank(rank);

        // ギアCommonIconセット、アイコンスプライト切替
        var bgSprite   = CommonIconUtility.GetGearBgSprite(data.gearType);
        var mainSprite = CommonIconUtility.GetGearMainImageSprite(gearMaster.key);
        var subSprite  = CommonIconUtility.GetGearSubImageSprite(gearMaster.subKey);

        this.commonIcon.SetGearSprite(bgSprite, mainSprite, subSprite);

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

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

        // ロック情報セット
        SetTemplockImage(isLock);
    }
    /// <summary>
    /// 開く
    /// </summary>
    public static void Open(PresentBoxDialogContent prefab, Action <PresentBoxDialogContent> onClose)
    {
        //BOX内リスト確認通信
        PresentApi.CallListApi((response) =>
        {
            //ローダー準備
            var loader = new AssetListLoader(response.tPresentBox
                                             .Concat(response.tPresentBoxLimited)
                                             .Concat(response.tPresentBoxReceived)
                                             .Select(x => CommonIconUtility.GetItemInfo(x.itemType, x.itemId))
                                             .Where(x => !x.IsCommonSprite())
                                             .Select(x => new AssetLoader <Sprite>(x.GetSpritePath())));

            //ロード中はタッチブロック
            SharedUI.Instance.DisableTouch();

            //ロード
            loader.Load(() =>
            {
                //タッチブロック解除
                SharedUI.Instance.EnableTouch();

                //ダイアログ表示
                var dialog                = SharedUI.Instance.ShowSimpleDialog();
                dialog.titleText.text     = Masters.LocalizeTextDB.Get("PresentBoxTitle");
                dialog.closeButtonEnabled = true;

                var content = dialog.AddContent(prefab);
                content.Setup(response, loader);
                content.onClose = onClose;
            });
        });
    }
Exemple #4
0
    /// <summary>
    /// vip詳細開く
    /// </summary>
    public static void Open(VipInfoDialog prefab)
    {
        // 通信で、vipLevel, 補償取得の可否取得
        VipApi.CallVipLevelApi((response) =>
        {
            var loader = new AssetListLoader(Masters.VipRewardDB
                                             .GetList()
                                             .Select(x => CommonIconUtility.GetItemInfo(x.itemType, x.itemId))
                                             .Where(x => !x.IsCommonSprite())
                                             .Select(x => new AssetLoader <Sprite>(x.GetSpritePath()))
                                             );

            // タッチブロック
            SharedUI.Instance.DisableTouch();

            // 読み込み開始
            loader.Load(() =>
            {
                //タッチブロック解除
                SharedUI.Instance.EnableTouch();
                // ロード後
                var dialog = SharedUI.Instance.ShowSimpleDialog();
                dialog.closeButtonEnabled = true;
                dialog.titleText.text     = Masters.LocalizeTextDB.Get("VipInfoTitle");
                var content         = dialog.AddContent(prefab);
                content.assetLoader = loader;
                content.Set(response);
            });
        });
    }
        /// <summary>
        /// 開く
        /// </summary>
        public static void Open(
            SingleBattleResultPopupContent prefab,
            Master.SingleStageData stageData,
            SinglePlayApi.ClearResponseData response,
            Rank clearRank,
            Action onClose)
        {
            //報酬
            var rewards = response.firstReward.Concat(response.normalReward).ToArray();

            //ローダー準備
            var loader = new AssetListLoader(rewards
                                             .Select(x => CommonIconUtility.GetItemInfo(x.itemType, x.itemId))
                                             .Where(x => !x.IsCommonSprite())
                                             .Select(x => new AssetLoader <Sprite>(x.GetSpritePath())));

            //ロード中はタッチブロック
            SharedUI.Instance.DisableTouch();

            //ロード
            loader.Load(() =>
            {
                //タッチブロック解除
                SharedUI.Instance.EnableTouch();

                //ダイアログ開く
                var dialog  = SharedUI.Instance.ShowSimpleDialog();
                var content = dialog.AddContent(prefab);
                content.Setup(dialog, stageData, response, clearRank, rewards, loader, onClose);
            });
        }
    /// <summary>
    /// リロード
    /// </summary>
    private void Reload()
    {
        //BOX内リスト確認通信
        PresentApi.CallListApi((response) =>
        {
            //追加ローダー準備
            var addLoader = new AssetListLoader(response.tPresentBox
                                                .Concat(response.tPresentBoxLimited)
                                                .Concat(response.tPresentBoxReceived)
                                                .Select(x => CommonIconUtility.GetItemInfo(x.itemType, x.itemId))
                                                .Where(x1 => !x1.IsCommonSprite() && !this.loader.Exists(x2 => x2.path == x1.GetSpritePath()))
                                                .Select(x => new AssetLoader <Sprite>(x.GetSpritePath())));

            //ロード中はタッチブロック
            SharedUI.Instance.DisableTouch();

            //ロード
            addLoader.Load(() =>
            {
                //タッチブロック解除
                SharedUI.Instance.EnableTouch();
                //ローダー統合
                this.loader.AddRange(addLoader);
                //再セットアップ
                this.Setup(response, this.loader);
                //必要ならVIPレベルアップ表示
                UIVipLevelUp.OpenIfNeed(this.vipLevelUpPrefab);
            });
        });
    }
    /// <summary>
    /// チェックボックスアイテムセット
    /// </summary>
    public void SetCheckBox(UserGearData data, bool isEquipped, uint isLock, uint checkFlg, Action <ItemInventoryGearScrollViewItem> onClick)
    {
        this.gearData = data;
        // CommonIconをギアに変更
        this.commonIcon.SetGearCommonIcon(true);
        var gearMaster = Masters.GearDB.FindById(data.gearId);

        // ランクスプライト切替
        var rank = CommonIconUtility.GetRarity((uint)ItemType.Gear, this.gearData.gearId);

        this.commonIcon.SetRank(rank);

        // ギアCommonIconセット
        var bgSprite   = CommonIconUtility.GetGearBgSprite(data.gearType);
        var mainSprite = CommonIconUtility.GetGearMainImageSprite(gearMaster.key);
        var subSprite  = CommonIconUtility.GetGearSubImageSprite(gearMaster.subKey);

        this.commonIcon.SetGearSprite(bgSprite, mainSprite, subSprite);

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

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

        // // ロック情報セット
        SetTemplockImage(isLock);

        // ロックの場合はクリック禁止・イメージ暗く
        if (isEquipped || isLock == 1)
        {
            this.commonIcon.button.interactable = false;

            // 色暗く
            var newColor = new Color(130 / 255f, 130 / 255f, 130 / 255f);
            this.commonIconGearBgGraphic.color   = newColor;
            this.commonIconGearMainGraphic.color = newColor;
            this.commonIconGearSubGraphic.color  = newColor;

            this.checkBox.SetActive(false);
        }
        // チェックボックスセット
        else
        {
            this.commonIcon.button.interactable = true;

            // 色の原本で
            var newColor = new Color(255 / 255f, 255 / 255f, 255 / 255f);
            this.commonIconGearBgGraphic.color   = newColor;
            this.commonIconGearMainGraphic.color = newColor;
            this.commonIconGearSubGraphic.color  = newColor;

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

        // 仮選択フラッグチェックセット
        SetTempCheckImage(checkFlg);
    }
    /// <summary>
    /// ショップ開く
    /// </summary>
    public static void Open(MultiBattleShop prefab)
    {
        //通信で商品リスト取得
        BillingApi.CallListApi(() => {
            ShopApi.CallNowShopApi((tShops) =>
            {
                //ローダー準備
                var loader = new AssetListLoader(Masters.ShopDB
                                                 .GetList()
                                                 .Where(x => x.multiFlg > 0)
                                                 .SelectMany(x1 => Masters.ShopItemDB.GetList().FindAll(x2 => x2.shopItemId == x1.shopItemId))
                                                 .Select(x => CommonIconUtility.GetItemInfo(x.itemType, x.itemId))
                                                 .Where(x => !x.IsCommonSprite())
                                                 .Select(x => new AssetLoader <Sprite>(x.GetSpritePath())));

                //ロード中タッチブロック
                SharedUI.Instance.DisableTouch();

                //リソースロード
                loader.Load(() =>
                {
                    //タッチブロック解除
                    SharedUI.Instance.EnableTouch();

                    //ショップダイアログ生成
                    var dialog    = SharedUI.Instance.ShowPopup(prefab);
                    dialog.loader = loader;
                    dialog.Setup(tShops);
                });
            });
        });
    }
Exemple #9
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 #10
0
    /// <summary>
    /// 表示構築
    /// </summary>
    public void BuildView(TPresentBox server, Action <PresentBoxItem> onClickReceiveButton)
    {
        this.server = server;
        this.onClickReceiveButton = onClickReceiveButton;
        var limitedData = this.server as TPresentBoxLimited;
        var itemInfo    = CommonIconUtility.GetItemInfo(this.server.itemType, this.server.itemId);

        //CommonIcon表示構築
        this.icon.Set(itemInfo, false);

        //アイテム数表示
        if (this.server.itemNum > 1)
        {
            this.icon.SetCountText(this.server.itemNum);
        }
        else
        {
            this.icon.countText.text = null;
        }

        //名前テキスト設定
        this.nameText.text = itemInfo.GetName();

        //メッセージテキスト設定
        this.messageText.text = Masters.MessageDB.FindById(this.server.messageId).messageText;

        //有期限プレゼントなら
        if (limitedData != null && limitedData.limitDate.HasValue)
        {
            //有期限オブジェクト表示ON
            this.limitedDateContent.SetActive(true);

            //残り時間表示
            var span = limitedData.limitDate.Value - DateTime.Now;
            this.limitedDateText.text = (span.Days > 0)    ? Masters.LocalizeTextDB.GetFormat("ReceiveLimitedToDay", span.Days)
                                      : (span.Hours > 0)   ? Masters.LocalizeTextDB.GetFormat("ReceiveLimitedToHour", span.Hours)
                                      : (span.Minutes > 0) ? Masters.LocalizeTextDB.GetFormat("ReceiveLimitedToMinites", span.Minutes)
                                      :                      Masters.LocalizeTextDB.GetFormat("ReceiveLimitedToMinites", 0);
        }
        //無期限プレゼントなら
        else
        {
            this.limitedDateContent.SetActive(false);
        }

        if (this.server.created_at == null)
        {
            //生成日付がnullだったらエラー回避のため今の時間を入れておく
            this.server.created_at = DateTime.Now;
        }

        //生成日付表示
        this.createDateText.text = this.server.created_at.Value.ToString();

        //受け取り済みプレゼントじゃなければ受け取りボタンを表示
        this.receiveButton.gameObject.SetActive(!(this.server is TPresentBoxReceived) && this.onClickReceiveButton != null);
    }
Exemple #11
0
    /// <summary>
    /// 表示構築
    /// </summary>
    public void BuildView(ProductBase product)
    {
        this.Initialize();

        //長押し時コールバック
        this.onLongPress = () =>
        {
            this.infoDialogData.OpenDialog(product);
        };

        //CommonIcon表示構築
        this.commonIcon.Set(product.addItems[0].itemType, product.addItems[0].itemId, false);

        //CommonIconのフレームと背景表示切り替え
        this.commonIcon.SetFrameVisible(product.isVisibleProductIconFrame);

        //CommonIconのサイズ変更
        this.commonIcon.rectTransform.sizeDelta = product.iconSize;

        //CommonIconに対する追加処理
        product.SetCommonIcon(this.commonIcon);

        //商品名
        this.productNameText.text = product.productName;

        //値段テキスト
        string priceText = product.price.ToString("#,0");

        if (product is ProductBilling)
        {
            //一次通貨で購入する場合は¥マーク表示になるので、支払いアイコンは非表示
            this.paymentItemIconImage.gameObject.SetActive(false);

            //値段テキスト
            priceText = Masters.LocalizeTextDB.GetFormat("Price", priceText);
        }
        else
        {
            var payInfo = CommonIconUtility.GetItemInfo((uint)product.payType, 0);
            if (payInfo.IsCommonSprite())
            {
                //支払いアイコン設定
                this.paymentItemIconImage.gameObject.SetActive(true);
                this.paymentItemIconImage.sprite = SharedUI.Instance.commonAtlas.GetSprite(payInfo.GetSpritePath());
            }
        }

        //値段テキスト
        this.priceText.text = priceText;

        //残り購入回数表示
        this.SetPurchasesCountText(product.remainCount);

        //おすすめの設定 (α版では表示したくないとのこと)
        this.recommendContent.SetActive(false);//(product.Recommended > 0);
    }
Exemple #12
0
    /// <summary>
    /// 表示構築
    /// </summary>
    public void SetGearData(UserGearData data, Action <CustomGearScrollViewItem> onClick)
    {
        this.gearData = data;
        this.onClick  = onClick;
        var localizeText = Masters.LocalizeTextDB;

        if (data == null)
        {
            this.removeViewObject.SetActive(true);
        }
        else
        {
            var config = Masters.ConfigDB.FindById(1);
            //各能力のMAX値(仮)
            var MAX_POWER              = config.maxGearPower;
            var MAX_BULLET_SPEED       = config.maxGearSpeed;
            var MAX_FV_POINT_GET_VALUE = config.maxGearFvPoint;

            // 歯車能力値
            var  master          = Masters.GearDB.FindById(this.gearData.gearId);
            uint power           = master.power;
            uint bulletSpeed     = master.speed;
            uint fvPointGetValue = master.fvPoint;

            //攻撃力ゲージ設定
            this.powerGauge.SetGaugeValue(Mathf.Clamp01((float)power / MAX_POWER));

            //発射速度ゲージ設定
            this.bulletSpeedGauge.SetGaugeValue(Mathf.Clamp01((float)bulletSpeed / MAX_BULLET_SPEED));

            //FVポイント獲得値ゲージ設定
            this.fvPointGetValueGauge.SetGaugeValue(Mathf.Clamp01((float)fvPointGetValue / MAX_FV_POINT_GET_VALUE));

            //ランクスプライト
            this.commonIcon.SetRank((Rank)master.rarity);

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

            // ギアCommonIconセット
            var bgSprite   = CommonIconUtility.GetGearBgSprite(this.gearData.gearType);
            var mainSprite = CommonIconUtility.GetGearMainImageSprite(master.key);
            var subSprite  = CommonIconUtility.GetGearSubImageSprite(master.subKey);
            this.commonIcon.SetGearSprite(bgSprite, mainSprite, subSprite);

            //ギアInfo
            this.gearName.text        = master.name;
            this.gearDescription.text = master.description;

            // localize
            this.powerGaugeText.text           = localizeText.Get("Power");
            this.bulletSpeedGaugeText.text     = localizeText.Get("BulletSpeed");
            this.fvPointGetValueGaugeText.text = localizeText.GetFormat("FvPointGetValue");
        }
    }
Exemple #13
0
    /// <summary>
    /// 一括ランク設定
    /// </summary>
    public void SetRank(Rank rank)
    {
        this.SetFrameSprite(CommonIconUtility.GetRarityFrameSprite(rank));
        this.rankImage.enabled       =
            this.rankBgImage.enabled = rank != Rank.None;

        if (rank != Rank.None)
        {
            this.SetRankSprite(CommonIconUtility.GetRaritySprite(rank));
            this.SetRankBgSprite(CommonIconUtility.GetRarityBgSprite(rank));
        }
    }
Exemple #14
0
    /// <summary>
    /// セット
    /// </summary>
    public void Set(IItemInfo itemInfo, bool setLongPress)
    {
        if (setLongPress)
        {
            this.onLongPress = () =>
            {
                this.infoDialogData.OpenDialog(itemInfo);
            };
        }

        if (itemInfo is Master.GearData)
        {
            var gearData = itemInfo as Master.GearData;

            //ギア表示ON
            this.SetGearCommonIcon(true);

            //スプライト設定
            this.SetGearSprite(
                bgSprite: CommonIconUtility.GetGearBgSprite(gearData.partsType),
                mainSprite: CommonIconUtility.GetGearMainImageSprite(gearData.key),
                subSprite: CommonIconUtility.GetGearSubImageSprite(gearData.subKey)
                );
        }
        else
        {
            //ギア表示OFF
            this.SetGearCommonIcon(false);

            Sprite sprite = null;

            if (itemInfo.IsCommonSprite())
            {
                sprite = SharedUI.Instance.commonAtlas.GetSprite(itemInfo.GetSpritePath());
            }
            else
            {
                var spritePath = itemInfo.GetSpritePath();
                sprite = AssetManager.FindHandle <Sprite>(spritePath).asset as Sprite;
            }

            //スプライト設定
            this.SetIconSprite(sprite);
        }

        //ランク設定
        var rank = itemInfo.GetRank();

        this.SetRank(rank);
    }
Exemple #15
0
    /// <summary>
    /// 表示構築
    /// </summary>
    public void BuildView(MissionContent content)
    {
        var rewardData     = Masters.MissionRewardDB.FindById(content.server.missionRewardId);
        var rewardItemInfo = CommonIconUtility.GetItemInfo(rewardData.itemType, rewardData.itemId);

        //アイコンイメージ設定
        this.iconImage.sprite = content.iconImage.sprite;

        //報酬名
        this.itemNameText.text = string.Format("{0}×{1:#,0}", rewardItemInfo.GetName(), rewardData.itemNum);

        //報酬説明文
        this.itemDescriptionText.text = rewardItemInfo.GetDescription();
    }
Exemple #16
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;
        }
    }
    public void SetOtherItemData(UserItemData data)
    {
        this.itemData = data;

        string key  = CommonIconUtility.GetSpriteKey((uint)data.itemType, data.itemId);
        string path = CommonIconUtility.GetSpritePath((uint)data.itemType, key);

        var handle = AssetManager.FindHandle <Sprite>(path);

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

        this.otherItemCommonIcon.SetCountText(this.itemData.stockCount);
        this.otherItemCommonIcon.countText.text = null;

        this.otherItemNameText.text        = CommonIconUtility.GetName((uint)data.itemType, data.itemId);
        this.otherItemDescriptionText.text = CommonIconUtility.GetDescription((uint)data.itemType, data.itemId);
    }
    /// <summary>
    /// 表示構築
    /// </summary>
    public void Set(UserItemData data, Action <ItemInventoryOtherItemScrollViewItem> onClick)
    {
        this.itemData = data;
        this.commonIcon.rankImage.gameObject.SetActive(false);
        this.commonIcon.rankBgImage.gameObject.SetActive(false);

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

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

        this.commonIcon.SetCountText(data.stockCount);

        // クリック時処理登録
        this.commonIcon.onClick = () => onClick(this);
    }
    /// <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);
    }
Exemple #20
0
    /// <summary>
    /// 開く
    /// </summary>
    public static void Open(MultiPlayApi.LogData logData, UILevelUp prefab, RectTransform parent, Action onClose)
    {
        //API実行
        MultiPlayApi.CallLevelUpApi(logData, (response) =>
        {
            //レベルアップ前後の値
            //uint beforeLevel = UserData.Get().lv;
            uint afterLevel   = response.tUsers.level;
            UserData.Get().lv = afterLevel;

            //ローダー
            var loader = new AssetListLoader();

            if (response.mLevelReward != null)
            {
                //汎用スプライトじゃなければローダーに積む
                loader.AddRange(response.mLevelReward
                                .Select(x => CommonIconUtility.GetItemInfo(x.itemType, x.itemId))
                                .Where(x => !x.IsCommonSprite())
                                .Select(x => new AssetLoader <Sprite>(x.GetSpritePath())));

                //報酬付与
                foreach (var reward in response.mLevelReward)
                {
                    UserData.Get().AddItem((ItemType)reward.itemType, reward.itemId, reward.itemNum);
                }
            }

            //ロード中のタッチブロック
            SharedUI.Instance.DisableTouch();

            //ロード開始
            loader.Load(() =>
            {
                //タッチブロック解除
                SharedUI.Instance.EnableTouch();

                //レベルアップダイアログ開く
                var dialog = Instantiate(prefab, parent, false);
                dialog.Setup(response, loader, onClose);
            });
        });
    }
        /// <summary>
        /// ギア情報のセット
        /// </summary>
        public void SetGearData(Master.GearData gearData)
        {
            if (gearData == null)
            {
                this.icon.gameObject.SetActive(false);
                this.nameText.gameObject.SetActive(false);
            }
            else
            {
                this.icon.SetGearCommonIcon(true);
                ;
                this.icon.SetRank((Rank)gearData.rarity);
                this.nameText.text = gearData.name;
                this.notEquipedText.gameObject.SetActive(false);

                // ギアスプライトセット
                var bgSprite   = CommonIconUtility.GetGearBgSprite(gearData.partsType);
                var mainSprite = CommonIconUtility.GetGearMainImageSprite(gearData.key);
                var subSprite  = CommonIconUtility.GetGearSubImageSprite(gearData.subKey);

                this.icon.SetGearSprite(bgSprite, mainSprite, subSprite);
            }
        }
    /// <summary>
    /// 開く
    /// </summary>
    public static void Open(
        SingleStageChallengeConfirmDialogContent prefab,
        Master.SingleStageData stageData,
        Rank rank,
        Action <uint> onStageStart)
    {
        bool isCleared = rank > Rank.None;

        //報酬リスト
        List <RewardData> rewards = new List <RewardData>();

        //このステージで入手可能な報酬一覧
        var lotDatas = Masters.SingleStageRewardDB
                       .GetList()
                       .Where(x => x.groupId == stageData.rewardGroupId)
                       .SelectMany(x1 => Masters.SingleStageRewardLotDB.GetList().FindAll(x2 => x2.lotGroupId == x1.lotGroupId))
                       .ToArray();

        foreach (var data in lotDatas)
        {
            if (!rewards.Exists(x => x.itemType == data.itemType && x.itemId == data.itemId))
            {
                rewards.Add(new RewardData {
                    itemType = data.itemType, itemId = data.itemId, itemNum = data.itemNum
                });
            }
        }

        //初回報酬
        var firstReward = Masters.SingleStageFirstRewardDB
                          .GetList()
                          .Where(x => x.groupId == stageData.rewardFirstGroupId)
                          .Select(x => new RewardData {
            itemType = x.itemType, itemId = x.itemId, itemNum = x.amount, isFirstReward = true
        });

        if (isCleared)
        {
            //初回報酬入手済みなら末尾に追加
            rewards.AddRange(firstReward);
        }
        else
        {
            //初回報酬未入手なら先頭に追加
            rewards.InsertRange(0, firstReward);
        }

        //ローダー準備
        var loader = new AssetListLoader(rewards
                                         .Select(x => CommonIconUtility.GetItemInfo(x.itemType, x.itemId))
                                         .Where(x => !x.IsCommonSprite())
                                         .Select(x => new AssetLoader <Sprite>(x.GetSpritePath())));

        //ロード中はタッチブロック
        SharedUI.Instance.DisableTouch();

        //ロード
        loader.Load(() =>
        {
            //タッチブロック解除
            SharedUI.Instance.EnableTouch();

            //ダイアログ開く
            var dialog  = SharedUI.Instance.ShowSimpleDialog();
            var content = dialog.AddContent(prefab);
            content.Set(dialog, stageData, rank, rewards, loader, onStageStart);
        });
    }
Exemple #23
0
    /// <summary>
    /// 表示構築
    /// </summary>
    public void BuildView(
        MissionApi.MissionProgress server,
        Action <MissionContent> onClickChallengeButton,
        Action <MissionContent> onClickReceiveButton)
    {
        this.server = server;
        this.onClickChallengeButton = onClickChallengeButton;
        this.onClickReceiveButton   = onClickReceiveButton;
        var rewardData     = Masters.MissionRewardDB.FindById(this.server.missionRewardId);
        var rewardItemInfo = CommonIconUtility.GetItemInfo(rewardData.itemType, rewardData.itemId);

        //ミッション名
        this.missionNameText.text = Masters.MissionTypeDB.FindById(this.server.missionTypeId).missionName;

        switch (this.server.missionTypeId)
        {
        //シングルモードステージ△△を〇〇回クリアする
        case (uint)Master.MissionData.MainType.SingleSelectStageClear:
            var stageName = Masters.SingleStageDB.FindById(this.server.missionTypeSubId.Value).name;
            this.missionNameText.text = string.Format(this.missionNameText.text, this.server.clearCondition, stageName);
            break;

        //マルチモードでバトルアイテム△△を〇〇個使用する
        case (uint)Master.MissionData.MainType.MultiConsumSelectItem:
            var itemName = Masters.BattleItemDB.FindById(this.server.missionTypeSubId.Value).name;
            this.missionNameText.text = string.Format(this.missionNameText.text, this.server.clearCondition, itemName);
            break;

        //マルチモードで特定の魚△△を〇〇匹捕まえる
        case (uint)Master.MissionData.MainType.MultiCatchSelectFish:
            var fishName = Masters.FishDB.FindById(this.server.missionTypeSubId.Value).name;
            this.missionNameText.text = string.Format(this.missionNameText.text, this.server.clearCondition, fishName);
            break;

        default:
            this.missionNameText.text = string.Format(this.missionNameText.text, this.server.clearCondition);
            break;
        }

        //アイコンイメージ
        this.iconImage.sprite = this.itemTypeToIconSprites.First(x => (uint)x.itemType == rewardData.itemType).sprite;

        //アイテム名テキスト
        this.itemNameText.text = rewardItemInfo.GetName();

        //アイテム個数テキスト
        this.itemCountText.text = rewardData.itemNum.ToString("#,0");

        //通算ミッション以外は期限表示有り
        this.limitDateContent.SetActive(this.server.category != MissionApi.Category.Total);

        if (this.limitDateContent.activeSelf)
        {
            //残り時間表示
            var span = TimeSpan.FromSeconds(this.server.endTime ?? 0);
            this.limitDateText.text = (span.Days > 0)  ? Masters.LocalizeTextDB.GetFormat("ReceiveLimitedToDay", span.Days)
                                    : (span.Hours > 0) ? Masters.LocalizeTextDB.GetFormat("ReceiveLimitedToHour", span.Hours)
                                    :                    Masters.LocalizeTextDB.GetFormat("ReceiveLimitedToMinites", span.Minutes);
        }

        //進捗ゲージ表示
        if (this.server.status == MissionApi.Status.NotClear)
        {
            this.progressText.text           = string.Format("{0}/{1}", this.server.missionCount, this.server.clearCondition);
            this.progressBarImage.color      = Color.blue;
            this.progressBarImage.fillAmount = (float)this.server.missionCount / this.server.clearCondition;
        }
        else
        {
            this.progressText.text           = Masters.LocalizeTextDB.Get("MissionAchieved");
            this.progressBarImage.color      = Color.red;
            this.progressBarImage.fillAmount = 1.0f;
        }

        //挑戦ボタンの表示切り替え
        this.challengeButton.gameObject.SetActive(this.server.status == MissionApi.Status.NotClear);

        //受け取りボタンの表示切り替え
        this.receiveButton.gameObject.SetActive(this.server.status == MissionApi.Status.ClearNotReceived);

        //受け取り済みテキストの表示切り替え
        this.receivedText.gameObject.SetActive(this.server.status == MissionApi.Status.ClearReceived);
    }
    /// <summary>
    /// 報酬情報の設定
    /// </summary>
    public void SetInfo(uint itemType, uint itemId, uint itemNum)
    {
        var  itemInfo = CommonIconUtility.GetItemInfo(itemType, itemId);
        bool isCannon = true;
        var  config   = Masters.ConfigDB.FindById(1);

        switch ((ItemType)itemType)
        {
        case ItemType.CannonSet:
            var cannonSet = itemInfo as Master.CannonSetData;
            Master.BatteryData       batteryData  = Masters.BatteryDB.FindById(cannonSet.batteryId);
            Master.BarrelData        barrelData   = Masters.BarrelDB.FindById(cannonSet.barrelId);
            Master.BulletData        bulletData   = Masters.BulletDB.FindById(cannonSet.bulletId);
            Master.TurretSerieseData cannonSeries = Masters.TurretSerieseDB.FindById(batteryData.seriesId);

            this.nameText.text = cannonSeries.name;

            // ゲージセット
            SetStatusGauge(
                itemType,
                bulletData.power, config.maxBulletPower,
                barrelData.speed, config.maxBarrelSpeed,
                batteryData.fvPoint, config.maxBatteryFvPoint);
            isCannon = true;
            break;

        case ItemType.Gear:
            nameText.text = itemInfo.GetName();

            // ゲージセット
            var gear = itemInfo as Master.GearData;
            SetStatusGauge(
                itemType,
                gear.power, config.maxGearPower,
                gear.speed, config.maxGearSpeed,
                gear.fvPoint, config.maxGearFvPoint);
            isCannon = true;
            break;

        case ItemType.BattleItem:
            this.nameText.text = itemInfo.GetName() + string.Format("×{0}", itemNum);
            isCannon           = false;
            break;

        case ItemType.FreeGem:
            this.nameText.text = Masters.LocalizeTextDB.GetFormat("UnitGem", itemNum);
            isCannon           = false;
            break;

        case ItemType.Coin:
            this.nameText.text = Masters.LocalizeTextDB.GetFormat("UnitCoin", itemNum);
            isCannon           = false;
            break;

        default:
            Debug.LogError("到達報酬に想定外のItemTypeが指定されています   ItemType = " + (ItemType)itemType);
            return;
        }

        this.commonIcon.Set(itemInfo, false);
        //砲台系のコンテンツの表示・非表示切り替え
        cannonContent.SetActive(isCannon);
    }
    /// <summary>
    /// ギア情報セット
    /// </summary>
    public void SetGearData(UserGearData data, Action onReflesh, Action onRefleshDecomposition)
    {
        this.gearData  = data;
        this.onReflesh = onReflesh;
        this.onRefleshDecomposition = onRefleshDecomposition;

        // CommonIconをギアに変更
        this.commonIcon.SetGearCommonIcon(true);
        // ギアアイコン情報セット
        this.gearCommonIcon.Set(
            data: data,
            isEquipped: data.partsServerId > 0,
            isLock: data.lockFlg,
            onClick: null
            );

        // マスターデータ
        var gearMaster = Masters.GearDB.FindById(data.gearId);

        //現在ギアと所有するギアを比較の上、同数
        uint[] gearIds = UserData.Get().gearData.Select(x => x.gearId).ToArray();
        int    count   = 0;

        for (int i = 0; i < gearIds.Length; i++)
        {
            var userGearIds    = gearIds[i].ToString();
            var currentGearIds = data.gearId.ToString();

            if (currentGearIds == userGearIds)
            {
                count++;
            }
        }

        // 同一のギア数テキスト
        this.overlapCountText.text = Masters.LocalizeTextDB.GetFormat("GearOverlapCount", count - 1);

        // 名前
        this.gearNameText.text = gearMaster.name;
        // 説明
        this.gearDescriptionText.text = gearMaster.description;

        // ゲージ、ギアを能力値
        var config  = Masters.ConfigDB.FindById(1);
        var power   = gearMaster.power;
        var speed   = gearMaster.speed;
        var fvPoint = gearMaster.fvPoint;

        // ゲージセット
        this.powerGauge.SetGaugeValue(Mathf.Clamp01((float)power / config.maxGearPower));
        this.bulletSpeedGauge.SetGaugeValue(Mathf.Clamp01((float)speed / config.maxGearSpeed));
        this.fvPointGetCalueGauge.SetGaugeValue(Mathf.Clamp01((float)fvPoint / config.maxGearFvPoint));

        // パーツ別に、情報ロード
        PartsInfoBase partsInfo = null;

        if (this.gearData.gearType == (uint)GearType.Battery)
        {
            partsInfo = new BatteryPartsInfo(data);
        }
        else if (this.gearData.gearType == (uint)GearType.Barrel)
        {
            partsInfo = new BarrelPartsInfo(data);
        }
        else if (this.gearData.gearType == (uint)GearType.Bullet)
        {
            partsInfo = new BulletPartsInfo(data);
        }

        if (data.partsServerId == null)
        {
            this.partsCommonIcon.gameObject.SetActive(false);
            this.needCoinArea.gameObject.SetActive(false);
            this.lockbutton.gameObject.SetActive(false);
            this.decompositionButton.gameObject.SetActive(true);
            this.lockbutton.gameObject.SetActive(false);
        }
        else
        {
            // パーツアイコン
            this.partsCommonIcon.countText.text = null;
            this.partsCommonIcon.gearArea.gameObject.SetActive(true);
            this.decompositionButton.gameObject.SetActive(false);
            this.lockbutton.gameObject.SetActive(true);

            // CommonIconパーツスプライトセット
            string Key  = CommonIconUtility.GetSpriteKey((uint)partsInfo.itemType, partsInfo.partsMasterId);
            string Path = CommonIconUtility.GetSpritePath((uint)partsInfo.itemType, partsInfo.partsMasterId);

            var partsHandle = AssetManager.FindHandle <Sprite>(Path);
            this.partsCommonIcon.SetIconSprite(partsHandle.asset as Sprite);

            // CommonIconパーツランキングセット
            var partsRank = CommonIconUtility.GetRarity((uint)partsInfo.itemType, partsInfo.partsMasterId);
            this.partsCommonIcon.SetRank(partsRank);

            // CommonIconパーツ装着中ギアセット
            var partsGearSize = partsInfo.partsGearSize;

            for (int i = 0; i < this.partsCommonIcon.gearIcon.Length; i++)
            {
                this.partsCommonIcon.gearIcon[i].enabled = i < partsInfo.partsGearSlotCount;
                if (i < partsGearSize)
                {
                    this.partsCommonIcon.gearOnIcon[i].gameObject.SetActive(true);
                }
            }

            // 装着中表示
            this.partsEquippedMark.SetActive(partsInfo.partsIsEquiped);
            // 外すテキスト
            this.unEquipGearText.text = Masters.LocalizeTextDB.GetFormat("unitNeedCoin", Masters.GearDB.FindById(gearData.gearId).rejectCoin);
        }

        // ロックチェック
        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取得
        this.getItem = Masters.ItemSellDB.GetList().FindAll(x => x.itemSellId == Masters.GearDB.FindById(data.gearId).itemSellId).ToArray();

        // 分解詩修得アイテムスクロールビュー
        this.decompositionScrollView.Initialize(
            this.decompositionItemPrefab.gameObject,
            this.getItem.Length,
            this.OnUpdateDecompositionScrollViewItem
            );

        // ボタングレーアウトON/OFF
        if (this.gearData.lockFlg == 1)
        {
            this.SetGrayout(true);
            this.decompositionButton.interactable = false;
        }
        else
        {
            this.SetGrayout(false);
        }
    }
Exemple #26
0
    /// <summary>
    /// 内容構築
    /// </summary>
    public override void Setup(ProductBase product)
    {
        var itemInfo = CommonIconUtility.GetItemInfo(product.addItems[0].itemType, product.addItems[0].itemId);

        this.Setup(itemInfo);
    }
Exemple #27
0
    /// <summary>
    /// セット
    /// </summary>
    public void Set(uint itemType, uint itemId, bool setLongPress)
    {
        var itemInfo = CommonIconUtility.GetItemInfo(itemType, itemId);

        this.Set(itemInfo, setLongPress);
    }
    /// <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);
    }