public NetworkedGamemode(MatchScreen screen, GamemodeType type) : base(type) { Screen = screen; Players = new Dictionary <NetConnection, ServerMPPlayer>(); respawns = new ConcurrentDictionary <NetConnection, RespawnToken>(); }
public NetworkedGamemode(MultiplayerScreen screen, GamemodeType type) : base(type) { Screen = screen; Players = new Dictionary <ushort, ClientPlayer>(); renderer = MasterRenderer.Instance; }
void R_SwitchGamemode(NetConnection server, NetBuffer data, ushort numArgs) { DashCMD.WriteStandard("Switching gamemode..."); GamemodeType type = (GamemodeType)data.ReadByte(); if (currentGamemode != null) { currentGamemode.Stop(); } currentGamemode = null; hud.SetGamemode(null); NetworkedGamemode gamemode; if (gamemodes.TryGetValue(type, out gamemode)) { currentGamemode = gamemode; currentGamemode.Start(); hud.SetGamemode(gamemode); leaderboard.SetGamemode(gamemode); objectComponent.HoldInstantiationPackets = false; } else { string message = string.Format("Failed to switch to gamemode '{0}'!", type); DashCMD.WriteError("[MultiplayerScreen] {0}", message); client.Disconnect("Critical client-side error"); Window.SwitchScreen("MainMenu", message); } }
public static AbstractGamemode ToGamemodeClass(this GamemodeType g) { switch (g) { case GamemodeType.DeathMatch: return(new GamemodeDeathMatch()); } return(null); }
/// <summary> /// Creates a new gamemode object of the provided type /// </summary> public static Gamemode Create(GamemodeType type, GameSceneController parent) { switch (type) { case GamemodeType.Elimination: return(new EliminationGamemode(parent)); default: throw new NotImplementedException("Can not create a gamemode object of type \"" + Enum.GetName(typeof(GamemodeType), type) + "\". Did you forget to add it to the switch statement?"); } }
public static GamemodeBase ConvertToGamemode(string json, GamemodeType type) { GamemodeBase gamemode = null; switch (type) { case GamemodeType.Racing: gamemode = JsonConvert.DeserializeObject <RacingGamemode>(json); break; case GamemodeType.Capture: gamemode = JsonConvert.DeserializeObject <CaptureGamemode>(json); break; case GamemodeType.Titans: gamemode = JsonConvert.DeserializeObject <KillTitansGamemode>(json); break; case GamemodeType.Endless: gamemode = JsonConvert.DeserializeObject <EndlessGamemode>(json); break; case GamemodeType.Wave: gamemode = JsonConvert.DeserializeObject <WaveGamemode>(json); break; case GamemodeType.Trost: gamemode = JsonConvert.DeserializeObject <TrostGamemode>(json); break; case GamemodeType.TitanRush: gamemode = JsonConvert.DeserializeObject <TitanRushGamemode>(json); break; case GamemodeType.PvpAhss: gamemode = JsonConvert.DeserializeObject <PvPAhssGamemode>(json); break; case GamemodeType.Infection: gamemode = JsonConvert.DeserializeObject <InfectionGamemode>(json); break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } return(gamemode); }
public PlayerModel(GamemodeType gamemode) { Inventory = new InventoryModel(); Gamemode = gamemode; if (Gamemode == GamemodeType.Creative) { Inventory.MainInventory[3, 0].Item = new BlockItemModel(BlockType.DefaultBlock); Inventory.MainInventory[3, 1].Item = new BlockItemModel(BlockType.DirtBlock); Inventory.MainInventory[3, 2].Item = new BlockItemModel(BlockType.GrassBlock); Inventory.MainInventory[3, 3].Item = new BlockItemModel(BlockType.LogBlock); Inventory.MainInventory[3, 4].Item = new BlockItemModel(BlockType.LeafBlock); for (int i = 0; i < 5; i++) { Inventory.MainInventory[3, i].ItemCount = 1; } } }
private static Gamemode CreateGamemode(GamemodeType gamemodeType, Player playerWhite, Player playerBlack) { switch (gamemodeType) { case GamemodeType.Classic: return(new ClassicChess(playerWhite, playerBlack)); case GamemodeType.Horde: return(new Horde(playerWhite, playerBlack)); case GamemodeType.CheckMateTest: return(new CheckMateTest(playerWhite, playerBlack)); case GamemodeType.PawnTest: return(new PawnTestChess(playerWhite, playerBlack)); case GamemodeType.Tiny: return(new TinyChess(playerWhite, playerBlack)); } return(null); }
void SwitchGamemode(GamemodeType to) { if (currentGamemode != null) { currentGamemode.Stop(); } currentGamemode = null; NetworkedGamemode gamemode; if (gamemodes.TryGetValue(to, out gamemode)) { currentGamemode = gamemode; currentGamemode.Start(); channel.FireEventForAllConnections("Client_SwitchGamemode", (byte)to); } else { DashCMD.WriteError("[MatchScreen] Gamemode type '{0}' is not defined!", to); } }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.PropertyField(type); GamemodeType st = (GamemodeType)type.enumValueIndex; switch (st) { case GamemodeType.TeamVsTeam: EditorGUILayout.IntSlider(forFFA, 0, 10, new GUIContent("forFFA")); EditorGUILayout.IntSlider(forTVT, 0, 100, new GUIContent("forTVT")); break; case GamemodeType.FreeForAll: EditorGUILayout.IntSlider(forTVT, 0, 100, new GUIContent("valForAB")); break; } serializedObject.ApplyModifiedProperties(); }
static string ChooseGamemode() { var gamemodes = new List <GamemodeType>(); foreach (var mod in ModDatabase.LoadedModulesList) { gamemodes.AddRange(mod.Gamemodes); } _logger.Info($"Choose the gamemode (1-{gamemodes.Count})"); _logger.Info("If you want the description, type desc {number}"); int id = 1; foreach (var gamemode in gamemodes) { _logger.Info($"[{id++}] - {gamemode.DisplayName}"); } GamemodeType selected = null; bool valid = false; while (!valid) { var line = WaitLine(30000); if (line == null) { line = "1"; //Chose the first one if no input } if (line.StartsWith("desc", StringComparison.OrdinalIgnoreCase)) { if (line.Split(' ').Length < 2) { _logger.Error("Missing mod number after desc."); continue; } var number = line.Split(' ')[1]; int num; if (!int.TryParse(number, out num)) { _logger.Error($"{number} is not a valid number."); continue; } if (num > gamemodes.Count || num < 1) { _logger.Error($"{num} is out of range. It must be between 1 and {gamemodes.Count}."); continue; } _logger.Info($"Gamemode description for {gamemodes[num - 1].DisplayName}."); _logger.Info(gamemodes[num - 1].DisplayDescription); continue; } int selection; if (!int.TryParse(line, out selection)) { _logger.Error($"{line} is not a valid number."); continue; } if (selection < 1 || selection > gamemodes.Count) { _logger.Error($"{selection} is out of range. It must be between 1 and {gamemodes.Count}."); continue; } selected = gamemodes[selection - 1]; valid = true; } _logger.Info($"Chose gamemode: {selected.DisplayName}."); return(selected.ReflectionTypeName); }
public Gamemode(GamemodeType type) { Type = type; }
public int GetGamemodeValue(GamemodeType gamemodeType) { return(_gamemodeData[(int)gamemodeType].DefaultValue); }
private void listBoxGamemode_SelectedIndexChanged(object sender, EventArgs e) { gamemodeType = (GamemodeType)Enum.Parse(typeof(GamemodeType), (string)listBoxGamemode.SelectedItem); }
public Gamemode(GameSceneController parent, GamemodeType type) { gameSceneController = parent; gamemodeType = type; }