private void OnMinimapSettingChange(bool oldvalue, bool newvalue) { RenderMinimap = newvalue; if (!newvalue) { _playingHud.RemoveChild(MiniMap); } else { _playingHud.AddChild(MiniMap); } }
public PlayingState(Alex alex, GraphicsDevice graphics, WorldProvider worldProvider, NetworkProvider networkProvider) : base(alex) { NetworkProvider = networkProvider; World = new World(alex.Services, graphics, Options, networkProvider); World.Player.IsFirstPersonMode = true; WorldProvider = worldProvider; if (worldProvider is SPWorldProvider) { World.DoDaylightcycle = false; //World.Player.SetInventory(new BedrockInventory(46)); if (ItemFactory.TryGetItem("minecraft:diamond_sword", out var sword)) { World.Player.Inventory.MainHand = sword; World.Player.Inventory[World.Player.Inventory.SelectedSlot] = sword; } } var title = new TitleComponent(); WorldProvider = worldProvider; WorldProvider.Init(World); WorldProvider.TitleComponent = title; _playingHud = new PlayingHud(Alex, World.Player, title); _playingHud.Chat.Network = networkProvider; WorldProvider.ScoreboardView = _playingHud.Scoreboard; WorldProvider.ChatRecipient = _playingHud; //WorldProvider.ScoreboardView _debugInfo = new GuiDebugInfo(); InitDebugInfo(); MiniMap = new GuiMiniMap(World.ChunkManager) { Anchor = Alignment.TopRight }; var settings = GetService <IOptionsProvider>(); settings.AlexOptions.VideoOptions.Minimap.Bind(OnMinimapSettingChange); RenderMinimap = settings.AlexOptions.VideoOptions.Minimap.Value; if (RenderMinimap) { _playingHud.AddChild(MiniMap); } _networkDebugHud = new NetworkDebugHud(NetworkProvider); }