// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT using System; namespace ClassicalSharp.Events { public class WorldEvents : OtherEvents { /// Raised when the player joins and begins loading a new world. public event EventHandler OnNewMap; internal void RaiseOnNewMap() { Raise( OnNewMap ); } /// Raised when a portion of the world is read and decompressed, or generated. public event EventHandler MapLoading; internal void RaiseMapLoading( float progress ) { loadingArgs.Progress = progress; Raise( MapLoading, loadingArgs ); } /// Raised when new world 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 world 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 float 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, WeatherSpeed, WeatherFade, } }