/// <summary> /// 玩家退出 /// </summary> /// <param name="player"></param> /// <returns>剩余玩家数</returns> public int Exit(PlayerBusiness player, bool online = false) { int count = 0; for (int i = 0; i < m_members.Length; i++) { PlayerBusiness member = m_members[i]; if (member != null) { if (member != player) { count++; } } } if (count == 0) { TeamInstanceProxy.TryRemove(m_id); m_members = Empty; } // 记录副本退出日志 PlayerLog log = new PlayerLog(ServerLogger.zoneid, Actiontype.EctypeOut); log.itemtype = m_difficulty; log.itemid = m_gc.ID; log.remark = m_gc.Name; player.WriteLog(log); if (online) { //转回主场景.. if (m_currentScene.ExitScene(player)) { player.TeamInstance = null; UserNote note = new UserNote(player, ClientCommand.IntoSceneSuccess, new object[] { oldx, oldy }); m_oldScene.Execute(note); } } return count; }
/// <summary> /// 重新进入 /// </summary> /// <param name="member"></param> internal void ReInto(PlayerBusiness member) { if (m_team != null && m_team.TryAddMember(member)) { var members = m_team.AllPlayerDetail; member.Call(TeamCommand.IntoTeamR, true, new object[] { m_team, members }); member.CallAllExcludeOne(member, TeamCommand.NewMemberR, m_team.TeamID, new PlayerDetail(member)); var apcs = m_currentApcs.FindAll(k => k.State <= 1); member.Call(InstanceCommand.NewInstanceR, new object[] { true, apcs, string.Empty }); // 记录副本进入日志 PlayerLog log = new PlayerLog(ServerLogger.zoneid, Actiontype.EctypeIn); log.itemtype = m_gc.SubType; //副本类型 log.itemid = m_gc.ID; //副本ID log.remark = m_gc.Name; //副本名称 member.WriteLog(log); } }
public void InitPlayer(PlayerBusiness player) { m_player = player; if (player != null) { DateTime now = DateTime.UtcNow; player.LoginTime = now; player.WriteLog(new RoleLogin()); } }