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); }
protected void Awake() { this.Show(false); this.m_headers = new Dictionary <string, string>(); this.m_headers["Accept"] = "application/json"; string str = (BattleNet.GetCurrentRegion() != Network.BnetRegion.REGION_CN) ? "us" : "cn"; string str2 = "https://api.battlenet.com.cn/cms/ad/list?locale=zh_cn&community=hearthstone&mediaCategory=IN_GAME_AD&apikey=4r78qhz9atqzsxkk2qhqku6gy7p9tj8c"; string str3 = string.Format("https://us.api.battle.net/cms/ad/list?locale={0}&community=hearthstone&mediaCategory=IN_GAME_AD&apikey=4r78qhz9atqzsxkk2qhqku6gy7p9tj8c", Localization.GetLocaleName()); if (str.Equals("cn")) { this.m_url = str2; } else { this.m_url = str3; } Log.InnKeepersSpecial.Print("Inkeeper Ad: " + this.m_url, new object[0]); this.m_link = null; this.adButton.AddEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.Click)); this.Update(); }
private bool CurrentRegionIsCN() { return(BattleNet.GetCurrentRegion() == Network.BnetRegion.REGION_CN); }