Ejemplo n.º 1
0
        public void SetResult(int times, VictoryOrDefeat result, Hand opp3rd)
        {
            string msg = String.Format("SetResult({0:D}, {1:D}, {2:D});", times, result, opp3rd);
            this.Send(msg);

            return;
        }
Ejemplo n.º 2
0
    // 勝ち負けの表示.
    void VictoryOrDefeatIndicator(VictoryOrDefeat myResult)
    {
        switch (myResult)
        {
        case VictoryOrDefeat.Victory:
            CenterText.GetComponent <Text>().text = GameText[2];
            break;

        case VictoryOrDefeat.Defeat:
            CenterText.GetComponent <Text>().text = GameText[3];
            break;

        case VictoryOrDefeat.Draw:
            CenterText.GetComponent <Text>().text = GameText[4];
            break;
        }
    }
Ejemplo n.º 3
0
    // 累計勝利回数、連勝数の更新.
    void UpdateWiningNum(VictoryOrDefeat myResult)
    {
        switch (myResult)
        {
        case VictoryOrDefeat.Victory:
            VictoryNum++;
            WinningStreak++;
            break;

        case VictoryOrDefeat.Defeat:
            WinningStreak = 0;
            break;

        case VictoryOrDefeat.Draw:
            WinningStreak = 0;
            break;
        }
    }
Ejemplo n.º 4
0
    // 更新.
    void Update()
    {
        // マウスクリック.
        if (Input.GetMouseButtonDown(0))
        {
            Vector3    aTapPoint   = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            Collider2D aCollider2d = Physics2D.OverlapPoint(aTapPoint);

            // 手を選択.
            if (aCollider2d)
            {
                // じゃんけん開始の文言を非表示.
                CenterText.GetComponent <Text>().text = GameText[1];

                GameObject obj = aCollider2d.transform.gameObject;
                Debug.Log("自分の手" + obj.name);
                Debug.Log("自分の手" + SelectHand(obj.name));
                SelectHandIndicator(SelectHand(obj.name), true);

                // 相手の選んだ手と勝負
                Hand enemyHand = ChoiseEnemyHand(SelectHand(obj.name));
                SelectHandIndicator(enemyHand, false);
                Debug.Log("相手の手" + enemyHand);
//				Debug.Log(CheckJanken(SelectHand(obj.name), enemyHand));
                VictoryOrDefeat myResult = VictoryOrDefeat.Draw;
                myResult = CheckJanken(SelectHand(obj.name), enemyHand);
                // 勝敗の表示.
                VictoryOrDefeatIndicator(myResult);
                // 勝利回数の更新.
                UpdateWiningNum(myResult);
                // 勝利回数の表示.
                VictoryNumIndicator(VictoryNum, WinningStreak);
                RetryButton.SetActive(true);
            }
        }
    }
Ejemplo n.º 5
0
    // 勝ち負けの表示.
    void VictoryOrDefeatIndicator(VictoryOrDefeat myResult)
    {
        switch (myResult)
        {
        case VictoryOrDefeat.Victory:
            CenterText.GetComponent<Text>().text = GameText[2];
            break;

        case VictoryOrDefeat.Defeat:
            CenterText.GetComponent<Text>().text = GameText[3];
            break;

        case VictoryOrDefeat.Draw:
            CenterText.GetComponent<Text>().text = GameText[4];
            break;

        }
    }
Ejemplo n.º 6
0
    // 累計勝利回数、連勝数の更新.
    void UpdateWiningNum(VictoryOrDefeat myResult)
    {
        switch (myResult)
        {
        case VictoryOrDefeat.Victory:
            VictoryNum++;
            WinningStreak++;
            break;

        case VictoryOrDefeat.Defeat:
            WinningStreak = 0;
            break;

        case VictoryOrDefeat.Draw:
            WinningStreak = 0;
            break;

        }
    }
Ejemplo n.º 7
0
 public void SetResult(int times, VictoryOrDefeat result, Hand opp3rd)
 {
     // 記録 相手の3手目
     recorder.Set(times, (h1, h2) => h2.Second = opp3rd);
 }
Ejemplo n.º 8
0
    void Start()
    {
        // 初期化.
        m_VictoryOrDefeat = VictoryOrDefeat.Draw;
        m_SetAvailableManager = true;
        m_PassCount = 0;
        m_TurnCount = 1;
        m_Log = GameObject.Find("Log").GetComponent<Log>();
        m_VictoryOrDefeatText = GameObject.Find("VictoryOrDefeat").GetComponent<VictoryOrDefeatText>();
        m_GameSet.Add (GameObject.Find("PanelFront")as GameObject);
        m_GameSet.Add (GameObject.Find("PanelBG") as GameObject);
        m_GameSet.Add (GameObject.Find("Result") as GameObject);
        ui = GameObject.Find ("Text").GetComponent<Ui>();
        m_TurnWait = false;
        gameInfo = GameObject.Find ("GameInfo").GetComponent<GameInfo>();

        // タイル配置.
        int count = 0;
        Vector3 tilePos = Vector3.zero;
        for (int row = 0; row < ROW; row++)
        {
            m_Tile.GetComponent<Tile>().Row = row;
            for(int column = 0; column < COLUMN; column++)
            {
                tilePos = new Vector3((m_Tile.transform.localScale.x + MARGE) * row,
                                      (m_Tile.transform.localScale.y + MARGE)* column,
                                      0);

                if(m_Tile != null)
                {
                    m_TileArray[count] = (GameObject)GameObject.Instantiate(m_Tile, tilePos, Quaternion.identity);
                    m_TileArray[count].name = "" + (row+1) + (column+1);
                    m_TileArray[count].GetComponent<Tile>().Num = count;
                    m_TileArray[count].GetComponent<Tile>().Column = column;

                }
                count++;
            }
        }

        // 石配置.

        m_StoneList.Add (CreateStone(MatrixPos(ROW/2 -1, COLUMN/2 - 1),false));	m_StoneList [0].name = "stone0";	m_TileArray[MatrixBox(ROW/2 -1, COLUMN/2 - 1)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (ROW/2 -1, COLUMN/2 - 1)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (ROW/2 -1, COLUMN/2 - 1)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [0].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(ROW/2 -1, COLUMN/2),true));	m_StoneList [1].name = "stone1";	m_TileArray[MatrixBox(ROW/2 -1, COLUMN/2)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (ROW/2 -1, COLUMN/2)].GetComponent<Tile> ().StoneColor = true;	 m_TileArray [MatrixBox (ROW/2 -1, COLUMN/2)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [1].GetComponent<Stone> ().StoneColor = true;
        m_StoneList.Add (CreateStone(MatrixPos(ROW/2, COLUMN/2 - 1),true));	m_StoneList [2].name = "stone2";	m_TileArray[MatrixBox(ROW/2, COLUMN/2 - 1)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (ROW/2, COLUMN/2 - 1)].GetComponent<Tile> ().StoneColor = true;	 m_TileArray [MatrixBox (ROW/2, COLUMN/2 - 1)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [2].GetComponent<Stone> ().StoneColor = true;
        m_StoneList.Add (CreateStone(MatrixPos(ROW/2, COLUMN/2),false));	m_StoneList [3].name = "stone3";	m_TileArray[MatrixBox(ROW/2, COLUMN/2)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (ROW/2, COLUMN/2)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (ROW/2, COLUMN/2)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [3].GetComponent<Stone> ().StoneColor = false;

        /*
        m_StoneList.Add (CreateStone(MatrixPos(3, 3),true));	m_StoneList [0].name = "stone0";	m_TileArray[MatrixBox(3,3)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (3, 3)].GetComponent<Tile> ().StoneColor = true; m_TileArray [MatrixBox (3, 3)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [0].GetComponent<Stone> ().StoneColor = true;
        m_StoneList.Add (CreateStone(MatrixPos(2, 2),false));	m_StoneList [1].name = "stone1";	m_TileArray[MatrixBox(2,2)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (2, 2)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (2, 2)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [1].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(2, 3),false));	m_StoneList [2].name = "stone2";	m_TileArray[MatrixBox(2,3)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (2, 3)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (2, 3)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [2].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(2, 4),false));	m_StoneList [3].name = "stone3";	m_TileArray[MatrixBox(2,4)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (2, 4)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (2, 4)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [3].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(3, 2),false));	m_StoneList [4].name = "stone4";	m_TileArray[MatrixBox(3,2)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (3, 2)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (3, 2)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [4].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(3, 4),false));	m_StoneList [5].name = "stone5";	m_TileArray[MatrixBox(3,4)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (3, 4)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (3, 4)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [5].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(4, 2),false));	m_StoneList [6].name = "stone6";	m_TileArray[MatrixBox(4,2)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (4, 2)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (4, 2)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [6].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(4, 3),false));	m_StoneList [7].name = "stone7";	m_TileArray[MatrixBox(4,3)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (4, 3)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (4, 3)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [7].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(4, 4),false));	m_StoneList [8].name = "stone8";	m_TileArray[MatrixBox(4,4)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (4, 4)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (4, 4)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [8].GetComponent<Stone> ().StoneColor = false;

        */
        /*
        m_StoneList.Add (CreateStone(MatrixPos(3, 3),true));	m_StoneList [0].name = "stone0";	m_TileArray[MatrixBox(3,3)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (3, 3)].GetComponent<Tile> ().StoneColor = true; m_TileArray [MatrixBox (3, 3)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [0].GetComponent<Stone> ().StoneColor = true;
        m_StoneList.Add (CreateStone(MatrixPos(2, 2),true));	m_StoneList [1].name = "stone1";	m_TileArray[MatrixBox(2,2)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (2, 2)].GetComponent<Tile> ().StoneColor = true; m_TileArray [MatrixBox (2, 2)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [1].GetComponent<Stone> ().StoneColor = false;
        //		m_StoneList.Add (CreateStone(MatrixPos(2, 3),false));	m_StoneList [2].name = "stone2";	m_TileArray[MatrixBox(2,3)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (2, 3)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (2, 3)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [2].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(2, 4),true));	m_StoneList [2].name = "stone3";	m_TileArray[MatrixBox(2,4)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (2, 4)].GetComponent<Tile> ().StoneColor = true; m_TileArray [MatrixBox (2, 4)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [2].GetComponent<Stone> ().StoneColor = false;
        //		m_StoneList.Add (CreateStone(MatrixPos(3, 2),false));	m_StoneList [4].name = "stone4";	m_TileArray[MatrixBox(3,2)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (3, 2)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (3, 2)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [4].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(3, 4),false));	m_StoneList [3].name = "stone5";	m_TileArray[MatrixBox(3,4)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (3, 4)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (3, 4)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [3].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(4, 2),true));	m_StoneList [4].name = "stone6";	m_TileArray[MatrixBox(4,2)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (4, 2)].GetComponent<Tile> ().StoneColor = true; m_TileArray [MatrixBox (4, 2)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [4].GetComponent<Stone> ().StoneColor = false;
        //		m_StoneList.Add (CreateStone(MatrixPos(4, 3),false));	m_StoneList [7].name = "stone7";	m_TileArray[MatrixBox(4,3)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (4, 3)].GetComponent<Tile> ().StoneColor = false; m_TileArray [MatrixBox (4, 3)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [7].GetComponent<Stone> ().StoneColor = false;
        m_StoneList.Add (CreateStone(MatrixPos(4, 4),true));	m_StoneList [5].name = "stone8";	m_TileArray[MatrixBox(4,4)].GetComponent<Tile>().Stone = true;	m_TileArray [MatrixBox (4, 4)].GetComponent<Tile> ().StoneColor = true; m_TileArray [MatrixBox (4, 4)].GetComponent<Tile> ().StoneNum = m_StoneList.Count-1;	m_StoneList [5].GetComponent<Stone> ().StoneColor = false;
        */

        SetAvailable (false);
        // ターンの設定	初期は黒.
        m_TurnManager = false;

        //		Debug.Log ("boardHistory" + BoardHistory.Count);
        BoardLog (false);

        ui.SendMessage("SetText");
    }