public void StartGame() { if (GameState == eGameState.Loading) { m_gameState = eGameState.Playing; ClearWaitTimer(); //同步时间 SendSyncLifeTime(); VaneLoading(); List <Player> list = GetAllFightPlayers(); MapPoint mapPos = MapMgr.GetMapRandomPos(m_map.Info.ID); GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD); pkg.WriteByte((byte)eTankCmdType.START_GAME); pkg.WriteInt(list.Count); foreach (Player p in list) { p.Reset(); Point pos = GetPlayerPoint(mapPos, p.Team); p.SetXY(pos); m_map.AddPhysical(p); p.StartMoving(); p.StartGame(); pkg.WriteInt(p.Id); pkg.WriteInt(p.X); pkg.WriteInt(p.Y); pkg.WriteInt(p.Direction); pkg.WriteInt(p.Blood); pkg.WriteInt(p.Team); //_loc_6.team = _loc_2.readInt(); pkg.WriteInt(p.Weapon.RefineryLevel); pkg.WriteInt(34); //powerRatio = _loc_2.readInt(); pkg.WriteInt(p.Dander); pkg.WriteInt(1); //_loc_6.wishKingCount = _loc_2.readInt(); pkg.WriteInt(1); //_loc_6.wishKingEnergy = _loc_2.readInt(); pkg.WriteInt(p.PlayerDetail.EquipEffect.Count); foreach (var templateID in p.PlayerDetail.EquipEffect) { ItemTemplateInfo item = ItemMgr.FindItemTemplate(templateID); if (item.Property3 < 27) { pkg.WriteInt(item.Property3); pkg.WriteInt(item.Property4); } else { pkg.WriteInt(0); pkg.WriteInt(0); } } } SendToAll(pkg); WaitTime(list.Count * 1000); OnGameStarted(); } }
public void StartGame() { if (base.GameState == eGameState.Loading) { this.m_gameState = eGameState.Playing; base.ClearWaitTimer(); base.SendSyncLifeTime(); List <Player> allFightPlayers = base.GetAllFightPlayers(); MapPoint mapRandomPos = MapMgr.GetMapRandomPos(this.m_map.Info.ID); GSPacketIn gSPacketIn = new GSPacketIn(91); gSPacketIn.WriteByte(99); gSPacketIn.WriteInt(allFightPlayers.Count); foreach (Player current in allFightPlayers) { current.Reset(); Point playerPoint = base.GetPlayerPoint(mapRandomPos, current.Team); current.SetXY(playerPoint); this.m_map.AddPhysical(current); current.StartMoving(); current.StartGame(); gSPacketIn.WriteInt(current.Id); gSPacketIn.WriteInt(current.X); gSPacketIn.WriteInt(current.Y); gSPacketIn.WriteInt(current.Direction); gSPacketIn.WriteInt(current.Blood); gSPacketIn.WriteInt(current.Team); gSPacketIn.WriteInt(current.Weapon.RefineryLevel); gSPacketIn.WriteInt(34); gSPacketIn.WriteInt(current.Dander); gSPacketIn.WriteInt(1); gSPacketIn.WriteInt(1); gSPacketIn.WriteInt(1); gSPacketIn.WriteInt(102); gSPacketIn.WriteInt(1); } this.SendToAll(gSPacketIn); base.VaneLoading(); base.WaitTime(allFightPlayers.Count * 1000); base.OnGameStarted(); } }
public void StartGame() { if (base.GameState == eGameState.Loading) { this.m_gameState = eGameState.Playing; base.ClearWaitTimer(); base.SendSyncLifeTime(); List <Player> list = base.GetAllFightPlayers(); MapPoint mapPos = MapMgr.GetMapRandomPos(this.m_map.Info.ID); GSPacketIn pkg = new GSPacketIn(91); pkg.WriteByte(99); pkg.WriteInt(list.Count); foreach (Player p in list) { p.Reset(); Point pos = base.GetPlayerPoint(mapPos, p.Team); p.SetXY(pos); this.AddPlayer(p); p.StartFalling(true); p.StartGame(); pkg.WriteInt(p.Id); pkg.WriteInt(p.X); pkg.WriteInt(p.Y); pkg.WriteInt(p.Direction); pkg.WriteInt(p.Blood); } base.SendToAll(pkg); if (this.m_npcID != 0 && base.RoomType == eRoomType.Match) { SimpleNpc npc = new SimpleNpc(this.physicalId++, this, NPCInfoMgr.GetNpcInfoById(this.m_npcID), 1, -1, 0); Point npcPos = base.GetPlayerPoint(mapPos, 3); npc.Reset(); npc.SetXY(npcPos); this.AddLiving(npc); npc.StartFalling(false); npc.IsNoHole = true; } base.WaitTime(list.Count * 1000); base.OnGameStarted(); } }