public unsafe int AddMetric(string tag, float minimumValue, float maximumValue, int sampleCount, Func <float> getCurrentValue) { int id; fixed(byte *tagBytes = ResourceLoader.GetBytes(tag)) { id = DllImports.AddGraph(new DllImports.GraphData() { tag = tagBytes, tagLen = tag.Length, minVal = minimumValue, maxVal = maximumValue, valuesCount = sampleCount }); } if (id <= DllImports.FpsGraphId) { return(DllImports.WrongGraphId); } _metrics.Add(new Metric { Id = id, Update = getCurrentValue }); DllImports.SetGraphVisibility(id, _metricsShown ? 1 : 0); return(id); }
private void UpdateState() { DllImports.SetGraphVisibility(DllImports.FpsGraphId, _metricsShown ? 1 : 0); foreach (Metric metric in _metrics) { DllImports.SetGraphVisibility(metric.Id, _metricsShown ? 1 : 0); } DllImports.SetLogConsoleVisibility(_metricsShown ? 1 : 0); }