예제 #1
0
        public override void use(ClientPlayerInfo p, string message)
        {
            Random r     = new Random();
            float  color = (float)r.NextDouble() * 360;

            Utilities.sendMessage("[b][" + ColorEx.ColorToHexNGUI(new ColorHSB(color, 1.0f, 1.0f, 1f).ToColor()) + "]" + winList[r.Next(winList.Count)] + "[-][/b]");
        }
예제 #2
0
파일: Entry.cs 프로젝트: larnin/ColoredName
        public static string colorizeText(string name, bool useFormating = true)
        {
            FormatFlags flags = new FormatFlags(rnd);

            float size = 0.06f * (float)Math.Sqrt(name.Length);

            float  t1      = (float)rnd.NextDouble();
            float  t2      = t1 + rnd.Next(2) >= 1 ? size : -size;
            string newName = "";

            if (flags.bold && useFormating)
            {
                newName += "[b]";
            }
            if (flags.sup && useFormating)
            {
                newName += "[sup]";
            }
            if (flags.sub && useFormating)
            {
                newName += "[sub]";
            }
            if (flags.italic && useFormating)
            {
                newName += "[i]";
            }
            if (flags.strike && useFormating)
            {
                newName += "[s]";
            }
            if (flags.underlined && useFormating)
            {
                newName += "[u]";
            }
            for (int i = 0; i < name.Length; i++)
            {
                float value = ((t2 - t1) / name.Length) * i + t1;
                while (value < 0)
                {
                    value++;
                }
                while (value > 1)
                {
                    value--;
                }
                if (flags.supSub && useFormating)
                {
                    newName += i % 2 == 0 ? "[sub]" : "[sup]";
                }
                newName += "[" + ColorEx.ColorToHexNGUI(new ColorHSB(value, 1.0f, 1.0f, 1f).ToColor()) + "]" + name[i] + "[-]";
                if (flags.supSub && useFormating)
                {
                    newName += i % 2 == 0 ? "[/sub]" : "[/sup]";
                }
            }
            if (flags.underlined && useFormating)
            {
                newName += "[/u]";
            }
            if (flags.strike && useFormating)
            {
                newName += "[/s]";
            }
            if (flags.italic && useFormating)
            {
                newName += "[/i]";
            }
            if (flags.sub && useFormating)
            {
                newName += "[/sub]";
            }
            if (flags.sup && useFormating)
            {
                newName += "[/sup]";
            }
            if (flags.bold && useFormating)
            {
                newName += "[/b]";
            }

            return(newName);
        }