Esempio n. 1
0
        /// <summary>
        /// ロードする
        /// </summary>
        public static void Load()
        {
            string filePath = GetSaveFilePath();
            string stringData = File.ReadAllText(filePath);
            //Byte[] bytes = Encoding.UTF8.GetBytes(stringData);
            Byte[] bytes = Convert.FromBase64String(stringData);

            // 復元する
            EVManager.Instance.Load(bytes);

            // 試合直前でオートセーブした場合は、リセット禁止のために負けた扱いとする
            if (EVManager.Instance.AutoSaveBefereGame)
            {
                // フラグを降ろす
                EVManager.Instance.AutoSaveBefereGame = false;

                // 相手の学校ランクは不明のため、弱小校に負けた扱いとする
                EVManager.Instance.ApplyGameResult(GameResultKind.Lose, SchoolGradeKind.Week, TeamNumber.s000, 0);

                // ユーザに通知
                // アプリケーションを終了するために終了メッセージを表示
                MessageWindow window = new MessageWindow();
                window.Text = "申し訳ありませんが、前回プレイ時に試合中に中断されたため、試合結果はセーブされていません。" + Environment.NewLine +
                              "残念ですが、試合に負けた扱いとしてプレイの再開をお願いします。";
                window.ShowDialog();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// セーブボタンハンドラ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveButton_OnClick(object sender, RoutedEventArgs e)
        {
            // セーブする
            SaveManager.Save();

            if (!SaveManager.HasSaveData)
            {
                MessageBox.Show("保存に失敗しました");
                return;
            }

            // アプリケーションを終了するために終了メッセージを表示
            MessageWindow window = new MessageWindow();
            window.Text = "セーブしました。" + Environment.NewLine +
                          "ちなみに[翌月へ]ボタンを押すたびに自動セーブもしています。" + Environment.NewLine +
                          "なので栄冠ナインと同様にセーブ&リセットはできないのでご注意ください。";
            window.ShowDialog();
        }
        /// <summary>
        /// 守備位置テキストのMouseEnterハンドラ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PositionFrame_MouseEnter(object sender, MouseEventArgs e)
        {
            // 守備位置変更可能なモードでなければ変更しない
            if (!CanChangeDefensePosition)
            {
                return;
            }

            // デバッグ中でなく、説明済みでない場合は説明ウィンドウ表示
            if (EVManager.Instance.DebugMode == false && EVManager.Instance.DescribedForDefensePosition == false)
            {
                EVManager.Instance.DescribedForDefensePosition = true;

                MessageWindow window = new MessageWindow();
                window.Text = "守備位置変更の説明です。" + Environment.NewLine +
                              "この画面では、スタメンと打順の変更だけでなく、守備位置も変更できます。" + Environment.NewLine +
                              "[遊]や[三]などと表示されている部分をクリックすると守備位置のみを入れ替えることができます。";
                window.ShowDialog();
                return;
            }

            // 守備位置テキストのホバー中フラグの設定
            IsPositionTextHover = true;

            Border border = (Border)sender;
            if (border.Background != s_AssignedBrush)
            {
                // 1人目を通常モードで指定した場合の2人目指定中は
                // 守備位置テキストの背景色を変更しない
                if (!OneAssigned || IsPositionChanging)
                {
                    border.Background = s_PositionTextHoverBrush;
                }
            }
        }
        /// <summary>
        /// 練習種別列にMouseEnterしたときのハンドラ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PracticeList_OnMouseEnter(object sender, MouseEventArgs e)
        {
            // デバッグ中は表示しない
            if (EVManager.Instance.DebugMode)
            {
                return;
            }

            // すでに説明済みであれば何もしない
            if (EVManager.Instance.DescribedForPractice)
            {
                return;
            }

            // 初回のみ操作方法を説明
            EVManager.Instance.DescribedForPractice = true;

            MessageWindow window = new MessageWindow();
            window.Text = "練習の設定方法の説明です。" + Environment.NewLine +
                          "[おまかせ]と表示されている部分をクリックすると、ミートやパワーなどが選択できるので、上げたい能力を選択してください。" + Environment.NewLine +
                          "また、選手の各能力の値をクリックすることでも、その能力を上げるように練習を設定できます。こちらの方がお手軽なので試してみてください。" + Environment.NewLine +
                          "初期状態では野手能力を表示しています。投手能力を表示するには、左下の[投手能力]ボタンを押してください。";
            window.ShowDialog();
        }
        /// <summary>
        /// 練習種別列のコンボボックスのドロップダウン表示イベントハンドラ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PracticeList_OnDropDownOpened(object sender, EventArgs e)
        {
            // コンボボックスの更新
            PracticeList_Loaded(sender, e);

            // 対象メンバの取得
            ComboBox combo = sender as ComboBox;
            if (combo == null)
            {
                return;
            }
            GameMember member = combo.DataContext as GameMember;
            if (member == null)
            {
                return;
            }

            if (member.Player.InitialAbility == InitialAbility.D && EVManager.Instance.DescribedForGeniusChangeDefense == false)
            {
                // 初回のみ天才が守備位置変更できないことを説明
                EVManager.Instance.DescribedForGeniusChangeDefense = true;

                MessageWindow window = new MessageWindow();
                window.Text = "天才型の選手の補足です。" + Environment.NewLine +
                              "天才型の選手は初期能力が高い代わりに守備位置を変更することができません。" + Environment.NewLine +
                              "中学時代からその守備位置で不動のレギュラーだったプライドがあるので、守備位置変更を受け入れられないのです。";
                window.ShowDialog();
            }
        }