Exemplo n.º 1
0
        protected override void DoWhenAllDataIsReady()
        {
            //if (Res.DebuggingSignalFlag)
            //    Log.Debug(_tag, $"DoWhenAll: {LoggedData.Count} data pts.");
            if (AllowDataUpdates) //base.DoWhenAllDataIsReady();
            {
                LoggedData.Add(Provider.Data);
                //Timestamps.Add(Timestamps.LastOrDefault() + Provider.Interval);
                Timestamps.Add(Provider.RunTime + AccumulatedRuntime);
                Intervals.Add(Provider.Interval);
            }
            //if (SessionCTS != null && SessionCTS.IsCancellationRequested)
            //{
            //    if (DeactivationCounter == 0)
            //    {
            //        SessionCTS = null;
            //        DeactivationCounter = 10;
            //        AdditionalPointsSignal.Set();
            //    }
            //    else DeactivationCounter--;
            //}

            if (InitialInterval == TimeSpan.Zero)
            {
                InitialInterval = Provider.Interval;
            }
        }
Exemplo n.º 2
0
 protected override void DoWhenAllDataIsReady()
 {
     _smoothedData.Add(Provider.Data);
     //Timestamps.Add(Timestamps.LastOrDefault() + providers[0].Interval);
     Timestamps.Add(providers[0].RunTime);
     Intervals.Add(Provider.Interval);
 }
Exemplo n.º 3
0
 private void InitTimestamps(int count)
 {
     for (int i = 0; i < count; i++)
     {
         Timestamps.Add("--:--:--");
     }
 }
Exemplo n.º 4
0
 protected override void DoWhenAllDataIsReady()
 {
     _smoothedData.Add(new Datapoint <T1, T2>()
     {
         Value1 = (providers[0] as IProvider <T1>).Data, Value2 = (providers[1] as IProvider <T2>).Data
     });
     //Timestamps.Add(Timestamps.LastOrDefault() + providers[0].Interval);
     Timestamps.Add(providers[0].RunTime);
     Intervals.Add(providers[0].Interval);
 }
Exemplo n.º 5
0
        public void readM2Track(BinaryReader br)
        {
            InterpolationType = br.ReadUInt16();
            GlobalSequence    = br.ReadInt16();

            UInt32 tCount     = br.ReadUInt32();
            UInt32 tOffset    = br.ReadUInt32();
            long   tHeaderpos = br.BaseStream.Position;

            br.BaseStream.Position = tOffset;


            for (int a = 0; a < tCount; a++)
            {
                List <UInt32> timestamps = new List <UInt32>();

                UInt32 ttCount     = br.ReadUInt32();
                UInt32 ttOffset    = br.ReadUInt32();
                long   ttHeaderpos = br.BaseStream.Position;
                br.BaseStream.Position = ttOffset;
                for (int b = 0; b < ttCount; b++)
                {
                    timestamps.Add(br.ReadUInt32());
                }
                br.BaseStream.Position = ttHeaderpos;

                Timestamps.Add(timestamps);
            }
            br.BaseStream.Position = tHeaderpos;

            tCount                 = br.ReadUInt32();
            tOffset                = br.ReadUInt32();
            tHeaderpos             = br.BaseStream.Position;
            br.BaseStream.Position = tOffset;

            for (int a = 0; a < tCount; a++)
            {
                List <UInt32> keys = new List <UInt32>();

                UInt32 ttCount     = br.ReadUInt32();
                UInt32 ttOffset    = br.ReadUInt32();
                long   ttHeaderpos = br.BaseStream.Position;
                br.BaseStream.Position = ttOffset;
                for (int b = 0; b < ttCount; b++)
                {
                    keys.Add(br.ReadUInt32());
                }
                br.BaseStream.Position = ttHeaderpos;

                Keys.Add(keys);
            }
            br.BaseStream.Position = tHeaderpos;
        }
Exemplo n.º 6
0
        private string GetUniqueTimeStamp(List <string> Timestamps)
        {
            ulong  seconds = Kicad_utils.Utils.GetUnixSeconds(DateTime.Now);
            string tstamp  = seconds.ToString("X");

            if (Timestamps == null)
            {
                Timestamps = new List <string>();
            }
            else
            {
                while (Timestamps.IndexOf(tstamp) != -1)
                {
                    seconds++;
                    tstamp = seconds.ToString("X");
                }
            }
            Timestamps.Add(tstamp);
            return(tstamp);
        }
Exemplo n.º 7
0
    public void AddCounter(Player player, long amount)
    {
        Counter += amount;
        if (IsDone)
        {
            return;
        }

        if (Counter < GradeCondition.Condition)
        {
            return;
        }

        if (!RewardTypeRequiresClaim(GradeCondition.RewardType) && LastReward == NextGrade)
        {
            // Add stat points and skill points
            switch (GradeCondition.RewardType)
            {
            case RewardType.statPoint:
                player.AddStatPoint(GradeCondition.RewardValue, OtherStatsIndex.Trophy);
                break;

            case RewardType.skillPoint:
                // TODO: Add skill points
                break;
            }

            LastReward++;
        }

        NextGrade++;
        Timestamps.Add(TimeInfo.Now());

        // level up but not completed
        if (NextGrade <= MaxGrade)
        {
            // Update condition
            GradeCondition = TrophyMetadataStorage.GetMetadata(Id).Grades.FirstOrDefault(x => x.Grade == NextGrade);
            return;
        }

        // level up and completed
        IsDone = true;
        NextGrade--;
        string[] categories = TrophyMetadataStorage.GetMetadata(Id).Categories;
        foreach (string category in categories)
        {
            switch (category)
            {
            case string s when s.Contains("combat"):
                player.TrophyCount[0] += 1;

                break;

            case string s when s.Contains("adventure"):
                player.TrophyCount[1] += 1;

                break;

            case string s when s.Contains("lifestyle"):
                player.TrophyCount[2] += 1;

                break;
            }
        }
    }
        public void AddCounter(GameSession session, long amount)
        {
            Counter += amount;
            if (IsDone)
            {
                return;
            }

            if (Counter < Condition)
            {
                return;
            }

            TrophyGradeMetadata grade = TrophyMetadataStorage.GetMetadata(Id).Grades.FirstOrDefault(x => x.Grade == NextGrade);

            if (!RewardTypeRequiresClaim(grade.RewardType) && LastReward == NextGrade)
            {
                // Add stat points and skill points
                switch (grade.RewardType)
                {
                case RewardType.statPoint:
                    session.Player.AddStatPoint(grade.RewardValue, OtherStatsIndex.Trophy);
                    break;

                case RewardType.skillPoint:
                    // TODO: Add skill points
                    break;
                }
                LastReward++;
            }
            NextGrade++;
            Timestamps.Add(DateTimeOffset.UtcNow.ToUnixTimeSeconds());

            // level up but not completed
            if (NextGrade <= MaxGrade)
            {
                // Update condition
                TrophyGradeMetadata trophyGradeMetadata = TrophyMetadataStorage.GetMetadata(Id).Grades.FirstOrDefault(x => x.Grade == NextGrade);
                Condition      = trophyGradeMetadata.Condition;
                ConditionType  = trophyGradeMetadata.ConditionType;
                ConditionCodes = trophyGradeMetadata.ConditionCodes;
                return;
            }

            // level up and completed
            IsDone = true;
            NextGrade--;
            string[] categories = TrophyMetadataStorage.GetMetadata(Id).Categories;
            foreach (string category in categories)
            {
                switch (category)
                {
                case string s when s.Contains("combat"):
                    session.Player.TrophyCount[0] += 1;

                    break;

                case string s when s.Contains("adventure"):
                    session.Player.TrophyCount[1] += 1;

                    break;

                case string s when s.Contains("lifestyle"):
                    session.Player.TrophyCount[2] += 1;

                    break;
                }
            }
        }