Animations bugfix
All AnimationSno now with their SnoFileName, to prevent issues and try to resolve animations (at least the ones that worked before).
This commit is contained in:
parent
8521c490c2
commit
c3d3984725
@ -1901,7 +1901,33 @@ namespace DiIiS_NA.Core.MPQ
|
||||
}
|
||||
public static Dictionary<string, int> LoadAnim()
|
||||
{
|
||||
return Enum.GetValues<AnimationSno>().ToDictionary(x => x.ToString(), x => (int)x);
|
||||
var dict = Enum.GetValues<AnimationSno>().ToDictionary(x => x.ToString(), x => (int)x);
|
||||
|
||||
// TODO: merge with LINQ above.
|
||||
// this parses enum values that has SnoFileNameAttribute, in case the dict linq above didn't get a correct name
|
||||
// for the actor file.
|
||||
foreach (var d in Enum.GetValues<AnimationSno>())
|
||||
{
|
||||
var enumType = typeof(AnimationSno);
|
||||
var memberInfos =
|
||||
enumType.GetMember(d.ToString());
|
||||
if (memberInfos.Length == 0)
|
||||
continue;
|
||||
var enumValueMemberInfo = memberInfos.FirstOrDefault(m => m.DeclaringType == enumType);
|
||||
if (enumValueMemberInfo == null) continue;
|
||||
var valueAttributes = enumValueMemberInfo.GetCustomAttributes(typeof(SnoFileNameAttribute), false)
|
||||
.Select(s=>(SnoFileNameAttribute)s)
|
||||
.FirstOrDefault();
|
||||
if (valueAttributes != null)
|
||||
{
|
||||
if (dict.ContainsKey(valueAttributes.FileName))
|
||||
{
|
||||
dict.Remove(valueAttributes.FileName);
|
||||
}
|
||||
dict.Add(valueAttributes.FileName, (int)d);
|
||||
}
|
||||
}
|
||||
return dict;
|
||||
}
|
||||
public static Dictionary<string, int> LoadAnimation2D()
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
user.block.title