public GameMode(string _name, string _description, GameModeType _gameModeType, Sprite[] _gameModeBackgrounds) { name = _name; description = _description; gameModeType = _gameModeType; gameModeBackgrounds = _gameModeBackgrounds; }
// Token: 0x06001901 RID: 6401 RVA: 0x0008629C File Offset: 0x0008449C private bool TryGetRandomSpawnPoint(GameModeType gameMode, TeamID teamID, out SpawnPoint point) { IList <SpawnPoint> spawnPointList = this.GetSpawnPointList(gameMode, teamID); point = ((spawnPointList.Count <= 0) ? null : spawnPointList[UnityEngine.Random.Range(0, spawnPointList.Count)]); return(point != null); }
List<AggregatedChampionStatistics> LoadAggregatedChampionStatistics(Summoner summoner, MapType map, GameModeType gameMode, NpgsqlConnection database) { const string query = "with source as " + "(select player.champion_id, player.won, player.kills, player.deaths, player.assists, player.gold, player.minion_kills from game_result, player where game_result.map = cast(:map as map_type) and game_result.game_mode = cast(:game_mode as game_mode_type) and (game_result.team1_id = player.team_id or game_result.team2_id = player.team_id) and player.summoner_id = :summoner_id) " + "select statistics.champion_id, coalesce(champion_wins.wins, 0) as wins, coalesce(champion_losses.losses, 0) as losses, statistics.kills, statistics.deaths, statistics.assists, statistics.gold, statistics.minion_kills from " + "(select source.champion_id, sum(source.kills) as kills, sum(source.deaths) as deaths, sum(source.assists) as assists, sum(source.gold) as gold, sum(source.minion_kills) as minion_kills from source group by source.champion_id) " + "as statistics " + "left outer join " + "(select champion_id, count(*) as wins from source where won = true group by champion_id) " + "as champion_wins " + "on statistics.champion_id = champion_wins.champion_id " + "left outer join " + "(select champion_id, count(*) as losses from source where won = false group by champion_id) " + "as champion_losses " + "on statistics.champion_id = champion_losses.champion_id;"; DatabaseCommand select = GetCommand(query, database); select.SetEnum("map", map.ToEnumString()); select.SetEnum("game_mode", gameMode.ToEnumString()); select.Set("summoner_id", summoner.Id); using (NpgsqlDataReader reader = select.ExecuteReader()) { List<AggregatedChampionStatistics> output = new List<AggregatedChampionStatistics>(); while (reader.Read()) { AggregatedChampionStatistics statistics = new AggregatedChampionStatistics(reader); statistics.ChampionName = GetChampionName(statistics.ChampionId); output.Add(statistics); } output.Sort(); return output; } }
public static void AddCompanion(UnitEntityData unit) { Player player = Game.Instance.Player; player.AddCompanion(unit); GameModeType currentMode = Game.Instance.CurrentMode; if (currentMode == GameModeType.Default || currentMode == GameModeType.Pause) { var pets = unit.Pets; unit.IsInGame = true; unit.Position = Game.Instance.Player.MainCharacter.Value.Position; unit.LeaveCombat(); Charm(unit); UnitPartCompanion unitPartCompanion = unit.Get <UnitPartCompanion>(); unit.Ensure <UnitPartCompanion>().SetState(CompanionState.InParty); unit.SwitchFactions(Game.Instance.Player.MainCharacter.Value.Faction); unit.GroupId = Game.Instance.Player.MainCharacter.Value.GroupId; unit.HoldingState.RemoveEntityData(unit); Game.Instance.Player.CrossSceneState.AddEntityData(unit); foreach (var pet in pets) { pet.Entity.Position = unit.Position; } } }
void ProcessSummary(MapType map, GameModeType gameMode, string target, Summoner summoner, List<PlayerStatSummary> summaries, DbConnection connection, bool forceNullRating = false) { foreach (var summary in summaries) { if (summary.playerStatSummaryType != target) continue; using (var update = Command("update summoner_rating set wins = :wins, losses = :losses, leaves = :leaves, kills = :kills, deaths = :deaths, assists = :assists, current_rating = :current_rating, top_rating = :top_rating where summoner_id = :summoner_id and map = :map and game_mode = :game_mode", connection)) { SetSummaryParameters(update, map, gameMode, summoner, summary, forceNullRating); int rowsAffected = update.Execute(); if (rowsAffected == 0) { //We're dealing with a new summoner rating entry, insert it using (var insert = Command("insert into summoner_rating (summoner_id, map, game_mode, wins, losses, leaves, kills, deaths, assists, current_rating, top_rating) values (:summoner_id, :map, :game_mode, :wins, :losses, :leaves, :kills, :deaths, :assists, :current_rating, :top_rating)", connection)) { SetSummaryParameters(insert, map, gameMode, summoner, summary, forceNullRating); insert.Execute(); //SummonerMessage(string.Format("New rating for mode {0}", target), summoner); } } else { //This rating was already in the database and was updated //SummonerMessage(string.Format("Updated rating for mode {0}", target), summoner); } break; } } }
// Token: 0x06001906 RID: 6406 RVA: 0x0008640C File Offset: 0x0008460C public void GetSpawnPointAt(int index, GameModeType gameMode, TeamID team, out Vector3 position, out Quaternion rotation) { if (gameMode == GameModeType.None) { gameMode = GameModeType.DeathMatch; } SpawnPoint spawnPoint; if (this.TryGetSpawnPointAt(index, gameMode, team, out spawnPoint)) { position = spawnPoint.transform.position; rotation = spawnPoint.transform.rotation; } else { Debug.LogException(new Exception(string.Concat(new object[] { "No spawnpoints found at ", index, " int list of length ", this.GetSpawnPointCount(gameMode, team) }))); if (GameState.Current.Map != null && GameState.Current.Map.DefaultSpawnPoint != null) { position = GameState.Current.Map.DefaultSpawnPoint.position; } else { position = new Vector3(0f, 10f, 0f); } rotation = Quaternion.identity; } }
void SetSummaryParameters(DatabaseCommand command, MapType map, GameModeType gameMode, Summoner summoner, PlayerStatSummary summary, bool forceNullRating) { if (forceNullRating) { command.Set("current_rating", DbType.Int32, null); command.Set("top_rating", DbType.Int32, null); } else { //Zero rating means that the Elo is below 1200 and is not revealed by the server if (summary.rating == 0) command.Set("current_rating", DbType.Int32, null); else command.Set("current_rating", summary.rating); command.Set("top_rating", summary.maxRating); } command.Set("summoner_id", summoner.Id); command.Set("map", (int)map); command.Set("game_mode", (int)gameMode); command.Set("wins", summary.wins); command.Set("losses", summary.losses); command.Set("leaves", summary.leaves); }
public void StartGame(GameModeType gm, int players, int time) { _gameModeType = gm; _players = players; _time = time; SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); }
void ProcessSummary(MapType map, GameModeType gameMode, string target, Summoner summoner, List <PlayerStatSummary> summaries, DbConnection connection, bool forceNullRating = false) { foreach (var summary in summaries) { if (summary.playerStatSummaryType != target) { continue; } using (var update = Command("update summoner_rating set wins = :wins, losses = :losses, leaves = :leaves, current_rating = :current_rating, top_rating = :top_rating where summoner_id = :summoner_id and map = :map and game_mode = :game_mode", connection)) { SetSummaryParameters(update, map, gameMode, summoner, summary, forceNullRating); int rowsAffected = update.Execute(); if (rowsAffected == 0) { //We're dealing with a new summoner rating entry, insert it using (var insert = Command("insert into summoner_rating (summoner_id, map, game_mode, wins, losses, leaves, current_rating, top_rating) values (:summoner_id, :map, :game_mode, :wins, :losses, :leaves, :current_rating, :top_rating)", connection)) { SetSummaryParameters(insert, map, gameMode, summoner, summary, forceNullRating); insert.Execute(); //SummonerMessage(string.Format("New rating for mode {0}", target), summoner); } } else { //This rating was already in the database and was updated //SummonerMessage(string.Format("Updated rating for mode {0}", target), summoner); } break; } } }
void Start() { if (AllowGameModeOverride) { gameMode = GameModeOverride; } else { gameMode = GameState.GameMode; } Debug.Log("Starting game in mode: " + gameMode); // Register callbacks FloorController.BallCollidedWithFloorEvent += OnResetTurn; BallController.ThrowTimer += OnResetTurn; BallGrabber.BallGrabbedByCell += OnResetRequestedByBoard; BoardController.GameOver += OnGameOver; if (DebugSlider) { SpeedFactor = DebugSlider.value / 10.0f; if (DebugLabel1) { DebugLabel1.text = SpeedFactor.ToString(); } DebugSlider.onValueChanged.AddListener(delegate { OnSetDebugVelocity(); }); } //OnResetTurn(); StartNewGame(); }
public void OnModeButtonPressed(GameModeType gameModeType) { Mediator.Instance.SoundManager.PlaySound(SoundType.Click); if (Mediator.Instance.ResourcesStorage.Chips.Count < 50) { Mediator.Instance.PopupsManager.CreatePopup <AlertPopup>().Init(AlertType.Lack_Chips); return; } IsCanContinue(gameModeType, isCanContinue => { if (!isCanContinue) { ShowInternetException(); return; } if (!TrySpendEnergy(gameModeType)) { return; } GameplayManager.SelectedGameModeType = gameModeType; Mediator.Instance.PopupsManager.CreatePopup <LoadingPopup>().LoadingScene("Game"); }); }
// Token: 0x06001907 RID: 6407 RVA: 0x0008650C File Offset: 0x0008470C public void GetRandomSpawnPoint(GameModeType gameMode, TeamID team, out Vector3 position, out Quaternion rotation) { if (gameMode == GameModeType.None) { gameMode = GameModeType.DeathMatch; } IList <SpawnPoint> list = this._spawnPointsDictionary[gameMode][team]; if (list.Count > 0) { SpawnPoint spawnPoint = list[UnityEngine.Random.Range(0, list.Count)]; position = spawnPoint.transform.position; rotation = spawnPoint.transform.rotation; } else { Debug.LogWarning(string.Concat(new object[] { "GetRandomSpawnPoint failed for ", team, "/", gameMode })); position = Vector3.zero; rotation = Quaternion.identity; } }
public void SwitchGamemode(GameModeType type, GameMode obj = null) { GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity(); GL.Ortho(0, 1600, 900, 0, 0, 4); byte index = (byte)type; if (obj != null) { Logger.DefaultLogger.WriteLine("Gamemode : {0} ({1})", type, obj.GetType()); this.LoadedGameMode[index] = obj; } else if (this.LoadedGameMode[index] == null) { Logger.DefaultLogger.WriteLine("Gamemode : {0}", type); this.LoadedGameMode[index] = GameMode.FromType(type); } else { Logger.DefaultLogger.WriteLine("Gamemode : {0} (cached)", type); } this.CurrentGamemode = this.LoadedGameMode[index]; this.CurrentGamemode.OnSwitch(); GL.ClearColor(this.CurrentGamemode.BackgroundColor); }
void OnChange() { GameModeType _mode = (GameModeType)Enum.Parse(typeof(GameModeType), popupList.value); if (Enum.IsDefined(typeof(GameModeType), _mode)) { Global.GameSetting().modeSelected = Global.GameSetting().modes[_mode]; } var _setting = modePrfs.Find((_entity) => _entity.mode == _mode); if (_setting != null) { if (m_Mode != null) { GameObject.Destroy(m_Mode); } m_Mode = GameObject.Instantiate(_setting.prefab) as GameObject; m_Mode.transform.parent = modeParent.transform; m_Mode.transform.localPosition = Vector3.zero; m_Mode.transform.localScale = Vector3.one; } else { Debug.LogError("The setting " + _mode.ToString() + " prefab is missing."); } }
void IGameModeHandler.OnGameModeStart(GameModeType gameMode) { if (gameMode == GameModeType.GlobalMap) { ModGlobalMapLocation.AddGlobalMapLocations(); } }
public static GameMode FromType(GameModeType type) { GameMode gameMode = GetGamemode(type); gameMode.Type = type; return(gameMode); }
public static GameMode CreateGameMode(GameModeType type) { GameMode gameMode = null; switch (type) { case GameModeType.Demo: gameMode = new GameModeDemo(); break; case GameModeType.LTE: gameMode = new GameModeLTE(); break; case GameModeType.Test: gameMode = new GameModeTest(); break; default: gameMode = new GameModeTest(); break; } gameMode.Type = type; return(gameMode); }
/// <summary> /// Можно ли продолжить игру в выбранном игровом режиме /// </summary> /// <param name="gameModeType">Выбранный игровой режим</param> /// <param name="isCanContinueHandler">callback возможности продолжения</param> private void IsCanContinue(GameModeType gameModeType, Action <bool> isCanContinueHandler) { if (Mediator.Instance.GameConfig.IsDebug) { isCanContinueHandler?.Invoke(true); return; } if (gameModeType != GameModeType.Throw_Online) // Если игра не онлайн, то разрешаем продолжить без проверки подключения к интернету { isCanContinueHandler?.Invoke(true); return; } //Иначе проверяем подключение Mediator.Instance.PopupsManager.CreatePopup <CheckInternetPopup>().CheckConnectionState((state) => { if (state) // Если подключение к интернету есть, открываем popup выбора ставки на которую готов играть пользователь { // Прокидываем callback, который вернет состояние установленной ставки Mediator.Instance.PopupsManager.CreatePopup <StepRatePopup>().Init(isSettedRate => { //Если ставка установлена, открываем popup поиска игрока if (isSettedRate) { Mediator.Instance.PopupsManager.CreatePopup <PlayerSearchPopup>().Init(() => isCanContinueHandler?.Invoke(true)); } }); } else { isCanContinueHandler?.Invoke(false); } }); }
private void ActivateGameMode(GameModeType type) { if (_currentGameMode != null) { if (_currentGameMode.Type != type) { var gameModeToDeactivate = _currentGameMode; DeactivateGameMode(gameModeToDeactivate); _currentGameMode = GetGameMode(type); } } else { _currentGameMode = GetGameMode(type); } _currentGameMode.Initialize(_ballSettingsStorage.GetNextBallSettings()); var controllableObjects = _currentGameMode.GetControllableObjects(); if (controllableObjects == null) { this.WaitUntil(() => (controllableObjects = _currentGameMode.GetControllableObjects()) != null, () => { _playerInputHandler.Initialize(controllableObjects); }); } else { _playerInputHandler.Initialize(controllableObjects); } }
void SetSummaryParameters(DatabaseCommand command, MapType map, GameModeType gameMode, Summoner summoner, PlayerStatSummary summary, bool forceNullRating) { if (forceNullRating) { command.Set("current_rating", DbType.Int32, null); command.Set("top_rating", DbType.Int32, null); } else { //Zero rating means that the Elo is below 1200 and is not revealed by the server if (summary.rating == 0) { command.Set("current_rating", DbType.Int32, null); } else { command.Set("current_rating", summary.rating); } command.Set("top_rating", summary.maxRating); } command.Set("summoner_id", summoner.Id); command.Set("map", (int)map); command.Set("game_mode", (int)gameMode); command.Set("wins", summary.wins); command.Set("losses", summary.losses); command.Set("leaves", summary.leaves); }
/// <summary> /// Sets up the game to be played in the map specified /// </summary> /// <param name="mode">Mode.</param> /// <param name="map">Map.</param> public void playGame(GameModeType mode, MapType map){ Debug.Log ("about to load scene"); switch(map){ case MapType.Prototype: SceneManager.LoadScene ("PrototypeMap", LoadSceneMode.Single); break; } Debug.Log ("Scene loaded"); GameObject container = new GameObject ("_SCRIPTS_"); Object.DontDestroyOnLoad (container); switch(mode){ case GameModeType.ProtectTheQueen: currentModeBeingPlayed = container.AddComponent<ProtectTheQueen.ProtectTheQueenModeBehavior> (); break; } }
public static void GameStateChange(Packet packet) { GameModeType gameModeType = (GameModeType)packet.ReadInt(); string lobbyName = packet.ReadString(); GameManager.instance.gameModeType = gameModeType; GameManager.instance.LobbyChange(lobbyName); }
public IUserStatistics GetStatistics(GameModeType gameMode) { if (statistics.TryGetValue(gameMode, out UserStatistics value)) { return(value); } return(PrimaryStats); }
// Token: 0x06001902 RID: 6402 RVA: 0x00010ADF File Offset: 0x0000ECDF private IList <SpawnPoint> GetSpawnPointList(GameModeType gameMode, TeamID team) { if (gameMode == GameModeType.None) { return(this._spawnPointsDictionary[GameModeType.DeathMatch][TeamID.NONE]); } return(this._spawnPointsDictionary[gameMode][team]); }
public static void RotateUnit(UnitEntityData unit, Vector3 position) { GameModeType currentMode = Game.Instance.CurrentMode; if (currentMode == GameModeType.Default || currentMode == GameModeType.Pause) { unit.LookAt(position); unit.ForceLookAt(position); } }
public Message PrepareRegisterBotMessage(string name, GameModeType gamemode) { Message m = new Message(); m.AddParameter(new StringParameter("type", "register")); m.AddParameter(new StringParameter("clientType", "bot")); m.AddParameter(new StringParameter("name", name)); m.AddParameter(new StringParameter("game", String.Join(" ", Regex.Split(gamemode.ToString(), @"(?<!^)(?=[A-Z])")))); return(m); }
public static void ChangeParty() { GameModeType currentMode = Game.Instance.CurrentMode; if (currentMode == GameModeType.Default || currentMode == GameModeType.Pause) { UnityModManager.UI.Instance.ToggleWindow(); GlobalMapView.Instance.ChangePartyOnMap(); } }
// Token: 0x060018FF RID: 6399 RVA: 0x000861F0 File Offset: 0x000843F0 private void Clear() { foreach (object obj in Enum.GetValues(typeof(GameModeType))) { GameModeType key = (GameModeType)((int)obj); this._spawnPointsDictionary[key][TeamID.NONE].Clear(); this._spawnPointsDictionary[key][TeamID.BLUE].Clear(); this._spawnPointsDictionary[key][TeamID.RED].Clear(); } }
public override void SetGameMode(GameModeType type) { foreach (GameMode mode in _GameModes) { if (mode._Type == type) { pCurrentGameMode = mode; } } }
// Token: 0x06000C23 RID: 3107 RVA: 0x00008B1E File Offset: 0x00006D1E public MapUsageView(DateTime playDate, int mapId, GameModeType gameModeId, int timeLimit, int playerLimit, int playersTotal, int playersCompleted) { this.PlayDate = playDate; this.MapId = mapId; this.GameModeId = gameModeId; this.TimeLimit = timeLimit; this.PlayerLimit = playerLimit; this.PlayersTotal = playersTotal; this.PlayersCompleted = playersCompleted; }
/// <summary> /// Creates a new instance of game the mode specified in the parameter. /// </summary> /// <param name="modeType">The game mode type.</param> /// <exception cref="GameModeNotFoundException">Thrown when the factory cannot create game mode with the specified type (enum value not supported).</exception> /// <returns>The mode instance.</returns> public GameModeBase Create(GameModeType modeType) { switch (modeType) { case GameModeType.Editor: return(new EditorMode(_consoleManager, _commandsManager)); case GameModeType.AIvsAI: return(new AIvsAIMode(_consoleManager, _commandsManager)); } throw new GameModeNotFoundException(); }
public async Task <object> Find(int id, GameModeType type) { switch (type) { case GameModeType.JackpotCsgo: return(await _repoServiceFactory.JackpotSettingRepo.Find(id)); default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
public static void SpawnFriendlyUnit(Vector3 position, string guid) { GameModeType currentMode = Game.Instance.CurrentMode; if (currentMode == GameModeType.Default || currentMode == GameModeType.Pause) { UnitEntityData player = Game.Instance.Player.MainCharacter.Value; UnitEntityData unit = Game.Instance.EntityCreator.SpawnUnit((BlueprintUnit)Utilities.GetBlueprintByGuid <BlueprintUnit>(guid), position, Quaternion.LookRotation(player.OrientationDirection), Game.Instance.CurrentScene.MainState); unit.Descriptor.SwitchFactions(Game.Instance.BlueprintRoot.PlayerFaction, true); } }
protected override void PerformExtendedReading(DatabaseReader reader) { InternalGameId = reader.Integer(); Map = (MapType)reader.Integer(); GameMode = (GameModeType)reader.Integer(); GameTime = reader.Time(); reader.SanityCheck(GetExtendedFields()); }
void EnableRTSCamera() { //temporary GameMode = GameModeType.RTS; RPGCamera.GetComponent<Camera>().enabled = false; RTSCamera.GetComponent<Camera>().enabled = true; RTSCamera.tag = "MainCamera"; RPGCamera.tag = "Untagged"; }
protected override void PerformExtendedReading(Reader reader) { InternalGameId = reader.Integer(); Map = reader.String().ToMapType(); GameMode = reader.String().ToGameModeType(); GameTime = reader.Time(); reader.SanityCheck(GetExtendedFields()); }
public static void TeleportUnit(UnitEntityData unit, Vector3 position) { GameModeType currentMode = Game.Instance.CurrentMode; if (currentMode == GameModeType.Default || currentMode == GameModeType.Pause) { unit.Commands.InterruptMove(); unit.Commands.InterruptMove(); unit.Position = position; } }
public SummonerRating(DatabaseReader reader) { Map = reader.Map(); GameMode = reader.GameMode(); Wins = reader.Integer(); Losses = reader.Integer(); Leaves = reader.Integer(); CurrentRating = reader.MaybeInteger(); TopRating = reader.MaybeInteger(); reader.SanityCheck(Fields); }
void SetSummaryParameters(DatabaseCommand command, MapType map, GameModeType gameMode, Summoner summoner, PlayerStatSummary summary, bool forceNullRating) { if (forceNullRating) { command.Set("current_rating", DbType.Int32, DBNull.Value); command.Set("top_rating", DbType.Int32, DBNull.Value); } else { //Zero rating means that the Elo is below 1200 and is not revealed by the server if (summary.rating == 0) command.Set("current_rating", DbType.Int32, DBNull.Value); else command.Set("current_rating", summary.rating); command.Set("top_rating", summary.maxRating); } command.Set("summoner_id", summoner.Id); command.Set("map", (int)map); command.Set("game_mode", (int)gameMode); command.Set("wins", summary.wins); command.Set("losses", summary.losses); command.Set("leaves", summary.leaves); int k = 0, d = 0, a = 0; var kills = summary.aggregatedStats.stats.FirstOrDefault(e => e.statType == "TOTAL_CHAMPION_KILLS"); if (kills != null) { k = kills.value; } var deaths = summary.aggregatedStats.stats.FirstOrDefault(e => e.statType == "TOTAL_DEATHS_PER_SESSION"); if (deaths != null) { d = deaths.value; } var assists = summary.aggregatedStats.stats.FirstOrDefault(e => e.statType == "TOTAL_ASSISTS"); if (assists != null) { a = assists.value; } command.Set("kills", k); command.Set("deaths", d); command.Set("assists", a); }
public static GameModeDef CreateDef(GameModeType _mode) { switch ( _mode) { case GameModeType.NULL: Debug.LogWarning("Trying to instantiate GameMode NULL."); return new GameModeDef(); case GameModeType.TEST: return new GameModeTestDef(); case GameModeType.DEATH_MATCH: return new GameModeDeathMatchDef(); default: Debug.LogWarning("Undefined mode " + _mode.ToString() + "."); return new GameModeDef(); } }
public SummonerRating(DbDataReader dataReader) { Reader reader = new Reader(dataReader); Map = reader.String().ToMapType(); GameMode = reader.String().ToGameModeType(); Wins = reader.Integer(); Losses = reader.Integer(); Leaves = reader.Integer(); CurrentRating = reader.MaybeInteger(); TopRating = reader.MaybeInteger(); reader.SanityCheck(Fields); }
public Game(DatabaseReader reader) { Id = reader.Integer(); GameId = reader.Integer(); Map = reader.Map(); GameMode = reader.GameMode(); GameTime = reader.Time(); BlueTeamWon = reader.Boolean(); BlueTeamId = reader.Integer(); PurpleTeamId = reader.Integer(); reader.SanityCheck(Fields); }
public void SetMode(GameModeType _mode) { if (m_ModeHUD != null) { Destroy(m_ModeHUD); m_ModeHUD = null; } var _prefab = m_Def.modeHUDs.Find(_modeHUD => _modeHUD.mode == _mode).prefab; if (_prefab == null) { Debug.LogWarning("HUD for mode " + _mode + " not found."); return; } m_ModeHUD = Instantiate(_prefab, Vector3.zero, Quaternion.identity) as GameObject; TransformHelper.SetParentLocal(m_ModeHUD, m_Def.hudRoot.gameObject); }
protected override void PerformExtendedReading(DatabaseReader reader) { InternalGameId = reader.Integer(); Map = reader.Map(); GameMode = reader.GameMode(); GameTime = reader.Integer(); int blueTeamId = reader.Integer(); int purpleTeamId = reader.Integer(); BlueTeamWon = reader.Boolean(); IsBlueTeam = blueTeamId == TeamId; Won = IsBlueTeam == BlueTeamWon; //reader.SanityCheck(GetExtendedFields()); }
public Game(NpgsqlDataReader dataReader) { Reader reader = new Reader(dataReader); Id = reader.Integer(); GameId = reader.Integer(); Map = reader.String().ToMapType(); GameMode = reader.String().ToGameModeType(); GameTime = reader.Time(); Team1Won = reader.Boolean(); Team1Id = reader.Integer(); Team2Id = reader.Integer(); reader.SanityCheck(Fields); }
public void Set(GameModeType gameMode) { Set((int)gameMode); }
public void Set(string name, GameModeType gameMode) { Set(name, (int)gameMode); }
List<AggregatedChampionStatistics> LoadAggregatedChampionStatisticsWithSP(Summoner summoner, MapType map, GameModeType gameMode, DbConnection connection) { const string query = "exec sp_getAggregatedChampionStatistics :summoner_id, :map, :game_mode"; using (var select = Command(query, connection)) { select.Set("summoner_id", summoner.Id); select.Set("map", map); select.Set("game_mode", gameMode); using (var reader = select.ExecuteReader()) { var output = new List<AggregatedChampionStatistics>(); while (reader.Read()) { var statistics = new AggregatedChampionStatistics(reader); output.Add(statistics); } return output; } } }
public void SetGameMode(GameModeType mode) { gameMode = mode; }
List<AggregatedChampionStatistics> LoadAggregatedChampionStatisticsWithCTE(Summoner summoner, MapType map, GameModeType gameMode, DbConnection connection) { const string query = "with source as " + "(select game.map, game.game_mode, game.blue_team_id, game.purple_team_id, game.blue_team_won, player.team_id, player.summoner_id, player.champion_id, player.kills, player.deaths, player.assists, player.gold, player.minion_kills from game, player where player.summoner_id = :summoner_id and game.map = :map and game.game_mode = :game_mode and (game.blue_team_id = player.team_id or game.purple_team_id = player.team_id)) " + "select statistics.champion_id, coalesce(champion_wins.wins, 0) as wins, coalesce(champion_losses.losses, 0) as losses, statistics.kills, statistics.deaths, statistics.assists, statistics.gold, statistics.minion_kills from " + "(select source.champion_id, sum(source.kills) as kills, sum(source.deaths) as deaths, sum(source.assists) as assists, sum(source.gold) as gold, sum(source.minion_kills) as minion_kills from source group by source.champion_id) " + "as statistics " + "left outer join " + "(select champion_id, count(*) as wins from source where (blue_team_won = 1 and blue_team_id = team_id) or (blue_team_won = 0 and purple_team_id = team_id) group by champion_id) " + "as champion_wins " + "on statistics.champion_id = champion_wins.champion_id " + "left outer join " + "(select champion_id, count(*) as losses from source where (blue_team_won = 0 and blue_team_id = team_id) or (blue_team_won = 1 and purple_team_id = team_id) group by champion_id) " + "as champion_losses " + "on statistics.champion_id = champion_losses.champion_id"; using (var select = Command(query, connection)) { select.Set("map", map); select.Set("game_mode", gameMode); select.Set("summoner_id", summoner.Id); using (var reader = select.ExecuteReader()) { List<AggregatedChampionStatistics> output = new List<AggregatedChampionStatistics>(); while (reader.Read()) { AggregatedChampionStatistics statistics = new AggregatedChampionStatistics(reader); output.Add(statistics); } return output; } } }
List<AggregatedChampionStatistics> LoadAggregatedChampionStatistics(Summoner summoner, MapType map, GameModeType gameMode, DbConnection connection) { if (DatabaseProvider.Type == DatabaseType.PostgreSQL) return LoadAggregatedChampionStatisticsWithCTE(summoner, map, gameMode, connection); else return LoadAggregatedChampionStatisticsWithTemporaryView(summoner, map, gameMode, connection); }
public override void SetGameMode(GameModeType type) { foreach (GameMode mode in _GameModes) if (mode._Type == type) pCurrentGameMode = mode; }
List<AggregatedChampionStatistics> LoadAggregatedChampionStatistics(Summoner summoner, MapType map, GameModeType gameMode, DbConnection connection) { string viewName = GetViewName(); try { //Create a temporary view with a dynamically generated name to emulate the former CTE string createViewQuery = "create temporary view {0} as select game.map, game.game_mode, game.blue_team_id, game.purple_team_id, game.blue_team_won, player.team_id, player.summoner_id, player.champion_id, player.kills, player.deaths, player.assists, player.gold, player.minion_kills from game, player where game.blue_team_id = player.team_id or game.purple_team_id = player.team_id"; using (var createView = Command(createViewQuery, connection, viewName)) { createView.Execute(); string commonWhereClause = string.Format("{0}.summoner_id = :summoner_id and {0}.map = :map and {0}.game_mode = :game_mode", viewName); string selectQuery = "select statistics.champion_id, coalesce(champion_wins.wins, 0) as wins, coalesce(champion_losses.losses, 0) as losses, statistics.kills, statistics.deaths, statistics.assists, statistics.gold, statistics.minion_kills from " + "(select {0}.champion_id, sum({0}.kills) as kills, sum({0}.deaths) as deaths, sum({0}.assists) as assists, sum({0}.gold) as gold, sum({0}.minion_kills) as minion_kills from {0} where {1} group by {0}.champion_id) " + "as statistics " + "left outer join " + "(select champion_id, count(*) as wins from {0} where {1} and ((blue_team_won = 1 and blue_team_id = team_id) or (blue_team_won = 0 and purple_team_id = team_id)) group by champion_id) " + "as champion_wins " + "on statistics.champion_id = champion_wins.champion_id " + "left outer join " + "(select champion_id, count(*) as losses from {0} where {1} and ((blue_team_won = 0 and blue_team_id = team_id) or (blue_team_won = 1 and purple_team_id = team_id)) group by champion_id) " + "as champion_losses " + "on statistics.champion_id = champion_losses.champion_id"; using (var select = Command(selectQuery, connection, viewName, commonWhereClause)) { select.Set("map", map); select.Set("game_mode", gameMode); select.Set("summoner_id", summoner.Id); using (var reader = select.ExecuteReader()) { List<AggregatedChampionStatistics> output = new List<AggregatedChampionStatistics>(); while (reader.Read()) { AggregatedChampionStatistics statistics = new AggregatedChampionStatistics(reader); output.Add(statistics); } using (var dropView = Command("drop view {0}", connection, viewName)) dropView.Execute(); return output; } } } } finally { ReleaseViewName(viewName); } }
public virtual void Init(GameModeDef _def) { type = _def.type; overrideMode = _def.overrideMode; return; }
public GameLogic(GameModeType gameMode = GameModeType.Common) { GameMode = gameMode; InitializeCharacters(); GeneratePathPoints(); }
List<AggregatedChampionStatistics> LoadAggregatedChampionStatistics(Summoner summoner, MapType map, GameModeType gameMode, DbConnection database) { const string query = "with source as " + "(select team_player.champion_id, team_player.won, team_player.kills, team_player.deaths, team_player.assists, team_player.gold, team_player.minion_kills from game_result, team_player where game_result.result_map = cast(:result_map as map_type) and game_result.game_mode = cast(:game_mode as game_mode_type) and (game_result.team1_id = team_player.team_id or game_result.team2_id = team_player.team_id) and team_player.summoner_id = :summoner_id) " + "select statistics.champion_id, coalesce(champion_wins.wins, 0) as wins, coalesce(champion_losses.losses, 0) as losses, statistics.kills, statistics.deaths, statistics.assists, statistics.gold, statistics.minion_kills from " + "(select source.champion_id, sum(source.kills) as kills, sum(source.deaths) as deaths, sum(source.assists) as assists, sum(source.gold) as gold, sum(source.minion_kills) as minion_kills from source group by source.champion_id) " + "as statistics " + "left outer join " + "(select champion_id, count(*) as wins from source where won = true group by champion_id) " + "as champion_wins " + "on statistics.champion_id = champion_wins.champion_id " + "left outer join " + "(select champion_id, count(*) as losses from source where won = false group by champion_id) " + "as champion_losses " + "on statistics.champion_id = champion_losses.champion_id;", myquery = @"SELECT statistics.champion_id, coalesce(champion_wins.wins, 0) as wins, coalesce(champion_losses.losses, 0) as losses, statistics.kills, statistics.deaths, statistics.assists, statistics.gold, statistics.minion_kills FROM ( SELECT source.champion_id, sum(source.kills) as kills, sum(source.deaths) as deaths, sum(source.assists) as assists, sum(source.gold) as gold, sum(source.minion_kills) as minion_kills FROM source WHERE source.result_map = ?result_map AND source.game_mode = ?game_mode AND source.summoner_id = ?summoner_id GROUP BY source.champion_id ) AS statistics LEFT OUTER JOIN ( SELECT champion_id, count(*) as wins FROM source WHERE source.won = true AND source.result_map = ?result_map AND source.game_mode = ?game_mode AND source.summoner_id = ?summoner_id GROUP BY champion_id ) champion_wins ON statistics.champion_id = champion_wins.champion_id LEFT OUTER JOIN ( SELECT champion_id, count(*) as losses FROM source WHERE source.won = false AND source.result_map = ?result_map AND source.game_mode = ?game_mode AND source.summoner_id = ?summoner_id GROUP BY champion_id ) champion_losses ON statistics.champion_id = champion_losses.champion_id;"; SQLCommand select; if (database is MySql.Data.MySqlClient.MySqlConnection) select = GetCommand(myquery, database); else select = GetCommand(query, database); select.SetEnum("result_map", map.ToEnumString()); select.SetEnum("game_mode", gameMode.ToEnumString()); select.Set("summoner_id", summoner.Id); using (DbDataReader reader = select.ExecuteReader()) { List<AggregatedChampionStatistics> output = new List<AggregatedChampionStatistics>(); while (reader.Read()) { AggregatedChampionStatistics statistics = new AggregatedChampionStatistics(reader); statistics.ChampionName = GetChampionName(statistics.ChampionId); output.Add(statistics); } output.Sort(); return output; } }