コード例 #1
0
 public void ClearAudioRepeatTimers()
 {
     if (this.audioRepeatTimers != null)
     {
         ViewTimerManager viewTimerManager = Service.ViewTimerManager;
         foreach (string current in this.audioRepeatTimers.Keys)
         {
             uint[] array = this.audioRepeatTimers[current];
             if (array != null)
             {
                 int i   = 0;
                 int num = array.Length;
                 while (i < num)
                 {
                     if (viewTimerManager != null)
                     {
                         viewTimerManager.KillViewTimer(array[i]);
                     }
                     array[i] = 0u;
                     i++;
                 }
             }
         }
         this.audioRepeatTimers.Clear();
         this.audioRepeatTimers = null;
     }
 }
コード例 #2
0
        private void ScheduleCrateExpireToast()
        {
            ViewTimerManager viewTimerManager = Service.Get <ViewTimerManager>();
            uint             num       = (uint)(GameConstants.CRATE_EXPIRATION_WARNING_TOAST * 60);
            uint             time      = ServerTime.Time;
            uint             afterTime = time + num;

            if (this.expireToastTimerId != 0u)
            {
                viewTimerManager.KillViewTimer(this.expireToastTimerId);
            }
            if (!Service.IsSet <CurrentPlayer>())
            {
                return;
            }
            CrateData crateSoonestToExpire = this.GetCrateSoonestToExpire(afterTime);

            if (crateSoonestToExpire == null)
            {
                return;
            }
            uint num2 = crateSoonestToExpire.ExpiresTimeStamp - num;
            uint num3 = num2 - time;

            if (num3 <= 432000u)
            {
                this.nextCrateExpireTime = crateSoonestToExpire.ExpiresTimeStamp;
                this.expireToastTimerId  = viewTimerManager.CreateViewTimer(num3, false, new TimerDelegate(this.AttemptShowCrateExpireToast), null);
            }
        }
コード例 #3
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();
        }
コード例 #4
0
        private void ScheduleCrateExpireBadgeUpdate()
        {
            ViewTimerManager viewTimerManager = Service.Get <ViewTimerManager>();
            uint             time             = ServerTime.Time;

            if (this.expireBadgeTimerId != 0u)
            {
                viewTimerManager.KillViewTimer(this.expireBadgeTimerId);
            }
            if (!Service.IsSet <CurrentPlayer>())
            {
                return;
            }
            CrateData crateSoonestToExpire = this.GetCrateSoonestToExpire(time);

            if (crateSoonestToExpire == null)
            {
                return;
            }
            uint expiresTimeStamp = crateSoonestToExpire.ExpiresTimeStamp;
            uint num = expiresTimeStamp - time;

            if (num <= 432000u)
            {
                this.expireBadgeTimerId = viewTimerManager.CreateViewTimer(num, false, new TimerDelegate(this.UpdateBadgesAfterCrateExpire), null);
            }
        }
コード例 #5
0
        private void TriggerAndKillTimers(List <uint> timerIds)
        {
            if (!Service.IsSet <ViewTimerManager>() || timerIds == null)
            {
                return;
            }
            List <uint> list  = new List <uint>();
            int         i     = 0;
            int         count = timerIds.Count;

            while (i < count)
            {
                uint num = timerIds[i];
                if (num != 0u)
                {
                    list.Add(num);
                }
                i++;
            }
            ViewTimerManager viewTimerManager = Service.Get <ViewTimerManager>();
            int j      = 0;
            int count2 = list.Count;

            while (j < count2)
            {
                uint num2 = list[j];
                if (num2 != 0u)
                {
                    viewTimerManager.TriggerKillViewTimer(num2);
                }
                j++;
            }
            list.Clear();
        }
コード例 #6
0
 public void CancelDailyCrateScheduledTimer()
 {
     if (this.nextDailyCrateTimerId != 0u)
     {
         ViewTimerManager viewTimerManager = Service.Get <ViewTimerManager>();
         viewTimerManager.KillViewTimer(this.nextDailyCrateTimerId);
         this.nextDailyCrateTimerId = 0u;
     }
 }
コード例 #7
0
 public HoloCharacter(string characterId, Vector3 holoPosition)
 {
     this.OnDoneLoading    = null;
     this.holoPosition     = holoPosition;
     this.destroyed        = false;
     this.turnedOn         = false;
     this.timerId          = 0u;
     this.viewTimerManager = Service.ViewTimerManager;
     this.eventManager     = Service.EventManager;
     this.assetManager     = Service.AssetManager;
     this.assetManager.Load(ref this.holoHandle, "hologram", new AssetSuccessDelegate(this.OnHologramLoaded), new AssetFailureDelegate(this.OnHologramLoadFailed), null);
     this.LoadCharacter(characterId, false);
 }
コード例 #8
0
        private void KillExistingTimers()
        {
            ViewTimerManager viewTimerManager  = Service.ViewTimerManager;
            List <uint>      squadScreenTimers = Service.SquadController.StateManager.SquadScreenTimers;
            int i     = 0;
            int count = squadScreenTimers.Count;

            while (i < count)
            {
                viewTimerManager.KillViewTimer(squadScreenTimers[i]);
                i++;
            }
            squadScreenTimers.Clear();
        }
コード例 #9
0
 public HoloCharacter(string characterId, Vector3 holoPosition)
 {
     this.HOLO_CONTAINER_POSITION = new Vector3(0f, 2000f, 0f);
     base..ctor();
     this.OnDoneLoading    = null;
     this.holoPosition     = holoPosition;
     this.destroyed        = false;
     this.turnedOn         = false;
     this.timerId          = 0u;
     this.viewTimerManager = Service.Get <ViewTimerManager>();
     this.eventManager     = Service.Get <EventManager>();
     this.assetManager     = Service.Get <AssetManager>();
     this.assetManager.Load(ref this.holoHandle, "hologram", new AssetSuccessDelegate(this.OnHologramLoaded), new AssetFailureDelegate(this.OnHologramLoadFailed), null);
     this.LoadCharacter(characterId, false);
 }
コード例 #10
0
        private void ScheduleNextRefresh()
        {
            Service.Logger.Debug("Next Scheduled Episode Refresh at: " + this.nextScheduledRefreshDate.ToString());
            ViewTimerManager viewTimerManager = Service.ViewTimerManager;

            if (this.scheduleTimerId != 0u)
            {
                viewTimerManager.KillViewTimer(this.scheduleTimerId);
            }
            TimeSpan timeSpan = this.nextScheduledRefreshDate.Subtract(Service.ServerAPI.ServerDateTime);

            if (timeSpan.TotalMilliseconds > 0.0 && timeSpan.TotalMilliseconds < 432000000.0)
            {
                this.scheduleTimerId = viewTimerManager.CreateViewTimer((float)timeSpan.TotalSeconds, false, new TimerDelegate(this.AttemptRefresh), null);
            }
        }
コード例 #11
0
        public void ScheduleGivingNextDailyCrate()
        {
            this.CancelDailyCrateScheduledTimer();
            ViewTimerManager viewTimerManager = Service.Get <ViewTimerManager>();
            InventoryCrates  crates           = Service.Get <CurrentPlayer>().Prizes.Crates;
            uint             nextDailCrateTimeWithSyncBuffer = crates.GetNextDailCrateTimeWithSyncBuffer();
            uint             time = ServerTime.Time;
            uint             num  = 0u;

            if (nextDailCrateTimeWithSyncBuffer > time)
            {
                num = nextDailCrateTimeWithSyncBuffer - time;
            }
            if (num <= 432000u)
            {
                this.nextDailyCrateTimerId = viewTimerManager.CreateViewTimer(num, false, new TimerDelegate(this.UpdateDailyCrateInventory), null);
            }
        }
コード例 #12
0
        public EatResponse OnScroll(float delta, Vector2 screenPosition)
        {
            this.camera.StopAddonBehaviors();
            this.camera.SetCameraFeel(CameraFeel.Fast);
            if (this.CameraZoom(delta * 20f, this.scrollImmediate))
            {
                this.scrollImmediate = true;
            }
            ViewTimerManager viewTimerManager = Service.Get <ViewTimerManager>();

            if (this.scrollTimer != 0u)
            {
                viewTimerManager.KillViewTimer(this.scrollTimer);
            }
            this.scrollTimer = viewTimerManager.CreateViewTimer(0.1f, false, new TimerDelegate(this.OnScrollTimer), null);
            Service.Get <EventManager>().SendEvent(EventId.UserStartedCameraMove, null);
            return(EatResponse.Eaten);
        }
コード例 #13
0
        public void PlayAudioRepeat(string id, int repeatCount, float delay, float interval)
        {
            if (repeatCount == 0)
            {
                this.logger.WarnFormat("Trying to play audio {0} with repeat count = 0, use PlayAudio", new object[]
                {
                    id
                });
                return;
            }
            uint[]           array            = new uint[repeatCount];
            ViewTimerManager viewTimerManager = Service.ViewTimerManager;

            for (int i = 0; i < repeatCount; i++)
            {
                float delay2 = delay + (float)(i + 1) * interval;
                array[i] = viewTimerManager.CreateViewTimer(delay2, false, new TimerDelegate(this.PlayAudioDelayedCallback), id);
            }
            this.SetAudioRepeatTimers(id, array);
        }
コード例 #14
0
ファイル: ServerAPI.cs プロジェクト: Hengle/swc-decompiled
 public ServerAPI(string baseUrl, uint protocolVersion, ViewTimerManager timerManager, MonoBehaviour engine, ServerAPI.DesynHandler desyncHandler, ServerAPI.MessageHandler messageHandler)
 {
     this.SetDispatcher(baseUrl, engine);
     this.serverTimeOffset = 0;
     this.protocolVersion  = protocolVersion;
     this.desyncHandler    = desyncHandler;
     this.messageHandler   = messageHandler;
     RequestId.Reset();
     this.queue             = new List <ICommand>();
     this.keepAliveCommand  = null;
     this.Enabled           = true;
     this.ServerTime        = 0u;
     this.ServerTimePrecise = 0.0;
     this.desyncMessages    = new Dictionary <DesyncType, string>();
     this.desyncMessages.Add(DesyncType.BatchMaxRetry, LangUtils.DESYNC_BATCH_MAX_RETRY);
     this.desyncMessages.Add(DesyncType.CommandMaxRetry, "DESYNC_COMMAND_MAX_RETRY");
     this.desyncMessages.Add(DesyncType.CriticalCommandFail, "DESYNC_CRITICAL_COMMAND_FAIL");
     this.desyncMessages.Add(DesyncType.ReceiptVerificationFailed, "DESYNC_RECEIPT_FAILED");
     this.SessionId = Guid.NewGuid().ToString();
     Service.Set <ServerAPI>(this);
 }
コード例 #15
0
        public void OnVantageSwitch(bool topDown)
        {
            ViewTimerManager viewTimerManager = Service.Get <ViewTimerManager>();

            if (this.switchingVantage)
            {
                viewTimerManager.KillViewTimer(this.switchingVantageTimer);
            }
            else
            {
                this.switchingVantage = true;
            }
            this.switchingVantageTimer = viewTimerManager.CreateViewTimer(0.5f, false, new TimerDelegate(this.OnVantageSwitchTimer), null);
            if (topDown)
            {
                this.mapHighYSuper = this.mapHighYSuperTopDown;
                this.mapHighYEarly = this.mapHighYEarlyTopDown;
                return;
            }
            this.mapHighYSuper = this.mapHighYSuperTopDown - 200f;
            this.mapHighYEarly = this.mapHighYEarlyTopDown - 200f;
        }