private void RunAsync(Session session, L2M_TeamModifyMember message, Action <M2L_TeamModifyMember> reply) { M2L_TeamModifyMember response = new M2L_TeamModifyMember(); try { var roomComponent = Game.Scene.GetComponent <RoomComponent>(); var room = roomComponent.Get(message.RoomId); if (room == null) { response.Error = ErrorCode.ERR_RoomIdNotFound; reply(response); return; } var roomTeamComponent = room.GetComponent <RoomTeamComponent>(); if (roomTeamComponent == null) { response.Error = ErrorCode.ERR_RoomTeamComponentNull; reply(response); return; } TeamMemberData selfMemberData = roomTeamComponent.GetMember(message.Uid); M2C_TeamModifyMember m2c_TeamModifyMember = new M2C_TeamModifyMember(); m2c_TeamModifyMember.Uid = message.Uid; m2c_TeamModifyMember.MemberData = selfMemberData; MapMessageHelper.BroadcastRoom(room.Id, m2c_TeamModifyMember, message.Uid); reply(response); } catch (Exception e) { ReplyError(response, e, reply); } }
public void SetReady(long uid, bool isReady) { TeamMemberData teamMemberData = GetMember(uid); if (teamMemberData != null) { teamMemberData.IsReady = isReady; } }
public static void ProcessChangeTeamName(GameClient client, bool needBroad = false) { try { if (ZhuanShengShiLian.IsZhuanShengShiLianCopyScene(client.ClientData.MapCode)) { ZSSLScene mapInfo; if (ZhuanShengShiLian.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out mapInfo)) { TeamData td = GameManager.TeamMgr.FindData(client.ClientData.TeamID); if (null != td) { string newName = ""; long tID = ZhuanShengShiLian.GetGUID(client.ClientData.TeamID, client.ClientData.RoleID); lock (td) { if (td.LeaderRoleID == client.ClientData.RoleID) { return; } TeamMemberData member = td.GetLeader(); if (null == member) { return; } newName = member.RoleName; } BHAttackLog tAttackLog; lock (ZhuanShengShiLian.ZhuanShengRunTimeData.Mutex) { if (null == mapInfo.AttackLog) { return; } if (!mapInfo.AttackLog.BHInjure.TryGetValue(tID, out tAttackLog)) { return; } tAttackLog.BHName = newName; } if (needBroad) { int myRank = mapInfo.AttackLog.BHAttackRank.FindIndex((BHAttackLog x) => object.ReferenceEquals(x, tAttackLog)); bool top5Chg = myRank >= 0 && myRank < 5; ZhuanShengShiLian.BroadBossLife(mapInfo, client, top5Chg); } } } } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Error, string.Format("ZhuanShengShiLian :: 处理清除角色伤害记录异常。", new object[0]), ex, true); } }
public void SetProgress(long uid, float progress) { TeamMemberData teamMemberData = GetMember(uid); if (teamMemberData != null) { teamMemberData.Progress = progress; if (teamMemberData.Progress > 0.999f) { teamMemberData.LoadingDone = true; } } }
public bool AddMember(MapUnit mapUnit) { if (!MemberDataUidDict.ContainsKey(mapUnit.Uid)) { int newMemberIndex = -1; if (Data.IsReservation) { //預約有屬於每個玩家的固定位置 for (int i = 0; i < ReservationMembers.Count; i++) { if (ReservationMembers[i].Uid == mapUnit.Uid) { newMemberIndex = i; break; } } } else { for (int i = 0; i < MEMBER_MAX; i++) { if (MemberDatas[i] == null) { newMemberIndex = i; break; } } } if (newMemberIndex == -1) { Log.Error($"AddMember Failed, 超出最大人數!, Uid:{mapUnit.Uid}, RoomId:{RoomEntity.Id}"); return(false); } TeamMemberData memberData = new TeamMemberData() { MemberIndex = newMemberIndex, Uid = mapUnit.Uid, Name = mapUnit.Info.Name, Location = mapUnit.Info.Location, CharSetting = mapUnit.Info.CharSetting, }; MemberDataUidDict.Add(mapUnit.Uid, memberData); MemberDatas[newMemberIndex] = memberData; return(true); } return(false); }
public static TeamMemberData NewTeamMemberData(LTPartnerData partnerData, int posIndex) { TeamMemberData teamMemData = new TeamMemberData(); teamMemData.Uid = partnerData.uid; teamMemData.HeroID = partnerData.HeroId; teamMemData.InfoID = partnerData.InfoId; var charTpl = Hotfix_LT.Data.CharacterTemplateManager.Instance.GetHeroInfo(partnerData.InfoId, partnerData.CurSkin); teamMemData.ModelName = charTpl.model_name; //需添加皮肤 teamMemData.Pos = posIndex; teamMemData.IsHire = partnerData.IsHire; return(teamMemData); }
public TeamMemberData GetTeamMemberData(string index) { var data = new TeamMemberData(); data.Tasks = new List <Task>(); using (var connection = new SqlConnection(CONNECTION_STRING)) { using (var command = new SqlCommand()) { command.Connection = connection; connection.Open(); command.CommandText = "SELECT IdTeamMember, FirstName, LastName, Email" + " FROM teammember WHERE IdTeamMember = @Id"; command.Parameters.AddWithValue("@Id", index); var reader = command.ExecuteReader(); if (!reader.Read()) { reader.Close(); return(null); } data.IdTeamMember = reader["IdTeamMember"].ToString(); data.FirstName = reader["FirstName"].ToString(); data.LastName = reader["LastName"].ToString(); data.Email = reader["Email"].ToString(); command.CommandText = "SELECT t.Idtask, t.Name, t.Description, t.Deadline, tm.LastName " + "FROM Task t " + "JOIN TeamMemeber tm ON t.IdAssignedTo = tm.IdTeamMember " + "WHERE IdTeamMember = @IdTeamMember" + "ORDER BY 4 DESC;"; command.Parameters.AddWithValue("@IdTeamMember", index); reader = command.ExecuteReader(); while (reader.Read()) { data.Tasks.Add(new Task( reader["IdTask"].ToString(), reader["Name"].ToString(), reader["Description"].ToString(), reader["Deadline"].ToString(), reader["LastName"].ToString() )); } } } return(data); }
public void ShowUI(TeamMemberData data, bool isShowHp = false, bool isShowTempHp = false) { ResetStarGrid(); HireObj.CustomSetActive(true); AlliancesManager.Instance.GetCacheAllianceMercenaries((partners) => { LTPartnerData temp = partners.Find((partner) => partner.HeroId == data.HeroID); if (temp == null) { temp = AlliancesManager.Instance.GetAlliancePartnerByHeroId(data.HeroID); } if (temp != null) { OnShow(data.HeroID.ToString(), temp.HeroInfo, temp.Star, temp.UpGradeId, temp.HireAwakeLevel, isShowHp, isShowTempHp, false); } }); }
bool GetCanAddHeroToFormation(string teamName, TeamMemberData memberData) { if (memberData.HeroID <= 0) { Debug.LogError("cannot AddHeroToFormation partnerData.HeroId <= 0"); return(false); } //if (memberData.Star <= 0) //{ // Debug.LogError("cannot AddHeroToFormation partnerData.Star <= 0"); // return false; //} //level limit num judge if (GetTeamMemList(teamName).Count >= SmallPartnerPacketRule.TEAM_MAX_NUM) { int messageId; if (!Hotfix_LT.Data.FuncTemplateManager.Instance.GetFunc(10046).IsConditionOK()) { messageId = SmallPartnerPacketRule.ADD_FORMATION_CODE4; } else { messageId = SmallPartnerPacketRule.ADD_FORMATION_CODE1; //上阵角色数量已达上限 } MessageTemplateManager.ShowMessage(messageId); return(false); } if (IsInTeam(memberData.HeroID)) { EB.Debug.LogError("is in team for heroid={0}", memberData.HeroID); return(false); } return(true); }
public async Task <IActionResult> Post([FromForm] TeamMemberData teamMemberData) { var teamMember = await _teamMemberService.SaveAsync(_environment.WebRootPath, _appsettings.UploadTeamMemberFolderName, teamMemberData); return(Ok(teamMember)); }
protected async ETTask RunAsync(Session session, C2G_TeamInviteAccept message, Action <G2C_TeamInviteAccept> reply) { G2C_TeamInviteAccept response = new G2C_TeamInviteAccept(); try { //取得自身資料 Player player = session.GetComponent <SessionPlayerComponent>().Player; User user = await UserDataHelper.FindOneUser((player?.uid).GetValueOrDefault(0)); if (user == null) { response.Error = ErrorCode.ERR_AccountDoesntExist; reply(response); return; } //判斷邀請是否合法 var inviteComponent = Game.Scene.GetComponent <InviteComponent>(); var invite = inviteComponent.GetByInviteId(message.InviteId); if (invite == null) { response.Error = ErrorCode.ERR_InviteIdNotFind; reply(response); return; } if (invite.data.ReceiverUid != player?.uid) { response.Error = ErrorCode.ERR_InviteNotSelf; reply(response); return; } //刪除該邀請 await inviteComponent.DestroyByInviteId(message.InviteId); //判斷房間是否合法 var room = Game.Scene.GetComponent <RoomComponent>().Get(invite.data.TeamRoomId); if (room == null) { response.Error = ErrorCode.ERR_RoomIdNotFound; reply(response); return; } if (room.Type != RoomType.Team) { response.Error = ErrorCode.ERR_RoonTypeError; reply(response); return; } if (room.State != RoomState.Start) { response.Error = ErrorCode.ERR_RoomTeamStateCanNotEnter; reply(response); return; } var roomTeamComponent = room.GetComponent <RoomTeamComponent>(); if (roomTeamComponent == null) { response.Error = ErrorCode.ERR_RoomTeamComponentNull; reply(response); return; } if (room.info.NowMemberCount >= room.info.MaxMemberCount) { response.Error = ErrorCode.ERR_RoomTeamMemberIsFull; reply(response); return; } // 連接到Map伺服器,並創建Unit實體 IPEndPoint mapAddress = StartConfigComponent.Instance.Get(player.mapAppId).GetComponent <InnerConfig>().IPEndPoint; Session mapSession = Game.Scene.GetComponent <NetInnerComponent>().Get(mapAddress); //建立Map實體並進入房間 G2M_MapUnitCreate g2M_MapUnitCreate = new G2M_MapUnitCreate(); g2M_MapUnitCreate.Uid = player.uid; g2M_MapUnitCreate.GateSessionId = session.InstanceId; g2M_MapUnitCreate.MapUnitInfo = new MapUnitInfo() { Name = user.name, Location = user.location, RoomId = room.Id, DistanceTravelled = 0, CharSetting = user.playerCharSetting, //PathId 一般組隊入場再決定 }; //建立自身MapUnit M2G_MapUnitCreate createUnit = (M2G_MapUnitCreate)await mapSession.Call(g2M_MapUnitCreate); g2M_MapUnitCreate.MapUnitInfo.MapUnitId = createUnit.MapUnitId; player.EnterRoom(createUnit.MapUnitId, room); //對全體廣播自己剛建立的MapUnitInfo(不包含自己) TeamMemberData selfMemberData = roomTeamComponent.GetMember(player.uid); M2C_TeamModifyMember m2c_TeamModifyMember = new M2C_TeamModifyMember(); m2c_TeamModifyMember.Uid = player.uid; m2c_TeamModifyMember.MemberData = selfMemberData; MapMessageHelper.BroadcastRoom(room.Id, m2c_TeamModifyMember, player.uid); //回傳資料 response.Info = room.info; response.Data = roomTeamComponent.Data; for (int i = 0; i < roomTeamComponent.MemberDatas.Length; i++) { if (roomTeamComponent.MemberDatas[i] != null) { response.MemberDatas.Add(roomTeamComponent.MemberDatas[i]); } } reply(response); } catch (Exception e) { ReplyError(response, e, reply); } }
public async Task <TeamMember> SaveAsync(string WRpath, string uploadFolderName, TeamMemberData ourTeamMemberData) { var responseAvatarFile = await _fileSaver.SaveAsync(WRpath, uploadFolderName, ourTeamMemberData.avatarFile); var responseImageFile = await _fileSaver.SaveAsync(WRpath, uploadFolderName, ourTeamMemberData.imageFile); if (responseAvatarFile != "Failed" || responseImageFile != "Failed") { var teamMember = new TeamMember { AvatarUrl = responseAvatarFile, FullName = ourTeamMemberData.fullName, Activity = ourTeamMemberData.activity, ImageUrl = responseImageFile, Description = ourTeamMemberData.description, Moto = ourTeamMemberData.moto }; return(await _ourTeamMemberRepository.AddAsync(teamMember)); } return(null); }
private async ETVoid RunAsync(Session session, C2G_TeamReservationJoin message, Action <G2C_TeamReservationJoin> reply) { G2C_TeamReservationJoin response = new G2C_TeamReservationJoin(); try { //取得自身資料 Player player = session.GetComponent <SessionPlayerComponent>().Player; User user = await UserDataHelper.FindOneUser((player?.uid).GetValueOrDefault()); if (user == null) { response.Error = ErrorCode.ERR_AccountDoesntExist; reply(response); return; } //取得預約資料 var reservationComponent = Game.Scene.GetComponent <ReservationComponent>(); var reservation = reservationComponent.GetByReservationId(message.ReservationId); //判斷是否有該預約 if (reservation == null) { response.Error = ErrorCode.ERR_ReservationIdNotFind; reply(response); return; } //判斷是否為被邀請者 if (!reservation.allData.MemberUid.Contains(player.uid)) { response.Error = ErrorCode.ERR_ReservationNotTheOwner; reply(response); return; } //判斷是否有該房間 if (reservation.room == null) { response.Error = ErrorCode.ERR_ReservationRoomNotFind; reply(response); return; } //判斷該房間是否可以進入 if (reservation.room.State != RoomState.Start) { response.Error = ErrorCode.ERR_RoomTeamStateCanNotEnter; reply(response); return; } //判斷是否人滿 if (reservation.room.info.NowMemberCount >= reservation.room.info.MaxMemberCount) { response.Error = ErrorCode.ERR_RoomTeamMemberIsFull; reply(response); return; } //判斷房間資料是否正確 var roomTeamComponent = reservation.room.GetComponent <RoomTeamComponent>(); if (roomTeamComponent == null) { response.Error = ErrorCode.ERR_RoomTeamComponentNull; reply(response); return; } // 連接到Map伺服器,並創建Unit實體 IPEndPoint mapAddress = StartConfigComponent.Instance.Get(player.mapAppId).GetComponent <InnerConfig>().IPEndPoint; Session mapSession = Game.Scene.GetComponent <NetInnerComponent>().Get(mapAddress); //建立Map實體並進入房間 G2M_MapUnitCreate g2M_MapUnitCreate = new G2M_MapUnitCreate(); g2M_MapUnitCreate.Uid = player.uid; g2M_MapUnitCreate.GateSessionId = session.InstanceId; g2M_MapUnitCreate.MapUnitInfo = new MapUnitInfo() { Name = user.name, Location = user.location, RoomId = reservation.room.Id, DistanceTravelled = 0, CharSetting = user.playerCharSetting, //PathId 一般組隊入場再決定 }; //建立自身MapUnit M2G_MapUnitCreate createUnit = (M2G_MapUnitCreate)await mapSession.Call(g2M_MapUnitCreate); g2M_MapUnitCreate.MapUnitInfo.MapUnitId = createUnit.MapUnitId; player.EnterRoom(createUnit.MapUnitId, reservation.room); //對全體廣播自己剛建立的MapUnitInfo(不包含自己) TeamMemberData selfMemberData = roomTeamComponent.GetMember(player.uid); M2C_TeamModifyMember m2c_TeamModifyMember = new M2C_TeamModifyMember(); m2c_TeamModifyMember.Uid = player.uid; m2c_TeamModifyMember.MemberData = selfMemberData; MapMessageHelper.BroadcastRoom(reservation.room.Id, m2c_TeamModifyMember, player.uid); //回傳資料 response.Error = ErrorCode.ERR_Success; response.Info = reservation.room.info; response.Data = roomTeamComponent.Data; for (int i = 0; i < roomTeamComponent.MemberDatas.Length; i++) { if (roomTeamComponent.MemberDatas[i] != null) { response.MemberDatas.Add(roomTeamComponent.MemberDatas[i]); } } for (int i = 0; i < roomTeamComponent.ReservationMembers.Count; i++) { if (roomTeamComponent.ReservationMembers[i] != null) { response.ReservationMemberDatas.Add(roomTeamComponent.ReservationMembers[i]); } } reply(response); } catch (Exception e) { ReplyError(response, e, reply); } }
public static void ProcessAttack(GameClient client, Monster monster, int injure) { try { if (injure > 0) { long tID = ZhuanShengShiLian.GetGUID(client.ClientData.TeamID, client.ClientData.RoleID); string tName = client.ClientData.RoleName; TeamData td = GameManager.TeamMgr.FindData(client.ClientData.TeamID); if (null != td) { lock (td) { TeamMemberData member = td.GetLeader(); if (null != member) { tName = member.RoleName; } } } ZSSLScene mapInfo; if (ZhuanShengShiLian.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out mapInfo)) { bool top5Chg = false; lock (ZhuanShengShiLian.ZhuanShengRunTimeData.Mutex) { BossAttackLog bossAttackLog = mapInfo.AttackLog; if (null == bossAttackLog) { bossAttackLog = new BossAttackLog { InjureSum = 0L, BHInjure = new Dictionary <long, BHAttackLog>(), BHAttackRank = new List <BHAttackLog>() }; } BHAttackLog bhAttackLog; if (!bossAttackLog.BHInjure.TryGetValue(tID, out bhAttackLog)) { bhAttackLog = new BHAttackLog { BHName = tName, BHInjure = 0L, RoleInjure = new Dictionary <int, long>() }; bossAttackLog.BHInjure[tID] = bhAttackLog; } if (!bhAttackLog.RoleInjure.ContainsKey(client.ClientData.RoleID)) { bhAttackLog.RoleInjure[client.ClientData.RoleID] = 0L; } Dictionary <int, long> roleInjure; int roleID; (roleInjure = bhAttackLog.RoleInjure)[roleID = client.ClientData.RoleID] = roleInjure[roleID] + (long)injure; bhAttackLog.BHInjure += (long)injure; top5Chg = ZhuanShengShiLian.TrySortAttackRank(bossAttackLog, bhAttackLog); bossAttackLog.InjureSum += (long)injure; } ZhuanShengShiLian.BroadBossLife(mapInfo, client, top5Chg); } } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Error, string.Format("ZhuanShengShiLian :: 处理攻击boss异常。", new object[0]), ex, true); } }
private void OnBtnUseClicked() { if (!_canClickUseBtn) { return; } _canClickUseBtn = false; object data = GetLineupPresetData(); if (data == null) { EB.Debug.LogError("阵容信息为空"); GlobalMenuManager.Instance.CloseMenu("LTLineupPresetUI"); _canClickUseBtn = true; return; } ArrayList lineupInfo; if (data is int[]) { lineupInfo = new ArrayList(data as int[]); } else { lineupInfo = data as ArrayList; } string teamName = FormationUtil.GetCurrentTeamName(_battleType); List <TeamMemberData> originTeamMembers = new List <TeamMemberData>(LTFormationDataManager.Instance.GetTeamMemList(teamName)); int count = 0; bool hasAlivePartner = false; // 上阵英雄至少要保留一个,故先处理新英雄上阵再处理旧英雄下阵 for (var i = 0; i < lineupInfo.Count; i++) { int heroId = System.Convert.ToInt32(lineupInfo[i]); bool isAlive = true; bool isSleepTower = false; if (heroId != 0 && (_battleType == eBattleType.ChallengeCampaign || _battleType == eBattleType.AlienMazeBattle)) { isAlive = FormationUtil.IsAlive(heroId, false); } if (_battleType == eBattleType.SleepTower && LTClimingTowerHudController.Instance != null) { if (heroId != 0) { isAlive = LTClimingTowerHudController.Instance.CanUpTeam(heroId); } isSleepTower = true; } if (heroId != 0 && isAlive) { hasAlivePartner = true; var memberData = originTeamMembers.Find(member => member.HeroID == heroId); originTeamMembers.Remove(memberData); if (LTFormationDataManager.Instance.CurTeamMemberData != null) { TeamMemberData temp = LTFormationDataManager.Instance.CurTeamMemberData; if (temp.Pos == i) { LTFormationDataManager.Instance.UnUseAllianceMercenary(temp.HeroID, i, null); } } LTFormationDataManager.Instance.RequestDragHeroToFormationPos(heroId, i, teamName, () => { count += 1; if (count >= lineupInfo.Count) { RemoveFromLineup(originTeamMembers, teamName, () => _canClickUseBtn = true); } }); } else { count += 1; if (count >= lineupInfo.Count) { if (hasAlivePartner) { RemoveFromLineup(originTeamMembers, teamName, () => _canClickUseBtn = true); } else { _canClickUseBtn = true; var tips = isSleepTower ? EB.Localizer.GetString("ID_LINEUP_PRESET_ALL_SLEEPED") : EB.Localizer.GetString("ID_LINEUP_PRESET_ALL_KILLED"); MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, tips); } } } } }