public BaseGame(int id, int roomId, Map map, eRoomType roomType, eGameType gameType, int timeType) : base(id, roomType, gameType, timeType) { m_roomId = roomId; m_players = new Dictionary<int, Player>(); m_turnQueue = new List<TurnedLiving>(); m_livings = new List<Living>(); m_random = new Random(); m_map = map; m_actions = new ArrayList(); PhysicalId = 0; BossWarField = ""; m_tempBox = new List<Box>(); m_tempPoints = new List<Point>(); if (roomType == eRoomType.Dungeon) { Cards = new int[21]; } else { Cards = new int[8]; } m_gameState = eGameState.Inited; }
public void OnGameOverLog(int _roomId, eRoomType _roomType, eGameType _fightType, int _changeTeam, DateTime _playBegin, DateTime _playEnd, int _userCount, int _mapId, string _teamA, string _teamB, string _playResult, int _winTeam, string BossWar) { if (GameOverLog != null) { GameOverLog(_roomId, _roomType, _fightType, _changeTeam, _playBegin, _playEnd, _userCount, _mapId, _teamA, _teamB, _playResult, _winTeam, BossWarField); } }
public GameLogic(byte i_BoardSize, eGameType i_GameType, string i_Player1Name, string i_Player2Name) { this.initializeBoard(i_BoardSize); this.initializePlayers(i_GameType, i_Player1Name, i_Player2Name); this.r_MaxNumOfMoves = (byte)(this.Board.BoardSize * this.Board.BoardSize); }
//function which start the game public void StartGame(string vSelectedGameType) { //show pause button vPauseButton.SetActive(true); //change the game type before we start vGameType = (eGameType)System.Enum.Parse(typeof(eGameType), vSelectedGameType); //get the game type we are on for further usage foreach (cGameType gametype in vGameConfig) { if (vGameType == gametype.vGameType) { vCurGameType = gametype; } } //enable the player to shoot vPlayer.SetActive(true); //hide menu vMenuObject.SetActive(false); if (vCurGameType.UseRandomBallColor) { ChangeChoiceColorPanel(); } //let's play! GameStarted = true; }
private static void StartMatchGame(ProxyRoom red, ProxyRoom blue) { try { int mapId = MapMgr.GetMapIndex((red.AvgLevel + blue.AvgLevel) / 2, ProxyRoomMgr.m_serverId); eGameType gameType = eGameType.Free; if (red.GameType == blue.GameType) { gameType = red.GameType; } else { if ((red.GameType == eGameType.ALL && blue.GameType == eGameType.Guild) || (blue.GameType == eGameType.ALL && red.GameType == eGameType.Guild)) { gameType = eGameType.Guild; } } BaseGame game = GameMgr.StartBattleGame(red.GetPlayers(), red, blue.GetPlayers(), blue, mapId, eRoomType.Match, gameType, 3); if (game != null) { blue.StartGame(game); red.StartGame(game); } } catch (Exception e) { ProxyRoomMgr.log.Error("Start Match Game Error:", e); } }
public Settings(Player i_Player1, Player i_Player2, int i_BoardSize, eGameType i_GameType) { r_Player1 = i_Player1; r_Player2 = i_Player2; r_BoardSize = i_BoardSize; r_GameType = i_GameType; }
public void UpdateRoomGameType() { switch (RoomType) { case eRoomType.Boss: GameType = eGameType.Boss; break; case eRoomType.Exploration: GameType = eGameType.Exploration; break; case eRoomType.Treasure: GameType = eGameType.Treasure; break; case eRoomType.Freedom: GameType = eGameType.Free; break; case eRoomType.Match: GameType = eGameType.Free; break; default: GameType = eGameType.ALL; break; } }
public void UpdateGameStyle() { if (this.m_host != null && this.RoomType == eRoomType.Match) { if (this.IsAllSameGuild()) { if (this.OldGameType == eGameType.ALL) { this.GameStyle = 1; this.GameType = eGameType.Guild; GSPacketIn pkg = this.m_host.Out.SendRoomType(this.m_host, this); this.SendToAll(pkg); } else { this.OldGameType = eGameType.ALL; } } else { this.GameStyle = 0; this.GameType = eGameType.Free; this.OldGameType = eGameType.ALL; GSPacketIn pkg = this.m_host.Out.SendRoomType(this.m_host, this); this.SendToAll(pkg); } } }
private static eGameType getGameType() { eGameType gameType = 0; bool validGameTypeFlag = false; System.Console.WriteLine(@" Please enter the desired game type: '1' for HumanVsHuman '2' for HumanVsComputer"); while (!validGameTypeFlag) { if (System.Enum.TryParse(System.Console.ReadLine(), out gameType) && System.Enum.IsDefined(typeof(eGameType), gameType)) { validGameTypeFlag = true; } else { System.Console.WriteLine("Invalid game type. Please try again."); } } if (gameType == eGameType.HumanVsHuman) { s_SecondPlayerName = getPlayerName(); } else { s_SecondPlayerName = "Computer"; } return(gameType); }
private static int GetOffer(int state, eGameType gameType) { switch (gameType) { case eGameType.Free: switch (state) { case 0: return(1); case 1: return(0); case 2: return(3); } break; case eGameType.Guild: switch (state) { case 0: return(5); case 1: return(0); case 2: return(10); } break; } return(0); }
public void StartGame(AbstractGame game) { if (this.m_game != null) { List <GamePlayer> list = this.GetPlayers(); foreach (GamePlayer player in list) { this.m_game.RemovePlayer(player, false); } this.m_game_GameStopped(this.m_game); } this.OldGameType = game.GameType; this.m_game = game; if (this.m_host != null && this.RoomType == eRoomType.Match) { if (this.IsAllSameGuild()) { this.GameType = this.OldGameType; GSPacketIn pkg = this.m_host.Out.SendRoomType(this.m_host, this); this.SendToAll(pkg); } } this.IsPlaying = true; this.m_game.GameStopped += new GameEventHandle(this.m_game_GameStopped); if (this.PickUpNPC) { this.m_game.RoomRest += new GameEventHandle(this.m_game_RoomRest); } }
public BaseGame(int id, int roomId, Map map, eRoomType roomType, eGameType gameType, int timeType) : base(id, roomType, gameType, timeType) { m_roomId = roomId; m_players = new Dictionary <int, Player>(); m_turnQueue = new List <TurnedLiving>(); m_livings = new List <Living>(); m_random = new Random(); m_map = map; m_actions = new ArrayList(); PhysicalId = 0; BossWarField = ""; m_tempBox = new List <Box>(); m_tempPoints = new List <Point>(); if (roomType == eRoomType.Treasure || roomType == eRoomType.Boss) { Cards = new int[21]; } else { Cards = new int[8]; } m_gameState = eGameState.Inited; }
private void HandlePlayerConsortiaFight(GSPacketIn pkg) { GamePlayer playerById = WorldMgr.GetPlayerById(pkg.ClientID); Dictionary <int, Player> dictionary = new Dictionary <int, Player>(); int consortiaWin = pkg.ReadInt(); int consortiaLose = pkg.ReadInt(); int num = pkg.ReadInt(); for (int i = 0; i < num; i++) { GamePlayer playerById2 = WorldMgr.GetPlayerById(pkg.ReadInt()); if (playerById2 != null) { Player value = new Player(playerById2, 0, null, 0, playerById2.PlayerCharacter.hp); dictionary.Add(i, value); } } eRoomType roomType = (eRoomType)pkg.ReadByte(); eGameType gameClass = (eGameType)pkg.ReadByte(); int totalKillHealth = pkg.ReadInt(); if (playerById != null) { int num2 = playerById.ConsortiaFight(consortiaWin, consortiaLose, dictionary, roomType, gameClass, totalKillHealth, num); } }
public static BaseGame StartGame(List<GamePlayer> red, List<GamePlayer> blue, int mapIndex,eRoomType roomType, eTeamType teamType, eGameType gameType, int timeType) { try { int index = MapMgr.GetMapIndex(mapIndex,(byte)roomType); Map map = MapMgr.CloneMap(index); if (map != null) { BaseGame game = new BaseGame(red, blue, map,roomType,teamType,gameType,timeType); lock (m_games) { m_games.Add(game); } game.Prepare(); return game; } else { return null; } } catch (Exception e) { log.Error("Create game error:", e); return null; } }
private void initializePlayers() { getPlayerName(); string msg = string.Format( @"Hey {0} please choose you preference, Press '1' for playing against friend Press '2' for playing against computer. Notice: Any time, for exit the game press 'Q'", m_FirstPlayer.Name); Console.WriteLine(msg); string selectionStr = Console.ReadLine(); switch (int.Parse(selectionStr)) { case (int)eGameType.againstFriend: m_GameType = eGameType.againstFriend; getPlayerName(); break; case (int)eGameType.againstComputer: m_GameType = eGameType.againstComputer; m_ComputerPlayer = new ComputerPlayer("computer"); break; } }
private void HandlePlayerConsortiaFight(GSPacketIn pkg) { GamePlayer player = WorldMgr.GetPlayerById(pkg.ClientID); Dictionary <int, Player> players = new Dictionary <int, Player>(); int consortiaWin = pkg.ReadInt(); int consortiaLose = pkg.ReadInt(); int count = pkg.ReadInt(); int offer = 0; for (int i = 0; i < count; i++) { GamePlayer Temp = WorldMgr.GetPlayerById(pkg.ReadInt()); if (Temp != null) { Player Tempplayer = new Player(Temp, 0, null, 0); players.Add(i, Tempplayer); } } eRoomType roomtype = (eRoomType)pkg.ReadByte(); eGameType gametype = (eGameType)pkg.ReadByte(); int totalKillHealth = pkg.ReadInt(); if (player != null) { offer = player.ConsortiaFight(consortiaWin, consortiaLose, players, roomtype, gametype, totalKillHealth, count); } if (offer != 0) { } }
public MemoryGame(string i_FirstUserName, string i_SecondUserName, bool i_IsFirstUserHuman, bool i_IsSecondUserHuman, MemoryGame.eGameType i_GameType, int i_Lenght, int i_Width) { m_GameType = i_GameType; m_GameTurn = eGameTurn.FirstUser; m_Board = new Board(i_Lenght, i_Width); m_UserPlayer1 = new User(i_FirstUserName, i_IsFirstUserHuman, 0); m_UserPlayer2 = new User(i_SecondUserName, i_IsSecondUserHuman, m_Board.MaxPairCards / 2); }
public GameLogic(Player[] i_Players, byte i_BoardSize, eGameType i_GameType) { m_Players = i_Players; m_BoardSize = i_BoardSize; m_GameType = i_GameType; m_GameBoard = new Board(m_BoardSize); InitializeTokens(); }
public void UpdateRoomGameType() { eRoomType roomType = this.RoomType; switch (roomType) { case eRoomType.Match: case eRoomType.Freedom: this.GameType = eGameType.Free; return; case eRoomType.Exploration: case (eRoomType)3: goto IL_77; case eRoomType.Dungeon: break; case eRoomType.FightLib: this.GameType = eGameType.FightLib; return; default: switch (roomType) { case eRoomType.Freshman: this.GameType = eGameType.Freshman; return; case eRoomType.AcademyDungeon: break; default: switch (roomType) { case eRoomType.Lanbyrinth: break; case eRoomType.Encounter: goto IL_77; case eRoomType.ConsortiaBoss: this.GameType = eGameType.ConsortiaBoss; return; default: goto IL_77; } break; } break; } this.GameType = eGameType.Dungeon; return; IL_77: this.GameType = eGameType.ALL; }
public static int ConsortiaFight(int consortiaWin, int consortiaLose, Dictionary<int, Player> players, eRoomType roomType, eGameType gameClass, int totalKillHealth, int playercount) { if (roomType != eRoomType.Match) return 0; int playerCount = playercount / 2; int riches = 0; int state = 2; int rate = 1; int value = 3; if (gameClass == eGameType.Guild) { value = 10; rate = (int)RateMgr.GetRate(eRateType.Offer_Rate); } float richesRate = RateMgr.GetRate(eRateType.Riches_Rate); using (ConsortiaBussiness db = new ConsortiaBussiness()) { if (gameClass == eGameType.Free) { playerCount = 0; } else { db.ConsortiaFight(consortiaWin, consortiaLose, playerCount, out riches, state, totalKillHealth, richesRate); } //(对方公会等级-3)*50*对方玩家人数(对方玩家人数是指进入战斗时的人数,中途退出或者掉线的玩家不改变这个数值) //玩家增加掠夺财富 foreach (KeyValuePair<int, Player> p in players) { //if (p.Value.State == TankGameState.LOSE) // continue; if (p.Value == null) continue; if (p.Value.PlayerDetail.PlayerCharacter.ConsortiaID == consortiaWin) { p.Value.PlayerDetail.AddOffer((playerCount + value) * rate); p.Value.PlayerDetail.PlayerCharacter.RichesRob += riches; } else if (p.Value.PlayerDetail.PlayerCharacter.ConsortiaID == consortiaLose) { p.Value.PlayerDetail.AddOffer((int)Math.Round(playerCount * 0.5) * rate); p.Value.PlayerDetail.RemoveOffer(value); } } } return riches; }
public PanelCheckers(Settings i_Settings) { r_GameEngine = new GameEngine(i_Settings.Player1, i_Settings.Player2, i_Settings.BoardSize); r_GameEngine.EventOccured += gameEngine_EventOccured; r_PictureBoxSoldiersMatrix = new PictureBoxSoldier[i_Settings.BoardSize, i_Settings.BoardSize]; r_PictureBoxTilesMatrix = new PictureBoxTile[i_Settings.BoardSize, i_Settings.BoardSize]; r_LogicsEventsQueue = new Queue <IGameLogicsEvent>(); initializeBoard(); Size = new Size(i_Settings.BoardSize * PictureBoxTile.TileSize, i_Settings.BoardSize * PictureBoxTile.TileSize); m_GameType = i_Settings.GameType; }
public PlayGame(string i_FirstUser, string i_SecondUser, int i_Rows, int i_Cols, eGameType i_GameType) { m_FirstPlayer = new Player(i_FirstUser, 0); m_SecondPlayer = new Player(i_SecondUser, 0); m_GameBoard = new Board(i_Rows, i_Cols); r_GameType = i_GameType; if (r_GameType == eGameType.AgainstComp) { m_AiOfPc = new AI(m_GameBoard); } }
// Token: 0x06002AFF RID: 11007 RVA: 0x000FC028 File Offset: 0x000FA228 public override void DeserializeMessage(byte[] data) { int num = 0; base.PacketType = ArrayManager.ReadUInt32(data, ref num); base.SessionToken = ArrayManager.ReadUInt64(data, ref num); base.SecurityToken = ArrayManager.ReadUInt64(data, ref num); base.RequestID = ArrayManager.ReadUInt32(data, ref num); ArrayManager.ReadUInt32(data, ref num); ArrayManager.ReadUInt32(data, ref num); this.GameType = ArrayManager.ReadeGameType(data, ref num); }
private static bool checkGameTypeOption(eGameType i_GameTypeOption) { bool isValid = true; if (Enum.IsDefined(typeof(eGameType), i_GameTypeOption) == false) { isValid = false; Console.WriteLine("Wrong option, please select a valid option"); } return(isValid); }
private void GetValidChoise(out eGameType o_UserChoise)//ready { bool isNum; int choise; Console.WriteLine("Please enter 1 to play agains pc or 2 to play against friend"); isNum = int.TryParse(Console.ReadLine(), out choise); while (!CheckIfValidChoise(choise)) { Console.WriteLine("Please enter valid choise 1 or 2"); isNum = int.TryParse(Console.ReadLine(), out choise); } o_UserChoise = (eGameType)choise; }
// Token: 0x0600312B RID: 12587 RVA: 0x001037F8 File Offset: 0x001019F8 private void InitRefTypes() { this.Username = string.Empty; this.AccountSUID = 0UL; this.GuildTag = string.Empty; this.GuildName = string.Empty; this.GuildID = 0UL; this.ResponseSecurityToken = 0UL; this.Status = eAuthLoginUserStatus.AuthLoginUserStatus_Failure; this.CurrentStoreRegion = ePriceCurrencyType.None; this.GameInProgress = false; this.GameType = eGameType.None; base.RequestID = uint.MaxValue; }
public GameManager(int i_BoardWidth, int i_BoardHeight, string i_FirstPlayerName, string i_SecondPlayerName, eGameType i_GameType) { m_Board = new Board(i_BoardHeight, i_BoardWidth); m_GameType = i_GameType; m_FirstPlayer = new Player(i_FirstPlayerName); m_CurrentPlayer = ePlayerType.FirstPlayer; if (i_GameType == eGameType.AgainstPC) { m_PcPlayer = new PcPlayer(); } else { m_SecondPlayer = new Player(i_SecondPlayerName); } }
public Game(string i_FirstUserName, string i_SecondUserName, Game.eGameType i_GameType, int i_Lenght, int i_Width) { bool isSecondUserHuman = i_GameType == eGameType.AgainstTheComputer ? false : true; r_GameType = i_GameType; m_GameTurn = eGameTurn.FirstUser; m_Board = new Board(i_Lenght, i_Width); m_UserPlayer1 = new User(i_FirstUserName, true, 0); m_UserPlayer2 = new User(i_SecondUserName, isSecondUserHuman, m_Board.MaxPairCards / 2); m_Board.AfterExpose += new ExposeCardEventHandler(updateIndexCardByInteval); if (m_UserPlayer2.IsHuman == false) { m_Board.AfterExpose += new ExposeCardEventHandler(updateComputerAI); } }
private void player_GameOver(AbstractGame game, bool isWin, int gainXp) { if (isWin) { eGameType gameType = game.GameType; switch (gameType) { case eGameType.Free: if ((this.m_info.Para1 == 0 || this.m_info.Para1 == -1) && base.Value > 0) { base.Value--; } break; case eGameType.Guild: if ((this.m_info.Para1 == 1 || this.m_info.Para1 == -1) && base.Value > 0) { base.Value--; } break; case eGameType.Training: case (eGameType)3: break; case eGameType.ALL: if ((this.m_info.Para1 == 4 || this.m_info.Para1 == -1) && base.Value > 0) { base.Value--; } break; default: if (gameType == eGameType.Dungeon) { if ((this.m_info.Para1 == 7 || this.m_info.Para1 == -1) && base.Value > 0) { base.Value--; } } break; } if (base.Value < 0) { base.Value = 0; } } }
private void player_AfterKillingLiving(AbstractGame game, int type, int id, bool isLiving, int demage) { if (!isLiving && type == 1) { eGameType gameType = game.GameType; switch (gameType) { case eGameType.Free: if ((this.m_info.Para1 == 0 || this.m_info.Para1 == -1) && base.Value > 0) { base.Value--; } break; case eGameType.Guild: if ((this.m_info.Para1 == 1 || this.m_info.Para1 == -1) && base.Value > 0) { base.Value--; } break; case eGameType.Training: case (eGameType)3: break; case eGameType.ALL: if ((this.m_info.Para1 == 4 || this.m_info.Para1 == -1) && base.Value > 0) { base.Value--; } break; default: if (gameType == eGameType.Dungeon) { if ((this.m_info.Para1 == 7 || this.m_info.Para1 == -1) && base.Value > 0) { base.Value--; } } break; } if (base.Value < 0) { base.Value = 0; } } }
private void HandlePlayerConsortiaFight(GSPacketIn pkg) { GamePlayer player = WorldMgr.GetPlayerById(pkg.ClientID); int consortiaWin = pkg.ReadInt(); int consortiaLose = pkg.ReadInt(); int count = pkg.ReadInt(); eRoomType roomtype = (eRoomType)pkg.ReadByte(); eGameType gametype = (eGameType)pkg.ReadByte(); int totalKillHealth = pkg.ReadInt(); int check = pkg.ReadInt(); if (player != null && check == totalKillHealth) { player.ConsortiaFight(consortiaWin, consortiaLose, roomtype, gametype, totalKillHealth, count); } }
/// <summary> /// 添加战斗记录 /// </summary> /// <param name="logFightInfo"></param> public static void LogFightAdd(int roomId, eRoomType roomType, eGameType fightType, int changeTeam, DateTime playBegin, DateTime playEnd, int userCount, int mapId, string teamA,string teamB, string playResult,int winTeam,string BossWar) { try { object[] info = { _gameType, _serverId, _areaId, roomId, (int)roomType, (int)fightType, changeTeam, playBegin, playEnd, userCount, mapId, teamA, teamB, playResult, winTeam, BossWar }; lock (m_LogFight) { m_LogFight.Rows.Add(info); } } catch (Exception e) { if (log.IsErrorEnabled) log.Error("LogMgr Error:Fight @ " + e); } }
public void UpdateGameStyle() { if (m_host != null && RoomType == eRoomType.Match) { if (IsAllSameGuild()) { GameStyle = 1; GameType = eGameType.Guild; } else { GameStyle = 0; GameType = eGameType.Free; } GSPacketIn pkg = m_host.Out.SendRoomType(m_host, this); SendToAll(pkg); } }
public void UpdateRoom(string name, string pwd, eRoomType roomType, byte timeMode, int mapId) { this.Name = name; this.Password = pwd; this.RoomType = roomType; this.TimeMode = timeMode; this.MapId = mapId; this.UpdateRoomGameType(); if (roomType == eRoomType.Freedom) { this.m_placesCount = 8; this.GameType = eGameType.Training; } else { this.m_placesCount = 4; } }
public PVEGame(int id, int roomId, PveInfo info, List<IGamePlayer> players, Map map, eRoomType roomType, eGameType gameType, int timeType, eHardLevel hardLevel) : base(id, roomId, map, roomType, gameType, timeType) { PlayersXY = new List<Point>(); foreach (IGamePlayer player in players) { Player fp = new Player(player, PhysicalId++, this, 1); //fp.Reset(); fp.Direction = m_random.Next(0, 1) == 0 ? 1 : -1; AddPlayer(player, fp); } m_info = info; BeginPlayersCount = players.Count; TotalKillCount = 0; TotalNpcGrade = 0; TotalNpcExperience = 0; TotalHurt = 0; m_IsBossType = ""; WantTryAgain = 0; SessionId = 0; m_gameOverResources = new List<string>(); Misssions = new Dictionary<int, MissionInfo>(); m_mapHistoryIds = new List<int>(); m_hardLevel = hardLevel; string script = GetScript(info, hardLevel); m_gameAI = ScriptMgr.CreateInstance(script) as APVEGameControl; if (m_gameAI == null) { log.ErrorFormat("Can't create game ai :{0}", script); m_gameAI = SimplePVEGameControl.Simple; } m_gameAI.Game = this; m_gameAI.OnCreated(); m_missionAI = SimpleMissionControl.Simple; beginTime = DateTime.Now; m_bossCardCount = 0; }
public PVPGame(int id, int roomId, List<IGamePlayer> red, List<IGamePlayer> blue, Map map, eRoomType roomType, eGameType gameType, int timeType) : base(id, roomId, map, roomType, gameType, timeType) { m_redTeam = new List<Player>(); m_blueTeam = new List<Player>(); StringBuilder sbTeampA = new StringBuilder(); m_redAvgLevel = 0; foreach (IGamePlayer player in red) { Player fp = new Player(player, PhysicalId++, this, 1); sbTeampA.Append(player.PlayerCharacter.ID).Append(","); fp.Reset(); fp.Direction = m_random.Next(0, 1) == 0 ? 1 : -1; AddPlayer(player, fp); m_redTeam.Add(fp); m_redAvgLevel += player.PlayerCharacter.Grade; } m_redAvgLevel = m_redAvgLevel / m_redTeam.Count; teamAStr = sbTeampA.ToString(); StringBuilder sbTeampB = new StringBuilder(); m_blueAvgLevel = 0; foreach (IGamePlayer player in blue) { Player fp = new Player(player, PhysicalId++, this, 2); sbTeampB.Append(player.PlayerCharacter.ID).Append(","); fp.Reset(); fp.Direction = m_random.Next(0, 1) == 0 ? 1 : -1; AddPlayer(player, fp); m_blueTeam.Add(fp); m_blueAvgLevel += player.PlayerCharacter.Grade; } m_blueAvgLevel = m_blueAvgLevel / blue.Count; teamBStr = sbTeampB.ToString(); BeginPlayerCount = m_redTeam.Count + m_blueTeam.Count; beginTime = DateTime.Now; }
public static BaseGame StartPVEGame(int roomId, List<IGamePlayer> players, int copyId, eRoomType roomType, eGameType gameType, int timeType, eHardLevel hardLevel, int levelLimits) { try { PveInfo info = null; if (copyId == 0 || copyId == 100000) { info = PveInfoMgr.GetPveInfoByType(roomType, levelLimits); } else { info = PveInfoMgr.GetPveInfoById(copyId); } if (info != null) { PVEGame game = new PVEGame(m_gameId++, roomId, info, players, null, roomType, gameType, timeType, hardLevel); game.GameOverLog += new BaseGame.GameOverLogEventHandle(LogMgr.LogFightAdd); lock (m_games) { m_games.Add(game); } game.Prepare(); return game; } else { return null; } } catch (Exception e) { log.Error("Create game error:", e); return null; } }
public static BaseGame StartPVPGame(int roomId, List<IGamePlayer> red, List<IGamePlayer> blue, int mapIndex, eRoomType roomType, eGameType gameType, int timeType) { try { int index = MapMgr.GetMapIndex(mapIndex, (byte)roomType, m_serverId); Map map = MapMgr.CloneMap(index); if (map != null) { PVPGame game = new PVPGame(m_gameId++, roomId, red, blue, map, roomType, gameType, timeType); game.GameOverLog += new BaseGame.GameOverLogEventHandle(LogMgr.LogFightAdd); lock (m_games) { m_games.Add(game); } game.Prepare(); return game; } else { return null; } } catch (Exception e) { log.Error("Create game error:", e); return null; } }
public int ConsortiaFight(int consortiaWin, int consortiaLose, Dictionary<int, Player> players, eRoomType roomType, eGameType gameClass, int totalKillHealth, int count) { m_client.SendPlayerConsortiaFight(m_character.ID, consortiaWin, consortiaLose, players, roomType, gameClass, totalKillHealth); return 0; }
public BattleGame(int id, List<IGamePlayer> red, ProxyRoom roomRed, List<IGamePlayer> blue, ProxyRoom roomBlue, Map map, eRoomType roomType, eGameType gameType, int timeType) : base(id, roomBlue.RoomId, red, blue, map, roomType, gameType, timeType) { m_roomRed = roomRed; m_roomBlue = roomBlue; }
public void SendPlayerConsortiaFight(int playerId, int consortiaWin, int consortiaLose, Dictionary<int, Player> players, eRoomType roomType, eGameType gameClass, int totalKillHealth) { GSPacketIn pkg = new GSPacketIn((byte)eFightPackageType.PLAYER_CONSORTIAFIGHT, playerId); pkg.WriteInt(consortiaWin); pkg.WriteInt(consortiaLose); pkg.WriteInt(players.Count); for (int i = 0; i < players.Count; i++) { pkg.WriteInt(players[i].PlayerDetail.PlayerCharacter.ID); } pkg.WriteByte((byte)roomType); pkg.WriteByte((byte)gameClass); pkg.WriteInt(totalKillHealth); SendTCP(pkg); }
public int ConsortiaFight(int consortiaWin, int consortiaLose, Dictionary<int, Player> players, eRoomType roomType, eGameType gameClass, int totalKillHealth, int count) { return ConsortiaMgr.ConsortiaFight(consortiaWin, consortiaLose, players, roomType, gameClass, totalKillHealth, count); }
public AbstractGame(int id, eRoomType roomType, eGameType gameType, int timeType) { m_id = id; m_roomType = roomType; m_gameType = gameType; m_timeType = timeType; switch (m_roomType) { case eRoomType.Freedom: m_mapType = eMapType.Normal; break; case eRoomType.Match: m_mapType = eMapType.PairUp; break; default: m_mapType = eMapType.Normal; break; } }
public static BaseGame StartPVEGame(List<IGamePlayer> player, int mapIndex, eRoomType roomType, eTeamType teamType, eGameType gameType, int timeType) { try { int index = MapMgr.GetMapIndex(mapIndex, (byte)roomType, m_serverId); index = 1072; Map map = MapMgr.CloneMap(index); if (map != null) { PVEGame game = new PVEGame(m_gameId ++,player, map, roomType, teamType, gameType, timeType); lock (m_games) { m_games.Add(game); } game.Prepare(); return game; } else { return null; } } catch (Exception e) { log.Error("Create game error:", e); return null; } }
public static BattleGame StartBattleGame(List<IGamePlayer> red, ProxyRoom roomRed, List<IGamePlayer> blue, ProxyRoom roomBlue, int mapIndex, eRoomType roomType, eGameType gameType, int timeType) { try { int index = MapMgr.GetMapIndex(mapIndex, (byte)roomType, m_serverId); Map map = MapMgr.CloneMap(index); if (map != null) { BattleGame game = new BattleGame(m_gameId++, red, roomRed, blue, roomBlue, map, roomType, gameType, timeType); lock (m_games) { m_games.Add(game.Id, game); } game.Prepare(); SendStartMessage(game); return game; } else { return null; } } catch (Exception e) { log.Error("Create battle game error:", e); return null; } }
public void UpdateRoomGameType() { switch (RoomType) { case eRoomType.FightLib: GameType = eGameType.FightLib; break; case eRoomType.Dungeon: GameType = eGameType.Dungeon; break; case eRoomType.Freedom: case eRoomType.Match: //case eRoomType.Freshman: GameType = eGameType.Free; break; default: GameType = eGameType.ALL; break; } }
public static int GetOffer(int cosortiaID1, int consortiaID2, eGameType gameType) { return GetOffer(FindConsortiaAlly(cosortiaID1, consortiaID2), gameType); }
public static int KillPlayer(GamePlayer win, GamePlayer lose, Dictionary<GamePlayer, Player> players, eRoomType roomType, eGameType gameClass) { if (roomType != eRoomType.Match) return -1; int state = FindConsortiaAlly(win.PlayerCharacter.ConsortiaID, lose.PlayerCharacter.ConsortiaID); if (state == -1) return state; int offer = GetOffer(state, gameClass); if (lose.PlayerCharacter.Offer < offer) offer = lose.PlayerCharacter.Offer; if (offer != 0) { players[win].GainOffer = offer; players[lose].GainOffer = -offer; } return state; }
private static int GetOffer(int state, eGameType gameType) { switch (gameType) { case eGameType.Free: switch (state) { case 0: return 1; case 1: return 0; case 2: return 3; } break; case eGameType.Guild: switch (state) { case 0: return 5; case 1: return 0; case 2: return 10; } break; } return 0; }
public void LaunchPractice() { _gameType = eGameType.practice; Application.LoadLevel("PlayField"); }
public ProxyGame(int id,FightServerConnector fightServer,eRoomType roomType, eGameType gameType,int timeType) : base(id,roomType,gameType,timeType) { m_fightingServer = fightServer; m_fightingServer.Disconnected += new Game.Base.ClientEventHandle(m_fightingServer_Disconnected); }
public BaseGame(List<GamePlayer> red, List<GamePlayer> blue, Map map,eRoomType roomType,eTeamType teamType, eGameType gameType, int timeType) { m_players = new Dictionary<GamePlayer, Player>(); m_redTeam = new List<Player>(); m_blueTeam = new List<Player>(); m_roomType = roomType; m_gameType = gameType; m_teamType = teamType; m_random = new Random(); m_redAvgLevel = 0; foreach (GamePlayer player in red) { Player fp = new Player(player, this, 1); fp.Direction = m_random.Next(0, 1) == 0 ? 1 : -1; m_players.Add(player, fp); m_redTeam.Add(fp); player.CurrentGame = this; m_redAvgLevel += player.PlayerCharacter.Grade; fp.Died += new PlayerEventHandle(Player_Died); } m_redAvgLevel = m_redAvgLevel / m_redTeam.Count; m_blueAvgLevel = 0; foreach (GamePlayer player in blue) { Player fp = new Player(player, this, 2); fp.Direction = m_random.Next(0, 1) == 0 ? 1 : -1; m_players.Add(player, fp); m_blueTeam.Add(fp); player.CurrentGame = this; m_blueAvgLevel += player.PlayerCharacter.Grade; fp.Died += new PlayerEventHandle(Player_Died); } m_blueAvgLevel = m_blueAvgLevel / blue.Count; m_map = map; m_actions = new ArrayList(); PhysicalId = 0; switch (m_roomType) { case eRoomType.Freedom: m_mapType = eMapType.Normal; break; case eRoomType.Match: m_mapType = eMapType.PairUp; break; default: m_mapType = eMapType.Normal; break; } m_timeType = timeType; m_tempBox = new List<Box>(); m_tempPoints = new List<Point>(); Cards = new int[8]; GameState = eGameState.Inited; }
public void LaunchEasy() { _gameType = eGameType.fuelEasy; //FuelHandler.Instance.LaunchCompeteDashBoard (); }