예제 #1
0
    public void SetVertex(GeoVertex vertex)
    {
        element = vertex;

        ButtonBoard buttonBoard = InitRootButtonBoard();

        List <ButtonAtRoot> buttonAtRoot = new List <ButtonAtRoot>();

        buttonAtRoot.Add(ColorButton);
        buttonAtRoot.Add(StyleButton);
        buttonAtRoot.Add(DisplayButton);
        buttonAtRoot.Add(SignButton);

        if (!vertex.isBased)
        {
            buttonAtRoot.Add(DeleteButton);
        }

        if (vertex.isSpace)
        {
            buttonAtRoot.Add(CoordinateButton);
        }

        buttonBoard.CountOfButtons = () => buttonAtRoot.Count;
        buttonBoard.ButtonAtIndex  = (button, i) => buttonAtRoot[i](button);
        buttonBoard.InitButtons();

        overlay.SetActive(true);
    }
예제 #2
0
    public void SetFace(GeoFace face)
    {
        element = face;

        ButtonBoard buttonBoard = InitRootButtonBoard();


        List <ButtonAtRoot> buttonAtRoot = new List <ButtonAtRoot>();

        buttonAtRoot.Add(ColorButton);
        buttonAtRoot.Add(StyleButton);
        buttonAtRoot.Add(DisplayButton);
        buttonAtRoot.Add(SignButton);

        if (!face.isBased)
        {
            buttonAtRoot.Add(DeleteButton);
        }

        buttonBoard.CountOfButtons = () => buttonAtRoot.Count;
        buttonBoard.ButtonAtIndex  = (button, i) => buttonAtRoot[i](button);
        buttonBoard.InitButtons();

        overlay.SetActive(true);
    }
예제 #3
0
    private ButtonBoard InitRootButtonBoard()
    {
        GameObject boardObject = GameObject.Instantiate(ButtonBoardPrefab.gameObject);

        boardObject.transform.SetParent(wrapper.transform, false);
        ButtonBoard buttonBoard = boardObject.GetComponent <ButtonBoard>();

        buttonBoard.Init();

        rootBoard = buttonBoard;
        return(buttonBoard);
    }
예제 #4
0
    private ButtonBoard InitChildButtonBoard()
    {
        GameObject boardObject = GameObject.Instantiate(ButtonBoardPrefab.gameObject);

        boardObject.transform.SetParent(wrapper.transform, false);
        RectTransform rectTransform = boardObject.GetComponent <RectTransform>();

        rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, UIConstants.ElementBottonHeight + UIConstants.ElementBoardSpacing, rectTransform.sizeDelta.y);
        ButtonBoard buttonBoard = boardObject.GetComponent <ButtonBoard>();

        buttonBoard.Init();

        childBoard = buttonBoard.gameObject;
        return(buttonBoard);
    }
예제 #5
0
    private void StyleButton(ButtonBoardCell button)
    {
        button.SetIcon(StyleOfIndex(element.style).Icon);
        button.SetColor(ColorOfIndex(0));

        button.OnClick += () =>
        {
            ButtonToggleActive(button);
        };

        button.OnActiveChanged += (active) =>
        {
            if (!active)
            {
                return;
            }
            ButtonBoard styleBoard = InitChildButtonBoard();
            styleBoard.CountOfButtons = () => ElementStyle(element).Count;
            styleBoard.ButtonAtIndex  = (childButton, index) => ButtonAtStyleBoard(button, childButton, index);
            styleBoard.InitButtons();
        };
    }
예제 #6
0
    private void ColorButton(ButtonBoardCell button)
    {
        button.SetIcon(null);
        button.SetColor(ColorOfIndex(element.color));

        button.OnClick += () =>
        {
            ButtonToggleActive(button);
        };

        button.OnActiveChanged += (active) =>
        {
            if (!active)
            {
                return;
            }
            ButtonBoard colorBoard = InitChildButtonBoard();
            colorBoard.CountOfButtons = () => StyleManager.Themes.Length + 1;
            colorBoard.ButtonAtIndex  = (childButton, index) => ButtonAtColorBoard(button, childButton, index);
            colorBoard.InitButtons();
        };
    }