当前位置: 首页>>代码示例>>C#>>正文


C# Utils.MyTimeSpan类代码示例

本文整理汇总了C#中VRage.Library.Utils.MyTimeSpan的典型用法代码示例。如果您正苦于以下问题:C# MyTimeSpan类的具体用法?C# MyTimeSpan怎么用?C# MyTimeSpan使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MyTimeSpan类属于VRage.Library.Utils命名空间,在下文中一共展示了MyTimeSpan类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateSleep

 public void UpdateSleep(bool isRelevant, MyTimeSpan currentTime)
 {
     if (isRelevant)
         SleepTime = MyTimeSpan.Zero;
     else if (!IsSleeping)
         SleepTime = currentTime;
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:7,代码来源:MyReplicableClientData.cs

示例2: BeforeRender

 public void BeforeRender(MyTimeSpan? currentDrawTime)
 {
     using (m_lock.Acquire())
     {
         if (currentDrawTime.HasValue)
             MyRenderProxy.CurrentDrawTime = currentDrawTime.Value;
     }
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:8,代码来源:MySharedData.cs

示例3: ReadAndClear

        public void ReadAndClear(MyTimeSpan currentTime, out Value sum, out int count, out Value min, out Value max, out Value last, out MyStatTypeEnum type, out int decimals, out MyTimeSpan inactivityMs)
        {
            Lock.Enter();
            try
            {
                inactivityMs = MyTimeSpan.Zero;

                if (Count <= 0) // Nothing was written
                {
                    // Load delta, increment it and save it
                    var delta = IntToDeltaTime(-Count);
                    delta += Count < 0 ? currentTime - LastClear : MyTimeSpan.FromMiliseconds(1);
                    Count = -DeltaTimeToInt(delta);

                    inactivityMs = delta;
                    LastClear = currentTime; // Nothing was written, postpone clear 
                }
                else
                {
                    if (currentTime >= (LastRefresh + MyTimeSpan.FromMiliseconds(RefreshRate)))
                    {
                        DrawSum = Sum;
                        DrawCount = Count;
                        DrawMin = Min;
                        DrawMax = Max;
                        DrawLast = Last;
                        LastRefresh = currentTime;

                        if (ClearRate == -1) // Clear with refresh
                        {
                            Count = 0;
                            ClearUnsafe();
                        }
                    }

                    if (ClearRate != -1 && currentTime >= (LastClear + MyTimeSpan.FromMiliseconds(ClearRate)))
                    {
                        Count = 0;
                        ClearUnsafe();
                        LastClear = currentTime;
                    }
                }

                type = Type;
                decimals = NumDecimals;
            }
            finally
            {
                Lock.Exit();
            }

            // No need lock, not accessed anywhere else outside read
            sum = DrawSum;
            count = DrawCount;
            min = DrawMin;
            max = DrawMax;
            last = DrawLast;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:58,代码来源:MyStat.cs

示例4: SetHealth

 private void SetHealth(float health)
 {
     if (health<20)
         //play heavy breath indefinitely
         m_healthOverride = MyTimeSpan.MaxValue;
     else
     if (health<100)
         m_healthOverride = MySandboxGame.Static.UpdateTime + MyTimeSpan.FromSeconds(300 / (health - 19.99));
     Update(true);
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:10,代码来源:MyCharacterBreath.cs

示例5: BeforeRender

        public void BeforeRender(MyRenderSettings writeTo, MyTimeSpan? currentDrawTime)
        {
            using (m_lock.Acquire())
            {
                if (currentDrawTime.HasValue)
                    MyRenderProxy.CurrentDrawTime = currentDrawTime.Value;

                writeTo.Synchronize(m_inputRenderSettings);
            }
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:10,代码来源:MySharedData.cs

示例6: AfterUpdate

        public void AfterUpdate(MyTimeSpan? updateTimestamp)
        {
            using (m_lock.Acquire())
            {
                if (updateTimestamp.HasValue)
                    m_inputRenderMessages.CurrentUpdateFrame.UpdateTimestamp = updateTimestamp.Value;

                m_inputRenderMessages.CommitUpdateFrame();
                m_inputBillboards.CommitWrite();
                m_inputBillboards.Write.Clear();
                m_inputTriangleBillboards.CommitWrite();
                m_inputTriangleBillboards.Write.Clear();
            }
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:14,代码来源:MySharedData.cs

示例7: AfterUpdate

        public void AfterUpdate(MyRenderSettings inputSettings, MyTimeSpan? updateTimestamp)
        {
            using (m_lock.Acquire())
            {
                if (updateTimestamp.HasValue)
                    m_inputRenderMessages.CurrentUpdateFrame.UpdateTimestamp = updateTimestamp.Value;

                m_inputRenderMessages.CommitUpdateFrame();
                m_inputRenderSettings.Synchronize(inputSettings); // TODO: OP! Better settings synchronization
                m_inputBillboards.CommitWrite();
                m_inputBillboards.Write.Clear();
                m_inputTriangleBillboards.CommitWrite();
                m_inputTriangleBillboards.Write.Clear();
            }
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:15,代码来源:MySharedData.cs

示例8: EndProfileBlock

        public static void EndProfileBlock()
        {
            Block ended = ProfileValues.m_block.Pop();
            MyTimeSpan elapsed = new MyTimeSpan(ProfileValues.m_timer.ElapsedTicks - ended.Started);

            using (ProfileValues.m_lock.AcquireExclusiveUsing())
            {
                Stats s;
                if (!ProfileValues.m_profile.TryGetValue(ended.Name, out s))
                {
                    s = new Stats();
                    ProfileValues.m_profile.Add(ended.Name, s);
                }
                s.TimeSpent += elapsed;
                s.Invokes++;

                if (ProfileValues.m_block.Count == 0)
                    ProfileValues.m_total.TimeSpent += elapsed;
                ProfileValues.m_total.Invokes++;
            }
        }
开发者ID:Souper07,项目名称:Autopilot,代码行数:21,代码来源:Profiler.cs

示例9: Results

			/// <summary>
			/// Create Results from a List of execution times.
			/// </summary>
			/// <param name="executionTimes">Execution times. Results does not create a copy, so the list should not be changed.</param>
			internal Results(ListSnapshots<MyTimeSpan> executionTimes)
			{
				UnsortedResults = executionTimes.immutable();
				Count = UnsortedResults.Count;

				Lazy_SortedResults = new Lazy<ReadOnlyList<MyTimeSpan>>(() =>
				{
					executionTimes.mutable().Sort((MyTimeSpan first, MyTimeSpan second) => { return Math.Sign((first - second).Ticks); });
					return new ReadOnlyList<MyTimeSpan>(executionTimes.immutable());
				});

				Lazy_Total = new Lazy<MyTimeSpan>(() =>
				{
					MyTimeSpan sum = new MyTimeSpan(0);
					foreach (MyTimeSpan result in UnsortedResults)
						sum += result;
					return sum;
				});

				Lazy_Mean = new Lazy<MyTimeSpan>(() => { return new MyTimeSpan(Total.Ticks / Count); });
				Lazy_Median = new Lazy<MyTimeSpan>(() => SortedResults_Interpolate((decimal)Count / 2 - 0.5m));
				Lazy_FirstQuartile = new Lazy<MyTimeSpan>(() => SortedResults_Interpolate((decimal)Count / 4 - 0.5m));
				Lazy_ThirdQuartile = new Lazy<MyTimeSpan>(() => SortedResults_Interpolate((decimal)Count * 3 / 4 - 0.5m));
			}
开发者ID:helppass,项目名称:Autopilot,代码行数:28,代码来源:TimeAction.cs

示例10: InfinarioUpdate

 public static void InfinarioUpdate(MyTimeSpan updateTime)
 {
     if (updateTime.Seconds - 60f >= m_lastMinuteUpdate)
     {
         m_lastMinuteUpdate = (float)updateTime.Seconds;
         ReportServerStatus();
     }
 }
开发者ID:liiir1985,项目名称:SpaceEngineers,代码行数:8,代码来源:MyAnalyticsHelper.cs

示例11: Log

 public void Log(MyTimeSpan currentTime)
 {
     Time += currentTime - TimeStamp;
     TotalTime += currentTime - TimeStamp;
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:5,代码来源:MySimpleProfiler.cs

示例12: SetViewMatrix

        public static void SetViewMatrix(MatrixD value, MyTimeSpan? updateTime)
        {
            if (MyRender.Settings.EnableCameraInterpolation && updateTime.HasValue)
            {
                var world = MatrixD.Invert(value);
                m_interpolation.AddSample(ref world, updateTime.Value);
                MatrixD worldOut;
                float i = m_interpolation.Interpolate(MyRender.InterpolationTime, out worldOut);
                m_viewMatrix = MatrixD.Invert(worldOut);
                MyRenderStats.Generic.Write("Camera interpolator", i, MyStatTypeEnum.Max, 250, 2);

                SetPosition(worldOut.Translation);
            }
            else
            {
                m_viewMatrix = value;

                MatrixD invertedViewMatrix;
                MatrixD.Invert(ref m_viewMatrix, out invertedViewMatrix);
                SetPosition(invertedViewMatrix.Translation);
            }

            InversePositionTranslationMatrix = MatrixD.CreateTranslation(-Position);
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:24,代码来源:MyRenderCamera.cs

示例13: ProfileCustomValue

        public void ProfileCustomValue(string name, float value, MyTimeSpan? customTime = null, string timeFormat = null, string valueFormat = null, [CallerMemberName] string member = "", [CallerLineNumber] int line = 0, [CallerFilePath] string file = "")
        {
            if (m_levelLimit != -1)
            {
                return;
            }

            ThreadProfiler.ProfileCustomValue(name, member, line, file, value, customTime, timeFormat, valueFormat);
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:9,代码来源:MyRenderProfiler.cs

示例14: End

 public static void End(float customValue = 0, MyTimeSpan? customTime = null, string timeFormat = null, string valueFormat = null, [CallerMemberName] string member = "", [CallerLineNumber] int line = 0, [CallerFilePath] string file = "")
 {
     MyRenderProxy.GetRenderProfiler().EndProfilingBlock(customValue, customTime, timeFormat, valueFormat, member, line, file);
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:4,代码来源:ProfilerShort.cs

示例15: ProfileCustomValue

 public void ProfileCustomValue(string name, string member, int line, string file, float value, MyTimeSpan? customTime, string timeFormat, string valueFormat, string callFormat = null)
 {
     StartBlock(name, member, line, file);
     EndBlock(member, line, file, customTime, value, timeFormat, valueFormat, callFormat);
 }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:5,代码来源:MyProfiler.cs


注:本文中的VRage.Library.Utils.MyTimeSpan类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。