/// <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);
            });
        }
예제 #2
0
        /// <summary>
        /// Start
        /// </summary>
        public override void Start()
        {
            foreach (Transform child in BattleGlobal.instance.bulletArea)
            {
                Destroy(child.gameObject);
            }
            foreach (Transform child in BattleGlobal.instance.fvAttackArea)
            {
                Destroy(child.gameObject);
            }

            this.scene.turret.EndLaserBeamAnimation();

            var userData = BattleGlobal.instance.userData as SingleBattleUserData;
            float hpRemain = (float)userData.hp / userData.maxHp;
            var clearRank = this.GetClearRank(hpRemain);
            var clearResult = hpRemain > 0f ? SinglePlayApi.ClearResult.Cleared : SinglePlayApi.ClearResult.Failed;

            //防衛成功
            if (clearResult == SinglePlayApi.ClearResult.Cleared)
            {
                this.endAnim = Instantiate(this.clearAnimPrefab, this.scene.animationEffectArea, false);
            }
            //防衛失敗
            else
            {
                this.endAnim = Instantiate(this.faildAnimPrefab, this.scene.animationEffectArea, false);
            }

            //アニメ中画面触れないようにしておく
            SharedUI.Instance.DisableTouch();

            //アニメ終わったら
            this.endAnim.onFinished = (tag) =>
            {
                SharedUI.Instance.EnableTouch();

                //バトル終了通信
                SinglePlayApi.CallClearApi(clearResult, clearRank, (response) =>
                {
                    if (clearResult == SinglePlayApi.ClearResult.Cleared)
                    {
                        //リザルト後、ステージセレクトへ戻る
                        SingleBattleResultPopupContent.Open(
                            this.resultPopupContentPrefab,
                            this.scene.stageData,
                            response,
                            clearRank,
                            this.scene.ChangeSceneToSingleStageSelect
                        );
                    }
                    else
                    {
                        //すぐステージセレクトへ戻る
                        this.scene.ChangeSceneToSingleStageSelect();
                    }
                });
            };
        }