void RefreshFaces()
        {
            // Clear existing faces
            ClearFaces();

            // Load matching texture for each face
            // Only Redguard and Breton supported for now
            // Generally FACTION.TXT only uses these two races - could expand later
            foreach (FaceDetails face in faces)
            {
                // Get race template
                RaceTemplate raceTemplate;
                switch (face.targetRace)
                {
                case Races.Redguard:
                    raceTemplate = new Redguard();
                    break;

                default:
                case Races.Breton:
                    raceTemplate = new Breton();
                    break;
                }

                // Get image for this face
                Texture2D faceTexture = null;
                if (face.gender == Genders.Male)
                {
                    faceTexture = DaggerfallUI.GetTextureFromCifRci(raceTemplate.PaperDollHeadsMale, face.faceIndex);
                }
                else if (face.gender == Genders.Female)
                {
                    faceTexture = DaggerfallUI.GetTextureFromCifRci(raceTemplate.PaperDollHeadsFemale, face.faceIndex);
                }

                // Must have a texture by now
                if (faceTexture == null)
                {
                    throw new Exception("RefreshFaces() could not load face texture for Person resource.");
                }

                // Add texture to list
                Panel facePanel = new Panel();
                facePanel.Size = new Vector2(faceTexture.width, faceTexture.height);
                facePanel.BackgroundTexture = faceTexture;
                facePanels.Add(facePanel);
                Components.Add(facePanel);
            }
        }
        public void RefreshFaces()
        {
            const int specialFacePanelWidth  = 48;
            const int specialFacePanelHeight = 48;

            // Clear existing faces
            ClearFaces();

            // Load matching texture for each face
            // Only Redguard and Breton supported for now
            // Generally FACTION.TXT only uses these two races - could expand later
            foreach (FaceDetails face in faces)
            {
                // Get race template
                RaceTemplate raceTemplate;
                switch (face.targetRace)
                {
                case Races.Redguard:
                    raceTemplate = new Redguard();
                    break;

                default:
                case Races.Breton:
                    raceTemplate = new Breton();
                    break;
                }

                // Get image for this face
                Texture2D faceTexture = null;
                Panel     facePanel   = new Panel();
                // Disable until placed
                facePanel.Enabled = false;
                if (face.factionFaceIndex >= 0 && face.factionFaceIndex <= 60)
                {
                    // Use special NPC face set at time face data was added
                    faceTexture    = DaggerfallUI.GetTextureFromCifRci(factionFaceFile, face.factionFaceIndex);
                    facePanel.Size = new Vector2(specialFacePanelWidth, specialFacePanelHeight);
                }
                else if (face.factionFaceIndex > 60 && face.factionFaceIndex <= 502)
                {
                    // Use special NPC face set by a mod at time face data was added
                    faceTexture    = DaggerfallUI.GetTextureFromCifRci(factionExtraFaceFile, face.factionFaceIndex);
                    facePanel.Size = new Vector2(specialFacePanelWidth, specialFacePanelHeight);
                }
                else
                {
                    string fileName;

                    // Use generic NPC face
                    if (!face.isChild)
                    {
                        // Get a racial portrait
                        fileName = face.gender == Genders.Male ? raceTemplate.PaperDollHeadsMale : raceTemplate.PaperDollHeadsFemale;
                    }
                    else
                    {
                        // Get a child portrait
                        fileName = factionChildrenFaceFile;
                    }

                    // Allow individual factions from mods to use normal race faces
                    ImageData imageData = ImageReader.GetImageData(fileName, face.faceIndex, 0, true, true);
                    faceTexture    = imageData.texture;
                    facePanel.Size = new Vector2(imageData.width, imageData.height);
                }

                // Must have a texture by now
                if (faceTexture == null)
                {
                    throw new Exception("RefreshFaces() could not load face texture for Person resource.");
                }

                // Add texture to list
                facePanel.BackgroundTexture = faceTexture;
                facePanels.Add(facePanel);
                Components.Add(facePanel);
            }
        }
        public void RefreshFaces()
        {
            const int specialFacePanelWidth  = 48;
            const int specialFacePanelHeight = 48;

            // Clear existing faces
            ClearFaces();

            // Load matching texture for each face
            // Only Redguard and Breton supported for now
            // Generally FACTION.TXT only uses these two races - could expand later
            foreach (FaceDetails face in faces)
            {
                // Get race template
                RaceTemplate raceTemplate;
                switch (face.targetRace)
                {
                case Races.Redguard:
                    raceTemplate = new Redguard();
                    break;

                default:
                case Races.Breton:
                    raceTemplate = new Breton();
                    break;
                }

                // Get image for this face
                Texture2D faceTexture = null;
                Panel     facePanel   = new Panel();
                if (face.factionFaceIndex >= 0 && face.factionFaceIndex <= 60)
                {
                    // Use special NPC face set at time face data was added
                    faceTexture    = DaggerfallUI.GetTextureFromCifRci(factionFaceFile, face.factionFaceIndex);
                    facePanel.Size = new Vector2(specialFacePanelWidth, specialFacePanelHeight);
                }
                else
                {
                    // Use generic NPC face
                    if (!face.isChild)
                    {
                        // Get a racial portrait
                        if (face.gender == Genders.Male)
                        {
                            faceTexture = DaggerfallUI.GetTextureFromCifRci(raceTemplate.PaperDollHeadsMale, face.faceIndex);
                        }
                        else if (face.gender == Genders.Female)
                        {
                            faceTexture = DaggerfallUI.GetTextureFromCifRci(raceTemplate.PaperDollHeadsFemale, face.faceIndex);
                        }
                    }
                    else
                    {
                        // Get a child portrait
                        faceTexture = DaggerfallUI.GetTextureFromCifRci(factionChildrenFaceFile, face.faceIndex);
                    }

                    facePanel.Size = new Vector2(faceTexture.width, faceTexture.height);
                }

                // Must have a texture by now
                if (faceTexture == null)
                {
                    throw new Exception("RefreshFaces() could not load face texture for Person resource.");
                }

                // Add texture to list
                facePanel.BackgroundTexture = faceTexture;
                facePanels.Add(facePanel);
                Components.Add(facePanel);
            }
        }