/// <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(); } }); }; }
/// <summary> /// Start /// </summary> private void Start() { //通信でワールドやステージの進行状況を取得 SinglePlayApi.CallTopApi((response) => { this.response = response; this.Load(); }); }
/// <summary> /// 挑戦するボタンクリック時 /// </summary> private void OnClickChallengeButton() { //ステージ開始通信 SinglePlayApi.CallStartApi(this.stageData.id, () => { this.dialog.onClose = () => this.onStageStart?.Invoke(this.stageData.id); this.dialog.Close(); }); }
/// <summary> /// 一時停止ボタンクリック時 /// </summary> public override void OnClickPauseButton() { //Noneステートへ一時退避 this.manager.PushState<NoneState>(null); //一時停止 TimePauseManager.Pause(); //一時停止メニューポップアップを開く var dialog = SharedUI.Instance.ShowSimpleDialog(); var content = dialog.SetAsYesNoMessageDialog(Masters.LocalizeTextDB.Get("ConfirmRetire")); content.yesNo.yes.onClick = () => { dialog.onClose = () => { //一時停止解除 TimePauseManager.Play(); //リタイア通信 SinglePlayApi.CallClearApi( SinglePlayApi.ClearResult.Retire, Rank.None, (response) => this.scene.ChangeSceneToSingleStageSelect() ); }; dialog.Close(); }; content.yesNo.no.onClick = () => { dialog.onClose = () => { //一時停止解除 TimePauseManager.Play(); //元のステートへ戻る this.manager.PopState(); }; dialog.Close(); }; }