public void PrepareContent(int lastTimeViewed)
        {
            int num = 0;

            this.DevNotes.Clear();
            int             serverTime     = (int)Service.Get <ServerAPI>().ServerTime;
            IDataController dataController = Service.Get <IDataController>();

            this.DevNotes = new List <DevNoteEntryVO>();
            foreach (DevNoteEntryVO current in dataController.GetAll <DevNoteEntryVO>())
            {
                if (current.StartTime <= serverTime && serverTime < current.EndTime)
                {
                    this.DevNotes.Add(current);
                    if (current.StartTime > lastTimeViewed)
                    {
                        num++;
                    }
                }
            }
            HolonetController holonetController = Service.Get <HolonetController>();

            this.DevNotes.Sort(new Comparison <DevNoteEntryVO>(holonetController.CompareTimestamps));
            holonetController.ContentPrepared(this, Math.Min(num, 3));
        }
        public void InitTransmissionsTest(List <TransmissionVO> testTransmissions)
        {
            CurrentPlayer   currentPlayer  = Service.Get <CurrentPlayer>();
            IDataController dataController = Service.Get <IDataController>();

            this.incomingTransmissions.Clear();
            if (testTransmissions != null)
            {
                foreach (TransmissionVO current in testTransmissions)
                {
                    if (current.Faction == currentPlayer.Faction)
                    {
                        this.incomingTransmissions.Add(current);
                    }
                }
            }
            foreach (TransmissionVO current2 in dataController.GetAll <TransmissionVO>())
            {
                if (current2.Faction == currentPlayer.Faction)
                {
                    this.incomingTransmissions.Add(current2);
                }
            }
            HolonetController holonetController = Service.Get <HolonetController>();

            holonetController.SetTabCount(this, this.incomingTransmissions.Count);
        }
Ejemplo n.º 3
0
        private void OnSuccess(HolonetGetCommandCenterEntriesResponse response, object cookie)
        {
            int num        = 0;
            int num2       = (int)cookie;
            int serverTime = (int)Service.Get <ServerAPI>().ServerTime;
            int i          = 0;
            int count      = response.CCVOs.Count;

            while (i < count)
            {
                CommandCenterVO commandCenterVO = response.CCVOs[i];
                if (!this.IsDuplicateFeaturedItem(commandCenterVO))
                {
                    if (commandCenterVO.StartTime <= serverTime && serverTime < commandCenterVO.EndTime && AudienceConditionUtils.IsValidForClient(commandCenterVO.AudienceConditions))
                    {
                        this.FeaturedItems.Add(commandCenterVO);
                        if (commandCenterVO.StartTime > num2)
                        {
                            num++;
                        }
                    }
                }
                else
                {
                    Service.Get <StaRTSLogger>().Error("Duplicate entry in commander center featured items repsonse: " + commandCenterVO.Uid);
                }
                i++;
            }
            HolonetController holonetController = Service.Get <HolonetController>();

            this.FeaturedItems.Sort(new Comparison <CommandCenterVO>(this.ComparePriority));
            InventoryCrates crates = Service.Get <CurrentPlayer>().Prizes.Crates;
            CrateData       dailyCrateIfAvailable = crates.GetDailyCrateIfAvailable();

            if (dailyCrateIfAvailable != null && (ulong)dailyCrateIfAvailable.ReceivedTimeStamp > (ulong)((long)num2))
            {
                num++;
            }
            holonetController.ContentPrepared(this, num);
        }
Ejemplo n.º 4
0
        private void OnFailure(uint status, object cookie)
        {
            HolonetController holonetController = Service.Get <HolonetController>();

            holonetController.ContentPrepared(this, 0);
        }
        private void FinishPreparingTransmissions(List <TransmissionVO> msgVOs)
        {
            int num = 0;

            this.Transmissions.Clear();
            this.incomingTransmissions.Clear();
            this.transmissionIndex = 0;
            SquadWarManager   warManager        = Service.Get <SquadController>().WarManager;
            SharedPlayerPrefs sharedPlayerPrefs = Service.Get <SharedPlayerPrefs>();
            int             pref           = sharedPlayerPrefs.GetPref <int>("DailyCrateTransTutorialViewed");
            int             serverTime     = (int)Service.Get <ServerAPI>().ServerTime;
            IDataController dataController = Service.Get <IDataController>();
            CurrentPlayer   currentPlayer  = Service.Get <CurrentPlayer>();

            foreach (TransmissionVO current in dataController.GetAll <TransmissionVO>())
            {
                if (current.Faction == currentPlayer.Faction && current.StartTime > 0 && current.StartTime <= serverTime && serverTime < current.EndTime && (!this.IsDailyCrateTutorialTransmission(current) || pref != 1))
                {
                    this.Transmissions.Add(current);
                    if (current.StartTime > this.lastTransmissionTimeViewed)
                    {
                        num++;
                    }
                }
            }
            HolonetController holonetController = Service.Get <HolonetController>();

            msgVOs.Sort(new Comparison <TransmissionVO>(holonetController.CompareTimestamps));
            int hOLONET_EVENT_MESSAGE_MAX_COUNT = GameConstants.HOLONET_EVENT_MESSAGE_MAX_COUNT;
            int count = msgVOs.Count;
            int num2  = 0;

            while (num2 < hOLONET_EVENT_MESSAGE_MAX_COUNT && num2 < count)
            {
                TransmissionVO transmissionVO = msgVOs[num2];
                if (!this.DuplicateTransmission(transmissionVO))
                {
                    this.Transmissions.Add(transmissionVO);
                    if (transmissionVO.StartTime > this.lastTransmissionTimeViewed)
                    {
                        num++;
                        if (this.IsWarTransmission(transmissionVO) && !warManager.IsTimeWithinCurrentSquadWarPhase(transmissionVO.StartTime))
                        {
                            num--;
                        }
                    }
                }
                else
                {
                    Service.Get <StaRTSLogger>().Error("Duplicate entry in transmission event messages repsonse: " + transmissionVO.Uid);
                }
                num2++;
            }
            this.Transmissions.Sort(new Comparison <TransmissionVO>(holonetController.CompareTimestamps));
            int            pref2 = sharedPlayerPrefs.GetPref <int>("HighestViewedSquadLvlUP");
            int            hOLONET_MAX_INCOMING_TRANSMISSIONS = GameConstants.HOLONET_MAX_INCOMING_TRANSMISSIONS;
            int            count2          = this.Transmissions.Count;
            int            num3            = 0;
            TransmissionVO transmissionVO2 = null;
            int            num4            = 0;

            while (num3 < hOLONET_MAX_INCOMING_TRANSMISSIONS && num4 < count2)
            {
                TransmissionVO transmissionVO3 = this.Transmissions[num4];
                if (this.IsIncomingTransmission(transmissionVO3) && (!this.IsWarTransmission(transmissionVO3) || warManager.IsTimeWithinCurrentSquadWarPhase(transmissionVO3.StartTime)))
                {
                    if (this.IsSquadLevelUpTransmission(transmissionVO3))
                    {
                        if (!Service.Get <PerkManager>().HasPlayerSeenPerkTutorial())
                        {
                            goto IL_2A7;
                        }
                        bool flag = transmissionVO2 == null || transmissionVO3.SquadLevel > transmissionVO2.SquadLevel;
                        if (!flag || pref2 >= transmissionVO3.SquadLevel)
                        {
                            goto IL_2A7;
                        }
                        if (transmissionVO2 != null)
                        {
                            num3--;
                            this.incomingTransmissions.Remove(transmissionVO2);
                        }
                        transmissionVO2 = transmissionVO3;
                    }
                    if (pref == 0)
                    {
                        if (this.IsDailyCrateTransmission(transmissionVO3))
                        {
                            goto IL_2A7;
                        }
                        if (this.IsDailyCrateTutorialTransmission(transmissionVO3))
                        {
                            sharedPlayerPrefs.SetPref("DailyCrateTransTutorialViewed", "1");
                        }
                    }
                    num3++;
                    this.incomingTransmissions.Add(transmissionVO3);
                }
IL_2A7:
                num4++;
            }
            this.incomingTransmissions.Sort(new Comparison <TransmissionVO>(this.CompareIncommingPriorites));
            holonetController.ContentPrepared(this, num);
        }