Exemple #1
0
 public TournamentController()
 {
     TournamentController.LoadTierData();
     Service.Set <TournamentController>(this);
     this.viewedTournaments = new Dictionary <string, bool>();
     this.currentPlayer     = Service.Get <CurrentPlayer>();
     this.currentPlayer.TournamentProgress.RemoveMissingTournamentData();
     this.LoadTournamentViewedData();
     this.UpdateTournamentsData(false);
     Service.Get <EventManager>().RegisterObserver(this, EventId.PlanetRelocate, EventPriority.Default);
     this.conflictPointPopupShown = (Service.Get <SharedPlayerPrefs>().GetPref <int>("ConfPtsPopup") >= 1);
     this.UpdatePlayerRanks();
 }
Exemple #2
0
        private static TournamentVO GetLiveTournamentForBonus(uint timeToCheck)
        {
            string          planetId       = Service.Get <CurrentPlayer>().PlanetId;
            IDataController dataController = Service.Get <IDataController>();

            foreach (TournamentVO current in dataController.GetAll <TournamentVO>())
            {
                if (TournamentController.IsPlanetaryConflict(current) && current.PlanetId == planetId && TimedEventUtils.IsTimedEventLive(current, timeToCheck))
                {
                    return(current);
                }
            }
            return(null);
        }
Exemple #3
0
        public int NumberOfTournamentsNotViewed()
        {
            int  num  = 0;
            bool flag = Service.Get <BuildingLookupController>().HasNavigationCenter();
            List <TournamentVO> allActiveTournaments = TournamentController.GetAllActiveTournaments();

            for (int i = 0; i < allActiveTournaments.Count; i++)
            {
                TournamentVO tournamentVO = allActiveTournaments[i];
                if (tournamentVO != null && this.viewedTournaments != null && !this.viewedTournaments.ContainsKey(tournamentVO.Uid) && GameUtils.ConflictStartsInBadgePeriod(tournamentVO) && (flag || this.currentPlayer.PlanetId == tournamentVO.PlanetId))
                {
                    num++;
                }
            }
            return(num);
        }
Exemple #4
0
        public void UpdateTournamentsData(bool canShowDialog)
        {
            this.FindNextExpiringConflict();
            this.CurrentPlanetActiveTournament = this.GetActiveTournamentOnCurrentPlanet();
            List <TournamentVO> tournamentVOs = TournamentController.GetTournamentVOs(TournamentFilter.All);

            for (int i = 0; i < tournamentVOs.Count; i++)
            {
                TournamentVO    tournamentVO = tournamentVOs[i];
                TimedEventState state        = TimedEventUtils.GetState(tournamentVO);
                if (tournamentVO != null && state != TimedEventState.Live && state != TimedEventState.Upcoming && this.IsPlayerInTournament(tournamentVO) && !this.IsTournamentRedeemed(tournamentVO))
                {
                    this.RedeemTournaments(canShowDialog);
                    return;
                }
            }
        }
Exemple #5
0
        public static List <TournamentVO> GetTournamentVOs(TournamentFilter tournamentFilter)
        {
            List <TournamentVO> list           = new List <TournamentVO>();
            IDataController     dataController = Service.Get <IDataController>();

            foreach (TournamentVO current in dataController.GetAll <TournamentVO>())
            {
                if (TournamentController.IsPlanetaryConflict(current))
                {
                    bool flag;
                    switch (tournamentFilter)
                    {
                    case TournamentFilter.Live:
                        flag = TimedEventUtils.IsTimedEventLive(current);
                        break;

                    case TournamentFilter.LiveOrClosing:
                        flag = TimedEventUtils.IsTimedEventLiveOrClosing(current);
                        break;

                    case TournamentFilter.Active:
                        flag = TimedEventUtils.IsTimedEventActive(current);
                        break;

                    case TournamentFilter.All:
                        goto IL_60;

                    default:
                        goto IL_60;
                    }
IL_63:
                    if (flag)
                    {
                        list.Add(current);
                        continue;
                    }
                    continue;
IL_60:
                    flag = true;
                    goto IL_63;
                }
            }
            return(list);
        }
Exemple #6
0
        public void OnGalaxyViewed()
        {
            bool flag = false;
            List <TournamentVO> allActiveTournaments = TournamentController.GetAllActiveTournaments();

            for (int i = 0; i < allActiveTournaments.Count; i++)
            {
                TournamentVO tournamentVO = allActiveTournaments[i];
                if (tournamentVO != null && this.viewedTournaments != null && GameUtils.ConflictStartsInBadgePeriod(tournamentVO) && !this.viewedTournaments.ContainsKey(tournamentVO.Uid))
                {
                    this.viewedTournaments.Add(tournamentVO.Uid, true);
                    flag = true;
                }
            }
            if (flag)
            {
                this.UpdateAndSyncTournamentViewedData();
            }
        }
Exemple #7
0
        private void FindNextExpiringConflict()
        {
            this.NextExpiringConflict = null;
            uint num = 4294967295u;
            List <TournamentVO> tournamentVOs = TournamentController.GetTournamentVOs(TournamentFilter.Live);

            for (int i = 0; i < tournamentVOs.Count; i++)
            {
                TournamentVO tournamentVO = tournamentVOs[i];
                if (tournamentVO != null && !this.IsTournamentRedeemed(tournamentVO) && (long)tournamentVO.EndTimestamp < (long)((ulong)num))
                {
                    num = (uint)tournamentVO.EndTimestamp;
                    this.NextExpiringConflict = tournamentVO;
                }
            }
            if (this.NextExpiringConflict != null)
            {
                Service.Get <ViewTimeEngine>().RegisterFrameTimeObserver(this);
            }
        }
Exemple #8
0
 public unsafe static long $Invoke1(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(TournamentController.CompareTiers((TournamentTierVO)GCHandledObjects.GCHandleToObject(*args), (TournamentTierVO)GCHandledObjects.GCHandleToObject(args[1]))));
 }
Exemple #9
0
 public unsafe static long $Invoke20(long instance, long *args)
 {
     TournamentController.LoadTierData();
     return(-1L);
 }
Exemple #10
0
 public unsafe static long $Invoke16(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(TournamentController.IsPlanetaryConflict((TournamentVO)GCHandledObjects.GCHandleToObject(*args))));
 }
Exemple #11
0
 public unsafe static long $Invoke14(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(TournamentController.GetVOForNextTier((TournamentTierVO)GCHandledObjects.GCHandleToObject(*args))));
 }
Exemple #12
0
 public unsafe static long $Invoke13(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(TournamentController.GetTournamentVOs((TournamentFilter)(*(int *)args))));
 }
Exemple #13
0
 public unsafe static long $Invoke10(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(TournamentController.GetIdForTopTier()));
 }
Exemple #14
0
 public unsafe static long $Invoke9(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(TournamentController.GetAllLiveAndClosingTournaments()));
 }
Exemple #15
0
 public unsafe static long $Invoke8(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(TournamentController.GetAllActiveTournaments()));
 }
Exemple #16
0
 public unsafe static long $Invoke7(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(TournamentController.GetActiveTournamentOnPlanet(Marshal.PtrToStringUni(*(IntPtr *)args))));
 }
Exemple #17
0
 private TournamentVO GetActiveTournamentOnCurrentPlanet()
 {
     return(TournamentController.GetActiveTournamentOnPlanet(this.currentPlayer.PlanetId));
 }
Exemple #18
0
 public static List <TournamentVO> GetAllActiveTournaments()
 {
     return(TournamentController.GetTournamentVOs(TournamentFilter.Active));
 }
Exemple #19
0
 public static List <TournamentVO> GetAllLiveAndClosingTournaments()
 {
     return(TournamentController.GetTournamentVOs(TournamentFilter.LiveOrClosing));
 }