protected override void ShowReward(bool updateCacheValues) { ArcaneDustRewardData data = base.Data as ArcaneDustRewardData; if (data == null) { Debug.LogWarning(string.Format("ArcaneDustReward.ShowReward() - Data {0} is not ArcaneDustRewardData", base.Data)); } else { if (!data.IsDummyReward && updateCacheValues) { NetCache.Get().OnArcaneDustBalanceChanged((long)data.Amount); if (CraftingManager.Get() != null) { CraftingManager.Get().AdjustLocalArcaneDustBalance(data.Amount); CraftingManager.Get().UpdateBankText(); } } base.m_root.SetActive(true); this.m_dustCount.Text = data.Amount.ToString(); Vector3 localScale = this.m_dustJar.transform.localScale; this.m_dustJar.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); object[] args = new object[] { "scale", localScale, "time", 0.5f, "easetype", iTween.EaseType.easeOutElastic }; iTween.ScaleTo(this.m_dustJar.gameObject, iTween.Hash(args)); } }
public static FixedRewardsMgr Get() { if (s_instance == null) { s_instance = new FixedRewardsMgr(); ApplicationMgr.Get().WillReset += new System.Action(s_instance.WillReset); } if (!s_instance.m_registeredForAdventureProgressUpdates) { s_instance.m_registeredForAdventureProgressUpdates = AdventureProgressMgr.Get().RegisterProgressUpdatedListener(new AdventureProgressMgr.AdventureProgressUpdatedCallback(s_instance.OnAdventureProgressUpdate)); } if (!s_instance.m_registeredForProfileNotices) { NetCache.Get().RegisterNewNoticesListener(new NetCache.DelNewNoticesListener(s_instance.OnNewNotices)); s_instance.m_registeredForProfileNotices = true; } if (!s_instance.m_registeredForCompletedAchieves) { AchieveManager.Get().RegisterNewlyCompletedAchievesListener(new AchieveManager.NewlyAcompletedAchievesCallback(s_instance.OnNewlyCompletedAchieves)); s_instance.m_registeredForCompletedAchieves = true; } if (!s_instance.m_registeredForAccountLicenseUpdates) { AccountLicenseMgr.Get().RegisterAccountLicensesChangedListener(new AccountLicenseMgr.AccountLicensesChangedCallback(s_instance.OnAccountLicensesUpdate)); s_instance.m_registeredForAccountLicenseUpdates = true; } return(s_instance); }
private void AddRewardsToCacheValues() { bool flag = false; foreach (RewardData data in this.m_Rewards) { switch (data.RewardType) { case Reward.Type.ARCANE_DUST: { ArcaneDustRewardData data2 = (ArcaneDustRewardData)data; NetCache.Get().OnArcaneDustBalanceChanged((long)data2.Amount); break; } case Reward.Type.CARD: { CardRewardData data3 = (CardRewardData)data; CollectionManager.Get().OnCardRewardOpened(data3.CardID, data3.Premium, data3.Count); break; } case Reward.Type.GOLD: flag = true; break; } } if (flag) { NetCache.Get().RefreshNetObject <NetCache.NetCacheGoldBalance>(); } }
public static async Task <bool> IsValidUrl(string url) { if (!Regex.IsMatch(url, NomalizedPattern)) { return(false); } var hp = new HttpHelper(); string html = null; if (!NetCache.HasCache(url)) { html = await hp.GET(url, encoding : Encoding.UTF8); NetCache.Set(url, html); } else { html = NetCache.Get(url); } if (!html.IsEmpty(true) && Regex.IsMatch(html, TitlePattern)) { return(!Regex.Match(html, TitlePattern).Groups[1].Value.AnyEquals("Youtube")); } return(false); }
public void Show() { this.m_isShown = true; base.gameObject.SetActive(true); this.ShowImpl(); if (!GameMgr.Get().IsTutorial() && !GameMgr.Get().IsSpectator()) { NetCache.HeroLevel heroLevel = GameUtils.GetHeroLevel(GameState.Get().GetFriendlySidePlayer().GetStartingHero().GetClass()); if (heroLevel == null) { this.HideXpBar(); } else { this.m_xpBar = UnityEngine.Object.Instantiate <HeroXPBar>(this.m_xpBarPrefab); this.m_xpBar.transform.parent = this.m_heroActor.transform; this.m_xpBar.transform.localScale = new Vector3(0.88f, 0.88f, 0.88f); this.m_xpBar.transform.localPosition = new Vector3(-0.1886583f, 0.2122119f, -0.7446293f); this.m_xpBar.m_soloLevelLimit = NetCache.Get().GetNetObject <NetCache.NetCacheRewardProgress>().XPSoloLimit; this.m_xpBar.m_isAnimated = true; this.m_xpBar.m_delay = BAR_ANIMATION_DELAY; this.m_xpBar.m_heroLevel = heroLevel; this.m_xpBar.m_levelUpCallback = new HeroXPBar.PlayLevelUpEffectCallback(this.PlayLevelUpEffect); this.m_xpBar.UpdateDisplay(); } } }
/* --- Static Methods (Interface) --- */ public static void Load() { // connect to the bot server if (HSMPClient.Get() == null) { HSMPClient.Connect("foobar"); } if (NetCache.Get() == null || BnetPresenceMgr.Get() == null || BnetPresenceMgr.Get().GetMyPlayer() == null) { HSMPClient.Get().Send(new MsgStatus(MsgStatus.State.HANDSHAKE_FAILED, MsgStatus.User.CLIENT, "Hearthstone is initializing, please wait...")); return; } if (s_loaded == false) { // create root game object UnityEngine.GameObject root = new UnityEngine.GameObject("HookRoot"); root.transform.parent = BaseUI.Get().transform; // initialize subcomponents AttachScripts(root); InstallNetworkSniffers(root); RegisterMessageListeners(root); s_loaded = true; } HSMPClient.Get().Send(new MsgStatus(MsgStatus.State.CONNECTED, MsgStatus.User.CLIENT, "Success")); }
private void UpdateTourneyPage() { if (!NetCache.Get().GetNetObject <NetCache.NetCacheFeatures>().Games.Tournament) { if (!SceneMgr.Get().IsModeRequested(SceneMgr.Mode.HUB)) { SceneMgr.Get().SetNextMode(SceneMgr.Mode.HUB); Error.AddWarningLoc("GLOBAL_FEATURE_DISABLED_TITLE", "GLOBAL_FEATURE_DISABLED_MESSAGE_PLAY", new object[0]); } } else { NetCache.NetCacheMedalInfo netObject = NetCache.Get().GetNetObject <NetCache.NetCacheMedalInfo>(); bool flag = (this.m_currentMedalInfo != null) && ((netObject.StarLevel != this.m_currentMedalInfo.StarLevel) || (netObject.Stars != this.m_currentMedalInfo.Stars)); this.m_currentMedalInfo = netObject; if (flag) { foreach (DelMedalChanged changed in this.m_medalChangedListeners.ToArray()) { changed(this.m_currentMedalInfo); } } this.m_netCacheReturned = true; } }
private void Awake() { NetCache.Get().RegisterGoldBalanceListener(new NetCache.DelGoldBalanceListener(this.OnGoldBalanceChanged)); this.m_mouseOverZone.AddEventListener(UIEventType.ROLLOVER, new UIEvent.Handler(this.OnFrameMouseOver)); this.m_mouseOverZone.AddEventListener(UIEventType.ROLLOUT, new UIEvent.Handler(this.OnFrameMouseOut)); SceneMgr.Get().RegisterSceneLoadedEvent(new SceneMgr.SceneLoadedCallback(this.OnSceneLoaded)); }
private void UpdateAmount(CurrencyType currencyType) { long amount = 0L; switch (currencyType) { case CurrencyType.NONE: return; case CurrencyType.GOLD: amount = NetCache.Get().GetNetObject <NetCache.NetCacheGoldBalance>().GetTotal(); this.SetAmount(amount); return; case CurrencyType.ARCANE_DUST: if (CraftingManager.Get() == null) { amount = NetCache.Get().GetNetObject <NetCache.NetCacheArcaneDustBalance>().Balance; break; } amount = CraftingManager.Get().GetLocalArcaneDustBalance(); break; default: return; } this.SetAmount(amount); }
private void SetUpBuyWithGoldButton() { string text = string.Empty; NoGTAPPTransactionData noGTAPPTransactionData = new NoGTAPPTransactionData { Product = ProductType.PRODUCT_TYPE_DRAFT, ProductData = 0, Quantity = 1 }; long goldCostNoGTAPP = StoreManager.Get().GetGoldCostNoGTAPP(noGTAPPTransactionData); if (goldCostNoGTAPP > 0L) { this.m_goldTransactionData = noGTAPPTransactionData; text = goldCostNoGTAPP.ToString(); NetCache.NetCacheGoldBalance netObject = NetCache.Get().GetNetObject <NetCache.NetCacheGoldBalance>(); this.UpdateGoldButtonState(netObject); } else { Debug.LogWarning("ForgeStore.SetUpBuyWithGoldButton(): no gold price for purchase Arena without GTAPP"); text = GameStrings.Get("GLUE_STORE_PRODUCT_PRICE_NA"); base.SetGoldButtonState(Store.BuyButtonState.DISABLED); } base.m_buyWithGoldButton.SetText(text); }
protected override void ShowReward(bool updateCacheValues) { GoldRewardData data = base.Data as GoldRewardData; if (!data.IsDummyReward) { bool flag = false; if (base.Data.Origin == NetCache.ProfileNotice.NoticeOrigin.BETA_REIMBURSE) { flag = NetCache.Get().GetNetObject <NetCache.NetCacheGoldBalance>().GetTotal() == 0L; } else { flag = updateCacheValues; } if (flag) { NetCache.Get().RefreshNetObject <NetCache.NetCacheGoldBalance>(); } } base.m_root.SetActive(true); Vector3 localScale = this.m_coin.transform.localScale; this.m_coin.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); object[] args = new object[] { "scale", localScale, "time", 0.5f, "easetype", iTween.EaseType.easeOutElastic }; iTween.ScaleTo(this.m_coin.gameObject, iTween.Hash(args)); this.m_coin.transform.localEulerAngles = new Vector3(0f, 180f, 180f); object[] objArray2 = new object[] { "amount", new Vector3(0f, 0f, 540f), "time", 1.5f, "easeType", iTween.EaseType.easeOutElastic, "space", Space.Self }; Hashtable hashtable = iTween.Hash(objArray2); iTween.RotateAdd(this.m_coin.gameObject, hashtable); }
public bool ReconnectFromLogin() { NetCache.ProfileNoticeDisconnectedGame dCGameNotice = this.GetDCGameNotice(); if (dCGameNotice == null) { return(false); } if (!this.IsReconnectEnabled()) { return(false); } if (dCGameNotice.GameResult != ProfileNoticeDisconnectedGameResult.GameResult.GR_PLAYING) { this.OnGameResult(dCGameNotice); return(false); } if (dCGameNotice.GameType == GameType.GT_UNKNOWN) { return(false); } this.m_pendingReconnectNotice = dCGameNotice; ReconnectType lOGIN = ReconnectType.LOGIN; this.StartReconnecting(lOGIN); NetCache.Get().RegisterReconnectMgr(new NetCache.NetCacheCallback(this.OnNetCacheReady)); return(true); }
public void SetULong(Option option, ulong val) { string str; if (this.m_clientOptionMap.TryGetValue(option, out str)) { bool existed = LocalOptions.Get().Has(str); ulong uLong = LocalOptions.Get().GetULong(str); if (!existed || (uLong != val)) { LocalOptions.Get().Set(str, val); this.FireChangedEvent(option, uLong, existed); } } else { ServerOption option2; if (this.m_serverOptionMap.TryGetValue(option, out option2)) { ulong num2; bool uLongOption = NetCache.Get().GetULongOption(option2, out num2); if (!uLongOption || (num2 != val)) { NetCache.Get().SetULongOption(option2, val); this.FireChangedEvent(option, num2, uLongOption); } } } }
public void EnterCraftMode(CollectionCardVisual cardToDisplay) { if (!this.m_cancellingCraftMode && !CollectionDeckTray.Get().IsWaitingToDeleteDeck()) { CollectionManagerDisplay.Get().HideAllTips(); this.m_arcaneDustBalance = NetCache.Get().GetNetObject <NetCache.NetCacheArcaneDustBalance>().Balance; this.m_offClickCatcher.enabled = true; KeywordHelpPanelManager.Get().HideKeywordHelp(); this.MoveCardToBigSpot(cardToDisplay, true); if (this.m_craftingUI == null) { string name = (UniversalInputManager.UsePhoneUI == null) ? "CraftingUI" : "CraftingUI_Phone"; this.m_craftingUI = AssetLoader.Get().LoadGameObject(name, true, false).GetComponent <CraftingUI>(); this.m_craftingUI.SetStartingActive(); GameUtils.SetParent(this.m_craftingUI, this.m_showCraftingUIBone.gameObject, false); } if ((this.m_cardInfoPane == null) && (UniversalInputManager.UsePhoneUI == null)) { this.m_cardInfoPane = AssetLoader.Get().LoadGameObject("CardInfoPane", true, false).GetComponent <CardInfoPane>(); } this.m_craftingUI.gameObject.SetActive(true); this.m_craftingUI.Enable(this.m_showCraftingUIBone.position, this.m_hideCraftingUIBone.position); this.FadeEffectsIn(); this.UpdateCardInfoPane(); Navigation.Push(new Navigation.NavigateBackHandler(this.CancelCraftMode)); } }
public void SetInt(Option option, int val) { string str; if (this.m_clientOptionMap.TryGetValue(option, out str)) { bool existed = LocalOptions.Get().Has(str); int @int = LocalOptions.Get().GetInt(str); if (!existed || (@int != val)) { LocalOptions.Get().Set(str, val); this.FireChangedEvent(option, @int, existed); } } else { ServerOption option2; if (this.m_serverOptionMap.TryGetValue(option, out option2)) { int num2; bool intOption = NetCache.Get().GetIntOption(option2, out num2); if (!intOption || (num2 != val)) { NetCache.Get().SetIntOption(option2, val); this.FireChangedEvent(option, num2, intOption); } } } }
private void Awake() { s_instance = this; AssetLoader.Get().LoadActor((UniversalInputManager.UsePhoneUI == null) ? "DeckPickerTray" : "DeckPickerTray_phone", delegate(string name, GameObject go, object data) { if (go == null) { Debug.LogError("Unable to load DeckPickerTray."); } else { this.m_deckPickerTray = go.GetComponent <DeckPickerTrayDisplay>(); if (this.m_deckPickerTray == null) { Debug.LogError("DeckPickerTrayDisplay component not found in DeckPickerTray object."); } else { GameUtils.SetParent(this.m_deckPickerTray, this.m_deckPickerTrayContainer, false); this.m_deckPickerTray.SetHeaderText(GameStrings.Get(!FriendChallengeMgr.Get().IsChallengeTavernBrawl() ? "GLOBAL_FRIEND_CHALLENGE_TITLE" : "GLOBAL_TAVERN_BRAWL")); this.m_deckPickerTray.Init(); this.DisableOtherModeStuff(); NetCache.Get().RegisterScreenFriendly(new NetCache.NetCacheCallback(this.OnNetCacheReady)); MusicManager.Get().StartPlaylist(!FriendChallengeMgr.Get().IsChallengeTavernBrawl() ? MusicPlaylistType.UI_Friendly : MusicPlaylistType.UI_TavernBrawl); } } }, null, false); }
public static void OnMassDisenchantResponse() { var pkt = ConnectAPI.GetMassDisenchantResponse(); long balance = NetCache.Get().GetNetObject <NetCache.NetCacheArcaneDustBalance>().Balance; HSMPClient.Get().SendDebugMessage("OnMassDisenchantResponse: " + balance + " +- " + pkt.Amount); HSMPClient.Get().Send(new MsgCurrencyBalance(MsgCurrencyBalance.CurrencyType.DUST, balance + pkt.Amount)); }
protected override void Awake() { base.Awake(); if (base.ShouldMakeUtilRequests()) { NetCache.Get().RegisterScreenEndOfGame(new NetCache.NetCacheCallback(this.OnNetCacheReady)); } }
private bool HasServerOptionFlag(ServerOptionFlag serverOptionFlag) { ServerOption option; ulong num; ulong num2; this.GetServerOptionFlagInfo(serverOptionFlag, out option, out num, out num2); return((NetCache.Get().GetULongOption(option) & num2) != 0L); }
private void DeleteServerOption(Option option, ServerOption serverOption) { if (NetCache.Get().ClientOptionExists(serverOption)) { object prevVal = this.GetServerOption(option, serverOption); NetCache.Get().DeleteClientOption(serverOption); this.RemoveListeners(option, prevVal); } }
public static void OnPurchaseWithGoldResponse() { var pkt = ConnectAPI.GetPurchaseWithGoldResponse(); long balance = NetCache.Get().GetNetObject <NetCache.NetCacheArcaneDustBalance>().Balance; long used = pkt.GoldUsed; HSMPClient.Get().SendDebugMessage("OnPurchaseWithGoldResponse: " + balance + " - " + used); HSMPClient.Get().Send(new MsgCurrencyBalance(MsgCurrencyBalance.CurrencyType.GOLD, balance - used)); }
private void OnNetCacheReady() { NetCache.Get().UnregisterNetCacheHandler(new NetCache.NetCacheCallback(this.OnNetCacheReady)); this.m_netCacheReady = true; if (SceneMgr.Get().GetMode() != SceneMgr.Mode.FATAL_ERROR) { this.UpdateMyAvailability(); } }
protected override void OnDataSet(bool updateVisuals) { if (updateVisuals) { GoldRewardData data = base.Data as GoldRewardData; if (data == null) { Debug.LogWarning(string.Format("goldRewardData.SetData() - data {0} is not GoldRewardData", base.Data)); } else { string headline = GameStrings.Get("GLOBAL_REWARD_GOLD_HEADLINE"); string details = data.Amount.ToString(); string source = string.Empty; UberText text = this.m_coin.GetComponentsInChildren <UberText>(true)[0]; if (text != null) { base.m_rewardBanner.m_detailsText = text; base.m_rewardBanner.AlignHeadlineToCenterBone(); } NetCache.ProfileNotice.NoticeOrigin origin = base.Data.Origin; switch (origin) { case NetCache.ProfileNotice.NoticeOrigin.BETA_REIMBURSE: headline = GameStrings.Get("GLOBAL_BETA_REIMBURSEMENT_HEADLINE"); source = GameStrings.Get("GLOBAL_BETA_REIMBURSEMENT_DETAILS"); break; case NetCache.ProfileNotice.NoticeOrigin.TOURNEY: { NetCache.NetCacheRewardProgress netObject = NetCache.Get().GetNetObject <NetCache.NetCacheRewardProgress>(); object[] args = new object[] { netObject.WinsPerGold }; source = GameStrings.Format("GLOBAL_REWARD_GOLD_SOURCE_TOURNEY", args); break; } default: if (origin == NetCache.ProfileNotice.NoticeOrigin.IGR) { if (data.Date.HasValue) { object[] objArray2 = new object[] { data.Date }; string str4 = GameStrings.Format("GLOBAL_CURRENT_DATE", objArray2); object[] objArray3 = new object[] { str4 }; source = GameStrings.Format("GLOBAL_REWARD_GOLD_SOURCE_IGR_DATED", objArray3); } else { source = GameStrings.Get("GLOBAL_REWARD_GOLD_SOURCE_IGR"); } } break; } base.SetRewardText(headline, details, source); } } }
public static int GetBoosterCount() { NetCache.NetCacheBoosters netObject = NetCache.Get().GetNetObject <NetCache.NetCacheBoosters>(); if (netObject == null) { return(0); } return(netObject.GetTotalNumBoosters()); }
public HashSet <int> GetCardBacksOwned() { NetCache.NetCacheCardBacks netObject = NetCache.Get().GetNetObject <NetCache.NetCacheCardBacks>(); if (netObject == null) { UnityEngine.Debug.LogWarning("CardBackManager.GetCardBacksOwned(): trying to access NetCacheCardBacks before it's been loaded"); return(null); } return(netObject.CardBacks); }
private void OnDestroy() { NetCache.Get().UnregisterNetCacheHandler(new NetCache.NetCacheCallback(this.OnNetCacheReady)); if (CheatMgr.Get() != null) { CheatMgr.Get().UnregisterCheatHandler("replaymissions", new CheatMgr.ProcessCheatCallback(this.OnProcessCheat_replaymissions)); CheatMgr.Get().UnregisterCheatHandler("replaymission", new CheatMgr.ProcessCheatCallback(this.OnProcessCheat_replaymissions)); } s_instance = null; }
public virtual void Awake() { IGGString.Init(); DontDestroyOnLoad(gameObject); //Application.targetFrameRate = 30; SceneM.LinkScheduler(gameObject); EventCenter.Init(); NetCache.Init(); protobufM.Init(); }
private int GetDisplayBannerId() { int @int = Vars.Key("Events.BannerIdOverride").GetInt(0); if (@int != 0) { return(@int); } NetCache.NetCacheProfileProgress netObject = NetCache.Get().GetNetObject <NetCache.NetCacheProfileProgress>(); return((netObject != null) ? netObject.DisplayBanner : 0); }
private void OnDestroy() { if (NetCache.Get() != null) { NetCache.Get().RemoveGoldBalanceListener(new NetCache.DelGoldBalanceListener(this.OnGoldBalanceChanged)); } if (SceneMgr.Get() != null) { SceneMgr.Get().UnregisterSceneLoadedEvent(new SceneMgr.SceneLoadedCallback(this.OnSceneLoaded)); } }
public static void Init() { if (s_instance == null) { s_instance = new AdventureProgressMgr(); Network.Get().RegisterNetHandler(AdventureProgressResponse.PacketID.ID, new Network.NetHandler(s_instance.OnAdventureProgress), null); NetCache.Get().RegisterNewNoticesListener(new NetCache.DelNewNoticesListener(s_instance.OnNewNotices)); ApplicationMgr.Get().WillReset += new System.Action(s_instance.WillReset); } Network.RequestAdventureProgress(); }