Ejemplo n.º 1
0
        /*
         * public List<CharacterLogic> GetPlayerByTeam()
         * {
         *  //m_stBattleInfo.m_listPlayers[i].m_iTeam
         *   GameGOW.Get().CharacterMgr.GetCharacterByUid()
         * }
         */
        #region (战斗结算)
        private void AddPlayerResult(int uid, int team)
        {
            if (!m_dicTeamResult.ContainsKey(team))
            {
                TeamResult teamResult = new TeamResult();
                teamResult.m_iTeam         = team;
                teamResult.m_iRank         = 0;
                teamResult.m_iLastDeadTick = m_stBattleInfo.m_iTimeLimit;
                teamResult.m_hsPlayerUIDs  = new HashSet <int>();
                teamResult.m_hsPlayerUIDs.Add(uid);
                teamResult.m_iAlivePlayer = teamResult.m_hsPlayerUIDs.Count;
                m_dicTeamResult[team]     = teamResult;
            }
            else
            {
                TeamResult teamResult = m_dicTeamResult[team];
                teamResult.m_hsPlayerUIDs.Add(uid);
                teamResult.m_iAlivePlayer = teamResult.m_hsPlayerUIDs.Count;
            }

            PlayerResult playerResult = new PlayerResult();

            playerResult.Reset();
            playerResult.m_iUID      = uid;
            playerResult.m_iTeam     = team;
            playerResult.m_iDeadTick = m_stBattleInfo.m_iTimeLimit;
            m_dicPlayerResult[uid]   = playerResult;
        }
Ejemplo n.º 2
0
        public void OnCharacterDead(object sender, EventArgs e)
        {
            if (!m_bIsInBattle)
            {
                return;
            }

            CharacterDeadEvent evt = e as CharacterDeadEvent;

            if (evt != null)
            {
                if (_IsPvEBossDead(evt.m_iUniqueID))
                {
                    if (Network.gamemode == BattleType.AI_1v1)
                    {
                        GameGOW.Get().BattleMgr.m_bIsInBattle = false;
                        //StopBattle();
                    }
                    else if (Network.NetworkMode == true)
                    {
                        //GameGOW.Get().BattleMgr.m_bIsInBattle = false;
                        //Network.Send_Over(Network.Pid_Tid[Network.playerid], GameGOW.Get().Winner_Id != Network.Pid_Tid[Network.playerid]);
                    }
                    else
                    {
                        StopBattle();
                    }
                    return;
                }

                if (m_dicPlayerResult.ContainsKey(evt.m_iUniqueID))
                {
                    PlayerResult playerResult = m_dicPlayerResult[evt.m_iUniqueID];
                    playerResult.m_iDeadTick = (int)GameGOW.Get().TickerMgr.TickCount;

                    TeamResult teamResult = m_dicTeamResult[playerResult.m_iTeam];
                    teamResult.m_iAlivePlayer--;
                    if (teamResult.m_iAlivePlayer == 0)
                    {
                        teamResult.m_iLastDeadTick = playerResult.m_iDeadTick;
                    }

                    if (m_stBattleInfo.m_eBattleType == BattleType.NORMAL_PVE)
                    {
                        if (teamResult.m_iAlivePlayer == 0)
                        {
                            if (Network.gamemode == BattleType.AI_1v1)
                            {
                                GameGOW.Get().BattleMgr.m_bIsInBattle = false;
                                //StopBattle();
                            }
                            else if (Network.NetworkMode == true)
                            {
                                GameGOW.Get().BattleMgr.m_bIsInBattle = false;
                                //Network.Send_Over(Network.Pid_Tid[Network.playerid], GameGOW.Get().Winner_Id != Network.Pid_Tid[Network.playerid]);
                            }
                            else
                            {
                                StopBattle();
                            }
                        }
                    }
                    else
                    {
                        if (_IsPvPBattleEnd())
                        {
                            if (Network.gamemode == BattleType.AI_1v1)
                            {
                                //StopBattle();
                                GameGOW.Get().BattleMgr.m_bIsInBattle = false;
                            }
                            else if (Network.NetworkMode == true)
                            {
                                //GameGOW.Get().BattleMgr.m_bIsInBattle = false;
                                //Network.Send_Over(Network.Pid_Tid[Network.playerid], GameGOW.Get().Winner_Id != Network.Pid_Tid[Network.playerid]);
                            }
                            else
                            {
                                StopBattle();
                            }
                        }
                    }
                }
            }
        }