public uint Execute(PacketDistributed ipacket) { GC_GUILD_SYNC_HIDEANDSEEK packet = (GC_GUILD_SYNC_HIDEANDSEEK)ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic if (GameManager.gameManager.PlayerDataPool.IsHaveGuild()) { if (packet.HasHideAndSeekWeek) { GameManager.gameManager.PlayerDataPool.GuildInfo.HideAndSeekWeek = packet.HideAndSeekWeek == 1; } if (packet.SceneNpcIdCount > 0) { GameManager.gameManager.PlayerDataPool.GuildInfo.HideAndSeekNpcInfo.Clear(); for (int i = 0; i < packet.SceneNpcIdCount; i++) { GuildHideAndSeekNpc npcInfo = new GuildHideAndSeekNpc(); if (packet.SceneNpcIdCount > i) { npcInfo.SceneNpcId = packet.SceneNpcIdList[i]; } if (packet.SceneNpcFindCount > i) { npcInfo.IsFound = packet.SceneNpcFindList[i] == 1; } if (npcInfo.IsValid()) { GameManager.gameManager.PlayerDataPool.GuildInfo.HideAndSeekNpcInfo.Add(npcInfo); } } } if (GuildActivityLogic.Instance() != null) { GuildActivityLogic.Instance().HandleSyncHideAndSeek(); } } return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
public void UpdateData(GC_GUILD_RET_INFO info) { //清空之前的数据 CleanUp(); //判断消息包数据合法性 if (null == info || info.GuildGuid == GlobeVar.INVALID_GUID) { return; } //填充数据 GuildGuid = info.GuildGuid; if (GuildGuid != GlobeVar.INVALID_GUID) { PreserveGuildGuid.Clear(); } GuildLevel = info.GuildLevel; GuildName = info.GuildName; GuildChiefGuid = info.GuildChiefGuid; GuildExp = info.GuildExp; GuildNotice = info.GuildNotice; GuildDeclaration = info.GuildDeclaration; NeedReserve = info.NeedReserve == 1; LastWeekContri = info.LastWeekContri; if (info.HasPscanacpttimes) { PSCanAcceptTimes = info.Pscanacpttimes; } for (int i = 0; i < info.memberGuidCount; ++i) { GuildMember member = new GuildMember(); //member.CleanUp(); member.Guid = info.GetMemberGuid(i); if (info.memberNameCount > i) { member.MemberName = info.GetMemberName(i); } if (info.memberVIPCount > i) { member.VIP = info.GetMemberVIP(i); } if (info.memberLevelCount > i) { member.Level = info.GetMemberLevel(i); } if (info.memberJobCount > i) { member.Job = info.GetMemberJob(i); } if (info.memberLastLogoutCount > i) { member.LastLogout = info.GetMemberLastLogout(i); } if (info.memberProfCount > i) { member.Profession = info.GetMemberProf(i); } if (info.memberStateCount > i) { member.State = info.GetMemberState(i); } if (info.memberContirbuteCount > i) { member.Contribute = info.GetMemberContirbute(i); } if (info.combatvalCount > i) { member.ComBatVal = info.GetCombatval(i); } if (member.IsValid()) { GuildMemberList.Add(member.Guid, member); } } for (int i = 0; i < info.ViceChiefRoutineCount && i < ViceChiefRoutine.Length; i++) { ViceChiefRoutine[i] = info.ViceChiefRoutineList[i] == 1; } for (int i = 0; i < info.ElderRoutineCount && i < ElderRoutine.Length; i++) { ElderRoutine[i] = info.ElderRoutineList[i] == 1; } for (int i = 0; i < info.GuildJobNameCount && i < GuildJobName.Length; i++) { GuildJobName[i] = info.GuildJobNameList[i]; } int nTextIndex = 0; for (int i = 0; i < info.GuildHistoryTypeCount; i++) { GuildHistory history = new GuildHistory(); if (info.GuildHistoryTypeCount > i) { history.HistoryType = info.GuildHistoryTypeList[i]; } if (info.GuildHistoryTimeCount > i) { history.HistoryTime = info.GuildHistoryTimeList[i]; } for (int j = 0; j < GuildHistory.GetTypeTextCount(history.HistoryType) && j < history.HistoryText.Length; j++) { history.HistoryText[j] = info.GuildHistoryTextList[nTextIndex]; nTextIndex += 1; } if (history.IsValid()) { GuildHistoryInfo.Add(history); } } for (int i = 0; i < info.SceneNpcIdCount; i++) { GuildHideAndSeekNpc npcInfo = new GuildHideAndSeekNpc(); if (info.SceneNpcIdCount > i) { npcInfo.SceneNpcId = info.SceneNpcIdList[i]; } if (info.SceneNpcFindCount > i) { npcInfo.IsFound = info.SceneNpcFindList[i] == 1; } if (npcInfo.IsValid()) { HideAndSeekNpcInfo.Add(npcInfo); } } if (info.HasHideAndSeekWeek) { m_HideAndSeekWeek = info.HideAndSeekWeek == 1; } //按照VIP等级排序 //SortMemberListByVIP(m_GuildMemberList); //按照等级排序 //SortMemberListByLevel(m_GuildMemberList); //按照在线状态进行排序 //SortMemberListByOnLine(m_GuildMemberList); //按照职位排序 //SortMemberListByJob(m_GuildMemberList); // 帮主永远第一位,玩家自己第二位,然后按照官职排,最后按照等级排列 SortByNewRule(); if (ChatInfoLogic.Instance() != null) { ChatInfoLogic.Instance().UpdateGuildChannel(); ChatInfoLogic.Instance().UpdateSpeakerList_Guild(); } }