Esempio n. 1
0
 /// <summary>
 /// Prevent people from calling default constructor.
 /// </summary>
 public AGSSocialLeaderboard()
 {
     leaderboard = AGSLeaderboard.GetBlankLeaderboard ();
     localPlayerScore = -1;
     localPlayerRank = -1;
     _timeScope = TimeScope.AllTime;
 }
Esempio n. 2
0
        private TimeScope Map(TIM tim, Catalog catalog)
        {
            DateTime?stamp1 = null;

            if (tim.A.HasValue)
            {
                stamp1 = tim.A.Value;
            }

            DateTime?stamp2 = null;

            if (tim.B.HasValue)
            {
                stamp2 = tim.B.Value;
            }

            var timeScope = new TimeScope {
                TimeStamp1 = stamp1, TimeStamp2 = stamp2, DateContext = DateContextEnum.ActualStart
            };

            if (catalog.TimeScopes == null)
            {
                catalog.TimeScopes = new List <TimeScope>();
            }
            catalog.TimeScopes.Add(timeScope);
            return(timeScope);
        }
Esempio n. 3
0
 private static void OnTopScoresChange(Leaderboard leaderboard, TimeScope timeScope)
 {
     if (timeScope == currentTimeScope)
     {
         topScoresChanged?.Invoke(leaderboard);
     }
 }
Esempio n. 4
0
        public ISOGuidanceShift ExportGuidanceShift(GuidanceShift adaptGuidanceShift)
        {
            ISOGuidanceShift gst = new ISOGuidanceShift();

            //Group ID
            gst.GuidanceGroupIdRef = TaskDataMapper.InstanceIDMap.GetISOID(adaptGuidanceShift.GuidanceGroupId);

            //Pattern ID
            gst.GuidancePatternIdRef = TaskDataMapper.InstanceIDMap.GetISOID(adaptGuidanceShift.GuidancePatterId);

            //Shifts
            gst.GuidanceEastShift  = adaptGuidanceShift.EastShift.AsConvertedInt("mm");
            gst.GuidanceNorthShift = adaptGuidanceShift.NorthShift.AsConvertedInt("mm");
            gst.PropagationOffset  = adaptGuidanceShift.PropagationOffset.AsConvertedInt("mm");

            //Allocation Stamp
            if (adaptGuidanceShift.TimeScopeIds.Any())
            {
                TimeScope scope = DataModel.Catalog.TimeScopes.FirstOrDefault(t => t.Id.ReferenceId == adaptGuidanceShift.TimeScopeIds.First()); //Mapping first timescope only
                if (scope != null)
                {
                    gst.AllocationStamp = AllocationStampMapper.ExportAllocationStamp(scope);
                }
            }

            return(gst);
        }
Esempio n. 5
0
        private void ReadPresetTopScores(Leaderboard leaderboard, TimeScope timeScope)
        {
            switch (timeScope)
            {
            case TimeScope.AllTime:
                _topScoresAllTimeDict[leaderboard].Clear();
                break;

            case TimeScope.Week:
                _topScoresWeekDict[leaderboard].Clear();
                break;

            case TimeScope.Today:
                _topScoresTodayDict[leaderboard].Clear();
                break;
            }

            string[] rawData = new string[3];
            for (int i = 0, imax = PRESET_SCORES_NAME.Length; i < imax; i++)
            {
                rawData[0] = PRESET_SCORES_NAME[i];
                rawData[1] = "" + (i + 1);
                rawData[2] = "" + PRESET_SCORES_SCORES[i];
                AddTopScore(rawData, leaderboard, timeScope);
            }

            WriteTopScores(leaderboard, timeScope);
        }
Esempio n. 6
0
        /// <summary>
        /// Shows the leaderboard UI for the given leaderboard in the specified time scope.
        /// </summary>
        /// <param name="leaderboardName">Leaderboard name.</param>
        /// <param name="timeScope">Time scope to display scores in the leaderboard.</param>
        public static void ShowLeaderboardUI(string leaderboardName, TimeScope timeScope)
        {
            if (!IsInitialized())
            {
                Debug.Log("Couldn't show leaderboard UI: user is not logged in.");
                return;
            }

            Leaderboard ldb = GetLeaderboardByName(leaderboardName);

            if (ldb == null)
            {
                Debug.Log("Couldn't show leaderboard UI: unknown leaderboard name.");
                return;
            }

#if UNITY_IOS
            GameCenterPlatform.ShowLeaderboardUI(ldb.Id, timeScope);
#elif UNITY_ANDROID && EM_GPGS
            PlayGamesPlatform.Instance.ShowLeaderboardUI(ldb.Id, ToGpgsLeaderboardTimeSpan(timeScope), null);
#else
            // Fallback
            Social.ShowLeaderboardUI();
#endif
        }
Esempio n. 7
0
 /// <summary>
 /// Prevent people from calling default constructor.
 /// </summary>
 public AGSSocialLeaderboard()
 {
     leaderboard      = AGSLeaderboard.GetBlankLeaderboard();
     localPlayerScore = -1;
     localPlayerRank  = -1;
     _timeScope       = TimeScope.AllTime;
 }
Esempio n. 8
0
        private static void AreEqual(TimeScope timeScope, TIM tim)
        {
            Assert.AreEqual(timeScope.TimeStamp1, tim.A);
            Assert.AreEqual(timeScope.TimeStamp2, tim.B);

            // todo.  check other attributes and PTN, dlvs,....
        }
        public static void DescribeSummaryData(ApplicationDataModel adm, LoggedData loggedData)
        {
            Console.WriteLine();
            Console.WriteLine("-----------------------");
            Console.WriteLine("Task Summary Information");
            Console.WriteLine("-----------------------");
            Console.WriteLine();

            //Each LoggedData object will map to a Summary object via the SummaryId property.
            Summary summary = adm.Documents.Summaries.SingleOrDefault(s => s.Id.ReferenceId == loggedData.SummaryId);

            if (summary != null)
            {
                //Each summary will have a start date timescope
                TimeScope timeScope = summary.TimeScopes.SingleOrDefault(t => t.DateContext == DateContextEnum.ActualStart);
                DateTime  startTime = timeScope.TimeStamp1.Value;

                //In the 2020 Plugin, we include the end date as TimeStamp2.
                DateTime endTime = timeScope.TimeStamp2.Value;

                Console.WriteLine($"The field operation started at {startTime.ToString()} and ended at {endTime.ToString()}");
                Console.WriteLine();
                Console.WriteLine($"The following are totals/averages for the field operation:");


                //The 2020 plugin will summarize all field Operation data into a single StampedMetersValues collection.
                //The ADAPT framework allows for multiple StampedMetersValues in cases where multiple timestamps govern multiple data values
                foreach (MeteredValue meteredValue in summary.SummaryData.Single().Values)
                {
                    NumericRepresentationValue representationValue = meteredValue.Value as NumericRepresentationValue;
                    string summaryValueName = representationValue.Representation.Description;
                    string uomCode          = representationValue.Value.UnitOfMeasure.Code;
                    double value            = representationValue.Value.Value;

                    Console.WriteLine($"{summaryValueName}: {value} {uomCode}");
                }

                Console.WriteLine();

                //For seed and liquid fertilizer products, the Plugin will summarize data by product

                Console.WriteLine($"The following are totals/averages by product:");
                foreach (OperationSummary operationSummary in summary.OperationSummaries)
                {
                    Product product = adm.Catalog.Products.FirstOrDefault(p => p.Id.ReferenceId == operationSummary.ProductId);
                    Console.WriteLine($"{product.Description}:");
                    foreach (MeteredValue meteredValue in operationSummary.Data.Single().Values)
                    {
                        NumericRepresentationValue representationValue = meteredValue.Value as NumericRepresentationValue;
                        string summaryValueName = representationValue.Representation.Description;
                        string uomCode          = representationValue.Value.UnitOfMeasure.Code;
                        double value            = representationValue.Value.Value;

                        Console.WriteLine($"{summaryValueName}: {value} {uomCode}");
                    }
                    Console.WriteLine();
                }
            }
        }
Esempio n. 10
0
 protected ModifierBase(string type, PhaseCode startPhase, ISource source, ICardInPlay target, TimeScope duration, int value)
     : base("Modifier", GetText(target, type, value), source)
 {
     this.StartPhase = startPhase;
     this.Target = target;
     this.Duration = duration;
     this.Value = value;
 }
Esempio n. 11
0
 public LeaderboardKey(string id, UserScope userScope, TimeScope timeScope, ushort startingRank, ushort numberOfRanks)
 {
     this.id            = id;
     this.userScope     = userScope;
     this.timeScope     = timeScope;
     this.startingRank  = startingRank;
     this.numberOfRanks = numberOfRanks;
 }
Esempio n. 12
0
        private DateTime FindActualStartTime(TimeScope timeScope)
        {
            if (timeScope.TimeStamp1 == null)
            {
                return(DateTime.MinValue);
            }

            return(timeScope.TimeStamp1.GetValueOrDefault());
        }
Esempio n. 13
0
        public void Setup()
        {
            _timeScope  = new TimeScope();
            _timeScopes = new List <TimeScope> {
                _timeScope
            };

            _timeMapper = new TimeMapper();
        }
Esempio n. 14
0
        public static LeaderboardEntry GetTopScores(Leaderboard leaderboard, TimeScope timeScope, int index)
        {
            List <LeaderboardEntry> topScores = GetTopScores(leaderboard, timeScope);

            if (index >= topScores.Count)
            {
                return(null);
            }
            return(topScores[index]);
        }
Esempio n. 15
0
        public void NotInIntervalDailyFixdTimeJobScheduleFrequencyTest()
        {
            DailyJobScheduleFrequency dailyFrequency = PrepareDailyJobSchedule(2);

            DateTime startTime = DateTime.Now.Date.AddDays(1);
            DateTime timePoint = startTime + new TimeSpan(10, 10, 10);

            TimeScope scope = dailyFrequency.GetTimeScope(startTime, timePoint, _TimeOffset);

            Assert.IsNotNull(scope);
        }
Esempio n. 16
0
        private Summary ImportSummary(ISOTask isoLoggedTask, LoggedData loggedData)
        {
            //Per ISO11783-10:2015(E) 6.8.3, the last Time element contains the comprehensive task totals.
            //Earlier Time elements contain the task totals leading up to points where the Task was paused.
            //As such, the Summary.TimeScopes will include detail on various intermittent Timescopes,
            //and the Summary.SummaryData will contain totals from only the last time element.
            //Summary.SummaryData.Stamp will be set to a comprehensive time stamp from the beginning of the first time to the end of the last.
            Summary summary = null;
            IEnumerable <ISOTime> timeElements = isoLoggedTask.Times.Where(t => t.HasStart && t.HasType);

            if (timeElements.Any())
            {
                summary = new Summary();

                //TimeScopes
                summary.TimeScopes = new List <TimeScope>();
                foreach (ISOTime time in isoLoggedTask.Times.Where(t => t.HasStart && t.HasType)) //Nothing added without a Start and Type attribute
                {
                    TimeScope timeScope = new TimeScope();
                    timeScope.TimeStamp1 = time.Start;
                    if (time.Stop != null)
                    {
                        timeScope.TimeStamp2 = time.Stop;
                    }

                    if (time.Stop == null && time.Duration != null)
                    {
                        //Calculate the Stop time if missing and duration present
                        timeScope.TimeStamp2 = timeScope.TimeStamp1.Value.AddSeconds(time.Duration.Value);
                    }
                    timeScope.DateContext = time.Type == ISOEnumerations.ISOTimeType.Planned ? DateContextEnum.ProposedStart : DateContextEnum.ActualStart;
                    timeScope.Duration    = timeScope.TimeStamp2.GetValueOrDefault() - timeScope.TimeStamp1.GetValueOrDefault();
                    summary.TimeScopes.Add(timeScope);
                }

                //Summary Data - does not have a product reference
                summary.SummaryData = ImportSummaryData(timeElements);

                //Operation Summaries - includes a product reference
                summary.OperationSummaries = ImportOperationSummaries(isoLoggedTask);

                //Copy properties from LoggedData
                summary.GrowerId                    = loggedData.GrowerId;
                summary.FarmId                      = loggedData.FarmId;
                summary.FieldId                     = loggedData.FieldId;
                summary.CropZoneId                  = loggedData.CropZoneId;
                summary.PersonRoleIds               = loggedData.PersonRoleIds;
                summary.WorkItemIds                 = loggedData.WorkItemIds;
                summary.GuidanceAllocationIds       = loggedData.GuidanceAllocationIds;
                summary.EquipmentConfigurationGroup = loggedData.EquipmentConfigurationGroup;
            }
            return(summary);
        }
Esempio n. 17
0
        private TIM Map(TimeScope timeScope)
        {
            var endTime = FindActualEndTime(timeScope);

            return(new TIM
            {
                A = FindActualStartTime(timeScope),
                B = endTime,
                BSpecified = endTime != DateTime.MinValue,
                D = TIMD.Item4
            });
        }
Esempio n. 18
0
        public static void DownloadAllLeaderboardTopScores(TimeScope timeScope)
        {
            if (instanceExists && instance.debugMode)
            {
                Debug.LogFormat("LeaderboardManager:DownloadAllLeaderboardTopScores({0})", timeScope);
            }

            for (int i = 0, imax = EnumUtils.GetCount <Leaderboard>(); i < imax; i++)
            {
                DownloadLeaderboardTopScores((Leaderboard)i, timeScope);
            }
        }
Esempio n. 19
0
        public void NotMatchDayInMonthlyFixdTimeJobScheduleFrequencyTest()
        {
            MonthlyJobScheduleFrequency monthlyFrequency = PrepareMonthlyJobSchedule(1, 5);

            DateTime now       = DateTime.Now;
            DateTime startTime = new DateTime(now.Year, now.Month, 1);

            DateTime timePoint = startTime.AddDays(10) + new TimeSpan(10, 10, 10);

            TimeScope scope = monthlyFrequency.GetTimeScope(startTime, timePoint, _TimeOffset);

            Assert.IsNull(scope);
        }
Esempio n. 20
0
        public void NotMatchWeekDayWeeklyFixdTimeJobScheduleFrequencyTest()
        {
            WeeklyJobScheduleFrequency weeklyFrequency = PrepareWeeklyJobSchedule(1, DayOfWeek.Monday);

            DateTime now       = DateTime.Now;
            DateTime startTime = now.AddDays(-((int)now.DayOfWeek - (int)DayOfWeek.Sunday)).Date;

            DateTime timePoint = startTime.AddDays(2) + new TimeSpan(10, 10, 10);;

            TimeScope scope = weeklyFrequency.GetTimeScope(startTime, timePoint, _TimeOffset);

            Assert.IsNull(scope);
        }
Esempio n. 21
0
        public static IEnumerable <TimeScope> ImportAllocationStamps(IEnumerable <ISOAllocationStamp> isoAllocationStamps)
        {
            //Import TimeScopes
            List <TimeScope> adaptTimeScopes = new List <TimeScope>();

            foreach (ISOAllocationStamp ISOAllocationStamp in isoAllocationStamps)
            {
                TimeScope adaptTimeScope = ImportAllocationStamp(ISOAllocationStamp);
                adaptTimeScopes.Add(adaptTimeScope);
            }

            return(adaptTimeScopes);
        }
Esempio n. 22
0
 public Leaderboard()
 {
     id               = "Invalid";
     range            = new Range(1, 10);
     userScope        = UserScope.Global;
     timeScope        = TimeScope.AllTime;
     m_Loading        = false;
     m_LocalUserScore = new Score("Invalid", 0L);
     m_MaxRange       = 0u;
     m_Scores         = new Score[0];
     m_Title          = "Invalid";
     m_UserIDs        = new string[0];
 }
Esempio n. 23
0
        public void BeforeRecurringTimeFrequencyTest()
        {
            TimeSpan sTime = new TimeSpan(10, 0, 0);
            TimeSpan eTime = new TimeSpan(22, 0, 0);

            TimeFrequencyBase frequency = new RecurringTimeFrequency(10, IntervalUnit.Second, sTime, eTime);

            Console.WriteLine(frequency.Description);

            TimeSpan  lastExecuteTime = new TimeSpan(9, 59, 59);
            TimeScope scope           = frequency.GetTimeScope(lastExecuteTime, _TimeOffset);

            Assert.IsNull(scope);
        }
Esempio n. 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AGSSocialLeaderboard"/> class.
 /// </summary>
 /// <param name='leaderboard'>
 /// Leaderboard.
 /// </param>
 public AGSSocialLeaderboard(AGSLeaderboard leaderboard)
 {
     if(null == leaderboard) {
         AGSClient.LogGameCircleError("AGSSocialLeaderboard constructor \"leaderboard\" argument should not be null");
         this.leaderboard = AGSLeaderboard.GetBlankLeaderboard();
     } else {
         this.leaderboard = leaderboard;
     }
     id = leaderboard.id;
     scores = new AGSSocialLeaderboardScore[0];
     localPlayerScore = -1;
     localPlayerRank = -1;
     _timeScope = TimeScope.AllTime;
 }
        public GuidanceShift ImportGuidanceShift(ISOGuidanceShift isoGuidanceShift)
        {
            GuidanceShift adaptShift = new GuidanceShift();

            //Group ID
            int?groupID = TaskDataMapper.InstanceIDMap.GetADAPTID(isoGuidanceShift.GuidanceGroupIdRef);

            if (groupID.HasValue)
            {
                adaptShift.GuidanceGroupId = groupID.Value;
            }

            //Pattern ID
            int?patternID = TaskDataMapper.InstanceIDMap.GetADAPTID(isoGuidanceShift.GuidancePatternIdRef);

            if (patternID.HasValue)
            {
                adaptShift.GuidancePatterId = patternID.Value;
            }

            //Shifts
            if (isoGuidanceShift.GuidanceEastShift.HasValue)
            {
                adaptShift.EastShift = isoGuidanceShift.GuidanceEastShift.Value.AsNumericRepresentationValue("mm");
            }

            if (isoGuidanceShift.GuidanceNorthShift.HasValue)
            {
                adaptShift.NorthShift = isoGuidanceShift.GuidanceNorthShift.Value.AsNumericRepresentationValue("mm");
            }

            if (isoGuidanceShift.PropagationOffset.HasValue)
            {
                adaptShift.PropagationOffset = isoGuidanceShift.PropagationOffset.Value.AsNumericRepresentationValue("mm");
            }

            //Allocation Stamp
            if (isoGuidanceShift.AllocationStamp != null)
            {
                TimeScope scope = AllocationStampMapper.ImportAllocationStamp(isoGuidanceShift.AllocationStamp);
                DataModel.Catalog.TimeScopes.Add(scope);
                adaptShift.TimeScopeIds = new List <int>()
                {
                    scope.Id.ReferenceId
                };
            }

            return(adaptShift);
        }
Esempio n. 26
0
        public static void ShowPlayGameCenterLeaderboard(Leaderboard leaderboard, TimeScope timeScope = TimeScope.AllTime)
        {
            if (!instanceExists)
            {
                return;
            }
            if (!PlayGameCenterManager.isAuthenticated)
            {
                PlayGameCenterManager.TryAuthentication(true);
            }
#if UNITY_IOS || UNITY_TVOS
            GameCenterBinding.showLeaderboardWithTimeScopeAndLeaderboard(TimeScope2GameCenterLeaderboardTimeScope(timeScope), instance.leaderboardInfos[(int)leaderboard].leaderboardId);
#elif UNITY_ANDROID && !CHS
            PlayGameServices.showLeaderboard(instance.leaderboardInfos[(int)leaderboard].leaderboardId);
#endif
        }
Esempio n. 27
0
        // Call only when successfully downloaded online leaderboard or when there is a change on leaderboard.
        public static void WriteTopScores(Leaderboard leaderboard = (Leaderboard)0, TimeScope timeScope = TimeScope.AllTime)
        {
            List <LeaderboardEntry> topScores = GetTopScores(leaderboard, timeScope);
            int loadTopScoreCount             = topScores.Count;

            for (int i = 0, imax = LeaderboardManager.numLoadedTopScores; i < imax; i++)
            {
                if (i >= loadTopScoreCount)                 // This only happens in new leaderboard having not enough top scores
                {
                    break;
                }
                PlayerPrefs.SetString(PREF_TOP_SCORES + leaderboard + timeScope + i, topScores[i].prefData);
            }

            OnTopScoresChange(leaderboard, timeScope);
        }
Esempio n. 28
0
        protected override void Awake()
        {
            base.Awake();

            // Return and not initialize score variables, if no in-game leaderboard needed
            if (!hasInGameLeaderboards)
            {
                return;
            }

            // Init all arrays, lists and dictionaries here
            _myLeaderboardEntries = new LeaderboardEntry[EnumUtils.GetCount <Leaderboard>()];
            for (int i = 0, imax = EnumUtils.GetCount <Leaderboard>(); i < imax; i++)
            {
                _topScoresAllTimeDict.Add((Leaderboard)i, new List <LeaderboardEntry>());
                _topScoresWeekDict.Add((Leaderboard)i, new List <LeaderboardEntry>());
                _topScoresTodayDict.Add((Leaderboard)i, new List <LeaderboardEntry>());
            }

            // Read PlayerPref
            ReadMyLeaderboardScores();
            ReadTopScores();

            currentTimeScope = (TimeScope)PlayerPrefs.GetInt(PREF_CURRENT_TIME_SCOPE);

            for (int i = 0, imax = EnumUtils.GetCount <Leaderboard>(); i < imax; i++)
            {
                if (shouldLoadMyScores)
                {
                    _isMyScoreLoadedDict.Add((Leaderboard)i, false);
                }
                if (shouldLoadTopScores)
                {
                    _topScoresLoadedTimeScopeDict.Add((Leaderboard)i, TimeScope.AllTime);
                }
            }

#if UNITY_IOS || UNITY_TVOS
            GameCenterManager.scoresLoadedEvent             += OnTopScoresLoaded;
            GameCenterManager.scoresForPlayerIdsLoadedEvent += OnMyScoreLoaded;
#elif UNITY_ANDROID && !CHS
            GPGManager.loadScoresSucceededEvent += OnTopScoresLoaded;
            GPGManager.loadCurrentPlayerLeaderboardScoreSucceededEvent += OnMyScoreLoaded;
#endif

            PlayGameCenterManager.authenticationSucceededEvent += CheckshouldLoadTopScores;
        }
Esempio n. 29
0
    private LeaderboardScope fromTimeScope(TimeScope scope)
    {
        switch (scope)
        {
        case TimeScope.Today:
            return(LeaderboardScope.GlobalDay);

        case TimeScope.Week:
            return(LeaderboardScope.GlobalWeek);

        case TimeScope.AllTime:
            return(LeaderboardScope.GlobalAllTime);

        default:
            return(LeaderboardScope.GlobalAllTime);
        }
    }
Esempio n. 30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AGSSocialLeaderboard"/> class.
 /// </summary>
 /// <param name='leaderboard'>
 /// Leaderboard.
 /// </param>
 public AGSSocialLeaderboard(AGSLeaderboard leaderboard)
 {
     if (null == leaderboard)
     {
         AGSClient.LogGameCircleError("AGSSocialLeaderboard constructor \"leaderboard\" argument should not be null");
         this.leaderboard = AGSLeaderboard.GetBlankLeaderboard();
     }
     else
     {
         this.leaderboard = leaderboard;
     }
     id               = leaderboard.id;
     scores           = new AGSSocialLeaderboardScore[0];
     localPlayerScore = -1;
     localPlayerRank  = -1;
     _timeScope       = TimeScope.AllTime;
 }
Esempio n. 31
0
        public void InIntervalDailyFixdTimeJobScheduleFrequencyTest()
        {
            DailyJobScheduleFrequency dailyFrequency = PrepareDailyJobSchedule(2);

            DateTime startTime = DateTime.Now.Date.AddDays(2);
            DateTime timePoint = startTime + new TimeSpan(10, 10, 10);

            TimeScope scope = dailyFrequency.GetTimeScope(startTime, timePoint, _TimeOffset);

            Assert.IsNotNull(scope);

            Console.WriteLine(scope.BeginTime);
            Console.WriteLine(scope.EndTime);

            Assert.AreEqual(new TimeSpan(10, 10, 10) - _TimeOffset, scope.BeginTime);
            Assert.AreEqual(new TimeSpan(10, 10, 10) + _TimeOffset, scope.EndTime);
        }
Esempio n. 32
0
        static LeaderboardTimeSpan ToGpgsLeaderboardTimeSpan(TimeScope timeScope)
        {
            switch (timeScope)
            {
            case TimeScope.AllTime:
                return(LeaderboardTimeSpan.AllTime);

            case TimeScope.Week:
                return(LeaderboardTimeSpan.Weekly);

            case TimeScope.Today:
                return(LeaderboardTimeSpan.Daily);

            default:
                return(LeaderboardTimeSpan.AllTime);
            }
        }
Esempio n. 33
0
        public void AfterMidnightFixedTimeFrequencyTest()
        {
            TimeSpan           occurTime = new TimeSpan(0, 0, 0);
            FixedTimeFrequency frequency = new FixedTimeFrequency(occurTime);

            Console.WriteLine(frequency.Description);

            TimeScope scope = frequency.GetTimeScope(new TimeSpan(0, 0, 5), _TimeOffset);

            Assert.IsNotNull(scope);

            Console.WriteLine(scope.BeginTime);
            Console.WriteLine(scope.EndTime);

            Assert.AreEqual(occurTime - _TimeOffset, scope.BeginTime);
            Assert.AreEqual(occurTime + _TimeOffset, scope.EndTime);
        }
Esempio n. 34
0
 public Limit(PlayerScope playerScope, TimeScope timeScope, byte value)
 {
     this.PlayerScope = playerScope;
     this.TimeScope = timeScope;
     this.Value = value;
 }
Esempio n. 35
0
 private LeaderboardScope fromTimeScope(TimeScope scope)
 {
     switch (scope) {
     case TimeScope.Today:
         return LeaderboardScope.GlobalDay;
     case TimeScope.Week:
         return LeaderboardScope.GlobalWeek;
     case TimeScope.AllTime:
         return LeaderboardScope.GlobalAllTime;
     default:
         return LeaderboardScope.GlobalAllTime;
     }
 }
Esempio n. 36
0
 /// <summary>
 /// 获取排行榜的排名
 /// </summary>
 /// <param name="id">排行榜ID</param>
 /// <param name="range">区间</param>
 /// <param name="onComplete">完成回调</param>
 /// <param name="scope">时间区间</param>
 /// <param name="userScope">用户区间</param>
 public void GetTopByByLeaderboardID(string id, Range range, System.Action<bool, IScore[]> onComplete, TimeScope scope = TimeScope.AllTime, UserScope userScope = UserScope.Global)
 {
     if (!Social.localUser.authenticated)
         return;
     ILeaderboard lb = Social.CreateLeaderboard();
     Debug.Log(lb);
     if (lb == null)
         return;
     lb.id = id;
     lb.range = range;
     lb.timeScope = scope;
     lb.userScope = userScope;
     lb.LoadScores(ok =>
    {
        onComplete(ok, lb.scores);
    });
 }
Esempio n. 37
0
 public static void ShowLeaderboardUI(string leaderboardID, TimeScope timeScope)
 {
     Debug.Log("ShowLeaderboardUI - no effect in editor");
 }
Esempio n. 38
0
 public AttackModifier(PhaseCode startPhase, ISource source, ICardInPlay target, TimeScope duration, int value)
     : base("Attack", startPhase, source, target, duration, value)
 {
 }
Esempio n. 39
0
 public ThreatModifier(PhaseCode startPhase, ISource source, IThreateningInPlay target, TimeScope duration, int value)
     : base("Threat", startPhase, source, target, duration, value)
 {
 }
Esempio n. 40
0
		public static void ShowLeaderboardUI(string leaderboardID, TimeScope timeScope){}
 public WillpowerModifier(PhaseCode startPhase, ISource source, ICardInPlay target, TimeScope duration, int value)
     : base("Willpower", startPhase, source, target, duration, value)
 {
 }