コード例 #1
0
        /// <summary>
        /// Update session and engine statistics
        /// </summary>
        /// <param name="data"></param>
        public void Restore(StatsDump data)
        {
            Sessions.Clear();
            foreach (var session in data.Sessions)
            {
                Sessions.Add(session);
            }

            EngineStats.Clear();
            foreach (var stat in data.Stats)
            {
                EngineStats.Add(stat.Id, stat);
            }
        }
コード例 #2
0
        /// <summary>
        /// Update game engine statistics
        /// </summary>
        /// <param name="s"></param>
        private void ProcessStat(EngineStat s)
        {
            if (EngineStats.ContainsKey(s.Id))
            {
                EngineStats[s.Id].Sum   += s.Sum;
                EngineStats[s.Id].Count += s.Count;

                Logger.LogDebug("updated stat {ChallengeId} {Sum} {Count} {Average}", EngineStats[s.Id].Id, EngineStats[s.Id].Sum, EngineStats[s.Id].Count, EngineStats[s.Id].Average);
            }
            else
            {
                EngineStats.Add(s.Id, s);
            }
        }
コード例 #3
0
        protected double GetTorque(double RPM)
        {
            if (!areEngineStatsSortedByRPM)
            {
                EngineStats.OrderBy(stat => stat.RPM);
                areEngineStatsSortedByRPM = true;
            }

            double torque;
            var    engineStat = EngineStats.Find(x => x.RPM == RPM);

            if (engineStat != null) //RPM is a point on our map
            {
                torque = engineStat.torque;
            }
            else
            {
                //RPM is not a point on our map (and it has top be approximated)
                if (RPM > EngineStats.First().RPM&& RPM < EngineStats.Last().RPM)  //it is in scale
                {
                    var p1 = EngineStats.Find(x => x.RPM > RPM);
                    var p2 = EngineStats.FindLast(x => x.RPM < RPM); //can be optimized
                    torque = LinearApprox(p1.RPM, p1.torque, 0, 0, RPM);
                }
                else if (RPM < EngineStats.First().RPM) //if its under a scale
                {
                    var p1 = EngineStats[0];
                    torque = LinearApprox(p1.RPM, p1.torque, 0, 0, RPM);
                }
                else //if its over a scale
                {
                    var p1 = EngineStats.Last();
                    torque = LinearApprox(p1.RPM, p1.torque, MaxEngineRPM, 0, RPM);
                }
            }

            return(torque);
        }
コード例 #4
0
 private void Awake()
 {
     meshOriginalRot = meshTransform.rotation;
     engineStats     = Utilities.CheckScriptableObject <EngineStats>(engineStats);
 }
コード例 #5
0
ファイル: Engine.cs プロジェクト: U3DC/ProjectLonestar
 private void Awake()
 {
     engineStats = Utilities.CheckScriptableObject <EngineStats>(engineStats);
     blinkCD     = Utilities.CheckScriptableObject <Cooldown>(blinkCD);
     sidestepCD  = Utilities.CheckScriptableObject <Cooldown>(sidestepCD);
 }
コード例 #6
0
 /// <summary>
 /// Return wait time in seconds for challenge initialization
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public int ChallengeWaitSeconds(string id)
 {
     return(EngineStats.ContainsKey(id)
         ? EngineStats[id].Average
         : 0);
 }
コード例 #7
0
        public override void Render(Context context)
        {
            if (InputManager.IsKeyPressed(KeyCode.Q))
            {
                _enabled = !_enabled;
            }

            if (!_enabled)
            {
                return;
            }
            HDC hdc;

            Common.CheckAndThrow(_surface.Get()->GetDC(0, &hdc), nameof(IDXGISurface1.GetDC));

            GDI32.SetTextColor(hdc, new COLORREF(0, 200, 200));
            GDI32.SetBkColor(hdc, new COLORREF(0, 0, 0));
            GDI32.SetBkMode(hdc, BackgroundMode.Transparent);

            const int lineHeight = 25;
            var       rectSize   = (EngineStats.TotalLines + 2) * lineHeight;
            //var oldBrush = GDI32.SelectObject(hdc, _brush);
            var rect = new RECT
            {
                Top    = 0,
                Left   = 0,
                Right  = 1000,
                Bottom = rectSize
            };

            GDI32.FillRect(hdc, &rect, _brush);
            var obj = GDI32.SelectObject(hdc, _font);

            const string template = "{0}: {1:N6}ms";
            var          i        = 1;

            foreach (var(name, value) in EngineStats.GetStats())
            {
                var str = string.Format(template, name, value);
                fixed(char *pStr = str)
                {
                    GDI32.TextOutW(hdc, 10, i * lineHeight, pStr, str.Length);
                    i++;
                }
            }

            const string systems = "Systems";

            fixed(char *pStr = systems)
            {
                GDI32.TextOutW(hdc, 10, i * 25, pStr, systems.Length);
                i++;
            }

            const string systemsTemplate = "{0} Pre: {1:N4}ms    Fixed: {2:N4}ms   Update: {3:N4}ms   Post: {4:N4}ms";

            foreach (var(key, value) in EngineStats.GetSystemStats().OrderBy(e => e.Key))
            {
                var str = string.Format(systemsTemplate, key.PadRight(25), value.PreUpdate, value.FixedUpdate, value.Update, value.PostUpdate);
                fixed(char *pStr = str)
                {
                    GDI32.TextOutW(hdc, 10, i * lineHeight, pStr, str.Length);
                    i++;
                }
            }

            GDI32.SelectObject(hdc, obj);
            _surface.Get()->ReleaseDC(null);
        }
コード例 #8
0
ファイル: Horde3D .NET.cs プロジェクト: mgottschlag/horde3d
 /// <summary>
 /// Gets a statistic value of the engine.
 /// </summary>
 /// This function returns the value of the specified statistic. The reset flag makes it possible
 /// to reset the statistic value after reading.
 /// <param name="param">statistic parameter</param>
 /// <param name="reset">flag specifying whether statistic value should be reset</param>
 /// <returns>current value of the specified statistic parameter</returns>
 public static float getStat(EngineStats param, bool reset)
 {
     return NativeMethodsEngine.getStat((int)param, reset);
 }