internal void HandleQueryArenaMatchGroup(ulong guid) { LogSys.Log(LOG_TYPE.DEBUG, "---got query match group msg! id=" + guid); UserInfo user = LobbyServer.Instance.DataProcessScheduler.GetUserInfo(guid); if (user == null) { return; } JsonMessageWithGuid resultMsg = new JsonMessageWithGuid(JsonMessageID.ArenaMatchGroupResult); resultMsg.m_Guid = guid; int cur_user_rank = ArenaSystem.UNKNOWN_RANK; ArenaInfo arena_info = m_ArenaSystem.GetArenaInfoById(guid); if (arena_info != null) { cur_user_rank = arena_info.GetRank(); }; List<MatchGroup> match_groups = m_ArenaSystem.QueryMatchArena(cur_user_rank, 3); ArkCrossEngineMessage.Msg_LC_ArenaMatchGroupResult protoData = new ArkCrossEngineMessage.Msg_LC_ArenaMatchGroupResult(); foreach (MatchGroup group in match_groups) { ArkCrossEngineMessage.Msg_LC_ArenaMatchGroupResult.MatchGroupData group_msg = new ArkCrossEngineMessage.Msg_LC_ArenaMatchGroupResult.MatchGroupData(); group_msg.One = ArenaUtil.CreateArenaInfoMsg(group.One); group_msg.Two = ArenaUtil.CreateArenaInfoMsg(group.Two); group_msg.Three = ArenaUtil.CreateArenaInfoMsg(group.Three); if (group_msg.One == null || group_msg.Two == null || group_msg.Three == null) { continue; } protoData.m_MatchGroups.Add(group_msg); } resultMsg.m_ProtoData = protoData; JsonMessageDispatcher.SendDcoreMessage(user.NodeName, resultMsg); LogSys.Log(LOG_TYPE.DEBUG, "---send match group msg! id=" + guid); }
internal void HandleQueryArenaInfo(ulong guid) { LogSys.Log(LOG_TYPE.DEBUG, "---got query arena info msg! id=" + guid); UserInfo user = LobbyServer.Instance.DataProcessScheduler.GetUserInfo(guid); if (user == null) { return; } JsonMessageWithGuid resultMsg = new JsonMessageWithGuid(JsonMessageID.ArenaInfoResult); resultMsg.m_Guid = guid; ArkCrossEngineMessage.Msg_LC_ArenaInfoResult protoData = new ArkCrossEngineMessage.Msg_LC_ArenaInfoResult(); ArenaInfo own_arena = m_ArenaSystem.GetArenaInfoById(guid); if (own_arena == null) { own_arena = m_ArenaSystem.CreateArenaInfo(user); } else if (own_arena.IsNeedUpdate(user)) { own_arena.UpdateArenaInfo(user); } m_ArenaSystem.ResetArenaFightCount(own_arena); protoData.m_ArenaInfo = ArenaUtil.CreateArenaInfoMsg(own_arena, false); protoData.m_LeftBattleCount = own_arena.LeftFightCount; protoData.m_CurFightCountByTime = own_arena.FightCountBuyTime; long passed_time = (long)(DateTime.Now - own_arena.LastBattleTime).TotalMilliseconds; protoData.m_BattleLeftCDTime = m_ArenaSystem.BaseConfig.BattleCd - passed_time; resultMsg.m_ProtoData = protoData; JsonMessageDispatcher.SendDcoreMessage(user.NodeName, resultMsg); LogSys.Log(LOG_TYPE.DEBUG, "---send query arena info msg! id=" + guid); }
internal void HandleArenaQueryRank(ulong guid, int handle) { JsonMessageWithGuid resultMsg = new JsonMessageWithGuid(JsonMessageID.ArenaQueryRankResult); resultMsg.m_Guid = guid; ArkCrossEngineMessage.Msg_LC_ArenaQueryRankResult protoData = new ArkCrossEngineMessage.Msg_LC_ArenaQueryRankResult(); ArenaInfo cur_info = m_ArenaSystem.GetArenaInfoById(guid); if (cur_info != null) { List<ArenaInfo> result = m_ArenaSystem.QueryRankList(cur_info.GetRank()); for (int i = 0; i < result.Count; i++) { protoData.RankMsg.Add(ArenaUtil.CreateArenaInfoMsg(result[i])); } } resultMsg.m_ProtoData = protoData; JsonMessageDispatcher.SendDcoreMessage(handle, resultMsg); LogSys.Log(LOG_TYPE.DEBUG, "send query rank list!"); }