VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtRoleSelectionControl Class Reference

Detailed Description

DtRoleSelectionControl provides functionality for cycling through and selecting different roles available on the current ownship entity. It tracks which roles are available (not occupied or engaged by other players), maintains state attributes for the UI to display, and handles the role switching process through input bindings or menu actions. It supports both direct-engaged roles and embark-engaged roles where a human avatar must be re-embarked in a specific slot.

#include <roleSelectionControl.h>

Inheritance diagram for makVre::DtRoleSelectionControl:
[legend]

Classes

struct  RoleListItem
 

Public Member Functions

 DtRoleSelectionControl ()
 
virtual ~DtRoleSelectionControl () override
 
virtual bool initialize (DtPlayerStation *player, DtInitTable &config) override
 
virtual bool postInitialize () override
 
virtual void tick (double dt) override
 
virtual void shutdown () override
 
virtual const char * type () const override
 
virtual void selectRole (const std::string &roleName)
 
virtual DtVreMessageResult handleSimState (DtVreMessage *msg)
 
virtual DtVreMessageResult handleMenuAction (DtVreMessage *msg)
 
virtual DtVreMessageResult handleEntityEmbarkationInformation (DtVreMessage *msg)
 
virtual void nextRole (double keyState)
 
virtual void previousRole (double keyState)
 
- Public Member Functions inherited from makVre::DtPlayerComponent
 DtPlayerComponent ()
 
virtual ~DtPlayerComponent ()
 
virtual void setName (const std::string &name)
 
virtual const std::string & name ()
 
virtual DtPlayerStationplayer ()
 
virtual DtAttributeHandleplayerAttributeStore ()
 
virtual const DtAttributeHandleplayerAttributeStore () const
 

Protected Member Functions

virtual void updateAvailableRolesAttribute ()
 
- Protected Member Functions inherited from makVre::DtPlayerComponent
virtual void initializeStateAttributes ()
 

Protected Attributes

std::vector< RoleListItemmyRolesList
 
unsigned int myRoleIndex
 
std::string myHasAvailableRolesAttributeName
 
std::string myAvailableRolesAttributeName
 
std::string mySelectRoleMenuAction
 
bool myIsStackedRole
 
DtInputLogic myInputLogic
 
- Protected Attributes inherited from makVre::DtPlayerComponent
std::string myName
 
DtInitTable myConfig
 
DtPlayerStationmyPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolvermyResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 

Constructor & Destructor Documentation

◆ DtRoleSelectionControl()

makVre::DtRoleSelectionControl::DtRoleSelectionControl ( )

Constructor for DtRoleSelectionControl.

Initializes the component with default settings

◆ ~DtRoleSelectionControl()

virtual makVre::DtRoleSelectionControl::~DtRoleSelectionControl ( )
overridevirtual

Virtual destructor for DtRoleSelectionControl.

Member Function Documentation

◆ initialize()

virtual bool makVre::DtRoleSelectionControl::initialize ( DtPlayerStation * player,
DtInitTable & config )
overridevirtual

Initializes the role selection control component.

Parameters
playerPointer to the player station this component belongs to
configConfiguration table containing role selection settings
Returns
True if initialization succeeded, false otherwise

Sets up available roles list, determines the component mode (stacked or direct), configures input bindings, and registers message handlers

Reimplemented from makVre::DtPlayerComponent.

References makVre::DtPlayerComponent::player().

◆ postInitialize()

virtual bool makVre::DtRoleSelectionControl::postInitialize ( )
overridevirtual

Performs post-initialization after all components are initialized.

Returns
True if post-initialization succeeded, false otherwise

Completes any setup that requires other components to be initialized first

Reimplemented from makVre::DtPlayerComponent.

◆ tick()

virtual void makVre::DtRoleSelectionControl::tick ( double dt)
overridevirtual

Called every frame to update the component state.

Parameters
dtDelta time since the last frame in seconds

For stacked roles, periodically requests embarkation information to update slot availability status

Implements makVre::DtPlayerComponent.

◆ shutdown()

virtual void makVre::DtRoleSelectionControl::shutdown ( )
overridevirtual

Shuts down the role selection control component.

Removes message handlers and input bindings

Reimplemented from makVre::DtPlayerComponent.

◆ type()

virtual const char * makVre::DtRoleSelectionControl::type ( ) const
overridevirtual

Returns the type identifier for this component.

Returns
The type string for DtRoleSelectionControl

Implements makVre::DtPlayerComponent.

◆ selectRole()

virtual void makVre::DtRoleSelectionControl::selectRole ( const std::string & roleName)
virtual

Switches to a specific role on the ownship entity.

Parameters
roleNameName of the role to switch to

For stacked roles, embarks the human player in the new role slot. For direct-engaged roles, assigns the player to the new role directly.

◆ handleSimState()

virtual DtVreMessageResult makVre::DtRoleSelectionControl::handleSimState ( DtVreMessage * msg)
virtual

Handles simulation state messages.

Parameters
msgSimulation state message
Returns
Message handling result indicating if the message was handled

Updates role engagement status based on information in simulation state messages

◆ handleMenuAction()

virtual DtVreMessageResult makVre::DtRoleSelectionControl::handleMenuAction ( DtVreMessage * msg)
virtual

Handles menu action messages.

Parameters
msgMenu action message
Returns
Message handling result indicating if the message was handled

Processes role selection menu actions

◆ handleEntityEmbarkationInformation()

virtual DtVreMessageResult makVre::DtRoleSelectionControl::handleEntityEmbarkationInformation ( DtVreMessage * msg)
virtual

Handles entity embarkation information messages.

Parameters
msgEntity embarkation information message
Returns
Message handling result indicating if the message was handled

Updates slot occupancy status based on embarkation information

◆ nextRole()

virtual void makVre::DtRoleSelectionControl::nextRole ( double keyState)
virtual

Input handler for cycling to the next available role.

Parameters
keyStateInput value (1.0 for pressed, 0.0 for released)

When triggered, finds the next non-occupied, non-engaged role and switches to it

◆ previousRole()

virtual void makVre::DtRoleSelectionControl::previousRole ( double keyState)
virtual

Input handler for cycling to the previous available role.

Parameters
keyStateInput value (1.0 for pressed, 0.0 for released)

When triggered, finds the previous non-occupied, non-engaged role and switches to it

◆ updateAvailableRolesAttribute()

virtual void makVre::DtRoleSelectionControl::updateAvailableRolesAttribute ( )
protectedvirtual

Updates the available roles state attributes.

Builds a list of available roles based on occupancy and engagement status and updates the corresponding state attributes for UI display

Member Data Documentation

◆ myRolesList

std::vector<RoleListItem> makVre::DtRoleSelectionControl::myRolesList
protected

List of roles available on the current entity.

◆ myRoleIndex

unsigned int makVre::DtRoleSelectionControl::myRoleIndex
protected

Index of the current role in the roles list.

◆ myHasAvailableRolesAttributeName

std::string makVre::DtRoleSelectionControl::myHasAvailableRolesAttributeName
protected

Name of the attribute indicating if there are available roles.

◆ myAvailableRolesAttributeName

std::string makVre::DtRoleSelectionControl::myAvailableRolesAttributeName
protected

Name of the attribute containing the list of available roles.

◆ mySelectRoleMenuAction

std::string makVre::DtRoleSelectionControl::mySelectRoleMenuAction
protected

Name of the menu action for selecting a role.

◆ myIsStackedRole

bool makVre::DtRoleSelectionControl::myIsStackedRole
protected

Flag indicating if this is a stacked role (embarked) versus direct-engaged.

◆ myInputLogic

DtInputLogic makVre::DtRoleSelectionControl::myInputLogic
protected

Input logic for handling role selection bindings.


The documentation for this class was generated from the following file: