• R/O
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

オセロのゲーム


コミットメタ情報

リビジョン59 (tree)
日時2015-07-03 11:30:33
作者bellyoshi

ログメッセージ

変更サマリ

差分

--- VisualBasic/ReversiGame2/ReversiGame/FormDispacher.vb (nonexistent)
+++ VisualBasic/ReversiGame2/ReversiGame/FormDispacher.vb (revision 59)
@@ -0,0 +1,25 @@
1+Public Class FormDispacher
2+
3+ Private Shared _instance As New FormDispacher
4+ Public Shared Function GetInstance() As FormDispacher
5+ Return _instance
6+ End Function
7+
8+
9+ Private WithEvents _frmCode As frmCodes
10+
11+ Public Sub ShowCode(ByVal board As Board)
12+ If _frmCode Is Nothing Then
13+ _frmCode = New frmCodes
14+ _frmCode.Show()
15+ End If
16+ _frmCode.Board = board
17+ _frmCode.ShowCodes()
18+
19+ End Sub
20+
21+ Private Sub _frmCode_FormClosed(sender As Object, e As System.Windows.Forms.FormClosedEventArgs) Handles _frmCode.FormClosed
22+ _frmCode = Nothing
23+ End Sub
24+
25+End Class
--- VisualBasic/ReversiGame2/ReversiGame/frmMain.vb (revision 58)
+++ VisualBasic/ReversiGame2/ReversiGame/frmMain.vb (revision 59)
@@ -1,6 +1,6 @@
11 Public Class frmMain
22 Private Property CellSize As Integer = 40
3- Private _frmCode As New frmCodes
3+
44 Private _nowBoard As New Board
55 Private _computerAIPlayer1 As computerPlayer
66 Private _computerAIPlayer2 As computerPlayer
@@ -82,10 +82,8 @@
8282 End Sub
8383
8484 Private Sub frmReflesh()
85- If _nowBoard IsNot Nothing AndAlso _frmCode IsNot Nothing AndAlso Not _frmCode.IsDisposed Then
86- _frmCode.Board = _nowBoard
87- _frmCode.ShowCodes()
88- End If
85+
86+ FormDispacher.GetInstance.ShowCode(_nowBoard)
8987 PictureBox1.Invalidate()
9088 End Sub
9189 Private Sub TurnChangeAndDecideGameWinner()
@@ -117,7 +115,7 @@
117115
118116
119117 Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
120- _frmCode.Board = _nowBoard
118+ FormDispacher.GetInstance.ShowCode(_nowBoard)
121119 _computerAIPlayer1 = New computerPlayer
122120 _computerAIPlayer2 = New computerPlayer
123121
@@ -209,7 +207,7 @@
209207
210208 Private Sub btnCodes_Click(sender As System.Object, e As System.EventArgs) Handles btnCodes.Click
211209
212- _frmCode.Show()
210+ FormDispacher.GetInstance.ShowCode(_nowBoard)
213211
214212 End Sub
215213 End Class
--- VisualBasic/ReversiGame2/ReversiGame/frmCodes.vb (revision 58)
+++ VisualBasic/ReversiGame2/ReversiGame/frmCodes.vb (revision 59)
@@ -8,7 +8,11 @@
88 End Sub
99
1010 Public Sub ShowCodes()
11- lstCodes.DataSource = Board.History
11+ Dim history As IList(Of Point) = New List(Of Point)
12+ If Board IsNot Nothing Then
13+ history = Board.History
14+ End If
15+ lstCodes.DataSource = history
1216 lstCodes.DisplayMember = "ToString"
1317 End Sub
1418