Exemplo n.º 1
0
        public void Dispose()
        {
            ChunkUpdater.Dispose();
            Atlas2D.Dispose();
            Atlas1D.Dispose();
            ModelCache.Dispose();
            Entities.Dispose();
            WorldEvents.OnNewMap       -= OnNewMapCore;
            WorldEvents.OnNewMapLoaded -= OnNewMapLoadedCore;
            Events.TextureChanged      -= TextureChangedCore;

            for (int i = 0; i < Components.Count; i++)
            {
                Components[i].Dispose();
            }

            Drawer2D.DisposeInstance();
            Graphics.Dispose();
            // TODO: is this needed
            //window.Dispose();

            if (!Options.HasChanged())
            {
                return;
            }
            Options.Load();
            Options.Save();
        }
Exemplo n.º 2
0
        public bool ChangeTerrainAtlas(Bitmap atlas)
        {
            if (!ValidateBitmap("terrain.png", atlas))
            {
                return(false);
            }
            if (atlas.Height < atlas.Width)
            {
                Chat.Add("&cUnable to use terrain.png from the texture pack.");
                Chat.Add("&c Its height is less than its width.");
                return(false);
            }
            if (Graphics.LostContext)
            {
                return(false);
            }

            Atlas1D.Dispose();
            Atlas2D.Dispose();
            Atlas2D.UpdateState(atlas);
            Atlas1D.UpdateState();

            Events.RaiseTerrainAtlasChanged();
            return(true);
        }