Drawing_OnDraw() public method

The drawing_ on draw.
public Drawing_OnDraw ( EventArgs args ) : void
args System.EventArgs /// The args. ///
return void
Exemplo n.º 1
0
        /// <summary>
        ///     The on draw.
        /// </summary>
        /// <param name="args">
        ///     The args.
        /// </param>
        private static void OnDraw(EventArgs args)
        {
            if (!MenuSettings.DrawMenu || Config.DisableDrawings)
            {
                return;
            }

            Menu draggedMenu = null;
            var  bgsize      = new Vector2(4, (float)(MenuSettings.MenuItemHeight / 1.2));

            Drawing.DrawRect(
                MenuSettings.BasePosition - new Vector2(MenuSettings.MenuItemHeight / 7, bgsize.Y - bgsize.X),
                new Vector2(
                    MenuSettings.MenuWidth + MenuSettings.MenuItemHeight + MenuSettings.MenuItemHeight / 7,
                    MenuSettings.MenuItemHeight * menuCount + bgsize.Y - bgsize.X),
                Root.SelectedTheme.RootMenuBackgroundColor);
            MenuPanel.Position = MenuSettings.BasePosition - new Vector2(MenuSettings.MenuItemHeight / 7, bgsize.Y - 1);
            MenuPanel.Size     =
                new Vector2(
                    MenuSettings.MenuWidth + MenuSettings.MenuItemHeight + MenuSettings.MenuItemHeight / 7,
                    bgsize.Y);
            MenuPanel.Color = Root.SelectedTheme.TopPanelBackgroundColor;
            MenuPanel.Draw();
            PanelText.Color    = Root.SelectedTheme.TopPanelTextColor;
            PanelText.TextSize = new Vector2((float)(MenuSettings.MenuItemHeight * 0.5));
            PanelText.CenterOnRectangleHorizontally(MenuPanel, (float)(MenuSettings.MenuItemHeight * 0.26));
            PanelText.Draw();

            foreach (var rootMenu in RootMenus.OrderBy(x => x.Value.OrderNumber))
            {
                if (rootMenu.Value.BeingDragged)
                {
                    draggedMenu = rootMenu.Value;
                    continue;
                }

                rootMenu.Value.Drawing_OnDraw(args);
            }

            if (draggedMenu == null)
            {
                return;
            }

            draggedMenu.Drawing_OnDraw(args);
        }