Пример #1
0
        public void PrintEnum()
        {
            CustomColor color = CustomColor.Black;

            System.Console.WriteLine(color);
            System.Console.Write(System.Environment.NewLine);

            Array values = Enum.GetValues(typeof(CustomColor));

            foreach (var value in values)
            {
                System.Console.WriteLine(value);
            }

            System.Console.Write(System.Environment.NewLine);
            CustomColor[] colors = EnumTest.GetEnumValues <CustomColor>();    //second way to get enum array values
            foreach (var c in colors)
            {
                System.Console.WriteLine(c);
            }

            System.Console.Write(System.Environment.NewLine);
            System.Console.WriteLine(Enum.GetName(typeof(CustomColor), 0));

            System.Console.WriteLine();
            System.Console.WriteLine(Enum.IsDefined(typeof(CustomColor), 59)); //should be false
        }
Пример #2
0
        /// <summary>
        /// Forces the colors to either enabled or disabled
        /// </summary>
        private void SetColors()
        {
            //Ensures they're not null
            currentBackgroundColor = new CustomColor();
            currentBorderColor     = new CustomColor();
            currentTextColor       = new CustomColor();

            Color backgroundColor;
            Color borderColor;
            Color textColor;

            if (Checked)
            {
                backgroundColor = backgroundOnColor;
                borderColor     = borderOnColor;
                textColor       = textOnColor;
            }
            else
            {
                backgroundColor = backgroundOffColor;
                borderColor     = borderOffColor;
                textColor       = textOffColor;
            }

            //Sets the colors to the current colors
            currentBackgroundColor.Set(backgroundColor);
            currentBorderColor.Set(borderColor);
            currentTextColor.Set(textColor);
        }
Пример #3
0
        private ShaderResourceView GenerateTexture(IContext context, int sliceCount)
        {
            Texture1D provinceTexture = new Texture1D(context.DirectX.Device, new Texture1DDescription
            {
                Width     = sliceCount,
                Format    = Format.R32G32B32A32_Float,
                BindFlags = BindFlags.ShaderResource,
                ArraySize = 1,
                MipLevels = 1
            });

            int rowPitch  = 16 * sliceCount;
            var byteArray = new byte[rowPitch];

            for (int i = 0; i < sliceCount; i++)
            {
                CustomColor color = ColorInSlice(i);
                Array.Copy(BitConverter.GetBytes(color.Red), 0, byteArray, i * 16, 4);
                Array.Copy(BitConverter.GetBytes(color.Green), 0, byteArray, i * 16 + 4, 4);
                Array.Copy(BitConverter.GetBytes(color.Blue), 0, byteArray, i * 16 + 8, 4);
                Array.Copy(BitConverter.GetBytes(1.0f), 0, byteArray, i * 16 + 12, 4);
            }
            DataStream dataStream = new DataStream(rowPitch, true, true);

            dataStream.Write(byteArray, 0, rowPitch);
            DataBox data = new DataBox(dataStream.DataPointer, rowPitch, rowPitch);

            context.DirectX.DeviceContext.UpdateSubresource(data, provinceTexture);

            return(new ShaderResourceView(context.DirectX.Device, provinceTexture));
        }
Пример #4
0
    private void ChangeColor(Material mat, CustomColor color)
    {
        switch (color)
        {
        case CustomColor.Selected:
            mat.SetColor("_BaseColor", selectedBaseColor);
            break;

        case CustomColor.Deselected:
            mat.SetColor("_BaseColor", deselectedBaseColor);
            break;

        case CustomColor.GreyedOut:
            mat.SetColor("_BaseColor", Color.green);
            break;

        case CustomColor.Normal:
            mat.SetColor("_BaseColor", Color.gray);
            break;

        case CustomColor.Overlapping:
            mat.SetColor("_BaseColor", Color.red);
            break;

        default:
            break;
        }
    }
Пример #5
0
    // Enabled btn
    public void GetMaterial(CustomColor c)
    {
        player.GetComponent <SpriteRenderer>().color = new Color32(
            c.GetComponent <CustomColor>().color.r,
            c.GetComponent <CustomColor>().color.g,
            c.GetComponent <CustomColor>().color.b,
            255);

        player.GetComponent <TrailRenderer>().startColor = new Color32(
            c.GetComponent <CustomColor>().color.r,
            c.GetComponent <CustomColor>().color.g,
            c.GetComponent <CustomColor>().color.b,
            255);

        player.GetComponent <TrailRenderer>().endColor = new Color32(
            c.GetComponent <CustomColor>().color.r,
            c.GetComponent <CustomColor>().color.g,
            c.GetComponent <CustomColor>().color.b,
            0);


        ColorTypeConverter col        = new ColorTypeConverter();
        string             colorSaved = col.ToRGBHex(c.GetComponent <CustomColor>().color);

        Debug.Log(colorSaved);
        // Save record
        PlayerPrefs.SetString("savecolor", colorSaved);
        PlayerPrefs.Save();
    }
Пример #6
0
 public PieChartInfo(int sliceCount, CustomColor color, string label, string tooltip)
 {
     SliceCount = sliceCount;
     Color      = color;
     Label      = label;
     Tooltip    = tooltip;
 }
Пример #7
0
        private void SetRuleColors(Color[] colorRange, CustomColorCollection customColors)
        {
            MapBucketCollection mapBuckets = m_mapRule.MapBuckets;
            bool flag        = GetDistributionType() == MapRuleDistributionType.Custom;
            int  bucketCount = GetBucketCount();

            for (int i = 0; i < bucketCount; i++)
            {
                CustomColor customColor = new CustomColor();
                if (i < colorRange.Length)
                {
                    customColor.Color = colorRange[i];
                }
                else
                {
                    customColor.Color = Color.Empty;
                }
                if (flag)
                {
                    MapBucket bucket = mapBuckets[i];
                    customColor.FromValue = GetFromValue(bucket);
                    customColor.ToValue   = GetToValue(bucket);
                }
                customColors.Add(customColor);
            }
        }
Пример #8
0
        internal static SysCol LookupColor(char colCode, out SysCol textCol)
        {
            SysCol      col    = default(SysCol);
            CustomColor custom = Color.ExtColors[colCode];

            if (Color.IsStandardColorCode(colCode))
            {
                int hex = Color.Hex(colCode);
                col = SysCol.FromArgb(
                    191 * ((hex >> 2) & 1) + 64 * (hex >> 3),
                    191 * ((hex >> 1) & 1) + 64 * (hex >> 3),
                    191 * ((hex >> 0) & 1) + 64 * (hex >> 3));
            }
            else if (custom.Undefined)
            {
                col = SysCol.White;
            }
            else
            {
                col = SysCol.FromArgb(custom.R, custom.G, custom.B);
            }

            double r = Map(col.R), g = Map(col.G), b = Map(col.B);
            double L = 0.2126 * r + 0.7152 * g + 0.0722 * b;

            textCol = L > 0.179 ? SysCol.Black : SysCol.White;
            return(col);
        }
 public static CustomColor FromHex(string redHex, string greenHex, string blueHex)
 {
     return(CustomColor.FromRgb(
                int.Parse(redHex, NumberStyles.HexNumber),
                int.Parse(greenHex, NumberStyles.HexNumber),
                int.Parse(blueHex, NumberStyles.HexNumber)));
 }
Пример #10
0
        internal static void ListHandler(Player p, string[] args, bool all)
        {
            int offset = 0, index = 0, count = 0;

            if (args != null && args.Length > 1)
            {
                int.TryParse(args[1], out offset);
            }
            CustomColor[] cols = Colors.ExtColors;

            for (int i = 0; i < cols.Length; i++)
            {
                CustomColor col = cols[i];
                if (col.Undefined)
                {
                    continue;
                }

                if (index >= offset)
                {
                    count++;
                    const string format = "{0} - %{1} displays as &{1}{2}{4}, and falls back to {3}.";
                    Player.SendMessage(p, String.Format(format, col.Name, col.Code, Hex(col), col.Fallback, Server.DefaultColor), false);

                    if (count >= 8 && !all)
                    {
                        const string helpFormat = "To see the next set of custom colors, type %T/ccols list {0}";
                        Player.SendMessage(p, String.Format(helpFormat, offset + 8));
                        return;
                    }
                }
                index++;
            }
        }
Пример #11
0
        //show damage at a point and make it a certain color
        public void ShowDamage(int _damage, Vector2 _pos, ColorElement _color)
        {
            //make new display object
            GameObject _display = (GameObject)GameObject.Instantiate(_emptyNums, _pos, Quaternion.identity);

            //length of the string representation of the value
            int _length = ((int)_damage).ToString().Length;

            //start to the left of the center for odd digit numbers
            float _startX = 0f - _length / 2 * _spacing;

            //if one digit set at origin
            if (_length == 1)
            {
                _startX = 0;
            }
            //if even digit number adjust spacing
            else if ((_length & 1) == 0)
            {
                _startX += _spacing / 2;
            }

            //create number
            for (int i = 0; i < _length; i++)
            {
                //find digit
                GameObject num    = (GameObject)Resources.Load(_numPath + _damage.ToString().Substring(i, 1));
                GameObject newNum = (GameObject)GameObject.Instantiate(num);
                //set within empty num
                newNum.transform.parent = _display.transform;
                //arrange position based on digit
                newNum.transform.localPosition = new Vector2(_startX + i * _spacing, 0);
                newNum.GetComponent <Renderer>().material.color = CustomColor.GetColor(_color);
            }
        }
Пример #12
0
    private void SetColor(CustomColor color)
    {
        Color baseColor = Color.white;

        switch (color)
        {
        case CustomColor.Red:
            baseColor = Color.red;
            break;

        case CustomColor.Green:
            baseColor = Color.green;
            break;

        case CustomColor.Yellow:
            baseColor = Color.yellow;
            break;

        default:
            break;
        }

        playerColor = color;
        rend.material.SetColor("_BaseColor", baseColor);
    }
Пример #13
0
        private void SwapCards()
        {
            if (activeCard.Equals(loadingCard))
            {
                randomCard.gameObject.SetActive(true);
                loadingCard.gameObject.SetActive(false);
                activeCard = randomCard;

                Card nextCard = allCards[Random.Range(0, allCards.Count)];

                cardName.text    = nextCard.Name;
                type.text        = nextCard.Type.ToString();
                damage.text      = nextCard.Action.Damage.ToString();
                range.text       = nextCard.Action.Range.ToString();
                description.text = nextCard.Description;

                image.sprite   = nextCard.Image;
                cardBase.color = CustomColor.ColorFromElement(nextCard.Element);
            }
            else
            {
                randomCard.gameObject.SetActive(false);
                loadingCard.gameObject.SetActive(true);
                activeCard = loadingCard;
            }
            counter = 0;
            activeCard.eulerAngles = new Vector3(0, -START_Y_ROT, 0);
        }
Пример #14
0
        private ShaderResourceView GenerateProvinceTexture(IContext context, IList <LandProvince> provinces, Func <LandProvince, CustomColor> colorGenerator)
        {
            int       maxId           = provinces.Max(p => p.NumericId);
            Texture1D provinceTexture = new Texture1D(context.DirectX.Device, new Texture1DDescription
            {
                Width     = maxId + 1,
                Format    = Format.R32G32B32A32_Float,
                BindFlags = BindFlags.ShaderResource,
                ArraySize = 1,
                MipLevels = 1
            });
            int rowPitch  = 16 * provinceTexture.Description.Width;
            var byteArray = new byte[rowPitch];

            foreach (LandProvince province in provinces)
            {
                CustomColor color = colorGenerator(province);
                Array.Copy(BitConverter.GetBytes(color.Red), 0, byteArray, province.NumericId * 16, 4);
                Array.Copy(BitConverter.GetBytes(color.Green), 0, byteArray, province.NumericId * 16 + 4, 4);
                Array.Copy(BitConverter.GetBytes(color.Blue), 0, byteArray, province.NumericId * 16 + 8, 4);
                Array.Copy(BitConverter.GetBytes(1.0f), 0, byteArray, province.NumericId * 16 + 12, 4);
            }
            DataStream dataStream = new DataStream(rowPitch, true, true);

            dataStream.Write(byteArray, 0, rowPitch);
            DataBox data = new DataBox(dataStream.DataPointer, rowPitch, rowPitch);

            //ResourceRegion region = new ResourceRegion();
            context.DirectX.DeviceContext.UpdateSubresource(data, provinceTexture);
            return(new ShaderResourceView(context.DirectX.Device, provinceTexture));
        }
Пример #15
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nПривет, введите цвет в формате RGB который нужно заменить:");
            Console.WriteLine("\nВведите R:");
            var r = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("\nВведите G:");
            var g = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("\nВведите B:");
            var b = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine($"\nВы выбрали {r},{g},{b}");
            Console.WriteLine("Ввыдите цвет на который нужно заменить в формате RGB: ");
            Console.WriteLine("\nВведите R:");
            var nr = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("\nВведите G:");
            var ng = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("\nВведите B:");
            var nb = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine($"\nВы заменяете {r},{g},{b} => {nr},{ng},{nb}");

            CustomColor changeColor = new CustomColor(r, g, b);

            string[]      files  = Directory.GetFiles(Environment.CurrentDirectory);
            List <string> images = new List <string>();

            string[] imagesExtension = { ".png", ".jpg", ".jpeg" };

            foreach (var file in files)
            {
                if (imagesExtension.Contains(Path.GetExtension(file)))
                {
                    images.Add(file);
                }
            }

            if (images.Count == 0)
            {
                Console.WriteLine("В директории нет фото");
                Environment.Exit(0);
            }

            string newPath = Environment.CurrentDirectory;

            foreach (var image in images)
            {
                Bitmap newImage = new Bitmap(image, true);

                newImage = ChangeColor(newImage, changeColor, Color.FromArgb(nr, ng, nb));

                newImage.Save(newPath + Path.GetFileNameWithoutExtension(image) + "_change" + Path.GetExtension(image));
            }
            Console.Write("\nPress any key to exit...");
            Console.ReadKey(true);
        }
Пример #16
0
        private void Finals(List <Team> teams)
        {
            List <Team> FinalsWinners = RoundSimulator.Simulation(teams, 2, "final");

            CustomColor.CustomConsoleColor(ConsoleColor.Magenta);
            Console.WriteLine($"\t\t\t\t\t\tThe Winning team is the {FinalsWinners[0].Name.ToUpper()}");
            CustomColor.CustomConsoleColor(ConsoleColor.Gray);
        }
        public static void UpdateColor(CustomColor color)
        {
            var entity            = _scene.EntityManager.Find("car.Plane_036.Plane_041");
            var materialComponent = entity.FindComponent <MaterialComponent>();
            var hex = color.Hex;

            ((StandardMaterial)materialComponent.Material).DiffuseColor = FromHex(hex);
        }
Пример #18
0
        void EditHandler(Player p, string[] args)
        {
            if (args.Length < 4)
            {
                Help(p); return;
            }

            char code = args[1][0];

            if (Colors.IsStandardColor(code))
            {
                Player.Message(p, "{0} is a standard color, and thus cannot be edited.", code); return;
            }

            if ((int)code >= 256 || Colors.ExtColors[code].Undefined)
            {
                Player.Message(p, "There is no custom color with the code {0}.", code);
                Player.Message(p, "Use \"%T/ccols list\" %Sto see a list of custom colors.");
                return;
            }

            CustomColor col = Colors.ExtColors[code];
            char        fallback;

            switch (args[2])
            {
            case "name":
                if (!CheckName(p, args[3]))
                {
                    return;
                }
                col.Name = args[3]; break;

            case "fallback":
                if (!CheckFallback(p, args[3], out fallback))
                {
                    return;
                }
                col.Fallback = fallback; break;

            case "hex":
            case "color":
                if (!Utils.CheckHex(p, ref args[3]))
                {
                    return;
                }
                CustomColor rgb = Colors.ParseHex(args[3]);
                col.R = rgb.R; col.G = rgb.G; col.B = rgb.B;
                break;

            default:
                Help(p); return;
            }

            Colors.AddExtColor(col);
            Player.Message(p, "Successfully edited a custom color.");
        }
Пример #19
0
        public static void AddColor(CustomColor customColor)
        {
            Palette.PlayerColors = Palette.PlayerColors.AddItem(customColor.FrontColor).ToArray();
            Palette.ShadowColors = Palette.ShadowColors.AddItem(customColor.BackColor).ToArray();
            Palette.ColorNames   = Palette.ColorNames.AddItem(customColor.ColorName).ToArray();
            // Telemetry.ColorNames = Palette.ColorNames;

            ColorSelectionPatches.CustomColors.Add(customColor);
        }
Пример #20
0
        public Pixel CreatePixel(CustomColor customColor)
        {
            Pixel pixel = new Pixel();
            pixel.brightness = 0xE0 | 0xF0;
            pixel.r = customColor.color.R;
            pixel.g = customColor.color.G;
            pixel.b = customColor.color.B;

            return pixel;
        }
Пример #21
0
        public static bool TryGetCustomColorById(int colorId, out CustomColor customColor)
        {
            var originalPaletteLength = ColorSelectionPatches.OriginalPaletteLength;

            var isCustomColor = colorId >= originalPaletteLength;

            customColor = isCustomColor ? ColorSelectionPatches.CustomColors[colorId - originalPaletteLength] : null;

            return(isCustomColor);
        }
Пример #22
0
 private static void Block()
 {
     if (!doOnce)
     {
         doOnce   = true;
         blocking = true;
         block.GetComponent <Renderer>().material.color = CustomColor.GetColor(FindObjectOfType <PlayerColorData>().Color);
         block.Show();
     }
 }
Пример #23
0
    public virtual void ChangeColor(CustomColor color)
    {
        if (_customColor == color)
        {
            return;
        }

        _customColor = color;
        SetColor(ColorUtils.GetColor(_customColor, _alpha));
    }
Пример #24
0
        public static void Initialize()
        {
            var newColors = new CustomColor[]
            {
                new NormalColor(new Color32(0, 128, 128, Byte.MaxValue),
                                new Color32(0, 100, 100, Byte.MaxValue),
                                "Teal"),
                new NormalColor(new Color32(99, 114, 24, Byte.MaxValue),
                                new Color32(66, 91, 15, Byte.MaxValue),
                                "Olive"),
                new NormalColor(new Color32(176, 48, 96, Byte.MaxValue),
                                new Color32(112, 29, 60, Byte.MaxValue),
                                "Maroon"),
                new NormalColor(new Color32(218, 165, 32, Byte.MaxValue),
                                new Color32(156, 117, 22, Byte.MaxValue),
                                "Gold"),
                new NormalColor(new Color32(168, 255, 195, Byte.MaxValue),
                                new Color32(123, 186, 143, Byte.MaxValue),
                                "Mint"),
                new NormalColor(new Color32(201, 146, 224, Byte.MaxValue),
                                new Color32(156, 113, 173, Byte.MaxValue),
                                "Lavender"),
                new CyclicColor(new[]
                {
                    // 0.99f is used instead of 1f, because HSV(0, a, b) is apparently the same as HSV(1, a, b), which
                    // is probably because it does a loopy loop. I spent a while trying to debug this.
                    new ColorStop(new HueColor(0f, 0.8f, 0.8f).ToRgbColor(),
                                  new HueColor(0f, 0.8f, 0.5f).ToRgbColor(),
                                  new HueShift(2.5f)),
                    new ColorStop(new HueColor(0.99f, 0.8f, 0.8f).ToRgbColor(),
                                  new HueColor(0.99f, 0.8f, 0.5f).ToRgbColor())
                }, "Rainbow")/*,
                              * // not removing this code since I use it for testing (and I'm a data hoarder)
                              * new CyclicColor(new[]
                              * {
                              * new ColorStop(new HueColor(0f, 0.8f, 0.5f).ToRgbColor(),
                              * new HueColor(0f, 0.8f, 0.2f).ToRgbColor(),
                              * new HueShift(1f)),
                              * new ColorStop(new HueColor(0f, 0.8f, 1f).ToRgbColor(),
                              * new HueColor(0f, 0.8f, 0.7f).ToRgbColor(),
                              * new HueShift(1f))
                              * }, "Red Hot"),
                              * new CyclicColor(new []
                              * {
                              * new ColorStop(new Color(1f, 0f, 0f, Byte.MaxValue),
                              * new Color(1f, 0f, 0f, Byte.MaxValue), 5f),
                              * new ColorStop(new Color(1f, 1f, 0f, Byte.MaxValue),
                              * new Color(1f, 1f, 0f, Byte.MaxValue), 3f),
                              * new ColorStop(new Color(0f, 1f, 0f, Byte.MaxValue),
                              * new Color(0f, 1f, 0f, Byte.MaxValue), 5f)
                              * }, "Traffic Lights")*/
            };

            Rainbow.AddColors(newColors);
        }
Пример #25
0
 //something enters collector trigger
 void OnTriggerEnter2D(Collider2D col)
 {
     //if it is an orb
     if (col.transform.tag.Equals("orb"))
     {
         //get the color and destroy the orb ----- ADD COLLECTING EFFECT LATER
         ColorPickup _orb = col.transform.GetComponent <ColorPickup>();
         _player.AddColor(CustomColor.GetColor(_orb.ColorType), _orb.Amount);
         _orb.GetComponent <Destroyer>().DestroyImmediate();
     }
 }
Пример #26
0
        void Start()
        {
            //find wheel
            _wheel = GameObject.Find("ColorWheel").GetComponent <ColorWheel>();

            //init scale at 0
            this.transform.localScale = new Vector3(0.5f, 1f, 1f);

            //set color
            this.GetComponent <Image>().color = CustomColor.GetColor(_color);
        }
Пример #27
0
    public static Color GetColor(CustomColor color, float alpha = 1)
    {
        if (!CustomColors.ContainsKey(color))
        {
            return(White);
        }

        var result = CustomColors[color];

        return(new Color(result.r, result.g, result.b, alpha));
    }
Пример #28
0
        private void MatchUp(Team team1, Team team2)
        {
            Arena arena = new Arena(RandomGenerator.RandomArena(), RandomGenerator.RandomCapacity());

            Teams.Add(team1);
            Teams.Add(team2);
            CustomColor.CustomConsoleColor(ConsoleColor.Red);
            Console.WriteLine($"\n{team1.Name.ToUpper()} VS {team2.Name.ToUpper()}");
            CustomColor.CustomConsoleColor(ConsoleColor.Gray);
            Hold.Wait(1000);
        }
Пример #29
0
    // Start is called before the first frame update
    void Start()
    {
        rb         = GetComponent <Rigidbody>();
        mainCamera = Camera.main;
        rend       = GetComponentInChildren <Renderer>();

        int         r         = Random.Range(1, 4);
        CustomColor tempColor = r == 1 ? CustomColor.Red : r == 2 ? CustomColor.Green : CustomColor.Yellow;

        SetColor(tempColor);
    }
Пример #30
0
    //Initialize the enemy
    public void Init()
    {
        //set the enemy color
        renderer.material.color = CustomColor.GetColor(_color);

        //load the orb
        _orb = (GameObject)Resources.Load("Prefabs/orb");

        //find the player
        _player = GameObject.Find("player");
    }
Пример #31
0
    /// <summary>
    /// 멤버 변수 값 입력
    /// </summary>
    /// <param name="widget"></param>
    public override void SetValue(UIWidget widget)
    {
        base.SetValue(widget);

        UISprite sprite = (UISprite)widget;

        AtlasName = sprite.atlas == null ? "null" : sprite.atlas.name;
        SpriteName = sprite.spriteName;
        Type = sprite.type;
        Flip = sprite.flip;
        ColorTint = new CustomColor(sprite.color);
    }
Пример #32
0
    public void SaveRacketColor()
    {
        var racketColor     = RacketColor.GetComponent <Image>().color;
        var racketSaveColor = new CustomColor
        {
            RedColor   = racketColor.r,
            GreenColor = racketColor.g,
            BlueColor  = racketColor.b
        };

        _storageProvider.SaveRacketColor(racketSaveColor);
    }
Пример #33
0
    public override void SetValue(UIWidget widget)
    {
        base.SetValue(widget);

        UILabel label = (UILabel)widget;

        FontName = label.bitmapFont.name;
        FontStyle = label.fontStyle;
        Alignment = label.alignment;
        IsGridient = label.applyGradient;
        GradientTop = new CustomColor(label.gradientTop);
        GradientBottom = new CustomColor(label.gradientBottom);
        EffectStyle = label.effectStyle;
        EffectColor = new CustomColor(label.effectColor);
        EffectDistance = new CustomVector2(label.effectDistance);
        EffectiveSpacingX = label.effectiveSpacingX;
        EffectiveSpacingY = label.effectiveSpacingY;
        ColorTint = new CustomColor(label.color);
    }
Пример #34
0
 public void SetColor(CustomColor color)
 {
     effect.SetColor(color);
 }
Пример #35
0
        /// <summary>
        /// Adds an entry to the console gui.
        /// </summary>
        /// <param name="text">The text to add.</param>
        /// <param name="color">The color of the text.</param>
        public void AddEntry(string text, CustomColor color)
        {
            // add the custom color tag
            string newText = "<customcolor:" + (int)color + ">" + text + "\n";

            // draw text doesn't like '{' or '}'
            newText = newText.Replace('{', '(').Replace('}', ')');

            // store our own copy of the text so it can be dumped or added to the gui
            // when it is initialized
            _consoleText += newText;

            if (_isInitialized)
            {
                _text.Text += newText;
                _scroll.ScrollToBottom();
            }

            #if !XBOX
            if(_dumpToFile && !string.IsNullOrEmpty(_consoleDumpFile))
            {
                // create a file with that name
                if (!File.Exists(_consoleDumpFile))
                    File.Create(_consoleDumpFile).Close();

                // create a text writer for the file
                TextWriter file = File.AppendText(_consoleDumpFile);

                // write the new line to the file
                file.Write(text + "\n");

                // close the file
                file.Close();
            }
            #endif
        }
Пример #36
0
 public FillColor()
 {
     color = new StaticColor(Color.Black);
 }
Пример #37
0
 public FillColor(CustomColor color)
 {
     this.color = color;
 }
Пример #38
0
 public void SetColor(CustomColor color)
 {
     this.color = color;
 }
Пример #39
0
 /// <summary>
 /// Returns the Color at the specified index.
 /// </summary>
 /// <param name="index">Index of the Color to return.</param>
 /// <returns>The color at the requested index.</returns>
 public Color this[CustomColor index]
 {
     get { return _color[(int)index]; }
     set { _color[(int)index] = value; }
 }