public void Init(Gender gender = Gender.None) { if (IsInitialized) { return; } _gender = SpritePath.Contains("[GENDER]") ? gender : Gender.None; ParsePath(false); if (Sprite != null) { Sprite.Remove(); } Sprite = new Sprite(SourceElement, file: SpritePath); Limb = (LimbType)Enum.Parse(typeof(LimbType), SourceElement.GetAttributeString("limb", "Head"), true); HideLimb = SourceElement.GetAttributeBool("hidelimb", false); HideOtherWearables = SourceElement.GetAttributeBool("hideotherwearables", false); InheritLimbDepth = SourceElement.GetAttributeBool("inheritlimbdepth", true); InheritTextureScale = SourceElement.GetAttributeBool("inherittexturescale", false); InheritOrigin = SourceElement.GetAttributeBool("inheritorigin", false); InheritSourceRect = SourceElement.GetAttributeBool("inheritsourcerect", false); DepthLimb = (LimbType)Enum.Parse(typeof(LimbType), SourceElement.GetAttributeString("depthlimb", "None"), true); Sound = SourceElement.GetAttributeString("sound", ""); var index = SourceElement.GetAttributePoint("sheetindex", new Point(-1, -1)); if (index.X > -1 && index.Y > -1) { SheetIndex = index; } IsInitialized = true; }
public void Init(Gender gender = Gender.None) { if (IsInitialized) { return; } _gender = UnassignedSpritePath.Contains("[GENDER]") ? gender : Gender.None; ParsePath(false); Sprite?.Remove(); Sprite = new Sprite(SourceElement, file: SpritePath); Limb = (LimbType)Enum.Parse(typeof(LimbType), SourceElement.GetAttributeString("limb", "Head"), true); HideLimb = SourceElement.GetAttributeBool("hidelimb", false); HideOtherWearables = SourceElement.GetAttributeBool("hideotherwearables", false); CanBeHiddenByOtherWearables = SourceElement.GetAttributeBool("canbehiddenbyotherwearables", true); InheritLimbDepth = SourceElement.GetAttributeBool("inheritlimbdepth", true); var scale = SourceElement.GetAttribute("inheritscale"); if (scale != null) { InheritScale = scale.GetAttributeBool(false); } else { InheritScale = SourceElement.GetAttributeBool("inherittexturescale", false); } IgnoreLimbScale = SourceElement.GetAttributeBool("ignorelimbscale", false); IgnoreTextureScale = SourceElement.GetAttributeBool("ignoretexturescale", false); IgnoreRagdollScale = SourceElement.GetAttributeBool("ignoreragdollscale", false); SourceElement.GetAttributeBool("inherittexturescale", false); InheritOrigin = SourceElement.GetAttributeBool("inheritorigin", false); InheritSourceRect = SourceElement.GetAttributeBool("inheritsourcerect", false); DepthLimb = (LimbType)Enum.Parse(typeof(LimbType), SourceElement.GetAttributeString("depthlimb", "None"), true); Sound = SourceElement.GetAttributeString("sound", ""); Scale = SourceElement.GetAttributeFloat("scale", 1.0f); Rotation = MathHelper.ToRadians(SourceElement.GetAttributeFloat("rotation", 0.0f)); var index = SourceElement.GetAttributePoint("sheetindex", new Point(-1, -1)); if (index.X > -1 && index.Y > -1) { SheetIndex = index; } HideWearablesOfType = new List <WearableType>(); var wearableTypes = SourceElement.GetAttributeStringArray("hidewearablesoftype", null); if (wearableTypes != null && wearableTypes.Length > 0) { foreach (var value in wearableTypes) { if (Enum.TryParse(value, ignoreCase: true, out WearableType wearableType)) { HideWearablesOfType.Add(wearableType); } } } IsInitialized = true; }