using System; namespace ClassicalSharp { public class MapEvents : Events { /// Raised when the player joins and begins loading a new map. public event EventHandler OnNewMap; internal void RaiseOnNewMap() { Raise( OnNewMap ); } /// Raised when a portion of the map is read and decompressed, or generated. public event EventHandler MapLoading; internal void RaiseMapLoading( byte progress ) { loadingArgs.Progress = progress; Raise( MapLoading, loadingArgs ); } /// Raised when new map has finished loading and the player can now interact with it. public event EventHandler OnNewMapLoaded; internal void RaiseOnNewMapLoaded() { Raise( OnNewMapLoaded ); } /// Raised when an environment variable of the map is changed by the user, CPE, or WoM config. public event EventHandler EnvVariableChanged; internal void RaiseEnvVariableChanged( EnvVar envVar ) { envArgs.Var = envVar; Raise( EnvVariableChanged, envArgs ); } MapLoadingEventArgs loadingArgs = new MapLoadingEventArgs(); EnvVarEventArgs envArgs = new EnvVarEventArgs(); } public sealed class MapLoadingEventArgs : EventArgs { /// Percentage of the map that has been fully decompressed, or generated. public int Progress; } public sealed class EnvVarEventArgs : EventArgs { /// Map environment variable that was changed. public EnvVar Var; } public enum EnvVar { SidesBlock, EdgeBlock, EdgeLevel, CloudsLevel, CloudsSpeed, Weather, SkyColour, CloudsColour, FogColour, SunlightColour, ShadowlightColour, } }