예제 #1
0
        public CharacterData getCharByGenderColor(Gender gender, CharColor color)
        {
            CharactersInfo list = mainChars;
            CharacterData  data = list.chars.Find(x => (x.gender == gender && x.color == color));

            return(data);
        }
예제 #2
0
 public void Clear(CharColor background)
 {
     for (var i = 0; i < BufferSize * BufferSize; i++)
     {
         _buffer[i] = new Character(' ', CharColor.White, background, CharAttribute.None);
     }
 }
예제 #3
0
 public void Clear(CharColor background)
 {
     for (var i = 0; i < BufferSize * BufferSize; i++)
     {
         _buffer[i].Attributes = (byte)((int)background + ((int)background << 4));
     }
 }
예제 #4
0
        public CharacterData getCharByColor(CharColor color)
        {
            CharactersInfo       list     = mainChars;
            List <CharacterData> findings = list.chars.FindAll(x => (x.color == color));

            return(Utils.getRandomElement(findings));
        }
예제 #5
0
 public Character(char chr, CharColor foreground, CharColor background,
                  CharAttribute attr)
 {
     Char       = chr;
     Foreground = foreground;
     Background = background;
     Attribute  = attr;
 }
 public override void Clear(CharColor background)
 {
     for (var x = 0; x < _width - _scrollX; x++)
     {
         for (var y = 0; y < _height - _scrollY; y++)
         {
             PutChar(new Point(x, y), ' ', CharColor.White, background, CharAttribute.None);
         }
     }
 }
예제 #7
0
 public static void BlackEnableDrawAt(Point p, CharColor cc)
 {
     if (Window.Contains(p))
     {
         Console.SetCursorPosition(p.X, p.Y);
         Console.ForegroundColor = cc.Color;
         Console.Write(cc.Char);
         DrawMap[p] = cc;
     }
 }
예제 #8
0
    private void setColor(CharColor c)
    {
        int   colorCounter = 0;
        Color newColor     = new Color(0, 0, 0);


        if ((int)c >= (int)CharColor.Red)
        {
            newColor.r += 1;
            colorCounter++;
            c -= (int)CharColor.Red;
        }

        if ((int)c >= (int)CharColor.Green)
        {
            newColor.g += 1;
            colorCounter++;
            c -= (int)CharColor.Green;
        }

        if ((int)c >= (int)CharColor.Blue)
        {
            newColor.b += 1;
            colorCounter++;
            c -= (int)CharColor.Blue;
        }

        if ((int)c >= (int)CharColor.White)
        {
            if (colorCounter == 0)
            {
                newColor.r = 1f;
                newColor.g = 1f;
                newColor.b = 1f;
            }
            else if (colorCounter == 3)
            {
                newColor.r = 0.5f;
                newColor.g = 0.5f;
                newColor.b = 0.5f;
            }
            else
            {
                newColor.r += 0.5f;
                newColor.g += 0.5f;
                newColor.b += 0.5f;
            }
        }
        newColor.a = 1;

        for (int i = 0; i < 4; i++)
        {
            this.transform.Find("color-container").GetComponent <SpriteRenderer>().color = newColor;
        }
    }
예제 #9
0
        public Texture2D CharTexture(CharColor color)
        {
            switch (color)
            {
            case CharColor.yellow:
                return(yellow);

            default:
                return(white);
            }
        }
예제 #10
0
        private CharColor CreateProxyColor(int charIndex)
        {
            var color = new CharColor
            {
                Color          = Text.color,
                VertexGradient = Text.colorGradient
            };

            proxyColors.Add(charIndex, color);
            return(color);
        }
예제 #11
0
 public static void DrawAt(Point p, CharColor cc)
 {
     if (Window.Contains(p))
     {
         if (cc.Char == ' ' || cc.Color == ConsoleColor.Black)
         {
             return;
         }
         BlackEnableDrawAt(p, cc);
     }
 }
예제 #12
0
 public override void PutChar(Point pt, char chr, CharColor foreground, CharColor background, CharAttribute attribute)
 {
     pt = pt.Offset(_scrollX, _scrollY);
     if (pt.X < 0 || pt.Y < 0 || pt.X >= _width || pt.Y >= _height)
     {
         return;
     }
     Console.Provider.PutChar(
         new Character(
             chr,
             _lowBrightness ? Darken(foreground) : foreground,
             _lowBrightness ? Darken(background) : background,
             attribute),
         pt.X + _x, pt.Y + _y);
 }
예제 #13
0
        public void updateView(CharColor color)
        {
            switch (state)
            {
            case SelectionState.ACTIVE:
                setActive(color);
                break;

            case SelectionState.DEFAULT:
                setDefault(color);
                break;

            case SelectionState.HIGHLIGHTED:
                setHighlighted(color);
                break;
            }
        }
예제 #14
0
        /// <summary>
        /// Only works if all letters are all leters and are all lowercase
        /// </summary>
        /// <param name="word"></param>
        /// <param name="color"></param>
        /// <returns></returns>
        public WordSprite Word(string word, CharColor color)
        {
            char[]     chars  = word.ToCharArray();
            WordSprite sprite = new WordSprite
            {
                Texture = CharTexture(color)
            };

            for (int i = 0; i < chars.Length; i++)
            {
                Rectangle source = new Rectangle
                {
                    Size = letterSize
                };
                source.Y = 0;
                source.X = (chars[i] - 'a') * letterWidthHeight;
                sprite.SourceRectangles.Add(source);
            }
            return(sprite);
        }
예제 #15
0
        public void setHighlighted(CharColor color)
        {
            switch (color)
            {
            case CharColor.BLUE:
                image.sprite = blueHighlighted;
                break;

            case CharColor.PINK:
                image.sprite = pinkHighlighted;
                break;

            case CharColor.RED:
                image.sprite = redHighlighted;
                break;

            case CharColor.YELLOW:
                image.sprite = yellowHighlighted;
                break;
            }
            state = SelectionState.HIGHLIGHTED;
        }
예제 #16
0
        public void setDefault(CharColor color)
        {
            switch (color)
            {
            case CharColor.BLUE:
                image.sprite = blueDefault;
                break;

            case CharColor.PINK:
                image.sprite = pinkDefault;
                break;

            case CharColor.RED:
                image.sprite = redDefault;
                break;

            case CharColor.YELLOW:
                image.sprite = yellowDefault;
                break;
            }
            state = SelectionState.DEFAULT;
        }
예제 #17
0
        public void setActive(CharColor color)
        {
            switch (color)
            {
            case CharColor.BLUE:
                image.sprite = blueActive;
                break;

            case CharColor.PINK:
                image.sprite = pinkActive;
                break;

            case CharColor.RED:
                image.sprite = redActive;
                break;

            case CharColor.YELLOW:
                image.sprite = yellowActive;
                break;
            }
            state = SelectionState.ACTIVE;
        }
예제 #18
0
        public void changeColor()
        {
            int index = 0;

            for (int i = 0; i < colors.Length; i++)
            {
                if (colors [i] == color)
                {
                    index = i + 1;
                    if (index >= colors.Length)
                    {
                        index = 0;
                        break;
                    }
                }
            }
            color = colors [index];
            GetComponent <ColorChanger> ().updateView(color);
            foreach (ColorChanger palette in GetComponentsInChildren <ColorChanger>())
            {
                palette.updateView(color);
            }
        }
예제 #19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="number"></param>
        /// <param name="places"></param>
        /// <returns></returns>
        public WordSprite Number(int number, int places, CharColor color)
        {
            char[]     theNumber = number.ToString().ToCharArray();
            WordSprite sprite    = new WordSprite
            {
                Texture = CharTexture(color)
            };

            //add leading zeros
            for (int i = 0; i < places - theNumber.Length; i++)
            {
                sprite.SourceRectangles.Add(new Rectangle(new Point(0, letterWidthHeight), numberSize));
            }
            for (int i = 0; i < theNumber.Length; i++)
            {
                Rectangle source = new Rectangle(new Point(0, letterWidthHeight), numberSize)
                {
                    X = (theNumber[i] - '0') * numberWidth
                };
                sprite.SourceRectangles.Add(source);
            }

            return(sprite);
        }
예제 #20
0
 public override void PutChar(Point pt, char chr, CharColor foreground, CharColor background, CharAttribute attribute)
 {
 }
예제 #21
0
 public abstract void PutChar(Point pt, char chr, CharColor foreground, CharColor background,
                              CharAttribute attribute);
예제 #22
0
 public abstract void Clear(CharColor background);
예제 #23
0
 public static CharColor Darken(CharColor color)
 {
     return(color == CharColor.Black ? CharColor.Black : CharColor.DarkGray);
 }
예제 #24
0
 public static Color GetPallete(CharColor c)
 {
     return(CharPallete[(int)c]);
 }
예제 #25
0
 public override void Clear(CharColor background)
 {
 }
예제 #26
0
        public static void Render(
            DrawingContext dc,
            CharColor background,
            CharColor foreground,
            FrameStyle style,
            IList <Control> children,
            IList <GridSize> columnDefinitions,
            IList <GridSize> rowDefinitions,
            int width,
            int height,
            int xoffset,
            int yoffset)
        {
            var rows = MeasureSizes(false, true, children, width, height,
                                    columnDefinitions, rowDefinitions, yoffset);
            var columns = MeasureSizes(true, true, children, width, height,
                                       columnDefinitions, rowDefinitions, xoffset);

            for (var column = 0; column < Math.Max(1, columnDefinitions.Count); column++)
            {
                for (var row = 0; row < Math.Max(1, rowDefinitions.Count); row++)
                {
                    var child       = children.FirstOrDefault(x => Grid.GetRow(x) == row && Grid.GetColumn(x) == column);
                    var nfc         = column > 0 ? 1 : 0;
                    var nfr         = row > 0 ? 1 : 0;
                    var boundingBox =
                        child != null
                            ? MeasureBoundingBox(children, child, true, width, height, columnDefinitions, rowDefinitions,
                                                 xoffset, yoffset).Offset(-1, -1).Expand(2, 2)
                            : HasSpanningChildren(children, row - 1, column, true)
                                  ? new Rectangle(0, 0, 0, 0)
                                  : HasSpanningChildren(children, row, column - 1, false)
                                        ? new Rectangle(0, 0, 0, 0)
                                        : new Rectangle(columns.Take(column).Sum() - nfc,
                                                        rows.Take(row).Sum() - nfr,
                                                        columns[column] + nfc,
                                                        rows[row] + nfr);

                    if (boundingBox.Width == 0 || boundingBox.Height == 0)
                    {
                        continue;
                    }
                    dc.DrawFrame(boundingBox, new FrameOptions
                    {
                        Foreground = foreground,
                        Background = background,
                        Style      = style,
                    });
                    if (column > 0 || row > 0)
                    {
                        dc.PutChar(new Point(boundingBox.X, boundingBox.Y),
                                   column > 0
                                       ? row > 0 && !HasSpanningChildren(children, row - 1, column - 1, false)
                                             ? !HasSpanningChildren(children, row - 1, column - 1, true)
                                                   ? Piece(FramePiece.Cross, style)
                                                   : Piece(FramePiece.Vertical | FramePiece.Right, style)
                                             : Piece(FramePiece.Horizontal | FramePiece.Bottom, style)
                                       : Piece(FramePiece.Vertical | FramePiece.Right, style),
                                   foreground, background, CharAttribute.None);
                    }
                    if (column == Math.Max(1, columnDefinitions.Count) - 1 && row > 0)
                    {
                        dc.PutChar(new Point(boundingBox.X + boundingBox.Width - 1, boundingBox.Y),
                                   Piece(FramePiece.Vertical | FramePiece.Left, style),
                                   foreground, background, CharAttribute.None);
                    }
                    if (row == Math.Max(1, rowDefinitions.Count) - 1 && column > 0)
                    {
                        dc.PutChar(new Point(boundingBox.X, boundingBox.Y + boundingBox.Height - 1),
                                   Piece(FramePiece.Horizontal | FramePiece.Top, style),
                                   foreground, background, CharAttribute.None);
                    }
                }
            }
        }