Example #1
0
    private void ButtonAtGroup(ToolButton button, int groupIndex, int buttonIndex)
    {
        Tool tool = toolGroups[groupIndex].Tools[buttonIndex];

        button.gameObject.name = tool.Name;
        button.SetIcon(tool.Icon);

        ToolGroupType type = toolGroups[groupIndex].Type;

        button.OnClick = () =>
        {
            if (OnClickTool != null)
            {
                OnClickTool(type, tool);
            }
        };

        button.OnEnter = () =>
        {
            float buttonPosX = buttonGroups[groupIndex].GetPosX() + button.GetPosX();
            SetTip(tool.Description, buttonPosX);
            toolTip.SetActive(true);
        };

        button.OnExit = () =>
        {
            toolTip.SetActive(false);
        };
    }