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 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);
 }
예제 #3
0
 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;
 }
예제 #4
0
    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);
    }
 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();
 }
예제 #6
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 void AddNewCardBack(int cardBackID)
 {
     NetCache.NetCacheCardBacks netObject = NetCache.Get().GetNetObject <NetCache.NetCacheCardBacks>();
     if (netObject == null)
     {
         UnityEngine.Debug.LogWarning(string.Format("CardBackManager.AddNewCardBack({0}): trying to access NetCacheCardBacks before it's been loaded", cardBackID));
     }
     else
     {
         netObject.CardBacks.Add(cardBackID);
     }
 }
 private void OnNetCacheReady()
 {
     NetCache.Get().UnregisterNetCacheHandler(new NetCache.NetCacheCallback(this.OnNetCacheReady));
     if (AchieveManager.Get().HasActiveQuests(true))
     {
         WelcomeQuests.Show(false, null, false);
     }
     else
     {
         GameToastMgr.Get().UpdateQuestProgressToasts();
     }
 }
 public void CheckForTutorialComplete(List <CardRewardData> cardRewards)
 {
     NetCache.NetCacheProfileProgress netObject = NetCache.Get().GetNetObject <NetCache.NetCacheProfileProgress>();
     if (netObject == null)
     {
         Debug.LogWarning(string.Format("FixedRewardsMgr.CheckForTutorialComplete(): null == NetCache.NetCacheProfileProgress", new object[0]));
     }
     else
     {
         this.TriggerTutorialProgressAction(false, (int)netObject.CampaignProgress, cardRewards);
     }
 }
    public void UpdateMode()
    {
        bool @bool = Options.Get().GetBool(Option.IN_RANKED_PLAY_MODE);

        NetCache.NetCacheFeatures netObject = NetCache.Get().GetNetObject <NetCache.NetCacheFeatures>();
        if (((netObject != null) && (netObject.Games != null)) && !netObject.Games.Casual)
        {
            this.m_casualButton.SetEnabled(false);
            if (!@bool)
            {
                @bool = true;
                Options.Get().SetBool(Option.IN_RANKED_PLAY_MODE, true);
            }
        }
        else
        {
            this.m_casualButton.SetEnabled(true);
        }
        if (@bool)
        {
            DeckPickerTrayDisplay.Get().SetPlayButtonText(GameStrings.Get("GLOBAL_PLAY_RANKED"));
            if (UniversalInputManager.UsePhoneUI != null)
            {
                DeckPickerTrayDisplay.Get().ToggleRankedDetailsTray(true);
            }
            this.m_casualButton.AddEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.OnCasualButtonRelease));
            this.m_rankedButton.RemoveEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.OnRankedButtonRelease));
            this.m_casualButton.Up();
            this.m_rankedButton.Down();
        }
        else
        {
            DeckPickerTrayDisplay.Get().SetPlayButtonText(GameStrings.Get("GLOBAL_PLAY"));
            if (UniversalInputManager.UsePhoneUI != null)
            {
                DeckPickerTrayDisplay.Get().ToggleRankedDetailsTray(false);
            }
            this.m_casualButton.RemoveEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.OnCasualButtonRelease));
            this.m_rankedButton.AddEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.OnRankedButtonRelease));
            this.m_casualButton.Down();
            this.m_rankedButton.Up();
        }
        if (DeckPickerTrayDisplay.Get().m_playButton.IsEnabled())
        {
            DeckPickerTrayDisplay.Get().m_playButton.m_newPlayButtonText.TextAlpha = 1f;
        }
        else
        {
            DeckPickerTrayDisplay.Get().m_playButton.m_newPlayButtonText.TextAlpha = 0f;
        }
        DeckPickerTrayDisplay.Get().UpdateRankedClassWinsPlate();
    }
    public void GotoSeasonWelcome()
    {
        this.m_currentMode = MODE.SEASON_WELCOME;
        this.m_medalPlayMaker.SendEvent("PageTear");
        this.m_welcomeItems.SetActive(true);
        this.m_bonusStarItems.SetActive(false);
        NetCache.NetCacheRewardProgress netObject = NetCache.Get().GetNetObject <NetCache.NetCacheRewardProgress>();
        string seasonName = this.GetSeasonName(netObject.Season);

        this.m_header.Text = seasonName;
        object[] args = new object[] { seasonName };
        this.m_welcomeDetails.Text = GameStrings.Format("GLOBAL_SEASON_END_NEW_SEASON", args);
    }
 public bool OwnsAccountLicense(long license)
 {
     NetCache.NetCacheAccountLicenses netObject = NetCache.Get().GetNetObject <NetCache.NetCacheAccountLicenses>();
     if (netObject == null)
     {
         return(false);
     }
     if (!netObject.AccountLicenses.ContainsKey(license))
     {
         return(false);
     }
     return(this.OwnsAccountLicense(netObject.AccountLicenses[license]));
 }
 public static bool AreAllTutorialsComplete()
 {
     NetCache.NetCacheProfileProgress netObject = NetCache.Get().GetNetObject <NetCache.NetCacheProfileProgress>();
     if (netObject == null)
     {
         return(false);
     }
     if (!AreAllTutorialsComplete(netObject.CampaignProgress))
     {
         return(false);
     }
     return(true);
 }
 public static AccountLicenseMgr Get()
 {
     if (s_instance == null)
     {
         s_instance = new AccountLicenseMgr();
         ApplicationMgr.Get().WillReset += new System.Action(s_instance.WillReset);
     }
     if (!s_instance.m_registeredForProfileNotices)
     {
         NetCache.Get().RegisterNewNoticesListener(new NetCache.DelNewNoticesListener(s_instance.OnNewNotices));
         s_instance.m_registeredForProfileNotices = true;
     }
     return(s_instance);
 }
 private void Awake()
 {
     s_instance = this;
     if (SceneMgr.Get() != null)
     {
         this.m_suppressed = SceneMgr.Get().IsModeRequested(SceneMgr.Mode.FATAL_ERROR);
     }
     NetCache.NetCacheProfileNotices netObject = NetCache.Get().GetNetObject <NetCache.NetCacheProfileNotices>();
     if (netObject != null)
     {
         this.MaybeShowSeasonEndDialog(netObject.Notices, false);
     }
     NetCache.Get().RegisterNewNoticesListener(new NetCache.DelNewNoticesListener(this.OnNewNotices));
 }
 public NetCache.CardValue GetCardValue(string cardID, TAG_PREMIUM premium)
 {
     NetCache.CardValue          value2;
     NetCache.NetCacheCardValues netObject = NetCache.Get().GetNetObject <NetCache.NetCacheCardValues>();
     NetCache.CardDefinition     key       = new NetCache.CardDefinition {
         Name    = cardID,
         Premium = premium
     };
     if (!netObject.Values.TryGetValue(key, out value2))
     {
         return(null);
     }
     return(value2);
 }
 private void GrantHeroLevelRewards(List <CardRewardData> cardRewards)
 {
     NetCache.NetCacheHeroLevels netObject = NetCache.Get().GetNetObject <NetCache.NetCacheHeroLevels>();
     if (netObject == null)
     {
         Debug.LogWarning(string.Format("FixedRewardsMgr.GrantHeroUnlockRewards(): null == NetCache.NetCacheHeroLevels", new object[0]));
     }
     else
     {
         foreach (NetCache.HeroLevel level in netObject.Levels)
         {
             this.TriggerHeroLevelAction(false, (int)level.Class, level.CurrentLevel.Level, cardRewards);
         }
     }
 }
 private void OnScaleAnimComplete()
 {
     if (this.IS_TESTING)
     {
         this.UpdateProgress();
     }
     else
     {
         NetCache.Get().RegisterTutorialEndGameScreen(new NetCache.NetCacheCallback(this.UpdateProgress), new NetCache.ErrorCallback(NetCache.DefaultErrorHandler));
     }
     foreach (HeroCoin coin in this.m_heroCoins)
     {
         coin.FinishIntroScaling();
     }
 }
    public bool HasOption(Option option)
    {
        string           str;
        ServerOption     option2;
        ServerOptionFlag flag;

        if (this.m_clientOptionMap.TryGetValue(option, out str))
        {
            return(LocalOptions.Get().Has(str));
        }
        if (this.m_serverOptionMap.TryGetValue(option, out option2))
        {
            return(NetCache.Get().ClientOptionExists(option2));
        }
        return(this.m_serverOptionFlagMap.TryGetValue(option, out flag) && this.HasServerOptionFlag(flag));
    }
예제 #20
0
 private void OnSceneLoaded(SceneMgr.Mode mode, Scene scene, object userData)
 {
     if (((SceneMgr.Get().GetPrevMode() == SceneMgr.Mode.GAMEPLAY) && (mode != SceneMgr.Mode.GAMEPLAY)) && (mode != SceneMgr.Mode.FATAL_ERROR))
     {
         this.m_netCacheReady = false;
         if ((mode == SceneMgr.Mode.FRIENDLY) || TavernBrawlManager.IsInTavernBrawlFriendlyChallenge())
         {
             this.UpdateMyAvailability();
         }
         else
         {
             this.CleanUpChallengeData(true);
         }
         NetCache.Get().RegisterFriendChallenge(new NetCache.NetCacheCallback(this.OnNetCacheReady));
     }
 }
예제 #21
0
 private void Awake()
 {
     s_instance = this;
     this.m_practicePickerTray = ((GameObject)GameUtils.Instantiate((GameObject)this.m_practicePickerTrayPrefab, this.m_practicePickerTrayContainer, false)).GetComponent <PracticePickerTrayDisplay>();
     if (UniversalInputManager.UsePhoneUI != null)
     {
         SceneUtils.SetLayer(this.m_practicePickerTray, GameLayer.IgnoreFullScreenEffects);
     }
     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
             {
                 if (this.m_deckPickerTrayContainer != null)
                 {
                     GameUtils.SetParent(this.m_deckPickerTray, this.m_deckPickerTrayContainer, false);
                 }
                 AdventureSubScene component = base.GetComponent <AdventureSubScene>();
                 if (component != null)
                 {
                     this.m_practicePickerTray.AddTrayLoadedListener(delegate {
                         this.OnTrayPartLoaded();
                         this.m_practicePickerTray.gameObject.SetActive(false);
                     });
                     this.m_deckPickerTray.AddDeckTrayLoadedListener(new DeckPickerTrayDisplay.DeckTrayLoaded(this.OnTrayPartLoaded));
                     if (this.m_practicePickerTray.IsLoaded() && this.m_deckPickerTray.IsLoaded())
                     {
                         component.SetIsLoaded(true);
                     }
                 }
                 this.InitializeTrays();
                 CheatMgr.Get().RegisterCheatHandler("replaymissions", new CheatMgr.ProcessCheatCallback(this.OnProcessCheat_replaymissions), null, null, null);
                 CheatMgr.Get().RegisterCheatHandler("replaymission", new CheatMgr.ProcessCheatCallback(this.OnProcessCheat_replaymissions), null, null, null);
                 NetCache.Get().RegisterScreenPractice(new NetCache.NetCacheCallback(this.OnNetCacheReady));
             }
         }
     }, null, false);
 }
예제 #22
0
 protected override void Awake()
 {
     base.Awake();
     this.m_gamesWonIndicator.Hide();
     this.m_noGoldRewardText.gameObject.SetActive(false);
     if (base.ShouldMakeUtilRequests())
     {
         if (GameMgr.Get().IsTutorial() && !GameMgr.Get().IsSpectator())
         {
             NetCache.Get().RegisterTutorialEndGameScreen(new NetCache.NetCacheCallback(this.OnNetCacheReady));
         }
         else
         {
             NetCache.Get().RegisterScreenEndOfGame(new NetCache.NetCacheCallback(this.OnNetCacheReady));
         }
     }
 }
 public void Unload()
 {
     CollectionManager.Get().RemoveDeckCreatedListener(new CollectionManager.DelOnDeckCreated(this.OnDeckCreated));
     CollectionManager.Get().RemoveDeckDeletedListener(new CollectionManager.DelOnDeckDeleted(this.OnDeckDeleted));
     CollectionManager.Get().RemoveDeckContentsListener(new CollectionManager.DelOnDeckContents(this.OnDeckContents));
     FriendChallengeMgr.Get().RemoveChangedListener(new FriendChallengeMgr.ChangedCallback(this.OnFriendChallengeChanged));
     NetCache.Get().RemoveUpdatedListener(typeof(NetCache.NetCacheTavernBrawlRecord), new System.Action(this.NetCache_OnTavernBrawlRecord));
     GameMgr.Get().UnregisterFindGameEvent(new GameMgr.FindGameCallback(this.OnFindGameEvent));
     if ((FriendChallengeMgr.Get().IsChallengeTavernBrawl() && !SceneMgr.Get().IsInGame()) && !SceneMgr.Get().IsModeRequested(SceneMgr.Mode.FRIENDLY))
     {
         FriendChallengeMgr.Get().CancelChallenge();
     }
     if (this.IsInDeckEditMode())
     {
         Navigation.Pop();
     }
 }
예제 #24
0
 private bool AcknowledgeBanner(int banner)
 {
     this.m_seenBanners.Add(banner);
     if ((banner != this.GetDisplayBannerId()) || this.m_bannerWasAcknowledged)
     {
         return(false);
     }
     this.m_bannerWasAcknowledged = true;
     NetCache.NetCacheProfileProgress netObject = NetCache.Get().GetNetObject <NetCache.NetCacheProfileProgress>();
     if (netObject != null)
     {
         netObject.DisplayBanner = banner;
         NetCache.Get().NetCacheChanged <NetCache.NetCacheProfileProgress>();
     }
     Network.AcknowledgeBanner(banner);
     return(true);
 }
    private void DeleteServerOptionFlag(Option option, ServerOptionFlag serverOptionFlag)
    {
        ServerOption option2;
        ulong        num;
        ulong        num2;

        this.GetServerOptionFlagInfo(serverOptionFlag, out option2, out num, out num2);
        ulong uLongOption = NetCache.Get().GetULongOption(option2);

        if ((uLongOption & num2) != 0L)
        {
            bool prevVal = (uLongOption & num) != 0L;
            uLongOption &= ~num2;
            NetCache.Get().SetULongOption(option2, uLongOption);
            this.RemoveListeners(option, prevVal);
        }
    }
예제 #26
0
            public static void OnBoughtSoldCard()
            {
                var  pkt     = ConnectAPI.GetCardSaleResult();
                long balance = NetCache.Get().GetNetObject <NetCache.NetCacheArcaneDustBalance>().Balance;

                HSMPClient.Get().SendDebugMessage("OnBoughtSoldCard: " + balance + " +- " + pkt.Amount);
                switch (pkt.Action)
                {
                case Network.CardSaleResult.SaleResult.CARD_WAS_BOUGHT:
                    HSMPClient.Get().Send(new MsgCurrencyBalance(MsgCurrencyBalance.CurrencyType.DUST, balance - pkt.Amount));
                    break;

                case Network.CardSaleResult.SaleResult.CARD_WAS_SOLD:
                    HSMPClient.Get().Send(new MsgCurrencyBalance(MsgCurrencyBalance.CurrencyType.DUST, balance + pkt.Amount));
                    break;
                }
            }
예제 #27
0
    public int GetRankedWinsForClass(TAG_CLASS heroClass)
    {
        int num = 0;

        foreach (NetCache.PlayerRecord record in NetCache.Get().GetNetObject <NetCache.NetCachePlayerRecords>().Records)
        {
            if (record.Data != 0)
            {
                EntityDef entityDef = DefLoader.Get().GetEntityDef(record.Data);
                if (((entityDef != null) && (entityDef.GetClass() == heroClass)) && (record.RecordType == GameType.GT_RANKED))
                {
                    num += record.Wins;
                }
            }
        }
        return(num);
    }
    public List <AccountLicenseInfo> GetAllOwnedAccountLicenseInfo()
    {
        List <AccountLicenseInfo> list = new List <AccountLicenseInfo>();

        NetCache.NetCacheAccountLicenses netObject = NetCache.Get().GetNetObject <NetCache.NetCacheAccountLicenses>();
        if (netObject != null)
        {
            foreach (AccountLicenseInfo info in netObject.AccountLicenses.Values)
            {
                if (this.OwnsAccountLicense(info))
                {
                    list.Add(info);
                }
            }
        }
        return(list);
    }
    private void SetUpBuyWithGoldButton()
    {
        string text = string.Empty;

        if (this.m_bundle != null)
        {
            text = this.m_bundle.GoldCost.ToString();
            NetCache.NetCacheGoldBalance netObject = NetCache.Get().GetNetObject <NetCache.NetCacheGoldBalance>();
            this.UpdateGoldButtonState(netObject);
        }
        else
        {
            Debug.LogWarning("AdventureStore.SetUpBuyWithGoldButton(): m_bundle is null");
            text = GameStrings.Get("GLUE_STORE_PRODUCT_PRICE_NA");
            base.SetMoneyButtonState(Store.BuyButtonState.DISABLED);
        }
        base.m_buyWithGoldButton.SetText(text);
    }
    public void StarBurstFinished()
    {
        if (this.m_medal.GetMedal().rank == 0)
        {
            this.m_medalPlayMaker.SendEvent("JustMedalIn");
        }
        else
        {
            this.m_medalPlayMaker.SendEvent("MedalBannerIn");
        }
        this.m_bonusStarText.gameObject.SetActive(false);
        this.m_bonusStarLabel.Text = this.m_medal.GetMedal().name;
        NetCache.NetCacheRewardProgress netObject = NetCache.Get().GetNetObject <NetCache.NetCacheRewardProgress>();
        string inlineSeasonName = this.GetInlineSeasonName(netObject.Season);

        object[] args = new object[] { inlineSeasonName };
        this.m_bonusStarTitle.Text = GameStrings.Format("GLOBAL_SEASON_END_NEW_SEASON", args);
    }