/// <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;
            });
        });
    }
    /// <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);
            });
        });
    }
Esempio n. 3
0
    /// <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);
                });
            });
        });
    }
Esempio n. 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>
    public static void Open(SingleStageFishDictionaryDialogContent prefab, Master.ModelBase master)
    {
        List <FishDataEx> fishDataList = null;
        string            worldKey     = null;

        //シングルモードの場合
        if (master is Master.SingleStageData)
        {
            var stageData = master as Master.SingleStageData;

            fishDataList = Masters.SingleStageFishDB
                           .GetList()
                           .Where(x => x.stageId == stageData.id)
                           .Select(x => new FishDataEx(Masters.FishDB.FindById(x.fishId), x))
                           .ToList();

            worldKey = Masters.SingleWorldDB.FindById(stageData.worldId).key;
        }
        //マルチモードの場合
        else if (master is Master.MultiWorldData)
        {
            var worldData = master as Master.MultiWorldData;

            fishDataList = Masters.MultiStageFishDB
                           .GetList()
                           .Where(x => x.worldId == worldData.id)
                           .Select(x => new FishDataEx(Masters.FishDB.FindById(x.fishId), x))
                           .ToList();

            worldKey = worldData.key;
        }

        var loader = new AssetListLoader(fishDataList.Select(x => new AssetLoader <Sprite>(SharkDefine.GetFishThumbnailSpritePath(x.Item1.key))));

        loader.Add <Sprite>(SharkDefine.GetZukanBgSpritePath(worldKey));

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

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

            //ダイアログ開く
            var dialog  = SharedUI.Instance.ShowSimpleDialog();
            var content = dialog.AddContent(prefab);
            content.Setup(dialog, fishDataList, loader, master);
        });
    }
Esempio n. 7
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 static void Open(UserInformationDialogContent contentPrefab, TurretViewer turretViewerPrefab)
    {
        var selectedTurret = UserData.Get().GetSelectedTurretData();
        var batteryData    = Masters.BatteryDB.FindById(selectedTurret.batteryMasterId);
        var barrelData     = Masters.BarrelDB.FindById(selectedTurret.barrelMasterId);
        var bulletData     = Masters.BulletDB.FindById(selectedTurret.bulletMasterId);

        var loader = new AssetListLoader();

        loader.Add <GameObject>(SharkDefine.GetBatteryPrefabPath(batteryData.key));
        loader.Add <GameObject>(SharkDefine.GetBarrelPrefabPath(barrelData.key));
        loader.Add <BulletBase>(SharkDefine.GetBulletPrefabPath(bulletData.key));

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

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

            //砲台表示
            var turretViewer        = Instantiate(turretViewerPrefab, null, false);
            turretViewer.BatteryKey = batteryData.key;
            turretViewer.BarrelKey  = barrelData.key;
            turretViewer.BulletKey  = bulletData.key;
            turretViewer.Reflesh();
            turretViewer.StartShot();

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

            var content = dialog.AddContent(contentPrefab);
            content.Set(loader, turretViewer);
        });
    }
    /// <summary>
    /// 開く
    /// </summary>
    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);
        });
    }