internal static void UpdateGowRank(UserInfo entity) { if (null == entity) return; GowRankConfig cfg = null; if (GowSystem.RankData.TryGetValue(entity.GowInfo.RankId, out cfg)) { if (cfg.m_IsTriggerAdvance && IsInUpMetches(entity, cfg.m_Point)) { if (CanAdvanceRank(entity, cfg)) { entity.GowInfo.RankId += 1; entity.GowInfo.Point = 0; entity.GowInfo.ResetCriticalData(); } } else if (cfg.m_IsTriggerReduced && IsInDownMetches(entity)) { if (CanReduceRank(entity, cfg)) { entity.GowInfo.RankId -= 1; entity.GowInfo.Point = 0; entity.GowInfo.ResetCriticalData(); } } } LogSys.Log(LOG_TYPE.INFO, "gowrank entitynickname:{0},rank:{1},point:{2},total:{3},win:{4},loss:{5}", entity.Nickname, entity.GowInfo.RankId, entity.GowInfo.Point, entity.GowInfo.CriticalTotalMatches, entity.GowInfo.AmassWinMatches, entity.GowInfo.AmassLossMatches); }
private static bool CanReduceRank(UserInfo user, GowRankConfig cfg) { int win = user.GowInfo.AmassWinMatches; int loss = user.GowInfo.AmassLossMatches; if (loss >= cfg.m_LossesMatches) { return true; } return false; }
private static bool CanAdvanceRank(UserInfo user, GowRankConfig cfg) { int win = user.GowInfo.AmassWinMatches; int loss = user.GowInfo.AmassLossMatches; int allow_loss_count = cfg.m_TotalMatches - cfg.m_WinMatches; if (loss > allow_loss_count) { return false; } if (win < cfg.m_WinMatches) { return false; } return true; }
private static void UpdateLoserPoint(UserInfo user, int reduce) { if (null == user) return; GowRankConfig cfg = null; if (GowSystem.RankData.TryGetValue(user.GowInfo.RankId, out cfg)) { if (cfg.m_IsTriggerReduced && IsInDownMetches(user)) { user.GowInfo.IncreaseLossMatches(); } else if (cfg.m_IsTriggerAdvance && IsInUpMetches(user, cfg.m_Point)) { user.GowInfo.IncreaseLossMatches(); } else { ReducePoint(user, reduce); } } }
private static void UpdateWinnerPoint(UserInfo user, int income) { if (null == user) return; GowRankConfig cfg = null; if (GowSystem.RankData.TryGetValue(user.GowInfo.RankId, out cfg)) { if (cfg.m_IsTriggerAdvance && IsInUpMetches(user, cfg.m_Point)) { user.GowInfo.IncreaseWinMatches(); } else if (cfg.m_IsTriggerReduced && IsInDownMetches(user)) { user.GowInfo.ResetCriticalData(); IncreasePoint(user, income, cfg.m_Point); } else { IncreasePoint(user, income, cfg.m_Point); } } }