Barotrauma Client Doc
Barotrauma.GameSession Class Reference

Public Types

enum class  InfoFrameTab { Crew , Mission , MyCharacter , Traitor }
 

Public Member Functions

 GameSession (SubmarineInfo submarineInfo, string savePath, GameModePreset gameModePreset, CampaignSettings settings, string? seed=null, MissionType missionType=MissionType.None)
 Start a new GameSession. Will be saved to the specified save path (if playing a game mode that can be saved). More...
 
 GameSession (SubmarineInfo submarineInfo, GameModePreset gameModePreset, string? seed=null, IEnumerable< MissionPrefab >? missionPrefabs=null)
 Start a new GameSession with a specific pre-selected mission. More...
 
 GameSession (SubmarineInfo submarineInfo, List< SubmarineInfo > ownedSubmarines, XDocument doc, string saveFile)
 Load a game session from the specified XML document. The session will be saved to the specified path. More...
 
void LoadPreviousSave ()
 
void SwitchSubmarine (SubmarineInfo newSubmarine, bool transferItems, Client? client=null)
 Switch to another submarine. The sub is loaded when the next round starts. More...
 
bool TryPurchaseSubmarine (SubmarineInfo newSubmarine, Client? client=null)
 
bool IsSubmarineOwned (SubmarineInfo query)
 
bool IsCurrentLocationRadiated ()
 
void StartRound (string levelSeed, float? difficulty=null, LevelGenerationParams? levelGenerationParams=null)
 
void StartRound (LevelData? levelData, bool mirrorLevel=false, SubmarineInfo? startOutpost=null, SubmarineInfo? endOutpost=null)
 
void PlaceSubAtStart (Level? level)
 
void Update (float deltaTime)
 
MissionGetMission (int index)
 
int GetMissionIndex (Mission mission)
 
void EnforceMissionOrder (List< Identifier > missionIdentifiers)
 
void EndRound (string endMessage, CampaignMode.TransitionType transitionType=CampaignMode.TransitionType.None, TraitorManager.TraitorResults? traitorResults=null)
 
void LogEndRoundStats (string eventId, TraitorManager.TraitorResults? traitorResults=null)
 
void KillCharacter (Character character)
 
void ReviveCharacter (Character character)
 
void Save (string filePath)
 
bool ToggleTabMenu ()
 
void AddToGUIUpdateList ()
 
void EnableEventLogNotificationIcon (bool enabled)
 
void HUDScaleChanged ()
 
void SetRespawnInfo (bool visible, string text, Color textColor, bool buttonsVisible, bool waitForNextRoundRespawn)
 
void Draw (SpriteBatch spriteBatch)
 

Static Public Member Functions

static Location[] CreateDummyLocations (LevelData levelData, LocationType? forceLocationType=null)
 
static Location[] CreateDummyLocations (string seed, LocationType? forceLocationType=null)
 
static ImmutableHashSet< CharacterGetSessionCrewCharacters (CharacterType type)
 Returns a list of crew characters currently in the game with a given filter. More...
 
static bool IsCompatibleWithEnabledContentPackages (IList< string > contentPackageNames, out LocalizedString errorMsg)
 
static GUIImage CreateNotificationIcon (GUIComponent parent, bool offset=true)
 
static void UpdateTalentNotificationIndicator (GUIImage indicator)
 

Public Attributes

readonly EventManager EventManager
 
GameModeGameMode
 
CrewManagerCrewManager
 
double TimeSpentCleaning
 
CharacterTeamTypeWinningTeam
 
List< SubmarineInfoOwnedSubmarines = new List<SubmarineInfo>()
 

Properties

Version LastSaveVersion = GameMain.Version [get, set]
 
float RoundDuration [get]
 
IEnumerable< MissionMissions [get]
 
IEnumerable< CharacterCasualties [get]
 
bool IsRunning [get]
 
bool RoundEnding [get]
 
LevelLevel [get]
 
LevelDataLevelData [get]
 
bool MirrorLevel [get]
 
Map?? Map [get]
 
CampaignModeCampaign [get]
 
LocationStartLocation [get]
 
LocationEndLocation [get]
 
SubmarineInfo SubmarineInfo [get, set]
 
SubmarineSubmarine [get, set]
 
string? SavePath [get, set]
 
bool TraitorsEnabled [get]
 
RoundSummary RoundSummary [get]
 
static bool IsTabMenuOpen [get]
 
static TabMenu TabMenuInstance [get]
 

Detailed Description

Member Enumeration Documentation

◆ InfoFrameTab

Enumerator
Crew 
Mission 
MyCharacter 
Traitor 

Definition at line 22 of file BarotraumaShared/SharedSource/GameSession/GameSession.cs.

Constructor & Destructor Documentation

◆ GameSession() [1/3]

Barotrauma.GameSession.GameSession ( SubmarineInfo  submarineInfo,
string  savePath,
GameModePreset  gameModePreset,
CampaignSettings  settings,
string?  seed = null,
MissionType  missionType = MissionType.None 
)

Start a new GameSession. Will be saved to the specified save path (if playing a game mode that can be saved).

Definition at line 129 of file BarotraumaShared/SharedSource/GameSession/GameSession.cs.

◆ GameSession() [2/3]

Barotrauma.GameSession.GameSession ( SubmarineInfo  submarineInfo,
GameModePreset  gameModePreset,
string?  seed = null,
IEnumerable< MissionPrefab >?  missionPrefabs = null 
)

Start a new GameSession with a specific pre-selected mission.

Definition at line 141 of file BarotraumaShared/SharedSource/GameSession/GameSession.cs.

◆ GameSession() [3/3]

Barotrauma.GameSession.GameSession ( SubmarineInfo  submarineInfo,
List< SubmarineInfo ownedSubmarines,
XDocument  doc,
string  saveFile 
)

Load a game session from the specified XML document. The session will be saved to the specified path.

Definition at line 152 of file BarotraumaShared/SharedSource/GameSession/GameSession.cs.

Member Function Documentation

◆ AddToGUIUpdateList()

void Barotrauma.GameSession.AddToGUIUpdateList ( )

◆ CreateDummyLocations() [1/2]

static Location [] Barotrauma.GameSession.CreateDummyLocations ( LevelData  levelData,
LocationType forceLocationType = null 
)
static

◆ CreateDummyLocations() [2/2]

static Location [] Barotrauma.GameSession.CreateDummyLocations ( string  seed,
LocationType forceLocationType = null 
)
static

◆ CreateNotificationIcon()

static GUIImage Barotrauma.GameSession.CreateNotificationIcon ( GUIComponent  parent,
bool  offset = true 
)
static

◆ Draw()

void Barotrauma.GameSession.Draw ( SpriteBatch  spriteBatch)

◆ EnableEventLogNotificationIcon()

void Barotrauma.GameSession.EnableEventLogNotificationIcon ( bool  enabled)

◆ EndRound()

void Barotrauma.GameSession.EndRound ( string  endMessage,
CampaignMode.TransitionType  transitionType = CampaignMode.TransitionType.None,
TraitorManager.TraitorResults traitorResults = null 
)

◆ EnforceMissionOrder()

void Barotrauma.GameSession.EnforceMissionOrder ( List< Identifier missionIdentifiers)

◆ GetMission()

Mission? Barotrauma.GameSession.GetMission ( int  index)

◆ GetMissionIndex()

int Barotrauma.GameSession.GetMissionIndex ( Mission  mission)

◆ GetSessionCrewCharacters()

static ImmutableHashSet<Character> Barotrauma.GameSession.GetSessionCrewCharacters ( CharacterType  type)
static

Returns a list of crew characters currently in the game with a given filter.

Parameters
typeCharacter type filter
Returns

In singleplayer mode the CharacterType.Player returns the currently controlled player.

Definition at line 840 of file BarotraumaShared/SharedSource/GameSession/GameSession.cs.

◆ HUDScaleChanged()

void Barotrauma.GameSession.HUDScaleChanged ( )

◆ IsCompatibleWithEnabledContentPackages()

static bool Barotrauma.GameSession.IsCompatibleWithEnabledContentPackages ( IList< string >  contentPackageNames,
out LocalizedString  errorMsg 
)
static

◆ IsCurrentLocationRadiated()

bool Barotrauma.GameSession.IsCurrentLocationRadiated ( )

◆ IsSubmarineOwned()

bool Barotrauma.GameSession.IsSubmarineOwned ( SubmarineInfo  query)

◆ KillCharacter()

void Barotrauma.GameSession.KillCharacter ( Character  character)

◆ LoadPreviousSave()

void Barotrauma.GameSession.LoadPreviousSave ( )

◆ LogEndRoundStats()

void Barotrauma.GameSession.LogEndRoundStats ( string  eventId,
TraitorManager.TraitorResults traitorResults = null 
)

◆ PlaceSubAtStart()

void Barotrauma.GameSession.PlaceSubAtStart ( Level level)

◆ ReviveCharacter()

void Barotrauma.GameSession.ReviveCharacter ( Character  character)

◆ Save()

void Barotrauma.GameSession.Save ( string  filePath)

◆ SetRespawnInfo()

void Barotrauma.GameSession.SetRespawnInfo ( bool  visible,
string  text,
Color  textColor,
bool  buttonsVisible,
bool  waitForNextRoundRespawn 
)

◆ StartRound() [1/2]

void Barotrauma.GameSession.StartRound ( LevelData levelData,
bool  mirrorLevel = false,
SubmarineInfo startOutpost = null,
SubmarineInfo endOutpost = null 
)

◆ StartRound() [2/2]

void Barotrauma.GameSession.StartRound ( string  levelSeed,
float?  difficulty = null,
LevelGenerationParams levelGenerationParams = null 
)

◆ SwitchSubmarine()

void Barotrauma.GameSession.SwitchSubmarine ( SubmarineInfo  newSubmarine,
bool  transferItems,
Client client = null 
)

Switch to another submarine. The sub is loaded when the next round starts.

Definition at line 318 of file BarotraumaShared/SharedSource/GameSession/GameSession.cs.

◆ ToggleTabMenu()

bool Barotrauma.GameSession.ToggleTabMenu ( )

◆ TryPurchaseSubmarine()

bool Barotrauma.GameSession.TryPurchaseSubmarine ( SubmarineInfo  newSubmarine,
Client client = null 
)

◆ Update()

void Barotrauma.GameSession.Update ( float  deltaTime)

◆ UpdateTalentNotificationIndicator()

static void Barotrauma.GameSession.UpdateTalentNotificationIndicator ( GUIImage  indicator)
static

Member Data Documentation

◆ CrewManager

CrewManager? Barotrauma.GameSession.CrewManager

◆ EventManager

readonly EventManager Barotrauma.GameSession.EventManager

◆ GameMode

GameMode? Barotrauma.GameSession.GameMode

◆ OwnedSubmarines

List<SubmarineInfo> Barotrauma.GameSession.OwnedSubmarines = new List<SubmarineInfo>()

◆ TimeSpentCleaning

double Barotrauma.GameSession.TimeSpentCleaning

◆ WinningTeam

CharacterTeamType? Barotrauma.GameSession.WinningTeam

Property Documentation

◆ Campaign

CampaignMode? Barotrauma.GameSession.Campaign
get

◆ Casualties

IEnumerable<Character> Barotrauma.GameSession.Casualties
get

◆ EndLocation

Location? Barotrauma.GameSession.EndLocation
get

◆ IsRunning

bool Barotrauma.GameSession.IsRunning
get

◆ IsTabMenuOpen

bool Barotrauma.GameSession.IsTabMenuOpen
staticget

◆ LastSaveVersion

Version Barotrauma.GameSession.LastSaveVersion = GameMain.Version
getset

◆ Level

Level? Barotrauma.GameSession.Level
get

◆ LevelData

LevelData? Barotrauma.GameSession.LevelData
get

◆ Map

Map?? Barotrauma.GameSession.Map
get

◆ MirrorLevel

bool Barotrauma.GameSession.MirrorLevel
get

◆ Missions

IEnumerable<Mission> Barotrauma.GameSession.Missions
get

◆ RoundDuration

float Barotrauma.GameSession.RoundDuration
get

◆ RoundEnding

bool Barotrauma.GameSession.RoundEnding
get

◆ RoundSummary

RoundSummary Barotrauma.GameSession.RoundSummary
get

◆ SavePath

string? Barotrauma.GameSession.SavePath
getset

◆ StartLocation

Location? Barotrauma.GameSession.StartLocation
get

◆ Submarine

Submarine? Barotrauma.GameSession.Submarine
getset

◆ SubmarineInfo

SubmarineInfo Barotrauma.GameSession.SubmarineInfo
getset

◆ TabMenuInstance

TabMenu Barotrauma.GameSession.TabMenuInstance
staticget

◆ TraitorsEnabled

bool Barotrauma.GameSession.TraitorsEnabled
get