예제 #1
0
        private void OnBuyShardSuccess(GetShardOfferingResponse response, object cookie)
        {
            bool flag;

            if (this.CurrentShopData == null)
            {
                flag = (response.ShopData != null);
            }
            else
            {
                flag = this.CurrentShopData.HasOfferChanged(response.ShopData);
            }
            if (cookie != null)
            {
                int num = (int)((KeyValuePair <object, object>)cookie).Value;
                if (num == this.ClientPredictionId)
                {
                    this.CurrentShopData = response.ShopData;
                }
            }
            if (flag)
            {
                Service.EventManager.SendEvent(EventId.ShardOfferChanged, null);
            }
            if (cookie != null)
            {
                KeyValuePair <object, object> keyValuePair = (KeyValuePair <object, object>)cookie;
                Action <object> action = (Action <object>)keyValuePair.Key;
                action(keyValuePair.Value);
            }
        }
예제 #2
0
        private void OnOfferingUpdated(GetShardOfferingResponse response, object cookie)
        {
            bool flag;

            if (this.CurrentShopData == null)
            {
                flag = (response.ShopData != null);
            }
            else
            {
                flag = this.CurrentShopData.HasOfferChanged(response.ShopData);
            }
            if (flag)
            {
                this.CurrentShopData = response.ShopData;
                Service.EventManager.SendEvent(EventId.ShardOfferChanged, null);
            }
            ViewTimerManager viewTimerManager = Service.ViewTimerManager;

            if (this.expirationTimer != 0u)
            {
                viewTimerManager.KillViewTimer(this.expirationTimer);
            }
            int   num  = (int)(Service.ServerAPI.ServerTime + (uint)((int)(this.CurrentShopData.OffsetMinutes * 60f)));
            float num2 = (float)((ulong)this.CurrentShopData.Expiration - (ulong)((long)num));

            num2 = Math.Max(1f, Math.Min(num2, 432000f));
            this.expirationTimer = viewTimerManager.CreateViewTimer(num2, false, new TimerDelegate(this.OnOfferExpired), null);
            if (cookie != null)
            {
                Action action = (Action)cookie;
                action();
            }
            this.AdjustOfferQuantities();
        }