いものやま。

雑多な知識の寄せ集め

変種オセロのUIを作ってみた。(まとめ)

これまでの各記事は以下から。

また、関係の深い記事は、以下。

正直、ここまで長くなるとは思わなかった・・・

クラス図

コードを全部載せてももはや何なのかという感じなので、大雑把なクラス図だけ書いておこうと思う。
(※クラス名の後ろにコロンで区切って書いてあるのは、親クラス名)

==> ViewController, View, Scene <==

+--------------------+
| GameViewController |
+--------------------+
        |
        V
    +--------+
    | SKView |
    +--------+
        |
        V
+--------------------+
| GameScene: SKScene |
+--------------------+

----

==> Scene, etc. <==

+--------------------+    +----------------+
| GameScene: SKScene |--->| TurnController |
+--------------------+    +----------------+
  |   |   |         |
  |   |   |         |     +---------------+
  |   |   |         +---->| LayoutManager |
  |   |   | child         +---------------+
  |   |   V
  |   |  +----------------------+
  |   |  | UserInfoNode: SKNode |
  |   |  +----------------------+
  |   |
  |   | child
  |   V
  |  +--------------------+
  |  | ButtonNode: SKNode |
  |  +--------------------+
  |
  | child
  V
+-------------------------+
| BoardNode: SKSpriteNode |
+-------------------------+

----

==> BoardNode, etc. <==

+-------------------------+ model +-------+
| BoardNode: SKSpriteNode |------>| Board |
+-------------------------+       +-------+
  |             |
  |             | notify  +-------------------+
  | child       +-------->| BoardNodeObserver |
  V                       +-------------------+
+--------------------+
| SquareNode: SKNode |
+--------------------+
  |
  | child
  V
+-------------------------+
| PieceNode: SKSpriteNode |
+-------------------------+

----

==> ButtonNode, etc <==

+--------------------------+
| ButtonNode: SKSpriteNode |
+--------------------------+
            |
            | notify
            V
  +--------------------+
  | ButtonNodeObserver |
  +--------------------+

----

==> UserInfoNode, etc <==

 +-------------------+
 | BoardNodeObserver |
 +-------------------+
          A
          | implement
+----------------------+
| UserInfoNode: SKNode |
+----------------------+

----

==> TurnController, etc. <==

+-------------------+
| BoardNodeObserver |
+-------------------+
 A       
 | implement
 |
 |  +--------------------+
 |  | ButtonNodeObserver |
 |  +--------------------+
 |   A
 |   | implement
+----------------+    +--------+
| TurnController |--->| Player |
+----------------+    +--------+
 |   |
 |   V
 |  +------------+
 |  | ButtonNode |
 |  +------------+
 |
 V
+-----------+
| BoardNode |
+-----------+

----

==> Player, etc. <==

+--------+   implement +--------------+
| Player |<|-----------| AlphaBetaCom |
+--------+             +--------------+
 A
 | implement
 |
 |  +-------------------+
 |  | BoardNodeObserver |
 |  +-------------------+
 |   A       
 |   | implement
 |   |
 |   |  +--------------------+
 |   |  | ButtonNodeObserver |
 |   |  +--------------------+
 |   |   A
 |   |   | implement
+-------------+    +------------+
| Human       |--->| ButtonNode |
+-------------+    +------------+
 |
 V
+-----------+
| BoardNode |
+-----------+

----

メソッド名とかも書いてないし、本当に大雑把だけど、名前からそれぞれのクラスがどんな関係になってるのかは大体分かるんじゃないかな。

今日はここまで!