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