Exemple #1
0
        public FightPlayer GetPlayerByIdx(long char_idx)
        {
            FightPlayer player = null;

            if (m_fight_players.TryGetValue(char_idx, out player))
            {
                return(player);
            }
            return(null);
        }
        public void RemovePlayer(long char_idx)
        {
            FightPlayer player = null;

            if (m_fight_players.TryGetValue(char_idx, out player))
            {
                player.Destroy();
            }
            m_fight_players.Remove(char_idx);
        }
Exemple #3
0
        public void RemovePlayer(long char_idx)
        {
            FightPlayer player = null;

            if (m_fight_players.TryGetValue(char_idx, out player))
            {
                player.Destroy();
                CommonObjectPools.Despawn(player);
            }
            m_fight_players.Remove(char_idx);
        }
Exemple #4
0
        public bool AddPlayer(long char_idx)
        {
            if (m_fight_players.ContainsKey(char_idx))
            {
                RemovePlayer(char_idx);
            }
            FightPlayer player = CommonObjectPools.Spawn <FightPlayer>();

            player.Setup(char_idx);
            m_fight_players.Add(char_idx, player);

            return(true);
        }
Exemple #5
0
        /// <summary>
        /// 战斗服退出
        /// </summary>
        /// <param name="uid"></param>
        private void OnFightServerLeave(ushort uid)
        {
            FightPlayer player = null;

            foreach (var obj in m_fight_players)
            {
                player = obj.Value as FightPlayer;
                if (player != null)
                {
                    player.HandleFightServerLeave(uid);
                }
            }
        }
        public bool AddPlayer(long char_idx)
        {
            if (m_fight_players.ContainsKey(char_idx))
            {
                RemovePlayer(char_idx);
            }
            FightPlayer player = new FightPlayer();

            player.Setup(char_idx);
            m_fight_players.Add(char_idx, player);

            return(true);
        }
Exemple #7
0
        /// <summary>
        /// 进入游戏
        /// </summary>
        private void OnPlayerLogin(long char_idx)
        {
            //如果是登陆进入游戏,判断是否还处于战场中;如果是,需要重连战斗
            Player player = UnitManager.Instance.GetPlayerByIdx(char_idx);

            if (player != null && player.fs_uid > 0)
            {
                this.AddPlayer(char_idx);
                FightPlayer f_player = null;
                if (m_fight_players.TryGetValue(char_idx, out f_player))
                {
                    f_player.EnterFight();
                }
            }
        }