anim group can be loaded from stream reader

This commit is contained in:
in0finite 2019-07-21 19:17:11 +02:00
parent 54f976de22
commit 814cb38cc9
2 changed files with 23 additions and 16 deletions

View file

@ -263,26 +263,33 @@ namespace SanAndreasUnity.Importing.Animation
{ get { return _sGroups; } } { get { return _sGroups; } }
public static void Load(string path) public static void Load(string path)
{
using (var reader = File.OpenText(path))
{
LoadFromStreamReader(reader);
}
}
public static void LoadFromStreamReader(StreamReader reader)
{ {
using (var reader = File.OpenText(path))
string line;
while ((line = reader.ReadLine()) != null)
{ {
string line; var match = _sHeaderRegex.Match(line);
while ((line = reader.ReadLine()) != null) if (!match.Success) continue;
var group = new AnimationGroup(match, reader);
if (!_sGroups.ContainsKey(group.Name))
{ {
var match = _sHeaderRegex.Match(line); _sGroups.Add(group.Name, new Dictionary<AnimGroup, AnimationGroup>());
if (!match.Success) continue;
var group = new AnimationGroup(match, reader);
if (!_sGroups.ContainsKey(group.Name))
{
_sGroups.Add(group.Name, new Dictionary<AnimGroup, AnimationGroup>());
}
_sGroups[group.Name].Add(group.Type, group);
} }
_sGroups[group.Name].Add(group.Type, group);
} }
} }
private static AnimationGroup GetInternal(string name, AnimGroup type) private static AnimationGroup GetInternal(string name, AnimGroup type)

View file

@ -27,7 +27,7 @@
- Chat - Chat
- Android: touch input is required ; set default fps to 25 ; add some predefined folders in file browser ; HUD must run before other UI scripts ; - Android: touch input is required ; set default fps to 25 ; add some predefined folders in file browser ; HUD must run before other UI scripts ; load config from resources ;
- Play sounds: horn ; empty weapon slot ; ped damage ; footsteps in run and sprint states ; - Play sounds: horn ; empty weapon slot ; ped damage ; footsteps in run and sprint states ;