Пример #1
0
        private int GetTileIndex(Portrait portrait, int frameCount, Layer layer)
        {
            char letter    = portrait.GetLetter(layer.Characteristic);
            int  tileIndex = Portrait.GetIndex(letter, frameCount);

            logger.Debug(string.Format("Layer letter: {0}, Tile Index: {1}", letter, tileIndex));
            return(tileIndex);
        }
        private void updateSelectedCharacteristicValues(Portrait portrait)
        {
            foreach (KeyValuePair <Characteristic, ComboBox> pair in dnaComboBoxes)
            {
                if (pair.Value != null)
                {
                    pair.Value.SelectedIndex = Portrait.GetIndex(portrait.GetDNA()[pair.Key.index], pair.Value.Items.Count);
                }
            }

            foreach (KeyValuePair <Characteristic, ComboBox> pair in propertiesComboBoxes)
            {
                if (pair.Value != null)
                {
                    pair.Value.SelectedIndex = Portrait.GetIndex(portrait.GetProperties()[pair.Key.index], pair.Value.Items.Count);
                }
            }
        }
Пример #3
0
        private void DrawTile(Portrait portrait, Graphics g, Sprite sprite, Layer layer, int tileIndex)
        {
            Bitmap tile;

            if (layer.IsHair)
            {
                List <Hair> hairCoulours = portrait.GetPortraitType().HairColours;
                int         hairIndex    = Portrait.GetIndex(portrait.GetLetter(Characteristic.HAIR_COLOR), hairCoulours.Count);
                tile = DrawHair(sprite.Tiles[tileIndex], hairCoulours[hairIndex]);
            }
            else if (layer.IsEye)
            {
                List <Colour> eyeCoulours = portrait.GetPortraitType().EyeColours;
                int           eyeIndex    = Portrait.GetIndex(portrait.GetLetter(Characteristic.EYE_COLOR), eyeCoulours.Count);
                tile = DrawEye(sprite.Tiles[tileIndex], eyeCoulours[eyeIndex]);
            }
            else
            {
                tile = sprite.Tiles[tileIndex];
            }

            g.DrawImage(tile, 12 + layer.Offset.X, 12 + 152 - tile.Size.Height - layer.Offset.Y);
        }