Example #1
0
        private static void DrawWarningMessage(EventArgs args, string message = "", SharpDX.Color color = default(Color))
        {
            if (ObjectManager.Player.IsDead)
            {
                return;
            }

            var xColor = color;

            DrawHelper.DrawText(DrawHelper.TextWarning, message, Drawing.Width * 0.301f, Drawing.Height * 0.422f,
                                SharpDX.Color.Black);
            DrawHelper.DrawText(DrawHelper.TextWarning, message, Drawing.Width * 0.30f, Drawing.Height * 0.42f,
                                xColor);
        }
Example #2
0
 public void DrawString(string text, float x, float y, FontWeight fw, SharpDX.DirectWrite.FontStyle fs, SharpDX.Color fontColor, float fontHeight, bool isUnderlined)
 {
     if ((y > -2) && (y <= tbHeight - fontHeight))
     {
         gv.DrawText(text, x + tbXloc, y + tbYloc, fw, fs, 1.0f, fontColor, isUnderlined);
     }
 }
Example #3
0
        /*
         * format is as follows
         * To change color of the string surround hex codes with {} Example: "Uncolored {#AARRGGBB}Colored"
         * having a blank {} will make it go back to default imgui text color, Example: "Uncolored {#AARRGGBB}Colored {}Back to orig color"
         */
        public void Coloredtext(string TextIn)
        {
            try
            {
                var accumulatedText   = "";
                var StartColor        = ImGui.GetStyle().GetColor(ColorTarget.Text);
                var foundBracketStart = "";
                var hexCode           = "";
                var sameLine          = false;
                var nextColor         = StartColor;
                for (var i = 0; i < TextIn.Length; i++)
                {
                    if (TextIn[i] == '{')
                    {
                        foundBracketStart = TextIn.Substring(i + 1);
                        for (var j = 0; j < foundBracketStart.Length; j++)
                        {
                            i++;
                            if (foundBracketStart[j] == '}')
                            {
                                break;
                            }
                            hexCode += foundBracketStart[j];
                        }

                        if (sameLine)
                        {
                            ImGui.SameLine(0f, 0f);
                        }
                        ImGui.Text(accumulatedText, nextColor);
                        if (TextIn[i - 1] == '{')
                        {
                            nextColor = StartColor;
                        }
                        accumulatedText = "";
                        sameLine        = true;
                        if (hexCode != "")
                        {
                            var tempColor  = ColorTranslator.FromHtml(hexCode);
                            var tempColor2 = new SharpDX.Color(tempColor.R, tempColor.G, tempColor.B, tempColor.A).ToVector4();
                            nextColor = new System.Numerics.Vector4(tempColor2.X, tempColor2.Y, tempColor2.Z, tempColor2.W);
                        }

                        i++;
                        hexCode = "";
                    }

                    accumulatedText += TextIn[i];
                }

                if (sameLine)
                {
                    ImGui.SameLine(0f, 0f);
                }
                ImGui.Text(accumulatedText, nextColor);
            }
            catch (Exception e)
            {
                // This spams all the time even tho nothing seems broken so it can f**k riiiiiiiight off
                //LogError("ColorText: Incorrect hex format \n" + e, 15);
            }
        }
Example #4
0
            public RecallRender(Packet.S2C.Teleport.Struct recall)
            {
                var recWidth = 200;

                Recall    = recall;
                Rectangle = new Render.Rectangle(Drawing.Width / 2, Drawing.Height / 4, recWidth, 10, SharpDX.Color.Green);
                Rectangle.PositionUpdate += delegate
                {
                    float percent  = RecallStatusPercent();
                    var   newWidth = (int)(recWidth - (recWidth * percent));
                    if (!Rectangle.Width.Equals(newWidth))
                    {
                        Rectangle.Width = newWidth;
                    }
                    SharpDX.Color newCol = Common.PercentColorRedToGreen(percent);
                    if (!Equals(newCol, Rectangle.Color))
                    {
                        Rectangle.Color = newCol;
                    }
                    return(new Vector2(Drawing.Width / 2 - recWidth / 2, Drawing.Height / 1.5f));
                };
                Rectangle.VisibleCondition = delegate
                {
                    return(IsActive() && Recall.Status == Packet.S2C.Teleport.Status.Start && (Recall.Start + Recall.Duration - Environment.TickCount) > 0);
                };
                Rectangle.Add(1);
                Line = new Render.Line(new Vector2(0, 0), new Vector2(0, 0), 1, SharpDX.Color.WhiteSmoke);
                Line.StartPositionUpdate += delegate
                {
                    return(new Vector2(Rectangle.X + Rectangle.Width, Rectangle.Y - 5));
                };
                Line.EndPositionUpdate += delegate
                {
                    return(new Vector2(Rectangle.X + Rectangle.Width, Rectangle.Y));
                };
                Line.VisibleCondition = delegate
                {
                    SharpDX.Color newCol = new SharpDX.Color(255, 255, 255, (int)(255 - (255 * RecallStatusPercent())));
                    if (!Equals(newCol, Line.Color))
                    {
                        Line.Color = newCol;
                    }
                    return(IsActive() && Recall.Status == Packet.S2C.Teleport.Status.Start && (Recall.Start + Recall.Duration - Environment.TickCount) > 0);
                };
                Line.Add(1);
                Text = new Render.Text(ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(Recall.UnitNetworkId).ChampionName, 0, 0, 18, SharpDX.Color.WhiteSmoke);
                Text.PositionUpdate += delegate
                {
                    return(new Vector2(Line.Start.X, Line.Start.Y - 15));
                };
                Text.TextUpdate = delegate
                {
                    SharpDX.Color newCol = new SharpDX.Color(255, 255, 255, (int)(255 - (150 * RecallStatusPercent())));
                    if (!Equals(newCol, Text.Color))
                    {
                        Text.Color = newCol;
                    }
                    return(ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(Recall.UnitNetworkId).ChampionName);
                };
                Text.Centered         = true;
                Text.VisibleCondition = delegate
                {
                    return(IsActive() && Recall.Status == Packet.S2C.Teleport.Status.Start && (Recall.Start + Recall.Duration - Environment.TickCount) > 0);
                };
                Text.Add(1);
                Text2 = new Render.Text(ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(Recall.UnitNetworkId).ChampionName, 0, 0, 18, SharpDX.Color.WhiteSmoke);
                Text2.PositionUpdate += delegate
                {
                    return(new Vector2(Line.Start.X, Line.Start.Y - 5));
                };
                Text2.TextUpdate = delegate
                {
                    SharpDX.Color newCol = new SharpDX.Color(255, 255, 255, (int)(255 - (150 * RecallStatusPercent())));
                    if (!Equals(newCol, Text2.Color))
                    {
                        Text2.Color = newCol;
                    }
                    TimeSpan t = TimeSpan.FromMilliseconds(Recall.Start + Recall.Duration - Environment.TickCount);
                    return(string.Format("{0}.{1}", t.Seconds, t.Milliseconds.ToString("D3").Remove(1, 2)));
                };
                Text2.Centered         = true;
                Text2.VisibleCondition = delegate
                {
                    return(IsActive() && Recall.Status == Packet.S2C.Teleport.Status.Start && (Recall.Start + Recall.Duration - Environment.TickCount) > 0);
                };
                Text2.Add(1);
            }