完成品
実際にデータカウンターアプリを動かしてみたらこんな感じです。
この記事が自分でデータカウンターを作ってみたいという方の参考になれば幸いです。
では中身を見ていきましょう。
システム
システム構成は、データ収集機、PC、パチスロ実機を繋いだ構成となります。

ハードウェア
データカウンターシステムのハードウェアです。
パチスロ実機 | パチスロ 新世紀エヴァンゲリオン 〜まごころを、君に〜 |
Arduino | Arduino Nano Every |
PC | Windows11 64bit |
ユニバーサル基板上にArduinoをプルアップ抵抗とともに実装し、データ収集機として取り扱います。
ソフトウェア
データ収集機とPCに対し、それぞれ専用のソフトウェアを開発します。ソフトウェアの名称は下記とします。
データ収集機 | DataCollector |
PC | DataCounter |
このうち、データ収集機側のソフトウェア『DataCollector』は、以前の記事で作成しましたのでこちらをご参照ください。
データカウンター(PC)解説
開発環境はMicrosoftの『Visual Studio Community 2022(64bit) Ver.17.10.4』を使用します。インストール方法については、こちらの記事をご参照ください。
WPF(Windows Presentation Foundation)という.NET Frameworkに含まれるUIフレームワークを使用します。
もちろん他のUIフレームワークでも問題ありません。
品目 | バージョン | 用途 |
---|---|---|
Prism.Unity | 9.0.537 | MVVMの設計パターンのフレームワーク |
ScottPlot.WPF | 5.0.47 | グラフ描画のためのライブラリ |
System.IO.Ports | 9.0.0 | シリアル通信クラスを利用するための入出力ライブラリ |
System.Text.Json | 9.0.0 | JSON形式のデータ加工のためのライブラリ |
Microsoft.Xaml.Behaviors.Wpf | 1.1.135 | XAMLで「Interaction.Triggers」を使用するためのライブラリ |
MaterialDesignThemes | 5.1.0 | WPFをモダンなUIデザインにするためのライブラリ |
MahApps.Metro | 2.4.10 | WPFをモダンなUIデザインにするためのライブラリ |
MahApps.Metro.IconPacks | 5.1.0 | Metroに合うアイコンのライブラリ |
アプリケーションを開発する際には、ライブラリを使用するのが一般的です。今回使用したのはこちらです。
特に『Prism.Unity』、『ScottPlot.WPF』、『System.IO.Ports』、『System.Text.Json』については、別の記事で詳細に解説していますのでご参照ください。
また、『MaterialDesignThemes』、『MahApps.Metro』、『Microsoft.Xaml.Behaviors.Wpf』については、他のサイトで詳しく解説されているので、そちらをご参照いただけたらと思います。

DataCounterのプログラム全体フローチャート(アクティビティ図)です。
橙色のレーンがModel、青色のレーンがViewModelを表しています。フローの始まりは一番左のシリアル通信クラスで、受信をきっかけにして全体のフローが流れていきます。
また、フローを見るとViewModelでやることは、『Modelのメソッドの呼び出し』と『プロパティの変更通知を受けてViewの表示を更新する』ことのみです。
これがMVVMの設計コンセプトであると私は理解しています。詳しくはこちらの記事をご参照ください。
こちらがソースコードです。
App.xaml.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
namespace Pachislot_DataCounter { /// <summary> /// Interaction logic for App.xaml /// </summary> public partial class App : PrismApplication { private Mutex m_Mutex = new Mutex( false, "Pachislot_DataCounter" ); /// <summary> /// Prismフレームワークで自動生成されるメソッド /// アプリ開始時に起動するWindowを設定する /// </summary> /// <returns>MainWindowのインスタンス</returns> protected override Window CreateShell( ) { return Container.Resolve<MainWindow>( ); } /// <summary> /// ViewとViewModelの関連付けを行いDIコンテナに登録する /// </summary> /// <param name="containerRegistry">DIコンテナ</param> protected override void RegisterTypes( IContainerRegistry p_ContainerRegistry ) { p_ContainerRegistry.RegisterSingleton<DataManager>( ); p_ContainerRegistry.Register<NumCounter>( ); p_ContainerRegistry.Register<SerialPort>( ); p_ContainerRegistry.Register<BonusHistoryList>( ); p_ContainerRegistry.Register<GraphDrawer>( ); p_ContainerRegistry.Register<IDialogCoordinator, DialogCoordinator>( ); } /// <summary> /// モジュールがあるときに使用する /// </summary> /// <param name="p_ModuleCatalog"></param> protected override void ConfigureModuleCatalog( IModuleCatalog p_ModuleCatalog ) { } /// <summary> /// スタートアップ時の処理 /// </summary> /// <param name="sender">イベント元オブジェクト</param> /// <param name="e">スタートアップイベントデータ</param> private void PrismApplication_Startup( object sender, StartupEventArgs e ) { if ( m_Mutex.WaitOne( 0, false ) ) { return; } MessageBox.Show( "二重起動できません", "情報", MessageBoxButton.OK, MessageBoxImage.Information ); m_Mutex.Close( ); m_Mutex = null; Shutdown( ); } /// <summary> /// アプリ終了時の処理 /// </summary> /// <param name="sender">イベント元オブジェクト</param> /// <param name="e">終了イベントデータ</param> private void PrismApplication_Exit( object sender, ExitEventArgs e ) { if ( m_Mutex != null ) { m_Mutex.ReleaseMutex( ); m_Mutex.Close( ); } } } } |
MODEL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
/** * ============================================================= * File :SerialCom.cs * Summary :シリアル通信クラス * ============================================================= */ namespace Pachislot_DataCounter.Models { public class SerialCom : BindableBase { // ======================================================= // メンバ変数 // ======================================================= private SerialPort m_SerialPort; private DataManager m_DataManager; // ======================================================= // プロパティ // ======================================================= private ObservableCollection<string> m_PortList = new ObservableCollection<string>(); public ObservableCollection<string> PortList { get { return m_PortList; } set { SetProperty( ref m_PortList, value ); } } private string m_SelectedPort; public string SelectedPort { get { return m_SelectedPort; } set { SetProperty( ref m_SelectedPort, value ); } } private string m_ConnectBadge; public string ConnectBadge { get { return m_ConnectBadge; } set { SetProperty( ref m_ConnectBadge, value ); } } // ======================================================= // コンストラクタ // ======================================================= /// <summary> /// コンストラクタ /// </summary> public SerialCom( SerialPort p_SerialPort, DataManager p_DataManager ) { m_DataManager = p_DataManager; m_SerialPort = p_SerialPort; m_SerialPort.BaudRate = 115200; m_SerialPort.DataBits = 8; m_SerialPort.Parity = Parity.None; m_SerialPort.Encoding = Encoding.UTF8; m_SerialPort.WriteTimeout = 5000; m_SerialPort.ReadTimeout = 5000; m_SerialPort.DtrEnable = true; foreach ( var port in SerialPort.GetPortNames( ) ) { PortList.Add( port ); } SelectedPort = PortList.FirstOrDefault( ); m_SerialPort.DataReceived += ( sender, e ) => { string message; GameInfo gameInfo = null; try { message = m_SerialPort.ReadLine( ); gameInfo = JsonSerializer.Deserialize<GameInfo>( message ); Application.Current.Dispatcher.Invoke( ( ) => { m_DataManager.Store( gameInfo ); } ); } catch ( Exception ex ) { MessageBox.Show( ex.Message, "エラー" ); } }; } // ======================================================= // 公開メソッド // ======================================================= /// <summary> /// 通信スタート /// </summary> public void ComStart( ) { try { m_SerialPort.PortName = SelectedPort; m_SerialPort.Open( ); ConnectBadge = "接続中"; } catch { throw; } } /// <summary> /// 通信ストップ /// </summary> public void ComStop( ) { try { if ( m_SerialPort.IsOpen ) { m_SerialPort.Close( ); ConnectBadge = string.Empty; } } catch { throw; } } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
/** * ============================================================= * File :DataManager.cs * Summary :データ管理クラス * ============================================================= */ namespace Pachislot_DataCounter.Models { public class DataManager : BindableBase { // ======================================================= // メンバ変数 // ======================================================= private int m_BigBonus; private int m_RegularBonus; private int m_AllGame; private int m_CurrentGame; private int m_InCoin; private int m_OutCoin; private int m_DiffCoin; private bool m_DuringRB; private bool m_DuringBB; private bool m_DuringBonus; // ======================================================= // プロパティ // ======================================================= /// <summary> /// ビッグボーナス回数 /// </summary> public int BigBonus { get { return m_BigBonus; } set { SetProperty( ref m_BigBonus, value ); } } /// <summary> /// レギュラーボーナス回数 /// </summary> public int RegularBonus { get { return m_RegularBonus; } set { SetProperty( ref m_RegularBonus, value ); } } /// <summary> /// 累計ゲーム数 /// </summary> public int AllGame { get { return m_AllGame; } set { SetProperty( ref m_AllGame, value ); } } /// <summary> /// 現在のゲーム数 /// </summary> public int CurrentGame { get { return m_CurrentGame; } set { SetProperty( ref m_CurrentGame, value ); } } /// <summary> /// IN枚数 /// </summary> public int InCoin { get { return m_InCoin; } set { SetProperty( ref m_InCoin, value ); } } /// <summary> /// OUT枚数 /// </summary> public int OutCoin { get { return m_OutCoin; } set { SetProperty( ref m_OutCoin, value ); } } /// <summary> /// 差枚数 /// </summary> public int DiffCoin { get { return m_DiffCoin; } set { SetProperty( ref m_DiffCoin, value ); } } /// <summary> /// レギュラーボーナス中フラグ /// </summary> public bool DuringRB { get { return m_DuringRB; } set { SetProperty( ref m_DuringRB, value ); } } /// <summary> /// ビッグボーナス中フラグ /// </summary> public bool DuringBB { get { return m_DuringBB; } set { SetProperty( ref m_DuringBB, value ); } } /// <summary> /// ボーナス中フラグ /// </summary> public bool DuringBonus { get { return m_DuringBonus; } set { SetProperty( ref m_DuringBonus, value ); } } /// <summary> /// コンストラクタ /// </summary> public DataManager( ) { BigBonus = 0; RegularBonus = 0; AllGame = 0; CurrentGame = 0; InCoin = 0; OutCoin = 0; DiffCoin = 0; DuringRB = false; DuringBB = false; DuringBonus = false; } /// <summary> /// ゲーム情報を保存する /// </summary> /// <param name="p_GameInfo">ゲーム情報</param> public void Store( GameInfo p_GameInfo ) { DuringRB = p_GameInfo.DuringRB; DuringBB = p_GameInfo.DuringBB; DuringBonus = DuringBB || DuringRB; CurrentGame = p_GameInfo.Game; AllGame = p_GameInfo.TotalGame; InCoin = p_GameInfo.In; OutCoin = p_GameInfo.Out; DiffCoin = p_GameInfo.Diff; RegularBonus = p_GameInfo.RB; BigBonus = p_GameInfo.BB; } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
/** * ============================================================= * File :NumCounter.cs * Summary :数値⇒数字画像変換クラス * ============================================================= */ namespace Pachislot_DataCounter.Models { public class NumCounter : BindableBase { // ======================================================= // メンバ変数 // ======================================================= /// <summary> /// 数字と数字画像の1対1の対応付けを行うディクショナリ /// </summary> private Dictionary<uint, BitmapImage> m_NumDictionary; // ======================================================= // プロパティ // ======================================================= /// <summary> /// 符号 /// </summary> private BitmapImage m_Sign; public BitmapImage Sign { get { return m_Sign; } set { SetProperty( ref m_Sign, value ); } } /// <summary> /// 6桁目の数値 /// </summary> private BitmapImage m_SixthDigit; public BitmapImage SixthDigit { get { return m_SixthDigit; } set { SetProperty( ref m_SixthDigit, value ); } } /// <summary> /// 5桁目の数値 /// </summary> private BitmapImage m_FifthDigit; public BitmapImage FifthDigit { get { return m_FifthDigit; } set { SetProperty( ref m_FifthDigit, value ); } } /// <summary> /// 4桁目の数値 /// </summary> private BitmapImage m_ForthDigit; public BitmapImage ForthDigit { get { return m_ForthDigit; } set { SetProperty( ref m_ForthDigit, value ); } } /// <summary> /// 3桁目の数値 /// </summary> private BitmapImage m_ThirdDigit; public BitmapImage ThirdDigit { get { return m_ThirdDigit; } set { SetProperty( ref m_ThirdDigit, value ); } } /// <summary> /// 2桁目の数値 /// </summary> private BitmapImage m_SecondDigit; public BitmapImage SecondDigit { get { return m_SecondDigit; } set { SetProperty( ref m_SecondDigit, value ); } } /// <summary> /// 1桁目の数値 /// </summary> private BitmapImage m_FirstDigit; public BitmapImage FirstDigit { get { return m_FirstDigit; } set { SetProperty( ref m_FirstDigit, value ); } } // ======================================================= // コンストラクタ // ======================================================= /// <summary> /// コンストラクタ /// </summary> public NumCounter( ) { m_NumDictionary = new Dictionary<uint, BitmapImage> { { 0, create_bitmap_image( "pack://application:,,,/Resource/数字/数字(0).png" ) }, { 1, create_bitmap_image( "pack://application:,,,/Resource/数字/数字(1).png" ) }, { 2, create_bitmap_image( "pack://application:,,,/Resource/数字/数字(2).png" ) }, { 3, create_bitmap_image( "pack://application:,,,/Resource/数字/数字(3).png" ) }, { 4, create_bitmap_image( "pack://application:,,,/Resource/数字/数字(4).png" ) }, { 5, create_bitmap_image( "pack://application:,,,/Resource/数字/数字(5).png" ) }, { 6, create_bitmap_image( "pack://application:,,,/Resource/数字/数字(6).png" ) }, { 7, create_bitmap_image( "pack://application:,,,/Resource/数字/数字(7).png" ) }, { 8, create_bitmap_image( "pack://application:,,,/Resource/数字/数字(8).png" ) }, { 9, create_bitmap_image( "pack://application:,,,/Resource/数字/数字(9).png" ) } }; Sign = null; SixthDigit = null; FifthDigit = null; ForthDigit = null; ThirdDigit = null; SecondDigit = null; FirstDigit = m_NumDictionary[ 0 ]; } // ======================================================= // 公開メソッド // ======================================================= /// <summary> /// 整数型の数値を設定すると適切に数値画像を選択する /// </summary> /// <param name="p_Number">整数</param> public void SetNumber( int p_Number ) { uint abs_number; uint temp; abs_number = ( uint )Math.Abs( p_Number ); if ( abs_number >= 0 && abs_number < 10 ) { SixthDigit = null; FifthDigit = null; ForthDigit = null; ThirdDigit = null; SecondDigit = null; FirstDigit = m_NumDictionary[ abs_number ]; Sign = p_Number < 0 ? create_bitmap_image( "pack://application:,,,/Resource/数字/数字(Sign).png" ) : null; } else if ( abs_number >= 10 && abs_number < 100 ) { SixthDigit = null; FifthDigit = null; ForthDigit = null; ThirdDigit = null; SecondDigit = m_NumDictionary[ abs_number / 10 ]; temp = abs_number % 10; FirstDigit = m_NumDictionary[ temp ]; Sign = p_Number < 0 ? create_bitmap_image( "pack://application:,,,/Resource/数字/数字(Sign).png" ) : null; } else if ( abs_number >= 100 && abs_number < 1000 ) { SixthDigit = null; FifthDigit = null; ForthDigit = null; ThirdDigit = m_NumDictionary[ abs_number / 100 ]; temp = abs_number % 100; SecondDigit = m_NumDictionary[ temp / 10 ]; temp = abs_number % 10; FirstDigit = m_NumDictionary[ temp ]; Sign = p_Number < 0 ? create_bitmap_image( "pack://application:,,,/Resource/数字/数字(Sign).png" ) : null; } else if ( abs_number >= 1000 && abs_number < 10000 ) { SixthDigit = null; FifthDigit = null; ForthDigit = m_NumDictionary[ abs_number / 1000 ]; temp = abs_number % 1000; ThirdDigit = m_NumDictionary[ temp / 100 ]; temp = abs_number % 100; SecondDigit = m_NumDictionary[ temp / 10 ]; temp = abs_number % 10; FirstDigit = m_NumDictionary[ temp ]; Sign = p_Number < 0 ? create_bitmap_image( "pack://application:,,,/Resource/数字/数字(Sign).png" ) : null; } else if ( abs_number >= 10000 && abs_number < 100000 ) { SixthDigit = null; FifthDigit = m_NumDictionary[ abs_number / 10000 ]; temp = abs_number % 10000; ForthDigit = m_NumDictionary[ temp / 1000 ]; temp = abs_number % 1000; ThirdDigit = m_NumDictionary[ temp / 100 ]; temp = abs_number % 100; SecondDigit = m_NumDictionary[ temp / 10 ]; temp = abs_number % 10; FirstDigit = m_NumDictionary[ temp ]; Sign = p_Number < 0 ? create_bitmap_image( "pack://application:,,,/Resource/数字/数字(Sign).png" ) : null; } else if ( abs_number >= 100000 && abs_number < 1000000 ) { SixthDigit = m_NumDictionary[ abs_number / 100000 ]; temp = abs_number % 100000; FifthDigit = m_NumDictionary[ temp / 10000 ]; temp = abs_number % 10000; ForthDigit = m_NumDictionary[ temp / 1000 ]; temp = abs_number % 1000; ThirdDigit = m_NumDictionary[ temp / 100 ]; temp = abs_number % 100; SecondDigit = m_NumDictionary[ temp / 10 ]; temp = abs_number % 10; FirstDigit = m_NumDictionary[ temp ]; Sign = p_Number < 0 ? create_bitmap_image( "pack://application:,,,/Resource/数字/数字(Sign).png" ) : null; } else { SixthDigit = m_NumDictionary[ 9 ]; FirstDigit = m_NumDictionary[ 9 ]; SecondDigit = m_NumDictionary[ 9 ]; ThirdDigit = m_NumDictionary[ 9 ]; ForthDigit = m_NumDictionary[ 9 ]; FifthDigit = m_NumDictionary[ 9 ]; Sign = p_Number < 0 ? create_bitmap_image( "pack://application:,,,/Resource/数字/数字(Sign).png" ) : null; } } // ======================================================= // 非公開メソッド // ======================================================= /// <summary> /// 数字画像のパスを指定するとBitmapImageクラスのインスタンスにして返す /// </summary> /// <param name="p_FilePath">数字画像のパス</param> /// <returns>数字画像のBitmapImage</returns> private BitmapImage create_bitmap_image( string p_FilePath ) { BitmapImage img = new BitmapImage( ); try { img.BeginInit( ); img.CacheOption = BitmapCacheOption.OnLoad; img.UriSource = new Uri( p_FilePath, UriKind.Absolute ); img.EndInit( ); img.Freeze( ); } catch ( Exception e ) { Debug.WriteLine( e.Message ); } return img; } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
/** * ============================================================= * File :GraphDrawer.cs * Summary :グラフ描画クラス * ============================================================= */ namespace Pachislot_DataCounter.Models { public class GraphDrawer : BindableBase { // ======================================================= // メンバ変数 // ======================================================= private DataManager m_DataManager; private List<int> m_GamesList; private List<int> m_CoinDiffList; // ======================================================= // プロパティ // ======================================================= public WpfPlot ScottPlot { set; get; } // ======================================================= // コンストラクタ // ======================================================= public GraphDrawer( DataManager p_DataManager ) { setting_graph( ); m_DataManager = p_DataManager; m_DataManager.PropertyChanged += ( sender, e ) => { if ( e.PropertyName == "AllGame" && m_DataManager.AllGame % 10 == 0 ) { draw_graph( m_DataManager.AllGame, m_DataManager.DiffCoin ); } }; } // ======================================================= // 非公開メソッド // ======================================================= /// <summary> /// グラフ設定 /// </summary> private void setting_graph( ) { ScottPlot = new WpfPlot( ); m_GamesList = new List<int>( ) { 0 }; m_CoinDiffList = new List<int>( ) { 0 }; // Y軸 ScottPlot.Plot.Axes.Left.Label.Text = "差枚数"; ScottPlot.Plot.Axes.Left.Label.FontName = "BIZ UDゴシック"; ScottPlot.Plot.Axes.Left.Label.ForeColor = Colors.Azure; ScottPlot.Plot.Axes.Left.Label.FontSize = 20; ScottPlot.Plot.Axes.Left.Label.Bold = true; ScottPlot.Plot.Axes.Left.MajorTickStyle.Color = Colors.GoldenRod; ScottPlot.Plot.Axes.Left.MinorTickStyle.Color = Colors.Transparent; ScottPlot.Plot.Axes.Left.MinorTickStyle.Length = 0; ScottPlot.Plot.Axes.Left.TickLabelStyle.ForeColor = Colors.Azure; ScottPlot.Plot.Axes.Left.TickLabelStyle.FontSize = 20; ScottPlot.Plot.Axes.Left.TickLabelStyle.Bold = true; ScottPlot.Plot.Axes.Left.FrameLineStyle.Color = Colors.Azure; ScottPlot.Plot.Axes.Left.FrameLineStyle.Width = 4; ScottPlot.TickGenerators.NumericAutomatic l_TickGenY = new ScottPlot.TickGenerators.NumericAutomatic(); l_TickGenY.TargetTickCount = 5; ScottPlot.Plot.Axes.Left.TickGenerator = l_TickGenY; // X軸 ScottPlot.Plot.Axes.Bottom.Label.Text = "ゲーム数"; ScottPlot.Plot.Axes.Bottom.Label.FontName = "BIZ UDゴシック"; ScottPlot.Plot.Axes.Bottom.Label.ForeColor = Colors.Azure; ScottPlot.Plot.Axes.Bottom.Label.FontSize = 20; ScottPlot.Plot.Axes.Bottom.Label.Bold = true; ScottPlot.Plot.Axes.Bottom.MajorTickStyle.Color = Colors.GoldenRod; ScottPlot.Plot.Axes.Bottom.MinorTickStyle.Color = Colors.Transparent; ScottPlot.Plot.Axes.Bottom.MinorTickStyle.Length = 0; ScottPlot.Plot.Axes.Bottom.TickLabelStyle.ForeColor = Colors.Azure; ScottPlot.Plot.Axes.Bottom.TickLabelStyle.FontSize = 20; ScottPlot.Plot.Axes.Bottom.TickLabelStyle.Bold = true; ScottPlot.Plot.Axes.Bottom.FrameLineStyle.Color = Colors.Azure; ScottPlot.Plot.Axes.Bottom.FrameLineStyle.Width = 4; ScottPlot.TickGenerators.NumericAutomatic l_TickGenX = new ScottPlot.TickGenerators.NumericAutomatic(); l_TickGenX.TargetTickCount = 6; ScottPlot.Plot.Axes.Bottom.TickGenerator = l_TickGenX; // グリッド ScottPlot.Plot.Grid.MajorLineColor = Colors.Azure.WithOpacity( 0.2 ); // 全体 ScottPlot.Plot.FigureBackground.Color = Colors.Transparent; ScottPlot.Plot.DataBackground.Color = Color.FromHex( "#1F1F1F" ); // 最初の軸最大最小を設定 ScottPlot.Plot.Axes.SetLimits( 0, 1000, -1000, 1000 ); // 初期データを設定 var l_Line = ScottPlot.Plot.Add.ScatterLine( m_GamesList, m_CoinDiffList ); l_Line.Color = Colors.Gold; l_Line.LineWidth = 6; l_Line.MarkerSize = 0; ScottPlot.Refresh( ); } /// <summary> /// 新しい点をグラフにプロットして描画 /// </summary> /// <param name="p_Game">新しい点の累計ゲーム数</param> /// <param name="p_CoinDiff">差枚数</param> private void draw_graph( int p_Game, int p_CoinDiff ) { m_GamesList.Add( p_Game ); m_CoinDiffList.Add( p_CoinDiff ); var l_Line = ScottPlot.Plot.Add.ScatterLine( m_GamesList, m_CoinDiffList ); l_Line.Color = Colors.Gold; l_Line.LineWidth = 6; l_Line.MarkerSize = 0; AxisLimits l_Limits = ScottPlot.Plot.Axes.GetLimits( ); double l_Min_X = l_Limits.Left; double l_Max_X = l_Limits.Right; double l_Min_Y = l_Limits.Bottom; double l_Max_Y = l_Limits.Top; if ( p_Game >= ( l_Max_X * 0.8 ) ) { l_Max_X = l_Max_X * 2.0; } if ( m_CoinDiffList.Min( ) <= ( l_Min_Y * 0.8 ) ) { l_Min_Y = l_Min_Y * 2.0; } if ( m_CoinDiffList.Max( ) >= ( l_Max_Y * 0.8 ) ) { l_Max_Y = l_Max_Y * 2.0; } ScottPlot.Plot.Axes.SetLimits( l_Min_X, l_Max_X, l_Min_Y, l_Max_Y ); ScottPlot.Refresh( ); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
/** * ============================================================= * File :BonusHistoryList.cs * Summary :ボーナス履歴リストクラス * ============================================================= */ namespace Pachislot_DataCounter.Models { public class BonusHistoryList : BindableBase { // ======================================================= // 列挙型 // ======================================================= private enum BonusType { BIG_BONUS, REGULAR_BONUS, NONE } // ======================================================= // メンバ変数 // ======================================================= private DataManager m_DataManager; // ======================================================= // プロパティ // ======================================================= /// <summary> /// 現在のゲーム数に合わせたバー表示リスト /// </summary> public ObservableCollection<GamesBar> CurrentGameBar { get; set; } /// <summary> /// 1回前から10回前のボーナス履歴のバー表示リスト /// </summary> public ObservableCollection<GamesBar> BonusHistory { get; set; } // ======================================================= // コンストラクタ // ======================================================= /// <summary> /// コンストラクタ /// </summary> /// <param name="p_DataManager">データ管理クラスオブジェクト</param> public BonusHistoryList( DataManager p_DataManager ) { m_DataManager = p_DataManager; CurrentGameBar = new ObservableCollection<GamesBar>( ); CurrentGameBar.Add( new GamesBar { Bar_Ten = Visibility.Hidden, Bar_Nine = Visibility.Hidden, Bar_Eight = Visibility.Hidden, Bar_Seven = Visibility.Hidden, Bar_Six = Visibility.Hidden, Bar_Five = Visibility.Hidden, Bar_Four = Visibility.Hidden, Bar_Three = Visibility.Hidden, Bar_Two = Visibility.Hidden, Bar_One = Visibility.Visible, TimesAgo = "現在", KindOfBonus = "NONE", Games = 0 } ); BonusHistory = new ObservableCollection<GamesBar>( ); for ( int i = 0; i < 10; i++ ) { BonusHistory.Add( new GamesBar { Bar_Ten = Visibility.Hidden, Bar_Nine = Visibility.Hidden, Bar_Eight = Visibility.Hidden, Bar_Seven = Visibility.Hidden, Bar_Six = Visibility.Hidden, Bar_Five = Visibility.Hidden, Bar_Four = Visibility.Hidden, Bar_Three = Visibility.Hidden, Bar_Two = Visibility.Hidden, Bar_One = Visibility.Visible, TimesAgo = i + 1 + "回前", KindOfBonus = "NONE", Games = 0 } ); } m_DataManager.PropertyChanged += ( sender, e ) => { if ( e.PropertyName == "CurrentGame" ) { update_currentgames( m_DataManager.CurrentGame ); RaisePropertyChanged( "CurrentGameBar" ); } if ( e.PropertyName == "DuringRB" && m_DataManager.DuringRB == false ) { update_bonushistory( BonusType.REGULAR_BONUS ); RaisePropertyChanged( "BonusHistory" ); } if ( e.PropertyName == "DuringBB" && m_DataManager.DuringBB == false ) { update_bonushistory( BonusType.BIG_BONUS ); RaisePropertyChanged( "BonusHistory" ); } }; } // ======================================================= // 非公開メソッド // ======================================================= /// <summary> /// ゲーム数が更新されたときに現在ゲーム数のバー表示も更新する /// </summary> /// <param name="p_GameCount">現在のゲーム数</param> private void update_currentgames( int p_GameCount ) { CurrentGameBar[ 0 ].Games = p_GameCount; if ( p_GameCount < 100 ) { CurrentGameBar[ 0 ].Bar_Ten = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Nine = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Eight = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Seven = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Six = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Five = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Four = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Three = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Two = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_One = Visibility.Visible; } else if ( 100 <= p_GameCount && p_GameCount < 200 ) { CurrentGameBar[ 0 ].Bar_Ten = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Nine = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Eight = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Seven = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Six = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Five = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Four = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Three = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Two = Visibility.Visible; CurrentGameBar[ 0 ].Bar_One = Visibility.Visible; } else if ( 200 <= p_GameCount && p_GameCount < 300 ) { CurrentGameBar[ 0 ].Bar_Ten = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Nine = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Eight = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Seven = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Six = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Five = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Four = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Three = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Two = Visibility.Visible; CurrentGameBar[ 0 ].Bar_One = Visibility.Visible; } else if ( 300 <= p_GameCount && p_GameCount < 400 ) { CurrentGameBar[ 0 ].Bar_Ten = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Nine = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Eight = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Seven = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Six = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Five = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Four = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Three = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Two = Visibility.Visible; CurrentGameBar[ 0 ].Bar_One = Visibility.Visible; } else if ( 400 <= p_GameCount && p_GameCount < 500 ) { CurrentGameBar[ 0 ].Bar_Ten = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Nine = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Eight = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Seven = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Six = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Five = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Four = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Three = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Two = Visibility.Visible; CurrentGameBar[ 0 ].Bar_One = Visibility.Visible; } else if ( 500 <= p_GameCount && p_GameCount < 600 ) { CurrentGameBar[ 0 ].Bar_Ten = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Nine = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Eight = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Seven = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Six = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Five = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Four = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Three = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Two = Visibility.Visible; CurrentGameBar[ 0 ].Bar_One = Visibility.Visible; } else if ( 600 <= p_GameCount && p_GameCount < 700 ) { CurrentGameBar[ 0 ].Bar_Ten = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Nine = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Eight = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Seven = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Six = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Five = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Four = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Three = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Two = Visibility.Visible; CurrentGameBar[ 0 ].Bar_One = Visibility.Visible; } else if ( 700 <= p_GameCount && p_GameCount < 800 ) { CurrentGameBar[ 0 ].Bar_Ten = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Nine = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Eight = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Seven = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Six = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Five = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Four = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Three = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Two = Visibility.Visible; CurrentGameBar[ 0 ].Bar_One = Visibility.Visible; } else if ( 800 <= p_GameCount && p_GameCount < 900 ) { CurrentGameBar[ 0 ].Bar_Ten = Visibility.Hidden; CurrentGameBar[ 0 ].Bar_Nine = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Eight = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Seven = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Six = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Five = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Four = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Three = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Two = Visibility.Visible; CurrentGameBar[ 0 ].Bar_One = Visibility.Visible; } else { CurrentGameBar[ 0 ].Bar_Ten = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Nine = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Eight = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Seven = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Six = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Five = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Four = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Three = Visibility.Visible; CurrentGameBar[ 0 ].Bar_Two = Visibility.Visible; CurrentGameBar[ 0 ].Bar_One = Visibility.Visible; } } /// <summary> /// ボーナス終了時に呼び出されてBonusHistoryの中のBonusHistoryVisibleオブジェクトをシフトする /// </summary> /// <param name="p_BonusType">ボーナス種別</param> private void update_bonushistory( BonusType p_BonusType ) { BonusHistory.Remove( BonusHistory.Last( ) ); switch ( p_BonusType ) { case BonusType.REGULAR_BONUS: CurrentGameBar[ 0 ].KindOfBonus = "RB"; break; case BonusType.BIG_BONUS: CurrentGameBar[ 0 ].KindOfBonus = "BB"; break; default: CurrentGameBar[ 0 ].KindOfBonus = "NONE"; break; } BonusHistory.Insert( 0, CurrentGameBar.First( ).Clone( ) ); // CurrentGameBarに入っているオブジェクトのディープコピーをBonusHisotyの先頭に追加する for ( int i = 0; i < BonusHistory.Count; i++ ) { BonusHistory[ i ].TimesAgo = ( i + 1 ).ToString( ) + "回前"; // X回前の表示を+1して過去のものにする } } } } |
VIEWMODEL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
/** * ============================================================= * File :MainWindowViewModel.cs * Summary :MainWindowのビューモデル * ============================================================= */ namespace Pachislot_DataCounter.ViewModels { public class MainWindowViewModel : BindableBase { // ======================================================= // メンバ変数 // ======================================================= private SerialCom m_SerialCom; private DataManager m_DataManager; private readonly IDialogCoordinator m_DialogCoordinator; // ======================================================= // コマンド // ======================================================= /// <summary> /// Connectトグルボタンチェックコマンド /// </summary> public DelegateCommand Checked_Connect { get; } /// <summary> /// Connectトグルボタンチェック解除コマンド /// </summary> public DelegateCommand Unchecked_Connect { get; } /// <summary> /// 接続状態を示すバッジ /// </summary> public string ConnectBadge { get { return m_SerialCom.ConnectBadge; } set { m_SerialCom.ConnectBadge = value; } } /// <summary> /// Exitボタンクリックコマンド /// </summary> public DelegateCommand<MainWindow> Click_Exit { get; } /// <summary> /// COMポートリスト /// </summary> public ObservableCollection<string> PortList { get { return m_SerialCom.PortList; } set { m_SerialCom.PortList = value; } } /// <summary> /// 選択中のCOMポート /// </summary> public string SelectedPort { get { return m_SerialCom.SelectedPort; } set { m_SerialCom.SelectedPort = value; } } // ======================================================= // コンストラクタ // ======================================================= /// <summary> /// MainWindowのビューモデルのコンストラクタ /// </summary> public MainWindowViewModel( IRegionManager p_RegionManager, IDialogCoordinator p_DialogCoordinator, SerialCom p_SerialCom, DataManager p_DataManager ) { m_DataManager = p_DataManager; m_SerialCom = p_SerialCom; m_DialogCoordinator = p_DialogCoordinator; m_SerialCom.PropertyChanged += ( sender, e ) => RaisePropertyChanged( e.PropertyName ); Checked_Connect = new DelegateCommand( checked_connect ); Unchecked_Connect = new DelegateCommand( unchecked_connect ); Click_Exit = new DelegateCommand<MainWindow>( exit_clicked ); p_RegionManager.RegisterViewWithRegion( "BigBonusCounter", typeof( BBCounter ) ); p_RegionManager.RegisterViewWithRegion( "RegularBonusCounter", typeof( RBCounter ) ); p_RegionManager.RegisterViewWithRegion( "AllGameCounter", typeof( AllGameCounter ) ); p_RegionManager.RegisterViewWithRegion( "CurrentGameCounter", typeof( CurrentGameCounter ) ); p_RegionManager.RegisterViewWithRegion( "DiffCoinCounter", typeof( DiffCoinCounter ) ); p_RegionManager.RegisterViewWithRegion( "BonusHistory", typeof( BonusHistory ) ); p_RegionManager.RegisterViewWithRegion( "SlumpGraph", typeof( SlumpGraph ) ); } // ======================================================= // 非公開メソッド // ======================================================= /// <summary> /// 接続ボタンクリック(チェック)時の処理 /// </summary> private async void checked_connect( ) { try { m_SerialCom.ComStart( ); // シリアル通信を開始する } catch ( Exception ex ) { await m_DialogCoordinator.ShowMessageAsync( this, "エラー", ex.Message ); } } /// <summary> /// 接続ボタンクリック(チェック解除)時の処理 /// </summary> private async void unchecked_connect( ) { try { m_SerialCom.ComStop( ); // シリアル通信を停止する } catch ( Exception ex ) { await m_DialogCoordinator.ShowMessageAsync( this, "エラー", ex.Message ); } } /// <summary> /// 終了ボタンクリック時の処理 /// </summary> private void exit_clicked( MainWindow p_Window ) { m_SerialCom.ComStop( ); // シリアル通信を停止する p_Window?.Close( ); // nullでなければウィンドウを閉じる } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
/** * ============================================================= * File :BBCounterViewModel.cs * Summary :BBCounterのビューモデル * ============================================================= */ namespace Pachislot_DataCounter.ViewModels { public class BBCounterViewModel : BindableBase { // ======================================================= // メンバ変数 // ======================================================= private NumCounter m_NumCounter; private DataManager m_DataManager; // ======================================================= // プロパティ // ======================================================= /// <summary> /// 3桁目の数値 /// </summary> public BitmapImage ThirdDigit { get { return m_NumCounter.ThirdDigit; } set { m_NumCounter.ThirdDigit = value; } } /// <summary> /// 2桁目の数値 /// </summary> public BitmapImage SecondDigit { get { return m_NumCounter.SecondDigit; } set { m_NumCounter.SecondDigit = value; } } /// <summary> /// 1桁目の数値 /// </summary> public BitmapImage FirstDigit { get { return m_NumCounter.FirstDigit; } set { m_NumCounter.FirstDigit = value; } } /// <summary> /// ビッグボーナス中フラグ /// </summary> public bool DuringBB { get { return m_DataManager.DuringBB; } set { m_DataManager.DuringBB = value; } } // ======================================================= // コンストラクタ // ======================================================= /// <summary> /// コンストラクタ /// </summary> /// <param name="p_NumCounter">DIコンテナ内のNumCounterオブジェクト</param> /// <param name="p_DataManager">DIコンテナ内のDataManagerオブジェクト</param> public BBCounterViewModel( NumCounter p_NumCounter, DataManager p_DataManager ) { m_NumCounter = p_NumCounter; m_NumCounter.PropertyChanged += ( sender, e ) => RaisePropertyChanged( e.PropertyName ); m_DataManager = p_DataManager; m_DataManager.PropertyChanged += ( sender, e ) => { if ( e.PropertyName == "BigBonus" ) { m_NumCounter.SetNumber( m_DataManager.BigBonus ); } if ( e.PropertyName == "DuringBB" ) { RaisePropertyChanged( e.PropertyName ); } }; } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
/** * ============================================================= * File :RBCounterViewModel.cs * Summary :RBCounterのビューモデル * ============================================================= */ namespace Pachislot_DataCounter.ViewModels { public class RBCounterViewModel : BindableBase { // ======================================================= // メンバ変数 // ======================================================= private NumCounter m_NumCounter; private DataManager m_DataManager; // ======================================================= // プロパティ // ======================================================= /// <summary> /// 3桁目の数値 /// </summary> public BitmapImage ThirdDigit { get { return m_NumCounter.ThirdDigit; } set { m_NumCounter.ThirdDigit = value; } } /// <summary> /// 2桁目の数値 /// </summary> public BitmapImage SecondDigit { get { return m_NumCounter.SecondDigit; } set { m_NumCounter.SecondDigit = value; } } /// <summary> /// 1桁目の数値 /// </summary> public BitmapImage FirstDigit { get { return m_NumCounter.FirstDigit; } set { m_NumCounter.FirstDigit = value; } } /// <summary> /// レギュラーボーナス中フラグ /// </summary> public bool DuringRB { get { return m_DataManager.DuringRB; } set { m_DataManager.DuringRB = value; } } // ======================================================= // コンストラクタ // ======================================================= /// <summary> /// コンストラクタ /// </summary> /// <param name="p_NumCounter">DIコンテナ内のNumCounterオブジェクト</param> /// <param name="p_DataManager">DIコンテナ内のDataManagerオブジェクト</param> public RBCounterViewModel( NumCounter p_NumCounter, DataManager p_DataManager ) { m_NumCounter = p_NumCounter; m_NumCounter.PropertyChanged += ( sender, e ) => RaisePropertyChanged( e.PropertyName ); m_DataManager = p_DataManager; m_DataManager.PropertyChanged += ( sender, e ) => { if ( e.PropertyName == "RegularBonus" ) { m_NumCounter.SetNumber( m_DataManager.RegularBonus ); } if ( e.PropertyName == "DuringRB" ) { RaisePropertyChanged( e.PropertyName ); } }; } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
/** * ============================================================= * File :DiffCoinCounterViewModel.cs * Summary :DiffCoinCounterのビューモデル * ============================================================= */ namespace Pachislot_DataCounter.ViewModels { public class DiffCoinCounterViewModel : BindableBase { // ======================================================= // メンバ変数 // ======================================================= private NumCounter m_NumCounter; private DataManager m_DataManager; // ======================================================= // プロパティ // ======================================================= /// <summary> /// 符号 /// </summary> public BitmapImage Sign { get { return m_NumCounter.Sign; } set { m_NumCounter.Sign = value; } } /// <summary> /// 5桁目の数値 /// </summary> public BitmapImage FifthDigit { get { return m_NumCounter.FifthDigit; } set { m_NumCounter.FifthDigit = value; } } /// <summary> /// 4桁目の数値 /// </summary> public BitmapImage ForthDigit { get { return m_NumCounter.ForthDigit; } set { m_NumCounter.ForthDigit = value; } } /// <summary> /// 3桁目の数値 /// </summary> public BitmapImage ThirdDigit { get { return m_NumCounter.ThirdDigit; } set { m_NumCounter.ThirdDigit = value; } } /// <summary> /// 2桁目の数値 /// </summary> public BitmapImage SecondDigit { get { return m_NumCounter.SecondDigit; } set { m_NumCounter.SecondDigit = value; } } /// <summary> /// 1桁目の数値 /// </summary> public BitmapImage FirstDigit { get { return m_NumCounter.FirstDigit; } set { m_NumCounter.FirstDigit = value; } } // ======================================================= // コンストラクタ // ======================================================= /// <summary> /// コンストラクタ /// </summary> /// <param name="p_NumCounter">DIコンテナ内のNumCounterオブジェクト</param> /// <param name="p_DataManager">DIコンテナ内のDataManagerオブジェクト</param> public DiffCoinCounterViewModel( NumCounter p_NumCounter, DataManager p_DataManager ) { m_NumCounter = p_NumCounter; m_NumCounter.PropertyChanged += ( sender, e ) => RaisePropertyChanged( e.PropertyName ); m_DataManager = p_DataManager; m_DataManager.PropertyChanged += ( sender, e ) => { if ( e.PropertyName == "DiffCoin" ) { m_NumCounter.SetNumber( m_DataManager.DiffCoin ); } }; } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
/** * ============================================================= * File :AllGameCounterViewModel.cs * Summary :AllGameCounterのビューモデル * ============================================================= */ namespace Pachislot_DataCounter.ViewModels { public class AllGameCounterViewModel : BindableBase { // ======================================================= // メンバ変数 // ======================================================= private NumCounter m_NumCounter; private DataManager m_DataManager; // ======================================================= // プロパティ // ======================================================= /// <summary> /// 5桁目の数値 /// </summary> public BitmapImage FifthDigit { get { return m_NumCounter.FifthDigit; } set { m_NumCounter.FifthDigit = value; } } /// <summary> /// 4桁目の数値 /// </summary> public BitmapImage ForthDigit { get { return m_NumCounter.ForthDigit; } set { m_NumCounter.ForthDigit = value; } } /// <summary> /// 3桁目の数値 /// </summary> public BitmapImage ThirdDigit { get { return m_NumCounter.ThirdDigit; } set { m_NumCounter.ThirdDigit = value; } } /// <summary> /// 2桁目の数値 /// </summary> public BitmapImage SecondDigit { get { return m_NumCounter.SecondDigit; } set { m_NumCounter.SecondDigit = value; } } /// <summary> /// 1桁目の数値 /// </summary> public BitmapImage FirstDigit { get { return m_NumCounter.FirstDigit; } set { m_NumCounter.FirstDigit = value; } } // ======================================================= // コンストラクタ // ======================================================= /// <summary> /// コンストラクタ /// </summary> /// <param name="p_NumCounter">DIコンテナ内のNumCounterオブジェクト</param> /// <param name="p_DataManager">DIコンテナ内のDataManagerオブジェクト</param> public AllGameCounterViewModel( NumCounter p_NumCounter, DataManager p_DataManager ) { m_NumCounter = p_NumCounter; m_NumCounter.PropertyChanged += ( sender, e ) => RaisePropertyChanged( e.PropertyName ); m_DataManager = p_DataManager; m_DataManager.PropertyChanged += ( sender, e ) => { if ( e.PropertyName == "AllGame" ) { m_NumCounter.SetNumber( m_DataManager.AllGame ); } }; } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
/** * ============================================================= * File :CurrentGameCounterViewModel.cs * Summary :CurrentGameCounterのビューモデル * ============================================================= */ namespace Pachislot_DataCounter.ViewModels { public class CurrentGameCounterViewModel : BindableBase { // ======================================================= // メンバ変数 // ======================================================= private NumCounter m_NumCounter; private DataManager m_DataManager; // ======================================================= // プロパティ // ======================================================= /// <summary> /// 4桁目の数値 /// </summary> public BitmapImage ForthDigit { get { return m_NumCounter.ForthDigit; } set { m_NumCounter.ForthDigit = value; } } /// <summary> /// 3桁目の数値 /// </summary> public BitmapImage ThirdDigit { get { return m_NumCounter.ThirdDigit; } set { m_NumCounter.ThirdDigit = value; } } /// <summary> /// 2桁目の数値 /// </summary> public BitmapImage SecondDigit { get { return m_NumCounter.SecondDigit; } set { m_NumCounter.SecondDigit = value; } } /// <summary> /// 1桁目の数値 /// </summary> public BitmapImage FirstDigit { get { return m_NumCounter.FirstDigit; } set { m_NumCounter.FirstDigit = value; } } /// <summary> /// ビッグボーナス中フラグ /// </summary> public bool DuringBonus { get { return m_DataManager.DuringBonus; } set { m_DataManager.DuringBonus = value; } } // ======================================================= // コンストラクタ // ======================================================= /// <summary> /// コンストラクタ /// </summary> /// <param name="p_NumCounter">DIコンテナ内のNumCounterオブジェクト</param> /// <param name="p_DataManager">DIコンテナ内のDataManagerオブジェクト</param> public CurrentGameCounterViewModel( NumCounter p_NumCounter, DataManager p_DataManager ) { m_NumCounter = p_NumCounter; m_NumCounter.PropertyChanged += ( sender, e ) => RaisePropertyChanged( e.PropertyName ); m_DataManager = p_DataManager; m_DataManager.PropertyChanged += ( sender, e ) => { if ( e.PropertyName == "CurrentGame" ) { m_NumCounter.SetNumber( m_DataManager.CurrentGame ); } if ( e.PropertyName == "DuringBonus" ) { RaisePropertyChanged( e.PropertyName ); } }; } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
/** * ============================================================= * File :SlumpGraphViewModel.cs * Summary :SlumpGraphのビューモデル * ============================================================= */ namespace Pachislot_DataCounter.ViewModels { public class SlumpGraphViewModel : BindableBase { // ======================================================= // メンバ変数 // ======================================================= private GraphDrawer m_GraphDrawer; // ======================================================= // プロパティ // ======================================================= /// <summary> /// ScottPlotオブジェクト /// ※ScottPlotはオブジェクトそのものをプロパティにするほかない。 /// </summary> public WpfPlot ScottPlot { get { return m_GraphDrawer.ScottPlot; } set { m_GraphDrawer.ScottPlot = value; } } // ======================================================= // コンストラクタ // ======================================================= /// <summary> /// コンストラクタ /// </summary> /// <param name="p_GraphDrawer">グラフ描画クラスのオブジェクト</param> public SlumpGraphViewModel( GraphDrawer p_GraphDrawer ) { m_GraphDrawer = p_GraphDrawer; } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
/** * ============================================================= * File :BonusHistoryViewModel.cs * Summary :BonusHistoryのビューモデル * ============================================================= */ namespace Pachislot_DataCounter.ViewModels { public class BonusHistoryViewModel : BindableBase { // ======================================================= // メンバ変数 // ======================================================= private BonusHistoryList m_BonusHistoryList; // ======================================================= // プロパティ // ======================================================= /// <summary> /// 現在のゲーム数に合わせたバー表示リスト /// </summary> public ObservableCollection<GamesBar> CurrentGameBar { get { return m_BonusHistoryList.CurrentGameBar; } set { m_BonusHistoryList.CurrentGameBar = value; } } /// <summary> /// 1回前から10回前のボーナス履歴のバー表示リスト /// </summary> public ObservableCollection<GamesBar> BonusHistory { get { return m_BonusHistoryList.BonusHistory; } set { m_BonusHistoryList.BonusHistory = value; } } // ======================================================= // コンストラクタ // ======================================================= /// <summary> /// コンストラクタ /// </summary> /// <param name="p_BonusHistoryList">ボーナス履歴リスト</param> public BonusHistoryViewModel( BonusHistoryList p_BonusHistoryList ) { m_BonusHistoryList = p_BonusHistoryList; m_BonusHistoryList.PropertyChanged += ( sender, e ) => RaisePropertyChanged( e.PropertyName ); } } } |
VIEW
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
<!--============================================================--> <!--File :MainWindow.xaml --> <!--Summary :メイン画面 --> <!--============================================================--> <metro:MetroWindow x:Class="Pachislot_DataCounter.Views.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Pachislot_DataCounter.Views" xmlns:prism="http://prismlibrary.com/" xmlns:i="http://schemas.microsoft.com/xaml/behaviors" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:metro="http://metro.mahapps.com/winfx/xaml/controls" xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks" xmlns:Dialog="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro" prism:ViewModelLocator.AutoWireViewModel="True" Dialog:DialogParticipation.Register="{Binding}" Title="金ぱとデータカウンター" Height="900" Width="1600" GlowBrush="{DynamicResource MahApps.Brushes.Accent}" WindowStartupLocation="CenterScreen" WindowState="Maximized" ResizeMode="CanMinimize" ShowTitleBar="False"> <!--#region ウィンドウの背景画像設定--> <!--======================================--> <!--ウィンドウの背景画像 --> <!--======================================--> <Window.Background> <ImageBrush ImageSource="/Resource/Background.png" /> </Window.Background> <!--#endregion--> <Window.Resources> <Thickness x:Key="ControlMargin">0 5 0 0</Thickness> </Window.Resources> <!--#region ウィンドウ本体--> <Grid> <!--#region グリッドサイズ設定--> <!--列の定義--> <Grid.ColumnDefinitions> <ColumnDefinition Width="0.2*" /> <ColumnDefinition Width="0.3*" /> <ColumnDefinition Width="0.2*" /> <ColumnDefinition Width="0.6*" /> <ColumnDefinition Width="0.1*" /> <ColumnDefinition Width="0.2*" /> <ColumnDefinition Width="0.7*" /> <ColumnDefinition Width="0.6*" /> <ColumnDefinition Width="0.2*" /> </Grid.ColumnDefinitions> <!--行の定義--> <Grid.RowDefinitions> <RowDefinition Height="50*" /> <RowDefinition Height="50*" /> <RowDefinition Height="10*" /> <RowDefinition Height="50*" /> <RowDefinition Height="60*" /> <RowDefinition Height="50*" /> <RowDefinition Height="50*" /> <RowDefinition Height="70*" /> <RowDefinition Height="50*" /> <RowDefinition Height="50*" /> <RowDefinition Height="57*" /> <RowDefinition Height="100*" /> <RowDefinition Height="60*" /> </Grid.RowDefinitions> <!--#endregion--> <!--#region ビッグボーナス回数--> <!--======================================--> <!--ビッグボーナスの回数 --> <!--======================================--> <Image Grid.Row="1" Grid.RowSpan="2" Grid.Column="1" Grid.ColumnSpan="3" Source="/Resource/飾り枠(セクション).png" /> <Image Grid.Row="3" Grid.Column="1" Source="/Resource/BB.png" HorizontalAlignment="Left" /> <ContentControl Grid.Row="3" Grid.RowSpan="2" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Right" VerticalAlignment="Center" prism:RegionManager.RegionName="BigBonusCounter" /> <!--#endregion--> <!--#region レギュラーボーナス回数--> <!--======================================--> <!--レギュラーボーナスの回数 --> <!--======================================--> <Image Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="3" Source="/Resource/飾り枠(セクション).png" /> <Image Grid.Row="6" Grid.Column="1" Source="/Resource/RB.png" HorizontalAlignment="Left" /> <!--ユーザーコントロールのレギュラーボーナスカウンター--> <ContentControl Grid.Row="6" Grid.RowSpan="2" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Right" VerticalAlignment="Center" prism:RegionManager.RegionName="RegularBonusCounter" /> <!--#endregion--> <!--#region ゲーム数表示--> <!--======================================--> <!--ゲーム数(ボーナス間)と累計ゲーム数 --> <!--======================================--> <Image Grid.Row="8" Grid.Column="1" Grid.ColumnSpan="3" Source="/Resource/飾り枠(セクション).png" /> <Image Grid.Row="9" Grid.Column="1" Source="/Resource/ゲーム数.png" HorizontalAlignment="Left" /> <Image Grid.Row="9" Grid.Column="2" Source="/Resource/累計.png" HorizontalAlignment="Right" /> <!--累計ゲーム数--> <ContentControl Grid.Row="9" Grid.Column="3" HorizontalAlignment="Right" VerticalAlignment="Center" prism:RegionManager.RegionName="AllGameCounter" /> <!--現在のゲーム数--> <ContentControl Grid.Row="10" Grid.RowSpan="2" Grid.Column="1" Grid.ColumnSpan="3" HorizontalAlignment="Right" VerticalAlignment="Center" Height="130" prism:RegionManager.RegionName="CurrentGameCounter" /> <!--#endregion--> <!--#region 差枚数表示--> <!--======================================--> <!--差枚数 --> <!--======================================--> <Image Grid.Row="1" Grid.RowSpan="3" Grid.Column="5" Margin="10" Source="/Resource/差枚数.png" HorizontalAlignment="Left" /> <ContentControl Grid.Row="1" Grid.RowSpan="3" Grid.Column="6" Margin="0,35,0,35" HorizontalAlignment="Right" prism:RegionManager.RegionName="DiffCoinCounter" /> <!--#endregion--> <!--#region ボタン--> <!--======================================--> <!--ボタン類 --> <!--======================================--> <StackPanel Grid.Row="1" Grid.RowSpan="2" Grid.Column="7" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center"> <metro:Badged Badge="{Binding ConnectBadge}" BadgeMargin="10 0 10 0" Margin="{ StaticResource ControlMargin}" BadgeFontSize="20"> <ToggleButton Content="{iconPacks:Material Kind=Connection, Width=30, Height=30}" Style="{StaticResource MahApps.Styles.ToggleButton.Circle}" BorderThickness="3" Width="65" Height="65" ToolTip="Connect"> <i:Interaction.Triggers> <i:EventTrigger EventName="Checked"> <i:InvokeCommandAction Command="{Binding Checked_Connect}" /> </i:EventTrigger> <i:EventTrigger EventName="Unchecked"> <i:InvokeCommandAction Command="{Binding Unchecked_Connect}" /> </i:EventTrigger> </i:Interaction.Triggers> </ToggleButton> </metro:Badged> <Button Command="{Binding Click_Exit}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:MainWindow}}" Content="{iconPacks:Material Kind=ExitToApp, Width=30, Height=30}" Style="{StaticResource MahApps.Styles.Button.Circle}" BorderThickness="3" Width="65" Height="65" Margin="90,0,0,0" ToolTip="Exit"> </Button> </StackPanel> <!--#endregion--> <!--#region シリアルポート選択--> <!--======================================--> <!--ポート選択 --> <!--======================================--> <ComboBox Grid.Row="3" Grid.Column="7" Margin="5" Style="{ StaticResource MaterialDesignOutlinedComboBox }" materialDesign:HintAssist.Hint="COMポート" FontFamily="トガリテ Heavy" ItemsSource="{Binding PortList}" SelectedItem="{Binding SelectedPort}" HorizontalAlignment="Right" Width="240" /> <!--#endregion--> <!--#region スランプグラフ表示--> <!--======================================--> <!--スランプグラフ --> <!--======================================--> <ContentControl Grid.Row="4" Grid.RowSpan="4" Grid.Column="5" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" prism:RegionManager.RegionName="SlumpGraph" /> <!--#region ボーナス履歴--> <!--======================================--> <!--ボーナス履歴 --> <!--======================================--> <ScrollViewer Grid.Row="8" Grid.RowSpan="4" Grid.Column="5" Grid.ColumnSpan="3" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch"> <ContentControl HorizontalAlignment="Right" prism:RegionManager.RegionName="BonusHistory" /> </ScrollViewer> <!--#endregion--> </Grid> <!--#endregion--> </metro:MetroWindow> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
<!--============================================================--> <!--File :BBCounter.xaml --> <!--Summary :ビッグボーナス回数表示 --> <!--============================================================--> <UserControl x:Class="Pachislot_DataCounter.Views.BBCounter" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:prism="http://prismlibrary.com/" mc:Ignorable="d" d:DesignHeight="200" d:DesignWidth="450" prism:ViewModelLocator.AutoWireViewModel="True" > <!--#region リソース--> <!--======================================--> <!--アニメーション設定 --> <!--======================================--> <UserControl.Resources> <Storyboard x:Key="Bonus_Blink"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" RepeatBehavior="Forever" AutoReverse="True"> <LinearDoubleKeyFrame KeyTime="0" Value="1" /> <LinearDoubleKeyFrame KeyTime="0:0:0.5" Value="0" /> </DoubleAnimationUsingKeyFrames> </Storyboard> </UserControl.Resources> <!--#endregion--> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> <StackPanel.Style> <Style TargetType="StackPanel"> <Style.Triggers> <!--BigBonus中になったら点滅させる--> <DataTrigger Binding="{Binding DuringBB}" Value="true"> <DataTrigger.EnterActions> <BeginStoryboard Name="BeginBB_Blink" Storyboard="{StaticResource Bonus_Blink}" /> </DataTrigger.EnterActions> <DataTrigger.ExitActions> <StopStoryboard BeginStoryboardName="BeginBB_Blink" /> </DataTrigger.ExitActions> </DataTrigger> </Style.Triggers> </Style> </StackPanel.Style> <Image Source="{Binding ThirdDigit, TargetNullValue={x:Null}}" Margin="0,0,2,0" Width="Auto" /> <Image Source="{Binding SecondDigit, TargetNullValue={x:Null}}" Margin="2,0,2,0" Width="Auto" /> <Image Source="{Binding FirstDigit, TargetNullValue={x:Null}}" Margin="2,0,0,0" Width="Auto" /> </StackPanel> </UserControl> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
<!--============================================================--> <!--File :RBCounter.xaml --> <!--Summary :レギュラーボーナス回数表示 --> <!--============================================================--> <UserControl x:Class="Pachislot_DataCounter.Views.RBCounter" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:prism="http://prismlibrary.com/" mc:Ignorable="d" d:DesignHeight="200" d:DesignWidth="450" prism:ViewModelLocator.AutoWireViewModel="True" > <!--#region リソース--> <!--======================================--> <!--アニメーション設定 --> <!--======================================--> <UserControl.Resources> <Storyboard x:Key="Bonus_Blink"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" RepeatBehavior="Forever" AutoReverse="True"> <LinearDoubleKeyFrame KeyTime="0" Value="1" /> <LinearDoubleKeyFrame KeyTime="0:0:0.5" Value="0" /> </DoubleAnimationUsingKeyFrames> </Storyboard> </UserControl.Resources> <!--#endregion--> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> <StackPanel.Style> <Style TargetType="StackPanel"> <Style.Triggers> <!--BigBonus中になったら点滅させる--> <DataTrigger Binding="{Binding DuringRB}" Value="true"> <DataTrigger.EnterActions> <BeginStoryboard Name="BeginBB_Blink" Storyboard="{StaticResource Bonus_Blink}" /> </DataTrigger.EnterActions> <DataTrigger.ExitActions> <StopStoryboard BeginStoryboardName="BeginBB_Blink" /> </DataTrigger.ExitActions> </DataTrigger> </Style.Triggers> </Style> </StackPanel.Style> <Image Source="{Binding ThirdDigit, TargetNullValue={x:Null}}" Margin="0,0,2,0" Width="Auto" /> <Image Source="{Binding SecondDigit, TargetNullValue={x:Null}}" Margin="2,0,2,0" Width="Auto" /> <Image Source="{Binding FirstDigit, TargetNullValue={x:Null}}" Margin="2,0,0,0" Width="Auto" /> </StackPanel> </UserControl> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
<!--============================================================--> <!--File :DiffCoinCounter.xaml --> <!--Summary :差枚数表示 --> <!--============================================================--> <UserControl x:Class="Pachislot_DataCounter.Views.DiffCoinCounter" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:prism="http://prismlibrary.com/" mc:Ignorable="d" d:DesignHeight="200" d:DesignWidth="900" prism:ViewModelLocator.AutoWireViewModel="True"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> <Image Source="{Binding Sign, TargetNullValue={x:Null}}" Margin="0,0,2,0" Width="Auto" /> <Image Source="{Binding FifthDigit, TargetNullValue={x:Null}}" Margin="2,0,2,0" Width="Auto" /> <Image Source="{Binding ForthDigit, TargetNullValue={x:Null}}" Margin="2,0,2,0" Width="Auto" /> <Image Source="{Binding ThirdDigit, TargetNullValue={x:Null}}" Margin="2,0,2,0" Width="Auto" /> <Image Source="{Binding SecondDigit, TargetNullValue={x:Null}}" Margin="2,0,2,0" Width="Auto" /> <Image Source="{Binding FirstDigit, TargetNullValue={x:Null}}" Margin="2,0,0,0" Width="Auto" /> </StackPanel> </UserControl> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
<!--============================================================--> <!--File :AllGameCounter.xaml --> <!--Summary :累計ゲーム数表示 --> <!--============================================================--> <UserControl x:Class="Pachislot_DataCounter.Views.AllGameCounter" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:prism="http://prismlibrary.com/" mc:Ignorable="d" d:DesignHeight="200" d:DesignWidth="750" prism:ViewModelLocator.AutoWireViewModel="True" > <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> <Image Source="{Binding FifthDigit, TargetNullValue={x:Null}}" Margin="0,0,2,0" Width="Auto" /> <Image Source="{Binding ForthDigit, TargetNullValue={x:Null}}" Margin="2,0,2,0" Width="Auto" /> <Image Source="{Binding ThirdDigit, TargetNullValue={x:Null}}" Margin="2,0,2,0" Width="Auto" /> <Image Source="{Binding SecondDigit, TargetNullValue={x:Null}}" Margin="2,0,2,0" Width="Auto" /> <Image Source="{Binding FirstDigit, TargetNullValue={x:Null}}" Margin="2,0,0,0" Width="Auto" /> </StackPanel> </UserControl> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
<!--============================================================--> <!--File :CurrentGameCounter.xaml --> <!--Summary :現在のゲーム数表示 --> <!--============================================================--> <UserControl x:Class="Pachislot_DataCounter.Views.CurrentGameCounter" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:prism="http://prismlibrary.com/" mc:Ignorable="d" d:DesignHeight="200" d:DesignWidth="600" prism:ViewModelLocator.AutoWireViewModel="True" > <!--#region リソース--> <!--======================================--> <!--アニメーション設定 --> <!--======================================--> <UserControl.Resources> <Storyboard x:Key="Bonus_Blink"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" RepeatBehavior="Forever" AutoReverse="True"> <LinearDoubleKeyFrame KeyTime="0" Value="1" /> <LinearDoubleKeyFrame KeyTime="0:0:0.5" Value="0" /> </DoubleAnimationUsingKeyFrames> </Storyboard> </UserControl.Resources> <!--#endregion--> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> <StackPanel.Style> <Style TargetType="StackPanel"> <Style.Triggers> <!--Bonus中になったら点滅させる--> <DataTrigger Binding="{Binding DuringBonus}" Value="true"> <DataTrigger.EnterActions> <BeginStoryboard Name="BeginBonus_Blink" Storyboard="{StaticResource Bonus_Blink}" /> </DataTrigger.EnterActions> <DataTrigger.ExitActions> <StopStoryboard BeginStoryboardName="BeginBonus_Blink" /> </DataTrigger.ExitActions> </DataTrigger> </Style.Triggers> </Style> </StackPanel.Style> <Image Source="{Binding ForthDigit, TargetNullValue={x:Null}}" Margin="0,0,2,0" Width="Auto" /> <Image Source="{Binding ThirdDigit, TargetNullValue={x:Null}}" Margin="2,0,2,0" Width="Auto" /> <Image Source="{Binding SecondDigit, TargetNullValue={x:Null}}" Margin="2,0,2,0" Width="Auto" /> <Image Source="{Binding FirstDigit, TargetNullValue={x:Null}}" Margin="2,0,0,0" Width="Auto" /> </StackPanel> </UserControl> |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<!--============================================================--> <!--File :SlumpGraph.xaml --> <!--Summary :スランプグラフ表示 --> <!--============================================================--> <UserControl x:Class="Pachislot_DataCounter.Views.SlumpGraph" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:prism="http://prismlibrary.com/" prism:ViewModelLocator.AutoWireViewModel="True"> <Grid> <ContentControl Content="{ Binding ScottPlot }" /> </Grid> </UserControl> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
<!--============================================================--> <!--File :BonusHistory.xaml --> <!--Summary :ボーナス履歴表示 --> <!--============================================================--> <UserControl x:Class="Pachislot_DataCounter.Views.BonusHistory" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:prism="http://prismlibrary.com/" prism:ViewModelLocator.AutoWireViewModel="True"> <!--#region リソース--> <UserControl.Resources> <Style x:Key="BonusStyle" TargetType="{x:Type Image}"> <Style.Triggers> <DataTrigger Binding="{Binding Numeric}" Value="0"> <Setter Property="Source" Value="/Resource/データスランプ(BB).png" /> </DataTrigger> <DataTrigger Binding="{Binding Numeric}" Value="1"> <Setter Property="Source" Value="/Resource/データスランプ(RB).png" /> </DataTrigger> </Style.Triggers> </Style> </UserControl.Resources> <!--#endregion--> <!--#region コントロール本体--> <StackPanel Orientation="Horizontal" Background="#1f1f1f"> <!--#region 現在のゲーム数のバー表示--> <!--現在のゲーム数--> <ItemsControl ItemsSource="{Binding CurrentGameBar}" Margin="30,0,0,0"> <ItemsControl.Template> <ControlTemplate TargetType="ItemsControl"> <ItemsPresenter /> </ControlTemplate> </ItemsControl.Template> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel Width="80" Orientation="Vertical" VerticalAlignment="Bottom" Margin="0,0,70,0"> <Image Visibility="{Binding Bar_Ten}" Source="/Resource/データスランプ(Bar)_Red.png" Margin="1" /> <Image Visibility="{Binding Bar_Nine}" Source="/Resource/データスランプ(Bar)_Red.png" Margin="1" /> <Image Visibility="{Binding Bar_Eight}" Source="/Resource/データスランプ(Bar)_Yellow.png" Margin="1" /> <Image Visibility="{Binding Bar_Seven}" Source="/Resource/データスランプ(Bar)_Yellow.png" Margin="1" /> <Image Visibility="{Binding Bar_Six}" Source="/Resource/データスランプ(Bar)_Yellow.png" Margin="1" /> <Image Visibility="{Binding Bar_Five}" Source="/Resource/データスランプ(Bar)_Yellow.png" Margin="1" /> <Image Visibility="{Binding Bar_Four}" Source="/Resource/データスランプ(Bar)_Green.png" Margin="1" /> <Image Visibility="{Binding Bar_Three}" Source="/Resource/データスランプ(Bar)_Green.png" Margin="1" /> <Image Visibility="{Binding Bar_Two}" Source="/Resource/データスランプ(Bar)_Green.png" Margin="1" /> <Image Visibility="{Binding Bar_One}" Source="/Resource/データスランプ(Bar)_Green.png" Margin="1" /> <Label Content="現在" FontSize="20" FontFamily="/Resource/Togalite-Heavy.otf#トガリテ Heavy" HorizontalAlignment="Center" /> <Image Visibility="Hidden" Source="/Resource/データスランプ(BB).png" /> <Label Content="{Binding Games}" FontSize="20" FontFamily="/Resource/Togalite-Heavy.otf#トガリテ Heavy" HorizontalAlignment="Center" /> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> <!--#endregion--> <!--#region 過去のボーナスのバー表示--> <!--履歴データ--> <ItemsControl ItemsSource="{Binding BonusHistory}" Margin="0,0,30,0"> <ItemsControl.Template> <ControlTemplate TargetType="ItemsControl"> <ItemsPresenter /> </ControlTemplate> </ItemsControl.Template> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal"/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel Width="80" Orientation="Vertical" VerticalAlignment="Bottom" Margin="5,0,5,0"> <Image Visibility="{Binding Bar_Ten}" Source="/Resource/データスランプ(Bar)_Red.png" Margin="1" /> <Image Visibility="{Binding Bar_Nine}" Source="/Resource/データスランプ(Bar)_Red.png" Margin="1" /> <Image Visibility="{Binding Bar_Eight}" Source="/Resource/データスランプ(Bar)_Yellow.png" Margin="1" /> <Image Visibility="{Binding Bar_Seven}" Source="/Resource/データスランプ(Bar)_Yellow.png" Margin="1" /> <Image Visibility="{Binding Bar_Six}" Source="/Resource/データスランプ(Bar)_Yellow.png" Margin="1" /> <Image Visibility="{Binding Bar_Five}" Source="/Resource/データスランプ(Bar)_Yellow.png" Margin="1" /> <Image Visibility="{Binding Bar_Four}" Source="/Resource/データスランプ(Bar)_Green.png" Margin="1" /> <Image Visibility="{Binding Bar_Three}" Source="/Resource/データスランプ(Bar)_Green.png" Margin="1" /> <Image Visibility="{Binding Bar_Two}" Source="/Resource/データスランプ(Bar)_Green.png" Margin="1" /> <Image Visibility="{Binding Bar_One}" Source="/Resource/データスランプ(Bar)_Green.png" Margin="1" /> <Label Content="{Binding TimesAgo}" FontSize="20" FontFamily="/Resource/Togalite-Heavy.otf#トガリテ Heavy" HorizontalAlignment="Center" /> <Image> <Image.Style> <Style TargetType="{x:Type Image}"> <Style.Triggers> <DataTrigger Binding="{Binding KindOfBonus}" Value="BB"> <Setter Property="Source" Value="/Resource/データスランプ(BB).png" /> </DataTrigger> <DataTrigger Binding="{Binding KindOfBonus}" Value="RB"> <Setter Property="Source" Value="/Resource/データスランプ(RB).png" /> </DataTrigger> <DataTrigger Binding="{Binding KindOfBonus}" Value="NONE"> <Setter Property="Source" Value="/Resource/データスランプ(NONE).png" /> </DataTrigger> </Style.Triggers> </Style> </Image.Style> </Image> <Label Content="{Binding Games}" FontSize="20" FontFamily="/Resource/Togalite-Heavy.otf#トガリテ Heavy" HorizontalAlignment="Center" /> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> <!--#endregion--> </StackPanel> <!--#endregion--> </UserControl> |
プログラムはこちらのGitHubに置いてます。