using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SCJMapper_V2.Layout { /// /// defines the action grouping /// class ActionGroups { /// /// All actionmap groups /// public enum EGroup { SpaceFlight = 0, SpaceDefensive, SpaceTargeting, SpaceWeapons, SpaceMining, Player, EVA, Vehicle, VehicleWeapons, Lights, Interaction, Spectator, Others, } private static Dictionary> m_actionDict; /// /// cTor /// static ActionGroups() { m_actionDict = new Dictionary>( ); // Define which maps belongs to which group var x = new List( ) { "spaceship_general", "spaceship_view", "spaceship_movement", "spaceship_docking", "spaceship_power", "IFCS_controls" }; m_actionDict.Add( EGroup.SpaceFlight, x ); x = new List( ) { "spaceship_targeting", "spaceship_target_hailing", "spaceship_scanning", "spaceship_ping", "spaceship_radar" }; m_actionDict.Add( EGroup.SpaceTargeting, x ); x = new List( ) { "spaceship_mining" }; m_actionDict.Add( EGroup.SpaceMining, x ); x = new List( ) { "spaceship_turret", "spaceship_weapons", "spaceship_missiles", "spaceship_auto_weapons" }; m_actionDict.Add( EGroup.SpaceWeapons, x ); x = new List( ) { "spaceship_defensive" }; m_actionDict.Add( EGroup.SpaceDefensive, x ); x = new List( ) { "lights_controller" }; m_actionDict.Add( EGroup.Lights, x ); x = new List( ) { "default", "prone", "player", "player_choice", "player_emotes", "player_input_optical_tracking" }; m_actionDict.Add( EGroup.Player, x ); x = new List( ) { "zero_gravity_eva" }; m_actionDict.Add( EGroup.EVA, x ); x = new List( ) { "vehicle_general", "vehicle_driver" }; m_actionDict.Add( EGroup.Vehicle, x ); x = new List( ) { "vehicle_gunner" }; m_actionDict.Add( EGroup.VehicleWeapons, x ); x = new List( ) { "spaceship_hud", "ui_textfield", "ui_notification" }; m_actionDict.Add( EGroup.Interaction, x ); x = new List( ) { "spectator", "flycam", "view_director_mode" }; m_actionDict.Add( EGroup.Spectator, x ); x = new List( ) { }; m_actionDict.Add( EGroup.Others, x ); } /// /// Return the names of the groups /// /// public static List ActionGroupNames() { return Enum.GetNames( typeof( EGroup ) ).ToList( ); } /// /// Returns the list of actionmaps of a group /// /// /// public static List ActionmapNames( EGroup eClass ) { return m_actionDict[eClass]; } /// /// Returns the group from the actionmap /// /// /// public static EGroup MapNameToGroup( string actionmap ) { foreach ( var kv in m_actionDict ) { if ( kv.Value.Contains( actionmap ) ) return kv.Key; } return EGroup.Others; } /// /// Returns the group from the actiongroup name /// /// /// public static EGroup GroupNameToGroup( string actiongroup ) { foreach ( var kv in m_actionDict ) { if ( kv.Key.ToString( ) == actiongroup ) return kv.Key; } return EGroup.Others; } } }