Пример #1
0
        /// <summary>
        /// チーム設定のチェック(よくある設定ミスをチェック)
        /// </summary>
        /// <param name="teamSetting"></param>
        public static void CheckTeamSetting(TeamSetting teamSetting)
        {
            if (teamSetting == null || teamSetting.CurrentGameMembers.Count < 9 || teamSetting.CurrentGameMembers.Count > 18)
            {
                throw new Exception("teamSetting == null || teamSetting.CurrentGameMembers.Count < 9 || teamSetting.CurrentGameMembers.Count > 18");
            }

            foreach (DefensePosition position in DefensePositionHelper.GetEnums)
            {
                if (teamSetting.CurrentPlayingMembers.Count(m => m.DefensePosition == position) != 1)
                {
                    throw new Exception("重複するポジションがあるか、不足するポジションが存在する");
                }
            }

            for (int i = 9; i < teamSetting.CurrentGameMembers.Count; i++)
            {
                if (teamSetting.CurrentGameMembers[i].DefensePosition != DefensePosition.Sub)
                {
                    throw new Exception("ベンチメンバが控えのポジションになっていない");
                }
            }

            foreach (GameMember member in teamSetting.AllCurrentGameMembers)
            {
                if (teamSetting.AllCurrentGameMembers.Count(m => m == member) != 1)
                {
                    throw new Exception("試合に登録されているメンバに重複がある");
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 初期化(更新も可能)
        /// </summary>
        /// <param name="teamSetting"></param>
        public void Initialize(TeamSetting teamSetting)
        {
            // 再更新できるようにいったんバインディングを解除してから設定する
            this.DataContext = null;
            this.DataContext = teamSetting;

            // 半径
            const double r = MaxSize / 2;

            // 枠の作成
            Frame1.Points = GetPoints(r);
            Frame2.Points = GetPoints(r * 6 / 7);
            Frame3.Points = GetPoints(r * 5 / 7);
            Frame4.Points = GetPoints(r * 4 / 7);
            Frame5.Points = GetPoints(r * 3 / 7);
            Frame6.Points = GetPoints(r * 2 / 7);
            Frame7.Points = GetPoints(r * 1 / 7);

            // 軸の線
            Line1.X1 = 0 + OffsetX;
            Line1.Y1 = 0 + OffsetY;
            Line1.X2 = 0 + OffsetX;
            Line1.Y2 = r + OffsetY;
            Line2.X1 = 0 + OffsetX;
            Line2.Y1 = 0 + OffsetY;
            Line2.X2 = r * (Math.Sqrt(3.0) / 2.0) + OffsetX;
            Line2.Y2 = r * (1.0 / 2.0) + OffsetY;
            Line3.X1 = 0 + OffsetX;
            Line3.Y1 = 0 + OffsetY;
            Line3.X2 = r * (Math.Sqrt(3.0) / 2.0) + OffsetX;
            Line3.Y2 = -r * (1.0 / 2.0) + OffsetY;
            Line4.X1 = 0 + OffsetX;
            Line4.Y1 = 0 + OffsetY;
            Line4.X2 = 0 + OffsetX;
            Line4.Y2 = -r + OffsetY;
            Line5.X1 = 0 + OffsetX;
            Line5.Y1 = 0 + OffsetY;
            Line5.X2 = -r * (Math.Sqrt(3.0) / 2.0) + OffsetX;
            Line5.Y2 = -r * (1.0 / 2.0) + OffsetY;
            Line6.X1 = 0 + OffsetX;
            Line6.Y1 = 0 + OffsetY;
            Line6.X2 = -r * (Math.Sqrt(3.0) / 2.0) + OffsetX;
            Line6.Y2 = r * (1.0 / 2.0) + OffsetY;

            // 実際の値でグラフを表示
            PointCollection points = GetPoints(r);
            points[0] = GetDataPoint(points[0], teamSetting.Batting);
            points[1] = GetDataPoint(points[1], teamSetting.Run);
            points[2] = GetDataPoint(points[2], teamSetting.Defense);
            points[3] = GetDataPoint(points[3], teamSetting.Wisdom);
            points[4] = GetDataPoint(points[4], teamSetting.Pitching);
            points[5] = GetDataPoint(points[5], teamSetting.Bench);
            Data.Points = points;
        }
Пример #3
0
        /// <summary>
        /// 構築
        /// </summary>
        /// <param name="topTeam">先行チーム設定</param>
        /// <param name="bottomTeam">後攻チーム設定</param>
        /// <param name="userTeamTopOrBottom"></param>
        public GameData(TeamSetting topTeam, TeamSetting bottomTeam, bool userTeamTopOrBottom)
        {
            TopTeamSetting = topTeam;
            BottomTeamSetting = bottomTeam;
            UserTeamTopOrBottom = userTeamTopOrBottom;

            CurrentInning = 1;
            IsCurrentInningTop = true;

            CurrentTopTeamBattingOrder = 1;
            CurrentBottomTeamBattingOrder = 1;

            RequestedBattingMissions = new List<BattingMission>();

            // ランナー初期化
            ClearRnners();

            // 初期値設定(nullException避け)
            BollPoint = Constants.PointHomeBase;
        }
Пример #4
0
        /// <summary>
        /// 構築
        /// </summary>
        /// <param name="topTeamSetting">先行チーム設定</param>
        /// <param name="bottomTeamSetting">後攻チーム設定</param>
        /// <param name="userTeamTopOrBottom"></param>
        public GameManager(TeamSetting topTeamSetting, TeamSetting bottomTeamSetting, bool userTeamTopOrBottom)
        {
            // リストフィールドの初期化
            CurrentInningMidwayShowMember = new List<GameMember>();

            // デフォルトメンバ設定を元にこの試合用のメンバ設定を作成
            topTeamSetting.CreateCurrentMembersFromDefault();
            bottomTeamSetting.CreateCurrentMembersFromDefault();

            // 試合データの作成
            GameData = new GameData(topTeamSetting, bottomTeamSetting, userTeamTopOrBottom);

            // フィールドの初期化
            DefenseActionManger = new DefenseActionManger(GameData);

            // 守備位置の初期化
            DefenseActionManger.InitializeDefensePosition();

            // イベント接続
            DefenseActionManger.PassedDefenseTerm += (DefenseActionManger_PassedDefenseTerm);
            DefenseActionManger.AddedRunScore += (DefenseActionManger_AddedRunScore);
            DefenseActionManger.ReflectedFense += (DefenseActionManger_ReflectedFense);
            DefenseActionManger.JudgedSafeOrOut += new Action<bool>(DefenseActionManger_JudgedSafeOrOut);
            DefenseActionManger.OccurError += DefenseActionManger_OccurError;
            DefenseActionManger.OccurFoul += DefenseActionManger_OccurFoul;
            DefenseActionManger.CatchBoll += DefenseActionManger_CatchBoll;
            DefenseActionManger.ThrowBoll += DefenseActionManger_ThrowBoll;
            DefenseActionManger.TurnForThrow += DefenseActionMangerOnTurnForThrow;

            // 試合進行フェーズの初期値は投球フェーズにする
            GameProgressKind = GameProgressKind.PitchingBoll;

            // 準備フェーズがないため、先頭打者に対しての守備変更をここで実行する
            UpdateDefenseShift();

            // 高速試合モードの設定
            ChangeGameMode();
        }
Пример #5
0
        /// <summary>
        /// 初期化処理
        /// </summary>
        /// <param name="teamSetting"></param>
        /// <param name="gameData"></param>
        /// <param name="modeType"></param>
        public void Initialize(TeamSetting teamSetting, GameData gameData, ModeType modeType)
        {
            // フィールドの格納
            TeamSetting = teamSetting;
            GameData = gameData;

            // フィールドの初期化
            m_PlayingMembers.Clear();
            m_SubMembers.Clear();
            m_OutsideMembers.Clear();
            m_ChangedMembers.Clear();
            m_ChangeSets.Clear();
            foreach (GameMember member in TeamSetting.CurrentPlayingMembers)
            {
                m_PlayingMembers.Add(member.Clone());
            }
            foreach (GameMember member in TeamSetting.CurrentSubMembers)
            {
                m_SubMembers.Add(member.Clone());
            }
            foreach (GameMember member in TeamSetting.CurrentOutSideMembers)
            {
                m_OutsideMembers.Add(member.Clone());
            }
            foreach (GameMember member in TeamSetting.CurrentChangedMembers)
            {
                m_ChangedMembers.Add(member.Clone());
            }

            // ベンチ外メンバを非表示
            SetOutsideMemberVisible(false);

            // モードごとの個別設定
            UpdateControlByModeType(modeType);

            // 表示状態に変更
            this.Visibility = Visibility.Visible;
        }
Пример #6
0
 /// <summary>
 /// 消滅
 /// </summary>
 public void Dispose()
 {
     TeamSetting = null;
     GameData = null;
     m_PlayingMembers = null;
     m_SubMembers = null;
     m_OutsideMembers = null;
     m_ChangedMembers = null;
     m_ChangeSets = null;
     FirstAssignedMembers = null;
 }
        /// <summary>
        /// 初期化処理
        /// </summary>
        /// <param name="teamSetting"></param>
        public void Initialize(TeamSetting teamSetting)
        {
            // フィールドの設定
            TeamSetting = teamSetting;

            // 変更前の練習種別の退避
            BeforePracticeKinds.Clear();
            foreach (GameMember member in teamSetting.AllDefaultTeamMembers)
            {
                BeforePracticeKinds.Add(member.Player.MainPractice);
            }

            // 既定のビューを取り出してセットする
            var view = CollectionViewSource.GetDefaultView(TeamSetting.AllDefaultTeamMembers);
            MemberGrid.ItemsSource = view;

            // 既定のビューにソートを指定する
            view.SortDescriptions.Clear();
            view.SortDescriptions.Add(new SortDescription("Player.FielderAbility.DefenseType", ListSortDirection.Ascending));
            view.SortDescriptions.Add(new SortDescription("Player.Grade", ListSortDirection.Descending));

            // DataGridコントロールのヘッダーにソートの印(三角のマーク)を表示する
            MemberGrid.Columns[1].SortDirection = ListSortDirection.Ascending;

            // 野手モードの表示
            ChangeMode(false);
        }
 /// <summary>
 /// 消滅
 /// </summary>
 public void Dispose()
 {
     TeamSetting = null;
     MemberGrid.ItemsSource = null;
 }
Пример #9
0
        /// <summary>
        /// チーム設定の作成
        /// </summary>
        /// <returns></returns>
        public TeamSetting CreateTeamSetting(TeamNumber teamNumber)
        {
            // チーム番号に即したデータを読み込む
            string text = Resources.Resource.ResourceManager.GetString(teamNumber.ToString());

            TeamSetting teamSetting = null;
            int basicValue = 0;
            StringReader reader = new StringReader(text);
            string line;
            int lineCount = 0;
            while ((line = reader.ReadLine()) != null)
            {
                if (lineCount == 0)
                {
                    // 1行目:チーム設定を取得
                    string[] teamSettingString = line.Split(TextSeparator);
                    basicValue = int.Parse(teamSettingString[0]);
                    string initialName = teamSettingString[1];
                    string teamName = teamSettingString[2];
                    teamSetting = new TeamSetting(teamName, initialName, teamNumber);
                }
                else if (lineCount == 1)
                {
                    // 2行目:何もしない
                }
                else if (lineCount >= 20)
                {
                    // 20行目:最大で18人分(LineCountが19)までしか読み込まない
                    break;
                }
                else
                {
                    // 3行目~19行目:能力値の取得
                    string[] memberSettingString = line.Split(TextSeparator);
                    if (memberSettingString[0] == string.Empty)
                    {
                        // 1列目が空文字であればそれ以上のメンバ無しとみなして取得終了
                        break;
                    }
                    int columnIndex = 1;
                    Player player = new Player();
                    DefensePosition defensePosition = (DefensePosition)System.Enum.Parse(typeof(DefensePosition), memberSettingString[columnIndex], true);
                    columnIndex++;
                    player.Name = memberSettingString[columnIndex];
                    columnIndex++;
                    player.Grade = int.Parse(memberSettingString[columnIndex]);
                    columnIndex++;
                    if (memberSettingString[columnIndex] != string.Empty)
                    {
                        player.IsLeftThrow = bool.Parse(memberSettingString[columnIndex]);
                    }
                    columnIndex++;
                    if (memberSettingString[columnIndex] != string.Empty)
                    {
                        player.IsLeftBox = bool.Parse(memberSettingString[columnIndex]);
                    }
                    columnIndex++;
                    player.BreedType = (BreedType)System.Enum.Parse(typeof(BreedType), memberSettingString[columnIndex], true);
                    columnIndex++;
                    player.FielderAbility.Meet = int.Parse(memberSettingString[columnIndex]) + basicValue;
                    columnIndex++;
                    player.FielderAbility.Power = int.Parse(memberSettingString[columnIndex]) + basicValue;
                    columnIndex++;
                    player.FielderAbility.Run = int.Parse(memberSettingString[columnIndex]) + basicValue;
                    columnIndex++;
                    player.FielderAbility.Defense = int.Parse(memberSettingString[columnIndex]) + basicValue;
                    columnIndex++;
                    player.FielderAbility.Wisdom = int.Parse(memberSettingString[columnIndex]) + basicValue;
                    columnIndex++;
                    columnIndex++;// [計]列はスキップ
                    // 守備適正は未記入であれば守備位置と同じものを設定
                    if (memberSettingString[columnIndex] != string.Empty)
                    {
                        player.FielderAbility.DefenseType = (DefenseType)System.Enum.Parse(typeof(DefenseType), memberSettingString[columnIndex], true);
                    }
                    else
                    {
                        player.FielderAbility.DefenseType = DefensePositionHelper.ConvertDefenseType(defensePosition);
                    }
                    columnIndex++;
                    // 起用は未記入であればNomalとする
                    UseKind useKind;
                    if (memberSettingString[columnIndex] != string.Empty)
                    {
                        useKind = (UseKind)System.Enum.Parse(typeof(UseKind), memberSettingString[columnIndex], true);
                    }
                    else
                    {
                        useKind = UseKind.Normal;
                    }
                    columnIndex++;
                    // 特殊能力
                    if (memberSettingString[columnIndex] != string.Empty)
                    {
                        player.FielderAbility.SpecialFilederAbility = SpecialAbilityHelper.GetSpecialFielderAbility(memberSettingString[columnIndex]);
                    }
                    columnIndex++;
                    if (memberSettingString[columnIndex] != string.Empty)
                    {
                        // 投手能力が設定されている場合
                        player.PitcherAbility.Fastball = int.Parse(memberSettingString[columnIndex]) + basicValue;
                        columnIndex++;
                        player.PitcherAbility.Breakingball = int.Parse(memberSettingString[columnIndex]) + basicValue;
                        columnIndex++;
                        player.PitcherAbility.Control = int.Parse(memberSettingString[columnIndex]) + basicValue;
                        columnIndex++;
                        player.PitcherAbility.Stamina = int.Parse(memberSettingString[columnIndex]) + basicValue;
                        columnIndex++;
                        columnIndex++;// [計]列はスキップ
                        if (memberSettingString[columnIndex] != string.Empty)
                        {
                            player.PitcherAbility.PitchingStyle = (PitchingStyle)System.Enum.Parse(typeof(PitchingStyle), memberSettingString[columnIndex], true);
                        }
                        columnIndex++;
                        // 投手の特殊能力
                        if (memberSettingString[columnIndex] != string.Empty)
                        {
                            player.PitcherAbility.SpecialPitcherAbility = SpecialAbilityHelper.GetSpecialPitcherAbility(memberSettingString[columnIndex]);
                        }
                    }
                    else
                    {
                        // 投手能力が未設定の場合
                        const int nothingValue = 0;
                        player.PitcherAbility.Fastball = nothingValue;
                        player.PitcherAbility.Breakingball = nothingValue;
                        player.PitcherAbility.Control = nothingValue;
                        player.PitcherAbility.Stamina = nothingValue;
                        player.PitcherAbility.SpecialPitcherAbility = SpecialPitcherAbility.Nothing;

                    }
                    // メンバの作成
                    GameMember member = new GameMember(player, defensePosition);
                    member.UseKind = useKind;
                    teamSetting.DefaultGameMembers.Add(member);
                }
                lineCount++;
            }

            // デフォルトのメンバ設定を元にメンバ設定を作成
            teamSetting.CreateCurrentMembersFromDefault();

            // チーム設定のチェック(よくある設定ミスをチェック)
            CheckTeamSetting(teamSetting);

            return teamSetting;
        }
Пример #10
0
        /// <summary>
        /// チーム設定の生成(デバッグ用)
        /// </summary>
        /// <param name="teamName"></param>
        /// <param name="basicValue"></param>
        /// <returns></returns>
        public TeamSetting CreateTeamSetting(string teamName, int basicValue)
        {
            TeamSetting teamSetting = new TeamSetting(teamName, teamName.Substring(0, 1), TeamNumber.s000);

            // スタメン設定
            for (int i = 1; i <= 18; i++)
            {
                // 基本能力の設定
                GameMember member = SetBasicAbility(i, basicValue, BreedType.Cat_White_Normal, teamSetting);
            }

            // デフォルトのメンバ設定を元にメンバ設定を作成
            teamSetting.CreateCurrentMembersFromDefault();

            return teamSetting;
        }
Пример #11
0
        /// <summary>
        /// 初期化
        /// </summary>
        private void Initialize()
        {
            // 初期チーム作成
            TeamSetting = new TeamSetting("栄冠にゃいん高校", "栄", TeamNumber.s000);

            // いったん全メンバをクリア
            TeamSetting.DefaultGameMembers.Clear();
            TeamSetting.DefaultOutSideMembers.Clear();

            // 初期メンバをランダムで生成
            List<Player> players = MemberCreater.CreateInitialPlayers();

            // メンバの打順とポジションを設定
            SetMembers(players);
        }
Пример #12
0
 /// <summary>
 /// 消滅
 /// </summary>
 public void Dispose()
 {
     CurrentCobwebChart.Dispose();
     m_TeamSetting = null;
     MemberGrid.ItemsSource = null;
 }
Пример #13
0
        /// <summary>
        /// 初期化
        /// </summary>
        /// <param name="teamSetting">チーム設定</param>
        public void Initialize(TeamSetting teamSetting)
        {
            // フィールド設定
            m_TeamSetting = teamSetting;

            // チームデータ設定
            TeamName.Text = teamSetting.Name;
            SeasonCount.Text = string.Format("{0}年目", EVManager.Instance.SeasonCount);
            WinCount.Text = string.Format("{0}勝", EVManager.Instance.Win);
            LoseCount.Text = string.Format("{0}敗", EVManager.Instance.Lose);
            DrawCount.Text = string.Format("{0}分", EVManager.Instance.Draw);
            SpringKoshienCount.Text = string.Format("{0}回", EVManager.Instance.SpringKoshienCount);
            SummerKoshienCount.Text = string.Format("{0}回", EVManager.Instance.SummerKoshienCount);
            SpringKoshienVictoryCount.Text = string.Format("{0}回", EVManager.Instance.SpringKoshienVictoryCount);
            SummerKoshienVictoryCount.Text = string.Format("{0}回", EVManager.Instance.SummerKoshienVictoryCount);

            // レーダーチャート設定
            CurrentCobwebChart.Initialize(teamSetting);

            // モードによるUI更新
            UpdateControlByMode();
        }
Пример #14
0
        /// <summary>
        /// 初期化処理
        /// </summary>
        /// <param name="teamSetting"></param>
        public void Initialize(TeamSetting teamSetting)
        {
            // フィールドの格納
            TeamSetting = teamSetting;

            // フィールドの初期化
            m_Fielders.Clear();
            m_Pitchers.Clear();
            foreach (GameMember member in TeamSetting.AllDefaultTeamMembers)
            {
                if (member.Player.Grade == 1)
                {
                    if (!member.IsPitcher)
                    {
                        m_Fielders.Add(member.Clone());
                    }
                    else
                    {
                        m_Pitchers.Add(member.Clone());
                    }
                }
            }

            // 表示状態に変更
            Visibility = Visibility.Visible;

            // 選択状態が残っていたら初期化
            ClearAssignedAndSelected();

            // 能力コントロールの野手能力/投手能力の表示切り替え
            FielderAbility.IsPitcherAbility = false;
            PitcherAbility.IsPitcherAbility = true;

            // 全メンバを表示状態に設定
            List<GameMember> members = new List<GameMember>();
            members.AddRange(m_Fielders);
            members.AddRange(m_Pitchers);
            foreach (GameMember member in members)
            {
                member.Visible = true;
            }

            // ListBoxを更新する
            UpdateListBox();

            // ビューを表示する
            this.Visibility = Visibility.Visible;

            // UI表示とともにBGM再生開始(すでにBGM再生していれば何もしない)
            SoundManager.PlayBGM(SoundBGMKind.mao_9_medley02);
        }
Пример #15
0
 /// <summary>
 /// 消滅
 /// </summary>
 public void Dispose()
 {
     TeamSetting = null;
     m_Fielders = null;
     m_Pitchers = null;
 }
Пример #16
0
        /// <summary>
        /// 基本的な能力を設定する
        /// </summary>
        /// <param name="i"></param>
        /// <param name="basecValue"></param>
        /// <param name="breedType"></param>
        /// <param name="teamSetting"></param>
        /// <returns></returns>
        private GameMember SetBasicAbility(int i, int basecValue, BreedType breedType, TeamSetting teamSetting)
        {
            Player player = new Player();
            player.Name = i.ToString();
            player.BreedType = breedType;
            player.FielderAbility.Meet = basecValue;
            player.FielderAbility.Power = basecValue;
            player.FielderAbility.Run = basecValue;
            player.FielderAbility.Defense = basecValue;
            player.FielderAbility.Wisdom = basecValue;
            player.PitcherAbility.Fastball = basecValue;
            player.PitcherAbility.Breakingball = basecValue;
            player.PitcherAbility.Control = basecValue;
            player.PitcherAbility.Stamina = basecValue;
            player.IsLeftThrow = false;
            player.IsLeftBox = false;

            // 守備適性の設定
            int defensePositionIntValue = i;
            if (defensePositionIntValue > 9)
            {
                defensePositionIntValue = 0;
            }
            DefensePosition defensePosition = (DefensePosition)defensePositionIntValue;
            switch (defensePosition)
            {
                case DefensePosition.Pitcher:
                    player.FielderAbility.DefenseType = DefenseType.Pitcher;
                    break;
                case DefensePosition.Catcher:
                    player.FielderAbility.DefenseType = DefenseType.Catcher;
                    break;
                case DefensePosition.First:
                case DefensePosition.Second:
                case DefensePosition.Third:
                case DefensePosition.Short:
                    player.FielderAbility.DefenseType = DefenseType.Infielder;
                    break;
                case DefensePosition.Right:
                case DefensePosition.Center:
                case DefensePosition.Left:
                    player.FielderAbility.DefenseType = DefenseType.Outfielder;
                    break;
                case DefensePosition.Sub:
                    if (i <= 12)
                    {
                        // 控え投手3人
                        player.FielderAbility.DefenseType = DefenseType.Pitcher;
                    }
                    else if (i == 13)
                    {
                        player.FielderAbility.DefenseType = DefenseType.Catcher;
                    }
                    else if (i <= 16)
                    {
                        player.FielderAbility.DefenseType = DefenseType.Infielder;
                    }
                    else
                    {
                        player.FielderAbility.DefenseType = DefenseType.Outfielder;
                    }
                    break;
                default:
                    throw new Exception("不明な守備位置");
            }

            // メンバの作成
            GameMember member = new GameMember(player, defensePosition);
            teamSetting.DefaultGameMembers.Add(member);

            return member;
        }
Пример #17
0
        /// <summary>
        /// チームの試合データを表示する
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="teamSetting"></param>
        private void ReportTeamResult(StringBuilder builder, TeamSetting teamSetting)
        {
            builder.AppendLine(string.Format("{0}", teamSetting.Name));
            builder.AppendLine(string.Format("打率 :{0}", teamSetting.BattingAverage));
            builder.AppendLine(string.Format("出塁率:{0}", teamSetting.OnBasePercentage));
            builder.AppendLine(string.Format("長打率:{0}", teamSetting.SluggingAverage));
            builder.AppendLine(string.Format("OPS   :{0}", teamSetting.OPS));
            builder.AppendLine(string.Format("打席数:{0}", teamSetting.BatCount));
            builder.AppendLine(string.Format("安打数:{0}", teamSetting.HitCount));
            builder.AppendLine(string.Format("二塁打:{0}", teamSetting.TwoBaseHitCount));
            builder.AppendLine(string.Format("三塁打:{0}", teamSetting.ThreeBaseHitCount));
            builder.AppendLine(string.Format("本塁打:{0}", teamSetting.HomeRunCount));
            builder.AppendLine(string.Format("四死球:{0}", teamSetting.FourBollOrDeadBollCount));
            builder.AppendLine(string.Format("犠打 :{0}", teamSetting.SacrificeCount));
            builder.AppendLine(string.Format("三振 :{0}", teamSetting.StrikeOutCount));
            builder.AppendLine(string.Format("盗塁 :{0}", teamSetting.StealCount));
            builder.AppendLine(string.Format("盗塁死:{0}", teamSetting.StealOutCount));
            builder.AppendLine(string.Format("エラー:{0}", teamSetting.ErrorCount));
            builder.AppendLine(string.Format("暴投 :{0}", teamSetting.WildPitchCount));
            builder.AppendLine(string.Format("投球数:{0}", teamSetting.ThrowBollCount));

            // 投手の表示
            foreach (GameMember pitcherMember in teamSetting.CurrentPitchedMembers)
            {
                builder.AppendLine(string.Format("{0}:投球回 {1}", pitcherMember.Name, pitcherMember.PitchingResult.ThrowInningString));
            }
        }
Пример #18
0
        /// <summary>
        /// 投手スタミナをデフォルトのメンバ設定に反映し、少し回復させた状態にする
        /// </summary>
        /// <param name="teamSetting"></param>
        private void ReflectGameMemberStamina(TeamSetting teamSetting)
        {
            // 試合に登録しているメンバが対象
            foreach (GameMember gameMember in teamSetting.AllCurrentGameMembers)
            {
                // スタミナ全快でないメンバのみが対象
                if (gameMember.RemainingStamina < gameMember.MaxStamina)
                {
                    // デフォルトのメンバ設定に反映
                    GameMember defaultMember = teamSetting.AllDefaultTeamMembers.First(m => m.Player == gameMember.Player);
                    defaultMember.RemainingStamina = gameMember.RemainingStamina;

                    // デフォルトのメンバ設定のスタミナに試合間隔で少し回復する分を加算
                    // (消費したスタミナの1/2を回復か、固定の最小値の多い方を回復)
                    double burnupStamina = defaultMember.MaxStamina - defaultMember.RemainingStamina;
                    double recoverStamina = burnupStamina * 1 / 2;
                    recoverStamina = Math.Max(recoverStamina, defaultMember.MaxStamina * EventConstants.MinRecoverStamina);
                    defaultMember.RemainingStamina += (int)recoverStamina;
                    if (defaultMember.RemainingStamina > defaultMember.MaxStamina)
                    {
                        // 残りスタミナが最大値を超えている場合は補正する
                        defaultMember.RemainingStamina = defaultMember.MaxStamina;
                    }
                }
            }
        }