コード例 #1
0
ファイル: T_D3UI.cs プロジェクト: r3peat/D3Helper.Public
            public static void create_InventoryMesh()
            {
                var Inventory = "Root.NormalLayer.inventory_dialog_mainPage.inventory_button_backpack";
                var inventoryUIRect = UIElement.getRect(Inventory);
                var inventoryRectLeft = inventoryUIRect.Left;
                var inventoryRectTop = inventoryUIRect.Top;
                var inventoryRectRight = inventoryUIRect.Right;
                var inventoryRectBottom = inventoryUIRect.Bottom;

                var itemSlotX = (inventoryRectRight - inventoryRectLeft) / 10;
                var itemSlotY = (inventoryRectBottom - inventoryRectTop) / 6;

                for (int iX = 0; iX <= 9; iX++)
                {
                    for (int iY = 0; iY <= 5; iY++)
                    {
                        UIRect newItemSlot = new UIRect();
                        newItemSlot.Left = inventoryRectLeft + (itemSlotX * iX);
                        newItemSlot.Right = inventoryRectLeft + (itemSlotX * (iX + 1));

                        newItemSlot.Top = inventoryRectTop + (itemSlotY * iY);
                        newItemSlot.Bottom = inventoryRectTop + (itemSlotY * (iY + 1));

                        A_Collection.D3UI.InventoryItemUIRectMesh.Add(new InventoryItemSlot(iX, iY), newItemSlot);
                    }
                }


            }
コード例 #2
0
ファイル: T_D3UI.cs プロジェクト: Defmaster/D3Helper.Public
            public static UIRect get_VersionInfoUIRect()
            {
                if (A_Collection.Me.HeroStates.isInGame)
                {
                    UIRect inventoryMainPage = UIElement.getRect("Root.NormalLayer.inventory_dialog_mainPage");

                    UIRect versionInfoUIRect = new UIRect();
                    versionInfoUIRect.Left = inventoryMainPage.Left + ((inventoryMainPage.Right - inventoryMainPage.Left) * 300 / 1000);
                    versionInfoUIRect.Top = inventoryMainPage.Top + ((inventoryMainPage.Bottom - inventoryMainPage.Top) * 8 / 1000);

                    return versionInfoUIRect;
                }
                return new UIRect();
            }
コード例 #3
0
ファイル: UIRect.cs プロジェクト: onethawt/enigma-d3
        /// <summary>
        /// This is just an example, change type to fit whatever UI system you're using for rendering.
        /// WinForm uses pixels (int) while WPF uses DPI (float).
        /// </summary>
        public UIRect TranslateToClientRect(float clientWidth, float clientHeight)
        {
            // All sizes/positions are based on a Root of height 1200. Its width will depend on
            // what aspect ratio the window (client) currently has.
            const float normalizedHeight = 1200.0f;

            var aspectRatio = clientWidth / clientHeight;
            var uiScale = clientHeight / normalizedHeight;
            var uiRootWidth = aspectRatio * normalizedHeight;
            var uiRootHeight = normalizedHeight;

            // An offset is applied to the horizontal axis in order to compensate for aspect ratio
            // changes. You can see the base is UIRoot width for 4:3 ratio.
            var horizontalOffset = (float)((int)((uiRootHeight * 4f / 3f) - uiRootWidth) >> 1);

            var clientRect = new UIRect();
            clientRect.Left = (Left - horizontalOffset) * uiScale;
            clientRect.Top = (Top * uiScale);
            clientRect.Right = clientRect.Left + (Width * uiScale);
            clientRect.Bottom = clientRect.Top + (Height * uiScale);
            return clientRect;
        }
コード例 #4
0
        /// <summary>
        /// This is just an example, change type to fit whatever UI system you're using for rendering.
        /// WinForm uses pixels (int) while WPF uses DPI (float).
        /// </summary>
        public UIRect TranslateToClientRect(float clientWidth, float clientHeight)
        {
            // All sizes/positions are based on a Root of height 1200. Its width will depend on
            // what aspect ratio the window (client) currently has.
            const float normalizedHeight = 1200.0f;

            var aspectRatio  = clientWidth / clientHeight;
            var uiScale      = clientHeight / normalizedHeight;
            var uiRootWidth  = aspectRatio * normalizedHeight;
            var uiRootHeight = normalizedHeight;

            // An offset is applied to the horizontal axis in order to compensate for aspect ratio
            // changes. You can see the base is UIRoot width for 4:3 ratio.
            var horizontalOffset = (float)((int)((uiRootHeight * 4f / 3f) - uiRootWidth) >> 1);

            var clientRect = new UIRect();

            clientRect.Left   = (Left - horizontalOffset) * uiScale;
            clientRect.Top    = (Top * uiScale);
            clientRect.Right  = clientRect.Left + (Width * uiScale);
            clientRect.Bottom = clientRect.Top + (Height * uiScale);
            return(clientRect);
        }
コード例 #5
0
        void Draw_NextConvention(UIRect portrait, A_Enums.DamageType element)
        {
            ImageBrush background_next = new ImageBrush(getConventionElement_BitmapImage(element));


            Canvas element_next = new Canvas();
            element_next.Opacity = 0.4;
            element_next.Width = portrait.Width;
            element_next.Height = portrait.Width;
            element_next.Background = background_next;

            Canvas.SetLeft(element_next, portrait.Right + portrait.Width);
            Canvas.SetTop(element_next, portrait.Bottom);

            canvas1.Children.Add(element_next);
        }
コード例 #6
0
        void Draw_CurrentConvention(UIRect portrait, A_Enums.DamageType element, double _ticksleft)
        {
            ImageBrush background_current = new ImageBrush(getConventionElement_BitmapImage(element));

            Canvas element_current = new Canvas();
            element_current.Width = portrait.Width;
            element_current.Height = portrait.Width;
            element_current.Background = background_current;

            Canvas.SetLeft(element_current, portrait.Right);
            Canvas.SetTop(element_current, portrait.Bottom);

            //--

            //TextBlock ticksleft_bg = new TextBlock();
            //ticksleft_bg.FontFamily = new FontFamily("Arial Black");
            //ticksleft_bg.Text = (_ticksleft / 60).ToString("0");
            //ticksleft_bg.Foreground = new SolidColorBrush(Colors.Black);
            //ticksleft_bg.Background = new SolidColorBrush(Colors.Transparent);
            //ticksleft_bg.FontSize = FontSize * 2.2;

            //Canvas.SetTop(ticksleft_bg, (portrait.Width / 2) * 40 / 100);
            //Canvas.SetLeft(ticksleft_bg, (portrait.Width / 2) * 50 / 100);
            //element_current.Children.Add(ticksleft_bg);

            //--

            TextBlock ticksleft = new TextBlock();
            ticksleft.FontFamily = new FontFamily("Arial Black");
            ticksleft.Text = (_ticksleft / 60).ToString("0");
            ticksleft.Foreground = new SolidColorBrush(Colors.WhiteSmoke);
            ticksleft.Background = new SolidColorBrush(Colors.Transparent);
            ticksleft.FontSize = FontSize * 1.5;
            
            Canvas.SetTop(ticksleft, (portrait.Width / 2) * 65 / 100);
            Canvas.SetLeft(ticksleft, (portrait.Width / 2) * 65 / 100);
            element_current.Children.Add(ticksleft);
            
            //--
            canvas1.Children.Add(element_current);
        }