Example #1
0
        /// <summary>
        /// Override sprite for religious/merchant
        ///
        /// This is quite messy - not sure what hardcoded vanilla logic exactly is - could be based on culture index ?!
        /// </summary>
        /// <param name="portrait"></param>
        /// <param name="layer"></param>
        /// <returns></returns>
        private string GetOverriddenSpriteName(Portrait portrait, Layer layer)
        {
            string spriteName = layer.Name;

            if ((portrait.IsReligious() || portrait.IsMerchant()) && (layer.Characteristic == Characteristic.CLOTHES || layer.Characteristic == Characteristic.HEADGEAR))
            {
                string sex         = portrait.GetSex() == Portrait.Sex.MALE ? "male" : "female";
                string layerSuffix = spriteName.Contains("behind") ? "_behind" : "";                 // Handles clothes_infront and headgear_mid
                string government  = portrait.IsReligious() ? "religious" : "merchant";
                string layerType   = layer.Characteristic == Characteristic.CLOTHES ? "clothes" : "headgear";
                spriteName = string.Format("GFX_{0}_{1}_{2}{3}", government, sex, layerType, layerSuffix);
            }
            return(spriteName);
        }