Пример #1
0
        void _beginWaitForNightBattle(int estimatedTickCount, BattleResult.Result result)
        {
            if (Properties.Settings.Default.ShowEnemyBattleStatus && estimatedTickCount > 0)
            {
                _battleResult = result;
                timerWaitForNightBattle.Interval = estimatedTickCount * 1000;
                timerWaitForNightBattle.Enabled = true;
                Debug.WriteLine(string.Format("夜戦入り検出を開始。{0}秒後に起動",
                    estimatedTickCount));
            }
            else
            {
                Debug.WriteLine("夜戦入り検出は開始してません。");
                timerWaitForNightBattle.Enabled = false;
            }

        }
Пример #2
0
        void _endWaitForNightBattle()
        {
            enemyFleetList.Visible = false;

            Debug.WriteLine("夜戦入り検出を終了。");

            //何らかの理由で離脱判定が出なかった場合でもタイマを止める。
            timerWaitForNightBattle.Enabled = false;
            _battleResult = null;
        }
Пример #3
0
        /// <summary>
        /// /kcsapi/api_req_sortie/battleresult
        /// /kcsapi/api_req_combined_battle/battleresult
        /// </summary>
        /// <param name="responseJson"></param>
        /// <param name="battleResult"></param>
        void BattleResult(string responseJson, BattleResult.Result battleResult)
        {
#if DEBUG
            if (battleResult != null)
            {
                Debug.WriteLine(battleResult.ToString());
            }
            else
            {
                Debug.WriteLine("BattleResult is null");
            }
#endif

            _parent.EndWaitForNightBattle();

            var binfo = _logBattle.Finish(responseJson,
                                          _memberShip, _memberDeck, _masterShip, _memberBasic);
            _parent.AddBattleResult(binfo);

            _statusManager.FinishBattle();

            //戦闘で受けた友軍ダメージを反映する
            _memberShip.ApplyBattleResult(battleResult);

            //推測戦闘結果
            if (battleResult != null)
            {
                var st  = battleResult.BattleState;
                var st2 = KCB2.BattleResult.Result.BattleResultStateString(st);

                //HP減少分をUIへ反映
                _parent.UpdateShipList(_memberShip.ShipList);
                _parent.UpdateDeckMemberList(_memberShip, _memberDeck.DeckList);

                if (binfo.ShipDropped.Length > 0 && !Properties.Settings.Default.HideDroppedShip)
                {
                    UpdateDetailStatus("評価{0}({2})で戦闘を終了、{1}がドロップしました",
                                       binfo.Rank, binfo.ShipDropped, st2);
                }
                else
                {
                    UpdateDetailStatus("評価{0}({1})で戦闘を終了しました", binfo.Rank, st2);
                }

                if (binfo.Rank != KCB2.BattleResult.Result.BattleResultStateShortString(st))
                {
                    string fn = string.Format("./{0}.missing.battleresult", DateTime.Now.Ticks.ToString());
                    Debug.WriteLine("BattleResult Missing log:" + fn);

                    using (var sw = new System.IO.StreamWriter(fn, true, Encoding.UTF8))
                    {
                        sw.WriteLine("Result(Official):{0}\r\nResult(Self):{1}\r\n\r\n{2}",
                                     binfo.Rank, st2, battleResult.ToString());
                    }
                }
            }
            else
            {
                //戦闘解析データがない場合は評価しない。
                _parent.UpdateShipList(_memberShip.ShipList);
                _parent.UpdateDeckMemberList(_memberShip, _memberDeck.DeckList);

                if (binfo.ShipDropped.Length > 0 && !Properties.Settings.Default.HideDroppedShip)
                {
                    UpdateDetailStatus("評価{0}で戦闘を終了、{1}がドロップしました",
                                       binfo.Rank, binfo.ShipDropped);
                }
                else
                {
                    UpdateDetailStatus("評価{0}で戦闘を終了しました", binfo.Rank);
                }
            }
            _parent.NotifyFinishBattle("戦闘");
        }