Client LuaCsForBarotrauma
GameModePreset.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Reflection;
4 
5 namespace Barotrauma
6 {
8  {
9  public static List<GameModePreset> List = new List<GameModePreset>();
10 
13  public static GameModePreset Tutorial;
14  public static GameModePreset Mission;
15  public static GameModePreset PvP;
16  public static GameModePreset TestMode;
17  public static GameModePreset Sandbox;
18  public static GameModePreset DevSandbox;
19 
20  public readonly Type GameModeType;
21 
22  public readonly LocalizedString Name;
23  public readonly LocalizedString Description;
24 
25  public readonly Identifier Identifier;
26 
27  public readonly bool IsSinglePlayer;
28 
29  //are clients allowed to vote for this gamemode
30  public readonly bool Votable;
31 
32  public GameModePreset(Identifier identifier, Type type, bool isSinglePlayer = false, bool votable = true)
33  {
34  Name = TextManager.Get("GameMode." + identifier);
35  Description = TextManager.Get("GameModeDescription." + identifier).Fallback("");
36  Identifier = identifier;
37 
38  GameModeType = type;
39 
40  IsSinglePlayer = isSinglePlayer;
41  Votable = votable;
42 
43  List.Add(this);
44  }
45 
46  public static void Init()
47  {
48 #if CLIENT
49  Tutorial = new GameModePreset("tutorial".ToIdentifier(), typeof(TutorialMode), isSinglePlayer: true);
50  DevSandbox = new GameModePreset("devsandbox".ToIdentifier(), typeof(GameMode), isSinglePlayer: true);
51  SinglePlayerCampaign = new GameModePreset("singleplayercampaign".ToIdentifier(), typeof(SinglePlayerCampaign), isSinglePlayer: true);
52  TestMode = new GameModePreset("testmode".ToIdentifier(), typeof(TestGameMode), isSinglePlayer: true);
53 #endif
54  Sandbox = new GameModePreset("sandbox".ToIdentifier(), typeof(GameMode), isSinglePlayer: false);
55  Mission = new GameModePreset("mission".ToIdentifier(), typeof(CoOpMode), isSinglePlayer: false);
56  PvP = new GameModePreset("pvp".ToIdentifier(), typeof(PvPMode), isSinglePlayer: false);
57  MultiPlayerCampaign = new GameModePreset("multiplayercampaign".ToIdentifier(), typeof(MultiPlayerCampaign), isSinglePlayer: false);
58  }
59  }
60 }
static GameModePreset Mission
readonly LocalizedString Description
static List< GameModePreset > List
static GameModePreset PvP
static GameModePreset TestMode
static GameModePreset DevSandbox
static GameModePreset Tutorial
readonly LocalizedString Name
static GameModePreset SinglePlayerCampaign
readonly bool IsSinglePlayer
static GameModePreset MultiPlayerCampaign
static GameModePreset Sandbox
readonly Identifier Identifier
GameModePreset(Identifier identifier, Type type, bool isSinglePlayer=false, bool votable=true)
LocalizedString Fallback(LocalizedString fallback, bool useDefaultLanguageIfFound=true)
Use this text instead if the original text cannot be found.