コード例 #1
0
    // Use this for initialization
    void Start()
    {
        gameBoard = GetComponent <BoardScript>();
        textTurn  = Instantiate(textPrefab, new Vector3(0, 0, 0), Quaternion.identity, canvas.transform);
        textPass  = Instantiate(textPrefab, new Vector3(0, 0, 0), Quaternion.identity, canvas.transform);

        textTurn.text = turn1;
        //textTurn.fontSize = 40;
        textTurn.rectTransform.anchoredPosition = new Vector2(-100, 0);
        //textTurn.rectTransform.anchorMax = new Vector2(1, 0.5f);
        //textTurn.rectTransform.anchorMin = new Vector2(1, 0.5f);
        //textTurn.rectTransform.sizeDelta = new Vector2(textTurn.fontSize * textTurn.text.Length + 5, textTurn.fontSize + 5);
        textPass.text = pass;
        textPass.rectTransform.anchoredPosition = new Vector2(-100, 60);
        textPass.color = new Color(0, 0, 0, 0);

        buttonUnDo = Instantiate(buttonUnDoPrefab, new Vector3(0, 0, 0), Quaternion.identity, canvas.transform);
        buttonUnDo.GetComponent <RectTransform>().anchoredPosition = new Vector2(-150, -100);
        buttonUnDo.GetComponentInChildren <Text>().text            = "1手戻す";
        buttonUnDo.GetComponentInChildren <Text>().fontSize        = 40;
        buttonUnDo.onClick.AddListener(() => gameBoard.Undo());
        //ゲーム版の作成
        Instantiate(board);

        gameBoard.Init();
        gameBoard.GetReversePointList(gameBoard.turnFlag);
    }