//private UILabel optionsLabel;

        public override void Start()
        {
            isVisible = false;

            backgroundSprite = "GenericPanel";
            color            = new Color32(64, 64, 64, 240);
            width            = MENU_WIDTH;
            height           = MENU_HEIGHT;

            VersionLabel = AddUIComponent <VersionLabel>();
            StatsLabel   = AddUIComponent <StatsLabel>();

            Buttons = new MenuButton[MENU_BUTTON_TYPES.Length];

            int i = 0;
            int y = TOP_BORDER;

            for (int row = 0; row < NUM_ROWS; ++row)
            {
                int x = HSPACING;
                for (int col = 0; col < NUM_BUTTONS_PER_ROW; ++col)
                {
                    if (i >= Buttons.Length)
                    {
                        break;
                    }

                    MenuButton button = AddUIComponent(MENU_BUTTON_TYPES[i]) as MenuButton;
                    button.relativePosition = new Vector3(x, y);
                    Buttons[i++]            = button;
                    x += BUTTON_SIZE + HSPACING;
                }
                y += BUTTON_SIZE + VSPACING;
            }

            GlobalConfig config = GlobalConfig.Instance;
            Vector3      pos    = new Vector3(config.Main.MainMenuX, config.Main.MainMenuY);

            VectorUtil.ClampPosToScreen(ref pos);
            absolutePosition = pos;

            var dragHandler = new GameObject("TMPE_Menu_DragHandler");

            dragHandler.transform.parent        = transform;
            dragHandler.transform.localPosition = Vector3.zero;
            Drag = dragHandler.AddComponent <UIDragHandle>();

            Drag.width   = width;
            Drag.height  = TOP_BORDER;
            Drag.enabled = !GlobalConfig.Instance.Main.MainMenuPosLocked;
        }
        public override void Start()
        {
            // Place the button.
            GlobalConfig config = GlobalConfig.Instance;
            Vector3      pos    = new Vector3(config.Main.MainMenuButtonX, config.Main.MainMenuButtonY);

            VectorUtil.ClampPosToScreen(ref pos);
            absolutePosition = pos;

            // Set the atlas and background/foreground
            atlas = TextureUtil.GenerateLinearAtlas("TMPE_MainMenuButtonAtlas", TextureResources.MainMenuButtonTexture2D, 6, new string[] {
                MAIN_MENU_BUTTON_BG_BASE,
                MAIN_MENU_BUTTON_BG_HOVERED,
                MAIN_MENU_BUTTON_BG_ACTIVE,
                MAIN_MENU_BUTTON_FG_BASE,
                MAIN_MENU_BUTTON_FG_HOVERED,
                MAIN_MENU_BUTTON_FG_ACTIVE
            });

            UpdateSprites();

            // Set the button dimensions.
            width  = 50;
            height = 50;

            // Enable button sounds.
            playAudioEvents = true;

            var dragHandler = new GameObject("TMPE_MainButton_DragHandler");

            dragHandler.transform.parent        = transform;
            dragHandler.transform.localPosition = Vector3.zero;
            Drag = dragHandler.AddComponent <UIDragHandle>();

            Drag.width   = width;
            Drag.height  = height;
            Drag.enabled = !GlobalConfig.Instance.Main.MainMenuButtonPosLocked;
        }