コード例 #1
0
ファイル: UISkin.cs プロジェクト: xSlayper/sharptibiaclient
        public void DrawBackground(SpriteBatch Batch, UIElementType type, Rectangle rect)
        {
            if (!Types.ContainsKey(type))
            {
                return;
            }
            UISkinElement e = Types[type];
            // Draw center square
            // Do this first since other stuff might overlap
            Vector2 pos = new Vector2(rect.X + e[UISkinOrientation.TopLeft].Width, rect.Y + e[UISkinOrientation.TopLeft].Height);

            if (e[UISkinOrientation.Center].Width > 0 && e[UISkinOrientation.Center].Height > 0)
            {
                while (pos.Y < rect.Bottom)
                {
                    pos.X = rect.X + e[UISkinOrientation.TopLeft].Width;
                    while (pos.X < rect.Right)
                    {
                        Batch.Draw(UISheet, pos, e[UISkinOrientation.Center], Color.White);
                        pos.X += e[UISkinOrientation.Center].Width;
                    }
                    pos.Y += e[UISkinOrientation.Center].Height;
                }
            }
        }
コード例 #2
0
    public void AddUIElementsSameLine(List <GameObject> uiElements, UIElementType elementType)
    {
        if (uiElements.Count == 0)
        {
            return;
        }

        RectTransform newElementHeightRectTransform = uiElements[0].GetComponentInChildren <TMP_Text>().gameObject.GetComponent <RectTransform>();
        float         height = LayoutUtility.GetPreferredHeight(newElementHeightRectTransform);
        float         offset = height + (elementType == UIElementType.Button ? buttonMargin : textMargin);

        ScrollElements(offset);

        float horizontalOffset = leftMargin;

        for (int i = 0; i < uiElements.Count; ++i)
        {
            if (elementType == UIElementType.Button)
            {
                addedButtons.Add(uiElements[i].GetComponent <DungeonRoomOptionButton>());
            }

            RectTransform newElementOffsetRectTransform = uiElements[i].GetComponent <RectTransform>();
            Vector3       newElementPosition            = newElementOffsetRectTransform.anchoredPosition;
            newElementPosition.x = horizontalOffset;
            newElementPosition.y = canvasHeight * -0.5f + offset + bottomMargin;
            newElementOffsetRectTransform.anchoredPosition = newElementPosition;

            uiElements[i].GetComponent <DynamicButtonWidth>().InitWidth();
            horizontalOffset += newElementOffsetRectTransform.rect.width + itemButtonMargin;

            activeUIElements.AddLast(uiElements[i]);
        }
    }
コード例 #3
0
ファイル: UIElementType.cs プロジェクト: guiqian/GameService
 public static System.Type FindUGUIType(UIElementType uiType)
 {
     System.Type type = null;
     if (mapping.TryGetValue(uiType, out type))
     {
     }
     return(type);
 }
コード例 #4
0
 public void Dispose()
 {
     this.OnUIElementValueChanged = null;
     this.OnValueChanged          = null;
     mUIType    = UIElementType.None;
     mUIPath    = null;
     mComponent = null;
     Value      = default(T);
 }
コード例 #5
0
ファイル: UISkin.cs プロジェクト: xSlayper/sharptibiaclient
        public Vector2 Measure(UIElementType type, UISkinOrientation orientation)
        {
            if (!Types.ContainsKey(type))
            {
                return(new Vector2(0, 0));
            }
            UISkinElement e = Types[type];

            return(new Vector2(e[orientation].Width, e[orientation].Height));
        }
コード例 #6
0
 public UIElement(string text, int fontIndex, Vector2 position) : this(position, false)
 {
     spriteIndex    = -1;
     Width          = 0;
     Height         = 0;
     this.text      = text;
     this.fontIndex = fontIndex;
     tower          = TowerType.None;
     type           = UIElementType.Text;
 }
コード例 #7
0
 public UIElement(int spriteIndex, Vector2 position, int width, int height, bool isClickable, TowerType tower) : this(position, isClickable)
 {
     this.spriteIndex = spriteIndex;
     Width            = width;
     Height           = height;
     text             = "";
     fontIndex        = 0;
     this.tower       = tower;
     type             = UIElementType.Image;
 }
コード例 #8
0
        /// <summary>
        /// Gets the color used for a specific user interface element type, such as a button face or window text.
        /// </summary>
        /// <param name="desiredElement">The type of element for which the color will be obtained.</param>
        /// <returns>The color of the element type, expressed as a 32-bit color value.</returns>
        /// <remarks>
        /// <para/><list type="table">
        /// <listheader><term>Platform</term><description>Version supported</description></listheader>
        /// <item><term>Windows UWP</term><description>Windows 10 Mobile</description></item>
        /// <item><term>Windows Store</term><description>Windows 8.1 or later</description></item>
        /// <item><term>Windows Phone Store</term><description>Windows Phone 8.1 or later</description></item>
        /// <item><term>Windows Phone Silverlight</term><description>Windows Phone 8.0 or later</description></item>
        /// <item><term>Windows (Desktop Apps)</term><description>Windows 7 or later</description></item></list></remarks>
        public Color UIElementColor(UIElementType desiredElement)
        {
#if WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP || WINDOWS_PHONE
            return(_settings.UIElementColor((Windows.UI.ViewManagement.UIElementType)((int)desiredElement)));
#elif WIN32
            uint color = NativeMethods.GetSysColor(UIElementTypeToCOLOR(desiredElement));
            return(Color.FromCOLORREF(color));
#else
            throw new PlatformNotSupportedException();
#endif
        }
コード例 #9
0
ファイル: UISettings.cs プロジェクト: inthehand/Charming
        /// <summary>
        /// Gets the color used for a specific user interface element type, such as a button face or window text.
        /// </summary>
        /// <param name="desiredElement">The type of element for which the color will be obtained.</param>
        /// <returns>The color of the element type, expressed as a 32-bit color value.</returns>
        public Color UIElementColor(UIElementType desiredElement)
        {
#if WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP || WINDOWS_PHONE
            return _settings.UIElementColor((Windows.UI.ViewManagement.UIElementType)((int)desiredElement));
#elif WIN32
            uint color = NativeMethods.GetSysColor(UIElementTypeToCOLOR(desiredElement));
            return Color.FromCOLORREF(color);
#else
            throw new PlatformNotSupportedException();
#endif
        }
コード例 #10
0
 /// <summary>
 /// Creates a new instance of the UIAttribute
 /// </summary>
 /// <param name="displayText">The text to display for the UI element associated with this property.</param>
 /// <param name="kind">The kind of UI element to create. If not specified, the engine will attempt to determine the kind based on the property's type.</param>
 /// <param name="enumOptions">Options for UIElementType.Enums. Can be checkboxes or radio buttons. Defaults to radio buttons if not specified.</param>
 /// <param name="enumLayout">Enum toggle button layout - horizontal or vertical. Defaults to vertical.</param>
 /// <param name="getVisible">The name of a parameterless boolean method or boolean property that will be called to determine whether this UI element is visible or not.</param>
 public UIAttribute(string displayText,
                    UIElementType kind        = UIElementType.Auto,
                    UIEnumOptions enumOptions = UIEnumOptions.RadioButtons,
                    UIEnumLayout enumLayout   = UIEnumLayout.Vertical,
                    string getVisible         = null)
 {
     DisplayText = displayText;
     Kind        = kind;
     EnumOptions = enumOptions;
     EnumLayout  = enumLayout;
     GetVisible  = getVisible;
 }
コード例 #11
0
        public void ShowAttribute(string attributeName, UIElementType uiElementType, int uiElementIndex)
        {
            var att       = _fableData.GetAttribute(attributeName);
            var container = FableUIManager.Instance.GetUIElement(uiElementIndex);

            switch (uiElementType)
            {
            case UIElementType.Slider:
                container.GetComponent <Slider>().value = att.Value;
                break;

            case UIElementType.Text:
                container.GetComponent <TextMeshProUGUI>().text = $"{att.Name}: {att.Value}";
                break;
            }
        }
コード例 #12
0
ファイル: UIAttribute.cs プロジェクト: MillerMark/Dynamic-UI
 /// <summary>
 /// Creates a new instance of the UIAttribute
 /// </summary>
 /// <param name="displayText">The text to display for the UI element associated with this property.</param>
 /// <param name="kind">The kind of UI element to create. If not specified, the engine will attempt to determine the kind based on the property's type.</param>
 /// <param name="row">The row number to place this UI element in.</param>
 /// <param name="column">The column to place this UI element in. If not specified, defaults to the left column.</param>
 /// <param name="enumOptions">Options for UIElementType.Enums. Can be checkboxes or radio buttons. Defaults to radio buttons if not specified.</param>
 /// <param name="enumLayout">Enum toggle button layout - horizontal or vertical. Defaults to vertical.</param>
 /// <param name="getVisible">The name of a parameterless boolean method or boolean property that will be called to determine whether this UI element is visible or not.</param>
 public UIAttribute(string displayText,
                    UIElementType kind        = UIElementType.Auto,
                    int row                   = 0,
                    Column column             = Column.Left,
                    UIEnumOptions enumOptions = UIEnumOptions.RadioButtons,
                    UIEnumLayout enumLayout   = UIEnumLayout.Vertical,
                    string getVisible         = null)
 {
     GetVisible  = getVisible;
     EnumLayout  = enumLayout;
     EnumOptions = enumOptions;
     Kind        = kind;
     DisplayText = displayText;
     Row         = row;
     Column      = column;
 }
コード例 #13
0
        private static int UIElementTypeToCOLOR(UIElementType t)
        {
            switch (t)
            {
            case UIElementType.ActiveCaption:
                return(2);

            case UIElementType.Background:
                return(1);

            case UIElementType.ButtonFace:
                return(15);

            case UIElementType.ButtonText:
                return(18);

            case UIElementType.CaptionText:
                return(9);

            case UIElementType.GrayText:
                return(17);

            case UIElementType.Highlight:
                return(13);

            case UIElementType.HighlightText:
                return(14);

            case UIElementType.Hotlight:
                return(26);

            case UIElementType.InactiveCaption:
                return(3);

            case UIElementType.InactiveCaptionText:
                return(19);

            case UIElementType.Window:
                return(5);

            case UIElementType.WindowText:
                return(8);
            }

            return(0);
        }
コード例 #14
0
ファイル: UISettings.cs プロジェクト: inthehand/Charming
        private static int UIElementTypeToCOLOR(UIElementType t)
        {
            switch (t)
            {
                case UIElementType.ActiveCaption:
                    return 2;

                case UIElementType.Background:
                    return 1;

                case UIElementType.ButtonFace:
                    return 15;

                case UIElementType.ButtonText:
                    return 18;

                case UIElementType.CaptionText:
                    return 9;

                case UIElementType.GrayText:
                    return 17;

                case UIElementType.Highlight:
                    return 13;

                case UIElementType.HighlightText:
                    return 14;

                case UIElementType.Hotlight:
                    return 26;

                case UIElementType.InactiveCaption:
                    return 3;

                case UIElementType.InactiveCaptionText:
                    return 19;

                case UIElementType.Window:
                    return 5;

                case UIElementType.WindowText:
                    return 8;
            }

            return 0;
        }
コード例 #15
0
ファイル: UISkin.cs プロジェクト: hjnilsson/sharptibiaclient
 public void DrawBackground(SpriteBatch Batch, UIElementType type, Rectangle rect)
 {
     if (!Types.ContainsKey(type))
         return;
     UISkinElement e = Types[type];
     // Draw center square
     // Do this first since other stuff might overlap
     Vector2 pos = new Vector2(rect.X + e[UISkinOrientation.TopLeft].Width, rect.Y + e[UISkinOrientation.TopLeft].Height);
     if (e[UISkinOrientation.Center].Width > 0 && e[UISkinOrientation.Center].Height > 0)
     {
         while (pos.Y < rect.Bottom)
         {
             pos.X = rect.X + e[UISkinOrientation.TopLeft].Width;
             while (pos.X < rect.Right)
             {
                 Batch.Draw(UISheet, pos, e[UISkinOrientation.Center], Color.White);
                 pos.X += e[UISkinOrientation.Center].Width;
             }
             pos.Y += e[UISkinOrientation.Center].Height;
         }
     }
 }
コード例 #16
0
    public void AddUIElement(GameObject uiElement, UIElementType elementType)
    {
        RectTransform newElementHeightRectTransform = uiElement.GetComponentInChildren <TMP_Text>().gameObject.GetComponent <RectTransform>();
        float         height = LayoutUtility.GetPreferredHeight(newElementHeightRectTransform);

        float offset = height + (elementType == UIElementType.Button ? buttonMargin : textMargin);

        if (elementType == UIElementType.Button)
        {
            addedButtons.Add(uiElement.GetComponent <DungeonRoomOptionButton>());
        }

        RectTransform newElementOffsetRectTransform = uiElement.GetComponent <RectTransform>();
        Vector3       newElementPosition            = newElementOffsetRectTransform.anchoredPosition;

        newElementPosition.x = leftMargin;
        newElementPosition.y = canvasHeight * -0.5f + offset + bottomMargin;
        newElementOffsetRectTransform.anchoredPosition = newElementPosition;

        ScrollElements(offset);
        activeUIElements.AddLast(uiElement);
    }
コード例 #17
0
 // Returns whether the given DynamicObject is a UIElement or not.
 internal static bool IsUIElement(DependencyObject o)
 {
     return(UIElementType.IsInstanceOfType(o));
 }
コード例 #18
0
 protected virtual GameObject Create(UIElementType element)
 {
     return(Create(element, contentContainer));
 }
コード例 #19
0
ファイル: UISkin.cs プロジェクト: hjnilsson/sharptibiaclient
 public Vector2 Measure(UIElementType type, UISkinOrientation orientation)
 {
     if (!Types.ContainsKey(type))
         return new Vector2(0, 0);
     UISkinElement e = Types[type];
     return new Vector2(e[orientation].Width, e[orientation].Height);
 }
コード例 #20
0
 public UIElement GetUIElement(VSCompletion itemToRender, ICompletionSession context, UIElementType elementType)
 {
     return(null);
 }
コード例 #21
0
ファイル: DecalProxy.cs プロジェクト: IbespwnAC/MagTools
        public static void Hooks_UIElementMove(Decal.Adapter.Wrappers.HooksWrapper hooks, UIElementType e, int x, int y)
        {
            //This will load the cached assembly. We don't actually care what the version is
            //since we just check below if the required members are present.
            TestDecalVersion(new Version());

            int ee = (int)e;

            Type DecalType_UIElementType = iCachedDecalAssembly.GetType("Decal.Adapter.Wrappers.UIElementType");
            if (DecalType_UIElementType == null) return;
            object e_decal = Enum.ToObject(DecalType_UIElementType, ee);

            Type DecalType_HooksWrapper = iCachedDecalAssembly.GetType("Decal.Adapter.Wrappers.HooksWrapper");
            if (DecalType_HooksWrapper == null) return;
            MethodInfo call = DecalType_HooksWrapper.GetMethod("UIElementMove", new Type[] { DecalType_UIElementType, typeof(int), typeof(int) });
            if (call == null) return;

            call.Invoke(hooks, new object[] { e_decal, x, y });
        }
コード例 #22
0
ファイル: UISkin.cs プロジェクト: xSlayper/sharptibiaclient
 public UISkinElement(UIElementType e)
 {
     Type = e;
 }
コード例 #23
0
ファイル: UISkin.cs プロジェクト: xSlayper/sharptibiaclient
        public void DrawBox(SpriteBatch Batch, UIElementType type, Rectangle rect)
        {
            if (!Types.ContainsKey(type))
            {
                return;
            }
            UISkinElement e = Types[type];

            Vector2 pos;

            // Draw top left
            if (e[UISkinOrientation.TopLeft].Width > 0 && e[UISkinOrientation.TopLeft].Height > 0)
            {
                pos = new Vector2(rect.X, rect.Y);
                Batch.Draw(UISheet, pos, e[UISkinOrientation.TopLeft], Color.White);
            }

            // Draw top
            if (e[UISkinOrientation.Top].Width > 0 && e[UISkinOrientation.Top].Height > 0)
            {
                pos = new Vector2(rect.X + e[UISkinOrientation.TopLeft].Width, rect.Y);
                while (pos.X < rect.Right)
                {
                    Batch.Draw(UISheet, pos, e[UISkinOrientation.Top], Color.White);
                    pos.X += e[UISkinOrientation.Top].Width;
                }
            }

            // Draw top right
            if (e[UISkinOrientation.TopRight].Width > 0 && e[UISkinOrientation.TopRight].Height > 0)
            {
                pos = new Vector2(rect.Right - e[UISkinOrientation.TopRight].Width, rect.Y);
                Batch.Draw(UISheet, pos, e[UISkinOrientation.TopRight], Color.White);
            }

            // Draw center left
            if (e[UISkinOrientation.Left].Width > 0 && e[UISkinOrientation.Left].Height > 0)
            {
                pos = new Vector2(rect.X, rect.Y + e[UISkinOrientation.TopLeft].Height);
                while (pos.Y < rect.Bottom)
                {
                    Batch.Draw(UISheet, pos, e[UISkinOrientation.Left], Color.White);
                    pos.Y += e[UISkinOrientation.Left].Height;
                }
            }

            // Draw center right
            if (e[UISkinOrientation.Right].Width > 0 && e[UISkinOrientation.Right].Height > 0)
            {
                pos = new Vector2(rect.Right - e[UISkinOrientation.Right].Width, rect.Y + e[UISkinOrientation.TopRight].Height);
                while (pos.Y < rect.Bottom)
                {
                    Batch.Draw(UISheet, pos, e[UISkinOrientation.Right], Color.White);
                    pos.Y += e[UISkinOrientation.Right].Height;
                }
            }

            // Draw bottom left
            if (e[UISkinOrientation.BottomLeft].Width > 0 && e[UISkinOrientation.BottomLeft].Height > 0)
            {
                pos = new Vector2(rect.X, rect.Bottom - e[UISkinOrientation.BottomLeft].Height);
                Batch.Draw(UISheet, pos, e[UISkinOrientation.BottomLeft], Color.White);
            }

            // Draw bottom
            if (e[UISkinOrientation.Bottom].Width > 0 && e[UISkinOrientation.Bottom].Height > 0)
            {
                pos = new Vector2(rect.X + e[UISkinOrientation.BottomLeft].Width, rect.Bottom - e[UISkinOrientation.Bottom].Height);
                while (pos.X < rect.Right)
                {
                    Batch.Draw(UISheet, pos, e[UISkinOrientation.Bottom], Color.White);
                    pos.X += e[UISkinOrientation.Bottom].Width;
                }
            }

            // Draw bottom right
            if (e[UISkinOrientation.BottomRight].Width > 0 && e[UISkinOrientation.BottomRight].Height > 0)
            {
                pos = new Vector2(rect.Right - e[UISkinOrientation.BottomRight].Width, rect.Bottom - e[UISkinOrientation.BottomRight].Height);
                Batch.Draw(UISheet, pos, e[UISkinOrientation.BottomRight], Color.White);
            }
        }
コード例 #24
0
        private string GetRgbaString(UIElementType type)
        {
            var color = _settings.UIElementColor(type);

            return("rgba(" + color.R + "," + color.G + "," + color.B + "," + color.A + ")");
        }
コード例 #25
0
 public UIElement GetUIElement(Completion itemToRender, ICompletionSession context, UIElementType elementType)
 {
     if (elementType == UIElementType.Tooltip)
     {
         return(new CompletionTooltipCustomization(itemToRender));
     }
     else
     {
         return(null);
     }
 }
コード例 #26
0
        public UIElement GetUIElement(Completion itemToRender, ICompletionSession context, UIElementType elementType)
        {
            if (elementType == UIElementType.Tooltip && itemToRender is SimpleCompletionEntry entry)
            {
                if (!string.IsNullOrEmpty(entry.Description))
                {
                    return(new UI.Controls.EditorTooltip(entry));
                }
            }

            return(null);
        }
コード例 #27
0
ファイル: UISkin.cs プロジェクト: hjnilsson/sharptibiaclient
        public void DrawBox(SpriteBatch Batch, UIElementType type, Rectangle rect)
        {
            if (!Types.ContainsKey(type))
                return;
            UISkinElement e = Types[type];

            Vector2 pos;

            // Draw top left
            if (e[UISkinOrientation.TopLeft].Width > 0 && e[UISkinOrientation.TopLeft].Height > 0)
            {
                pos = new Vector2(rect.X, rect.Y);
                Batch.Draw(UISheet, pos, e[UISkinOrientation.TopLeft], Color.White);
            }

            // Draw top
            if (e[UISkinOrientation.Top].Width > 0 && e[UISkinOrientation.Top].Height > 0)
            {
                pos = new Vector2(rect.X + e[UISkinOrientation.TopLeft].Width, rect.Y);
                while (pos.X < rect.Right)
                {
                    Batch.Draw(UISheet, pos, e[UISkinOrientation.Top], Color.White);
                    pos.X += e[UISkinOrientation.Top].Width;
                }
            }

            // Draw top right
            if (e[UISkinOrientation.TopRight].Width > 0 && e[UISkinOrientation.TopRight].Height > 0)
            {
                pos = new Vector2(rect.Right - e[UISkinOrientation.TopRight].Width, rect.Y);
                Batch.Draw(UISheet, pos, e[UISkinOrientation.TopRight], Color.White);
            }

            // Draw center left
            if (e[UISkinOrientation.Left].Width > 0 && e[UISkinOrientation.Left].Height > 0)
            {
                pos = new Vector2(rect.X, rect.Y + e[UISkinOrientation.TopLeft].Height);
                while (pos.Y < rect.Bottom)
                {
                    Batch.Draw(UISheet, pos, e[UISkinOrientation.Left], Color.White);
                    pos.Y += e[UISkinOrientation.Left].Height;
                }
            }

            // Draw center right
            if (e[UISkinOrientation.Right].Width > 0 && e[UISkinOrientation.Right].Height > 0)
            {
                pos = new Vector2(rect.Right - e[UISkinOrientation.Right].Width, rect.Y + e[UISkinOrientation.TopRight].Height);
                while (pos.Y < rect.Bottom)
                {
                    Batch.Draw(UISheet, pos, e[UISkinOrientation.Right], Color.White);
                    pos.Y += e[UISkinOrientation.Right].Height;
                }
            }

            // Draw bottom left
            if (e[UISkinOrientation.BottomLeft].Width > 0 && e[UISkinOrientation.BottomLeft].Height > 0)
            {
                pos = new Vector2(rect.X, rect.Bottom - e[UISkinOrientation.BottomLeft].Height);
                Batch.Draw(UISheet, pos, e[UISkinOrientation.BottomLeft], Color.White);
            }

            // Draw bottom
            if (e[UISkinOrientation.Bottom].Width > 0 && e[UISkinOrientation.Bottom].Height > 0)
            {
                pos = new Vector2(rect.X + e[UISkinOrientation.BottomLeft].Width, rect.Bottom - e[UISkinOrientation.Bottom].Height);
                while (pos.X < rect.Right)
                {
                    Batch.Draw(UISheet, pos, e[UISkinOrientation.Bottom], Color.White);
                    pos.X += e[UISkinOrientation.Bottom].Width;
                }
            }

            // Draw bottom right
            if (e[UISkinOrientation.BottomRight].Width > 0 && e[UISkinOrientation.BottomRight].Height > 0)
            {
                pos = new Vector2(rect.Right - e[UISkinOrientation.BottomRight].Width, rect.Bottom - e[UISkinOrientation.BottomRight].Height);
                Batch.Draw(UISheet, pos, e[UISkinOrientation.BottomRight], Color.White);
            }
        }
コード例 #28
0
ファイル: DecalProxy.cs プロジェクト: IbespwnAC/MagTools
        public static Rectangle Hooks_UIElementRegion(Decal.Adapter.Wrappers.HooksWrapper hooks, UIElementType e)
        {
            //This will load the cached assembly. We don't actually care what the version is
            //since we just check below if the required members are present.
            TestDecalVersion(new Version());

            int ee = (int)e;

            Type DecalType_UIElementType = iCachedDecalAssembly.GetType("Decal.Adapter.Wrappers.UIElementType");
            if (DecalType_UIElementType == null) return Rectangle.Empty;
            object e_decal = Enum.ToObject(DecalType_UIElementType, ee);

            Type DecalType_HooksWrapper = iCachedDecalAssembly.GetType("Decal.Adapter.Wrappers.HooksWrapper");
            if (DecalType_HooksWrapper == null) return Rectangle.Empty;
            MethodInfo call = DecalType_HooksWrapper.GetMethod("UIElementRegion", new Type[] { DecalType_UIElementType });
            if (call == null) return Rectangle.Empty;

            return (Rectangle)call.Invoke(hooks, new object[] { e_decal });
        }
コード例 #29
0
ファイル: UISkin.cs プロジェクト: hjnilsson/sharptibiaclient
 public UISkinElement(UIElementType e)
 {
     Type = e;
 }
コード例 #30
0
 public GameObject Create(UIElementType element)
 {
     return(Create(element, rootElement));
 }
コード例 #31
0
        public UIElement GetUIElement(Completion itemToRender, ICompletionSession context, UIElementType elementType)
        {
            if (RoslynUtilities.IsFinalRoslyn)
            {
                // The bug which requires this provider has been fixed
                return(null);
            }

            // only hook when necessary
            if ((!RoslynUtilities.IsRoslynInstalled(_serviceProvider) ?? true) || !_mefProviderOptions.EnableExtendedXmlCommentsCompletion)
            {
                return(null);
            }

            if (itemToRender != null && itemToRender.GetType().FullName != "Microsoft.CodeAnalysis.Editor.Implementation.Completion.Presentation.CustomCommitCompletion")
            {
                // The Roslyn-provided tool tip provider will throw an exception in this case, so
                // we override it with the default Visual Studio behavior
                TextBlock formattableTextBlock = new TextBlock();
                formattableTextBlock.Text         = itemToRender.Description;
                formattableTextBlock.MaxWidth     = GetScreenRect(context).Width * 0.4;
                formattableTextBlock.TextWrapping = TextWrapping.Wrap;
                //formattableTextBlock.TextRunProperties = this._completionTabView.SessionView.PresenterStyle.TooltipTextRunProperties;
                return(formattableTextBlock);
            }

            // allow Roslyn to handle this case
            return(null);
        }
コード例 #32
0
        public static void Hooks_UIElementMove(Decal.Adapter.Wrappers.HooksWrapper hooks, UIElementType e, int x, int y)
        {
            //This will load the cached assembly. We don't actually care what the version is
            //since we just check below if the required members are present.
            TestDecalVersion(new Version());

            int ee = (int)e;

            Type DecalType_UIElementType = iCachedDecalAssembly.GetType("Decal.Adapter.Wrappers.UIElementType");

            if (DecalType_UIElementType == null)
            {
                return;
            }
            object e_decal = Enum.ToObject(DecalType_UIElementType, ee);

            Type DecalType_HooksWrapper = iCachedDecalAssembly.GetType("Decal.Adapter.Wrappers.HooksWrapper");

            if (DecalType_HooksWrapper == null)
            {
                return;
            }
            MethodInfo call = DecalType_HooksWrapper.GetMethod("UIElementMove", new Type[] { DecalType_UIElementType, typeof(int), typeof(int) });

            if (call == null)
            {
                return;
            }

            call.Invoke(hooks, new object[] { e_decal, x, y });
        }
コード例 #33
0
 protected virtual GameObject Create(UIElementType element, GameObject parent)
 {
     return(UIManager.instance.Create(element, parent));
 }
コード例 #34
0
        public UIElement?GetUIElement(Completion itemToRender, ICompletionSession context, UIElementType elementType)
        {
            if (elementType != UIElementType.Tooltip)
            {
                return(null);
            }

            if (lastAsyncToolTipContentWeakReference?.Target is AsyncToolTipContent lastAsyncToolTipContent && lastAsyncToolTipContent.Session == context)
            {
                lastAsyncToolTipContent.Cancel();
                lastAsyncToolTipContentWeakReference = null;
            }

            var roslynCompletion = itemToRender as RoslynCompletion;

            if (roslynCompletion is null)
            {
                return(null);
            }
            var roslynCollection = context.SelectedCompletionSet as RoslynCompletionSet;

            Debug.Assert(!(roslynCollection is null));
            if (roslynCollection is null)
            {
                return(null);
            }

            const bool colorize = true;
            var        result   = new AsyncToolTipContent(this, roslynCollection, roslynCompletion, context, taggedTextElementProviderService, colorize);

            lastAsyncToolTipContentWeakReference = result.IsDisposed ? null : new WeakReference(result);
            return(result);
        }
コード例 #35
0
        public UIElement GetUIElement(VSCompletion itemToRender, ICompletionSession context, UIElementType elementType)
        {
            var item = itemToRender as CustomCommitCompletion;

            if (item == null)
            {
                return(null);
            }

            return(new CancellableContentControl(this, item));
        }
コード例 #36
0
ファイル: UIView.cs プロジェクト: xSlayper/sharptibiaclient
 /// <summary>
 /// Base constructor for all UIPanels
 /// </summary>
 /// <param name="Frame">The size and position of the element </param>
 /// <param name="ElementType">What style type this element should use.</param>
 public UIView(Rectangle?Frame = null, UIElementType ElementType = UIElementType.None)
 {
     Bounds           = Frame ?? new Rectangle(0, 0, 0, 0);
     this.ElementType = ElementType;
 }
コード例 #37
0
        public UIElement GetUIElement(CompletionSet itemToRender, ICompletionSession context, UIElementType elementType)
        {
            if (_gettingUIElement)
            {
                return(null);
            }
            _gettingUIElement = true;
            try {
                var orderedProviders = Orderer.Order(UnOrderedCompletionSetUIElementProviders);
                var pyContentType    = _serviceProvider.GetPythonContentType();
                foreach (var presenterProviderExport in orderedProviders)
                {
                    foreach (var contentType in presenterProviderExport.Metadata.ContentTypes)
                    {
                        if (pyContentType.IsOfType(contentType))
                        {
                            if (presenterProviderExport.Value.GetType() == typeof(CompletionUIElementProvider))
                            {
                                // don't forward to ourselves...
                                continue;
                            }

                            var res = presenterProviderExport.Value.GetUIElement(itemToRender, context, elementType);
                            if (res != null)
                            {
                                if (_isPreSp1)
                                {
                                    return(res);
                                }

                                return(new CompletionControl(_serviceProvider, res, context));
                            }
                        }
                    }
                }

                return(null);
            } finally {
                _gettingUIElement = false;
            }
        }
コード例 #38
0
 public GameObject Create(UIElementType element, GameObject parent)
 {
     return(Instantiate(genericPrefabs[element], parent.transform));
 }