E_MPGameType GetGameWithXpBonus() { PlayerPersistantInfo ppi = PPIManager.Instance.GetLocalPPI(); if (ppi == null) { return(E_MPGameType.None); } int rank = ppi.Rank; for (E_MPGameType gameType = E_MPGameType.DeathMatch; gameType < E_MPGameType.None; ++gameType) { GameTypeInfo gameInfo = GameInfoSettings.GetGameInfo(gameType); if (gameInfo == null) { continue; } if (gameInfo.MinimalDesiredRankToPlay > rank) { continue; } if (ppi.IsFirstGameToday(gameType) == false) { continue; } return(gameType); } return(E_MPGameType.None); }
public static void Load(string json) { JsonData data; try { data = JsonMapper.ToObject(json); } catch { data = new JsonData(); } for (E_MPGameType gameType = E_MPGameType.DeathMatch; gameType < E_MPGameType.None; ++gameType) { string gameTypeName = GameInfo.GetGameTypeName(gameType); GameTypeInfo gameInfo = null; if (data.IsObject == true && data.HasValue(gameTypeName) == true) { JsonData gameData = data[gameTypeName]; switch (gameType) { case E_MPGameType.DeathMatch: gameInfo = JsonMapper.ToObject <DeathMatchInfo>(gameData.ToJson()); break; case E_MPGameType.ZoneControl: gameInfo = JsonMapper.ToObject <ZoneControlInfo>(gameData.ToJson()); break; default: throw new System.ArgumentOutOfRangeException("GameInfoSettings.Load() - unknown GameType '" + gameType + "'"); } } else { switch (gameType) { case E_MPGameType.DeathMatch: gameInfo = new DeathMatchInfo(); break; case E_MPGameType.ZoneControl: gameInfo = new ZoneControlInfo(); break; default: throw new System.ArgumentOutOfRangeException("GameInfoSettings.Load() - unknown GameType '" + gameType + "'"); } } #if IGNORE_DESIRED_RANK_TO_PLAY gameInfo.MinimalDesiredRankToPlay = 1; #endif m_GameInfos[(int)gameType] = gameInfo; } }
public void AddGameType(GameTypeInfo info) { var manager = new LotteryGameManager(); manager.AddLotteryGameType(new LotteryGameType { DisplayName = info.DisplayName, EnableStatus = EnableStatus.Enable, Game = new LotteryGameManager().LoadGame(info.Game.GameCode), GameType = info.GameType, GameTypeId = string.Format("{0}|{1}", info.Game.GameCode, info.GameType), }); }