private void CheckForNewRank(BnetPlayer player) { MedalInfoTranslator rankPresenceField = RankMgr.Get().GetRankPresenceField(player); if (rankPresenceField != null) { BnetGameAccountId hearthstoneGameAccountId = player.GetHearthstoneGameAccountId(); int rank = rankPresenceField.GetCurrentMedal().rank; if (!this.m_lastKnownMedal.ContainsKey(hearthstoneGameAccountId)) { this.m_lastKnownMedal[hearthstoneGameAccountId] = rank; } else if ((rank <= 10) && (this.m_lastKnownMedal[hearthstoneGameAccountId] > rank)) { this.m_lastKnownMedal[hearthstoneGameAccountId] = rank; if (rank == 0) { object[] args = new object[] { "5ecaf0ff", player.GetBestName() }; this.AddToast(GameStrings.Format("GLOBAL_SOCIAL_TOAST_FRIEND_RANK_LEGEND", args)); } else { object[] objArray2 = new object[] { "5ecaf0ff", player.GetBestName(), rankPresenceField.GetCurrentMedal().rank }; this.AddToast(GameStrings.Format("GLOBAL_SOCIAL_TOAST_FRIEND_GAINED_RANK", objArray2)); } } } }
public void RunJob(DateTime nextTime) { _nextTime = nextTime; try { var list = RankMgr.GetRankList(_rankType, _domainId); if (list == null) { return; } if (_rankType == EnumRankType.LevelRank) { foreach (var entity in list) { var levelEntity = entity as RankLevelEntity; if (levelEntity != null) { levelEntity.Exp = levelEntity.Exp + CacheFactory.ManagerDataCache.GetTotalExp(levelEntity.Level); } } } _rankList = list; _totalRecord = _rankList.Count; _rankLinkDic = _rankList.ToDictionary(d => d.ManagerId, d => d); } catch (Exception ex) { SystemlogMgr.Error("RankHandler run job", "[" + _rankType + "]," + ex.Message, ex.StackTrace); } }
public static RankMgr Get() { if (s_instance == null) { s_instance = new RankMgr(); } return(s_instance); }
private void UpdateRank() { if (this.ShouldUseBogusRank()) { this.m_medalInfo = new MedalInfoTranslator(); } else { BnetPlayer player = BnetPresenceMgr.Get().GetPlayer(this.m_gameAccountId); this.m_medalInfo = RankMgr.Get().GetRankPresenceField(player); } }
public static void OnMessageRecv(Message msg) { var response = new MsgAccountInfoResponse(); var p = BnetPresenceMgr.Get().GetMyPlayer(); string name = p.GetBattleTag().GetName(); string region = BattleNet.GetCurrentRegion().ToString().Substring(7); response.Name = name + "-" + region; response.Dust = NetCache.Get().GetNetObject <NetCache.NetCacheArcaneDustBalance>().Balance; response.Gold = NetCache.Get().GetNetObject <NetCache.NetCacheGoldBalance>().GetTotal(); response.Packs = NetCache.Get().GetNetObject <NetCache.NetCacheBoosters>().GetTotalNumBoosters(); var rm = RankMgr.Get(); var rpf = rm.GetRankPresenceField(p); var medal = rpf.GetCurrentMedal(); response.Rank = medal.rank; response.Stars = medal.earnedStars; HSMPClient.Get().Send(response); // TEST var deckList = new MsgDeckList(); var list = new List <MsgDeckList.Deck>(); var cm = CollectionManager.Get(); foreach (var k in cm.GetDecks()) { var deck = new MsgDeckList.Deck(); deck.ID = k.Value.ID; deck.Name = k.Value.Name; deck.HeroClass = k.Value.GetClass(); list.Add(deck); } deckList.Decks = list; HSMPClient.Get().Send(deckList); }
public virtual void UpdateFriend() { this.m_ChatIcon.UpdateIcon(); if (this.m_player != null) { Color color; if (this.m_player.IsOnline()) { if (this.m_player.IsAway()) { color = TEXT_COLOR_AWAY; } else if (this.m_player.IsBusy()) { color = TEXT_COLOR_BUSY; } else { color = TEXT_COLOR_NORMAL; } } else { color = TEXT_COLOR_OFFLINE; } this.m_StatusText.TextColor = color; BnetGameAccount hearthstoneGameAccount = this.m_player.GetHearthstoneGameAccount(); this.m_medal = (hearthstoneGameAccount != null) ? RankMgr.Get().GetRankPresenceField(hearthstoneGameAccount) : null; if ((this.m_medal == null) || (this.m_medal.GetCurrentMedal().rank == 0x19)) { this.m_rankMedal.gameObject.SetActive(false); this.m_PlayerIcon.Show(); } else { this.m_PlayerIcon.Hide(); this.m_rankMedal.gameObject.SetActive(true); this.m_rankMedal.SetMedal(this.m_medal, false); } } }
void Awake() { instance = this; }
void OnDestroy() { instance = null; EventMgr.instance.RemoveListener(this); }
void Awake() { rankMgr = GameObject.Find("RankMgr").GetComponent <RankMgr>(); }