protected override void Initialize() { Window.Title = $"Alex - {VersionUtils.GetVersion()} - {RenderingEngine}"; // InitCamera(); this.Window.TextInput += Window_TextInput; if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { var currentAdapter = GraphicsAdapter.Adapters.FirstOrDefault(x => x == GraphicsDevice.Adapter); if (currentAdapter != null) { if (currentAdapter.IsProfileSupported(GraphicsProfile.HiDef)) { DeviceManager.GraphicsProfile = GraphicsProfile.HiDef; } } } base.InactiveSleepTime = TimeSpan.Zero; GraphicsDevice.PresentationParameters.MultiSampleCount = 8; DeviceManager.ApplyChanges(); base.Initialize(); RichPresenceProvider.Initialize(); }
private static RichPresence GenerateDefaultPresence() { return(new RichPresence { Details = "Running version " + VersionUtils.GetVersion(), State = "Hanging out", Assets = GetDefaultAssets(), Timestamps = Timestamps.Now }); }
private static string GetHash(string[] arrLine, IReadOnlyList <ScenarioDefinition> scenarioDefinitions, int startLocation, ScenarioDefinition scenarioDefinition, IEnumerable <string> backgroundSteps) { var currentScenarioStartLocation = GherkinUtils.GetFirstStepLocation(scenarioDefinition); Location nextScenarioStartLocation = null; if (startLocation + 1 < scenarioDefinitions.Count) { nextScenarioStartLocation = GherkinUtils.GetFirstTagLocation(scenarioDefinitions[startLocation + 1]); } return(VersionUtils.GetVersion( arrLine, currentScenarioStartLocation, nextScenarioStartLocation, backgroundSteps)); }
public Startup(IConfiguration configuration) { string logPath = Environment.GetEnvironmentVariable("MAGNUM_LOG_PATH"); LoggerConfiguration logConfig = new LoggerConfiguration(); logConfig.MinimumLevel.Is(LogEventLevel.Information); logConfig.Enrich.FromLogContext(); if (logPath != null) { logConfig.WriteTo.File(logPath, rollingInterval: RollingInterval.Day, retainedFileCountLimit: 7); } Log.Logger = logConfig.CreateLogger(); Log.Logger.Information("MagnumWeb version {Version} started", VersionUtils.GetVersion()); Configuration = configuration; }
protected void SetSdkVersion() { requestObs.Headers.Add(HEADER_SDK_VERSION, VersionUtils.GetVersion() + "/" + VersionUtils.GetPlatform()); }
private void InitDebugInfo() { string gameVersion = VersionUtils.GetVersion(); _debugInfo.AddDebugLeft( () => { double avg = 0; /* if (World.ChunkManager.TotalChunkUpdates > 0) * { * avg = (World.ChunkManager.ChunkUpdateTime / World.ChunkManager.TotalChunkUpdates) * .TotalMilliseconds; * }*/ return ($"Alex {gameVersion} ({Alex.FpsMonitor.Value:##} FPS, {World.Ticker.TicksPerSecond:##} TPS, Chunk Updates: {World.EnqueuedChunkUpdates} queued, {World.ConcurrentChunkUpdates} active)"); }, TimeSpan.FromMilliseconds(50)); _debugInfo.AddDebugLeft(() => { var pos = World.Player.KnownPosition; var blockPos = pos.GetCoordinates3D(); return($"Position: (X={pos.X:F2}, Y={pos.Y:F2}, Z={pos.Z:F2}, OnGround={pos.OnGround}) / Block: ({blockPos.X:D}, {blockPos.Y:D}, {blockPos.Z:D})"); }); _debugInfo.AddDebugLeft(() => { var pos = World.Player.KnownPosition; return($"Facing: {GetCardinalDirection(pos)} (HeadYaw={pos.HeadYaw:F2}, Yaw={pos.Yaw:F2}, Pitch={pos.Pitch:F2})"); }); _debugInfo.AddDebugLeft(() => { var pos = World.Player.Velocity; return($"Velocity: (X={pos.X:F2}, Y={pos.Y:F2}, Z={pos.Z:F2}) ({World.Player.CurrentSpeed:F3} m/s)"); // / Target Speed: {(World.Player.CalculateMovementSpeed() * 20f):F3} m/s"; }); _debugInfo.AddDebugLeft(() => $"Primitives: {Alex.Metrics.PrimitiveCount:N0} Draw count: {Alex.Metrics.DrawCount}", TimeSpan.FromMilliseconds(500)); // _debugInfo.AddDebugLeft(() => $"IndexBuffer Elements: {World.IndexBufferSize:N0} ({GetBytesReadable(World.IndexBufferSize * 4)})"); _debugInfo.AddDebugLeft(() => $"Chunks: {World.ChunkCount}, {World.ChunkManager.RenderedChunks}", TimeSpan.FromMilliseconds(500)); _debugInfo.AddDebugLeft(() => $"Entities: {World.EntityManager.EntityCount}, {World.EntityManager.EntitiesRendered}", TimeSpan.FromMilliseconds(500)); _debugInfo.AddDebugLeft(() => { return($"Biome: {_currentBiome.Name} ({_currentBiomeId})"); }, TimeSpan.FromMilliseconds(500)); //_debugInfo.AddDebugLeft(() => { return $"Do DaylightCycle: {World.DoDaylightcycle}"; }); _debugInfo.AddDebugLeft( () => { return($"Exhaustion: {World.Player.HealthManager.Exhaustion:F1}/{World.Player.HealthManager.MaxExhaustion}"); }, TimeSpan.FromMilliseconds(250)); _debugInfo.AddDebugLeft( () => { return($"Saturation: {World.Player.HealthManager.Saturation:F1}/{World.Player.HealthManager.MaxSaturation}"); }, TimeSpan.FromMilliseconds(250)); _debugInfo.AddDebugLeft( () => { return($"Health: {World.Player.HealthManager.Health:F1}/{World.Player.HealthManager.MaxHealth}"); }, TimeSpan.FromMilliseconds(250)); _debugInfo.AddDebugLeft( () => { return($"Gamemode: {World.Player.Gamemode}"); }, TimeSpan.FromSeconds(5)); _debugInfo.AddDebugRight(Alex.OperatingSystem); _debugInfo.AddDebugRight(Alex.Gpu); _debugInfo.AddDebugRight($"{Alex.DotnetRuntime}\n"); _debugInfo.AddDebugRight(Alex.RenderingEngine); //_debugInfo.AddDebugRight(() => MemoryUsageDisplay); _debugInfo.AddDebugRight(() => $"RAM: {GetBytesReadable(_ramUsage, 2)}", TimeSpan.FromMilliseconds(1000)); _debugInfo.AddDebugRight(() => $"GPU: {GetBytesReadable(GpuResourceManager.GetMemoryUsage, 2)}", TimeSpan.FromMilliseconds(1000)); _debugInfo.AddDebugRight(() => { return ($"Threads: {(_threadsUsed):00}/{_maxThreads}"); }, TimeSpan.FromMilliseconds(50)); _debugInfo.AddDebugRight(() => { var player = World?.Player; if (player == null) { return(""); } if (player.HasRaytraceResult) { var raytracedBlock = player.RaytracedBlock; var adjacentBlock = player.AdjacentRaytraceBlock; var adj = Vector3.Floor(adjacentBlock) - Vector3.Floor(raytracedBlock); adj.Normalize(); var face = adj.GetBlockFace(); StringBuilder sb = new StringBuilder(); sb.AppendLine($"Target: {raytracedBlock} Face: {face}"); sb.AppendLine( $"Skylight: {World.GetSkyLight(raytracedBlock)} Face Skylight: {World.GetSkyLight(adjacentBlock)}"); sb.AppendLine( $"Blocklight: {World.GetBlockLight(raytracedBlock)} Face Blocklight: {World.GetBlockLight(adjacentBlock)}"); //sb.AppendLine($"Skylight scheduled: {World.IsScheduled((int) _raytracedBlock.X, (int) _raytracedBlock.Y, (int) _raytracedBlock.Z)}"); foreach (var bs in World .GetBlockStates((int)raytracedBlock.X, (int)raytracedBlock.Y, (int)raytracedBlock.Z)) { var blockstate = bs.State; if (blockstate != null && blockstate.Block.HasHitbox) { sb.AppendLine($"{blockstate.Name} (S: {bs.Storage})"); /*if (blockstate.IsMultiPart) * { * sb.AppendLine($"MultiPart=true"); * sb.AppendLine(); * * sb.AppendLine("Models:"); * * foreach (var model in blockstate.AppliedModels) * { * sb.AppendLine(model); * } * }*/ var dict = blockstate.ToDictionary(); if (dict.Count > 0) { sb.AppendLine(); sb.AppendLine("Blockstate:"); foreach (var kv in dict) { sb.AppendLine($"{kv.Key}={kv.Value}"); } } } } return(sb.ToString()); } else { return(string.Empty); } }, TimeSpan.FromMilliseconds(500)); _debugInfo.AddDebugRight(() => { var player = World.Player; if (player == null || player.HitEntity == null) { return(string.Empty); } var entity = player.HitEntity; return($"Hit entity: {entity.EntityId} / {entity.ToString()}"); }, TimeSpan.FromMilliseconds(500)); }
public void TestVersionExtraction() { Assert.AreNotEqual("unknown", VersionUtils.GetVersion()); }