@@ -8,42 +8,39 @@ namespace Editors.Audio.Shared.Dat
88{
99 public interface IDatGeneratorService
1010 {
11- void GenerateEventDatFile ( List < ActionEvent > actionEvents , string audioProjectFileNameWithoutExtension ) ;
12- void GenerateStatesDatFile ( List < StateGroup > stateGroups , string audioProjectFileNameWithoutExtension ) ;
11+ void GenerateEventDatFile ( string audioProjectFileNameWithoutExtension , List < ActionEvent > actionEvents = null , List < StateGroup > stateGroups = null ) ;
1312 }
1413
1514 public class DatGeneratorService ( IFileSaveService fileSaveService ) : IDatGeneratorService
1615 {
1716 private readonly IFileSaveService _fileSaveService = fileSaveService ;
1817
19- public void GenerateEventDatFile ( List < ActionEvent > actionEvents , string audioProjectFileNameWithoutExtension )
18+ public void GenerateEventDatFile ( string audioProjectFileNameWithoutExtension , List < ActionEvent > actionEvents = null , List < StateGroup > stateGroups = null )
2019 {
21- var soundDatFile = new SoundDatFile ( ) ;
20+ var datFile = new SoundDatFile ( ) ;
2221
23- foreach ( var actionEvent in actionEvents )
24- soundDatFile . EventWithStateGroup . Add ( new SoundDatFile . DatEventWithStateGroup ( ) { Event = actionEvent . Name , Value = 400 } ) ;
25-
26- var datFileName = $ "event_data__{ audioProjectFileNameWithoutExtension } .dat";
27- var datFilePath = $ "audio\\ wwise\\ { datFileName } ";
28- SaveDatFileToPack ( soundDatFile , datFileName , datFilePath ) ;
29- }
30-
31- public void GenerateStatesDatFile ( List < StateGroup > stateGroups , string audioProjectFileNameWithoutExtension )
32- {
33- var stateDatFile = new SoundDatFile ( ) ;
22+ if ( actionEvents != null && actionEvents . Count > 0 )
23+ {
24+ foreach ( var actionEvent in actionEvents )
25+ datFile . EventWithStateGroup . Add ( new SoundDatFile . DatEventWithStateGroup ( ) { Event = actionEvent . Name , Value = 400 } ) ;
26+ }
3427
35- foreach ( var stateGroup in stateGroups )
28+ if ( stateGroups != null && stateGroups . Count > 0 )
3629 {
37- var states = new List < string > ( ) ;
38- foreach ( var state in stateGroup . States )
39- states . Add ( state . Name ) ;
4030
41- stateDatFile . StateGroupsWithStates1 . Add ( new SoundDatFile . DatStateGroupsWithStates ( ) { StateGroup = stateGroup . Name , States = states } ) ;
31+ foreach ( var stateGroup in stateGroups )
32+ {
33+ var states = new List < string > ( ) ;
34+ foreach ( var state in stateGroup . States )
35+ states . Add ( state . Name ) ;
36+
37+ datFile . StateGroupsWithStates1 . Add ( new SoundDatFile . DatStateGroupsWithStates ( ) { StateGroup = stateGroup . Name , States = states } ) ;
38+ }
4239 }
4340
44- var datFileName = $ "states_data__ { audioProjectFileNameWithoutExtension } .dat";
41+ var datFileName = $ "event_data__ { audioProjectFileNameWithoutExtension } .dat";
4542 var datFilePath = $ "audio\\ wwise\\ { datFileName } ";
46- SaveDatFileToPack ( stateDatFile , datFileName , datFilePath ) ;
43+ SaveDatFileToPack ( datFile , datFileName , datFilePath ) ;
4744 }
4845
4946 private void SaveDatFileToPack ( SoundDatFile datFile , string datFileName , string datFilePath )
0 commit comments