/// <summary> /// 结束战斗 /// </summary> /// <param name="needCalcResult">是否需要计算结果, 玩家主动退出情况不需要计算结果</param> public void StopBattle(bool needCalcResult = true) { if (needCalcResult) { _CheckFinalBattleResult(); } if (GameGOW.Get().Winner_Id == 2) { SounderManager.Get().PlaySound(1, "sound/win01"); } else { SounderManager.Get().PlaySound(1, "sound/shibai_09"); } RemoveEvents(); m_bIsInBattle = false; m_stBattleInfo = null; m_iCurrentRound = 0; m_iBattleEndTick = (int)GameGOW.Get().TickerMgr.TickCount; EventDispatcher.DispatchEvent("EventBattleStop", this, null); }
public void Clear() { m_dicPlayerResult.Clear(); m_dicTeamResult.Clear(); m_bIsInBattle = false; m_stBattleInfo = null; m_iCurrentRoundPlayerIndex = 0; m_iCurrentRoundTime = ROUND_TIME; m_pCurrentPlayer = null; m_iPlayerCount = 0; m_iBattleStartTick = 0; m_iBattleEndTick = 0; m_iBossUID = 0; m_iWaitTime = 0; }
public void SwitchMap(BattleInfo info) { //m_pTickerMgr.Clear(); //m_pMapMgr.Clear(); //m_pCharacterMgr.Clear(); //m_pBattleMgr.Clear(); //EventDispatcher.DispatchEvent("EventBeforeSwitchMap", null, null); //m_pCurrentMapData = m_pDataMgr.GetMapDataByID(info.m_iMapIndex); //m_pMapMgr.SetData(m_pCurrentMapData); //m_pCharacterMgr.SetData(m_pCurrentMapData); //EventDispatcher.DispatchEvent("EventAfterSwitchMap", null, null); //m_pBattleMgr.StartBattle(info, m_pCurrentMapData); //m_pMyPlayer = m_pBattleMgr.m_pCurrentPlayer; }
public void StartBattle(BattleInfo info, MapData pMapData) { m_iCurrentRoundPlayerIndex = 0; m_stBattleInfo = info; m_iCurrentRound = 0; m_iWaitTime = 0; InitPlayerInfo(pMapData); m_pCurrentPlayer = GameGOW.Get().CharacterMgr.GetCharacterByUid(info.m_listPlayers[m_iCurrentRoundPlayerIndex].m_iPlayerUID); m_iCurrentRoundTime = ROUND_TIME; //info.m_iRoundLimit * 60; AddEvents(); m_bIsInBattle = true; EventDispatcher.DispatchEvent("EventBattleStart", this, new ChangeControllerEvent(info.m_listPlayers[m_iCurrentRoundPlayerIndex].m_iPlayerUID)); }
public void TestDemo(int iMapIndex) { Network.InitRound(); BattleInfo info = new BattleInfo(); info.m_iMapIndex = iMapIndex; info.m_eBattleType = BattleType.NORMAL_PVP; info.m_iRoundLimit = 10; info.m_iTimeLimit = GameDefine.INFINITE; PlayerInfo p1 = new PlayerInfo(); p1.m_iPlayerUID = 1; p1.m_iTeam = 1; p1.m_strName = "P1"; p1.m_iInstructionID = 300001; p1.m_iHP = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p1.m_iInstructionID).m_iHP; p1.m_iMoveEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p1.m_iInstructionID).m_iMoveEnergy; p1.m_iAddEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p1.m_iInstructionID).m_iAddEnergy; if (Network.gamemode == BattleType.AI_1v1) { p1.m_strName = Network.name; p1.m_iPlayerUID = Network.playerid; p1.m_iInstructionID = Network.Player_tank * 100000 + 1; p1.m_iHP = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p1.m_iInstructionID).m_iHP; p1.m_iMoveEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p1.m_iInstructionID).m_iMoveEnergy; p1.m_iAddEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p1.m_iInstructionID).m_iAddEnergy; if (Network.Player_tank == 3) { Network.default_skill = (int)SkillManager.SkillType.Rocket; } else { Network.default_skill = (int)SkillManager.SkillType.TripleBomb; } //while ((Network.skill1 = UnityEngine.Random.Range(1, 7)) == 4) ; while (true) { Network.skill1 = UnityEngine.Random.Range(1, 8); if (Network.skill1 != 4 && Network.skill1 != (int)SkillManager.SkillType.Rocket && Network.skill1 != (int)SkillManager.SkillType.TripleBomb) { break; } } } else if (Network.NetworkMode == true) { info.m_iMapIndex = Network.battleinfo.m_iMapIndex; p1.m_iPlayerUID = Network.battleinfo.m_listPlayers[0].m_iPlayerUID; p1.m_iInstructionID = Network.battleinfo.m_listPlayers[0].m_iInstructionID; p1.m_iTeam = Network.battleinfo.m_listPlayers[0].m_iTeam; p1.m_strName = Network.battleinfo.m_listPlayers[0].m_strName; } info.m_listPlayers.Add(p1); PlayerInfo p2 = new PlayerInfo(); p2.m_iPlayerUID = 2; p2.m_iTeam = 2; p2.m_strName = "P2"; p2.m_iInstructionID = 400001; p2.m_iHP = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p2.m_iInstructionID).m_iHP; p2.m_iMoveEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p2.m_iInstructionID).m_iMoveEnergy; p2.m_iAddEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p2.m_iInstructionID).m_iAddEnergy; if (Network.gamemode == BattleType.AI_1v1) { p2.m_strName = "心是六月的情"; p2.m_iInstructionID = Network.Ai_tank * 100000 + 1; p2.m_iHP = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p2.m_iInstructionID).m_iHP; p2.m_iMoveEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p2.m_iInstructionID).m_iMoveEnergy; p2.m_iAddEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p2.m_iInstructionID).m_iAddEnergy; p2.m_iPlayerUID = Network.playerid + 1; Network.playerid2 = p2.m_iPlayerUID; p2.m_iHP *= 2; p2.m_iMoveEnergy *= 10; } else if (Network.NetworkMode == true) { p2.m_iPlayerUID = Network.battleinfo.m_listPlayers[1].m_iPlayerUID; p2.m_iInstructionID = Network.battleinfo.m_listPlayers[1].m_iInstructionID; p2.m_iTeam = Network.battleinfo.m_listPlayers[1].m_iTeam; p2.m_strName = Network.battleinfo.m_listPlayers[1].m_strName; } info.m_listPlayers.Add(p2); if (Network.gamemode == BattleType.PVP_2V2 || Network.gamemode == BattleType.PVP_3V3) { info.m_iMapIndex = 200 + info.m_iMapIndex; //info.m_iMapIndex = 201; } if (info.m_iMapIndex >= 201 || (info.m_iMapIndex > 300 && info.m_iMapIndex <= 303)) { PlayerInfo p3 = new PlayerInfo(); p3.m_iPlayerUID = 3; p3.m_iTeam = 1; p3.m_strName = "p3"; p3.m_iInstructionID = 100001; p3.m_iHP = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p3.m_iInstructionID).m_iHP; p3.m_iMoveEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p3.m_iInstructionID).m_iMoveEnergy; p3.m_iAddEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p3.m_iInstructionID).m_iAddEnergy; if (Network.gamemode == BattleType.PVP_2V2 || Network.gamemode == BattleType.PVP_3V3) { p3.m_iPlayerUID = Network.battleinfo.m_listPlayers[2].m_iPlayerUID; p3.m_iInstructionID = Network.battleinfo.m_listPlayers[2].m_iInstructionID; p3.m_iTeam = Network.battleinfo.m_listPlayers[2].m_iTeam; p3.m_strName = Network.battleinfo.m_listPlayers[2].m_strName; } info.m_listPlayers.Add(p3); PlayerInfo p4 = new PlayerInfo(); p4.m_iPlayerUID = 4; p4.m_iTeam = 2; p4.m_strName = "p4"; p4.m_iInstructionID = 200001; p4.m_iHP = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p4.m_iInstructionID).m_iHP; p4.m_iMoveEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p4.m_iInstructionID).m_iMoveEnergy; p4.m_iAddEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p4.m_iInstructionID).m_iAddEnergy; if (Network.gamemode == BattleType.PVP_2V2 || Network.gamemode == BattleType.PVP_3V3) { p4.m_iPlayerUID = Network.battleinfo.m_listPlayers[3].m_iPlayerUID; p4.m_iInstructionID = Network.battleinfo.m_listPlayers[3].m_iInstructionID; p4.m_iTeam = Network.battleinfo.m_listPlayers[3].m_iTeam; p4.m_strName = Network.battleinfo.m_listPlayers[3].m_strName; } info.m_listPlayers.Add(p4); } if (Network.gamemode == BattleType.PVP_3V3) { info.m_iMapIndex = 100 + info.m_iMapIndex; //info.m_iMapIndex = 301; } if (info.m_iMapIndex > 300 && info.m_iMapIndex <= 303) { PlayerInfo p5 = new PlayerInfo(); p5.m_iPlayerUID = 5; p5.m_iTeam = 1; p5.m_strName = "p5"; p5.m_iInstructionID = 100001; p5.m_iHP = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p5.m_iInstructionID).m_iHP; p5.m_iMoveEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p5.m_iInstructionID).m_iMoveEnergy; p5.m_iAddEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p5.m_iInstructionID).m_iAddEnergy; if (Network.gamemode == BattleType.PVP_3V3) { p5.m_iPlayerUID = Network.battleinfo.m_listPlayers[4].m_iPlayerUID; p5.m_iInstructionID = Network.battleinfo.m_listPlayers[4].m_iInstructionID; p5.m_iTeam = Network.battleinfo.m_listPlayers[4].m_iTeam; p5.m_strName = Network.battleinfo.m_listPlayers[4].m_strName; } info.m_listPlayers.Add(p5); PlayerInfo p6 = new PlayerInfo(); p6.m_iPlayerUID = 6; p6.m_iTeam = 2; p6.m_strName = "p6"; p6.m_iInstructionID = 200001; p6.m_iHP = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p6.m_iInstructionID).m_iHP; p6.m_iMoveEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p6.m_iInstructionID).m_iMoveEnergy; p6.m_iAddEnergy = GameGOW.Get().DataMgr.GetCharacterInstructionByID(p6.m_iInstructionID).m_iAddEnergy; if (Network.gamemode == BattleType.PVP_3V3) { p6.m_iPlayerUID = Network.battleinfo.m_listPlayers[5].m_iPlayerUID; p6.m_iInstructionID = Network.battleinfo.m_listPlayers[5].m_iInstructionID; p6.m_iTeam = Network.battleinfo.m_listPlayers[5].m_iTeam; p6.m_strName = Network.battleinfo.m_listPlayers[5].m_strName; } info.m_listPlayers.Add(p6); } if (Network.gamemode == BattleType.AI_1v1 || Network.NetworkMode == false) { //Network.playerid = 1; Network.playerindex = 0; Network.battleinfo = info; } battleinfo = info; Network.GameLoading_Cnt = 0; Network.GameLoading = 0; for (int i = 1; i <= 10; i++) { Network.GameLoading_num[i] = 0; } if (Network.gamemode == BattleType.AI_1v1) { Network.GameLoading_num[1] = UnityEngine.Random.Range(10, (Network.GameLoading + 1) * 20); Network.GameLoading = 1; } else if (Network.NetworkMode == true) { Network.Send_GameLoading(UnityEngine.Random.Range(10, (Network.GameLoading + 1) * 20)); } else { Network.GameLoading_num[1] = UnityEngine.Random.Range(10, (Network.GameLoading + 1) * 20); Network.GameLoading = 1; } //SwitchMap(info); }