/// <summary> Raises the <see cref="E:System.Windows.Forms.Control.MouseWheel" /> event. </summary> /// <param name="e"> A <see cref="T:System.Windows.Forms.MouseEventArgs" /> that contains the /// event data. </param> /// <seealso cref="System.Windows.Forms.Control.OnMouseWheel(MouseEventArgs)"/> protected override void OnMouseWheel(MouseEventArgs e) { base.OnMouseWheel(e); if (_fullyVisibleRows > 0) { this.ScrollControl(WheelHelper.WheelScrollLines(this.Handle, e.Delta, _fullyVisibleRows, true)); } }
/// <summary> /// I mostly put this in C# because running a lua function 10 times every second per kart seemed like it could cause some slowdowns /// </summary> public SAA_WheelParticleHandler() { // init the dictionaries wheelHelpers = new Dictionary<int, Pair<WheelHelper, WheelHelper>>(); kartSpeedStates = new List<KartSpeedState>(); // hook up to events KartHandler.OnGround += OnGround; KartHandler.OnGroundChanged += OnGroundChanged; KartHandler.OnTouchdown += OnTouchdown; KartHandler.OnLiftoff += OnLiftoff; var sceneMgr = LKernel.GetG<SceneManager>(); // create particles for each wheel foreach (Player p in LKernel.GetG<PlayerManager>().Players) { WheelHelper lefthelper = new WheelHelper(); lefthelper.dust = sceneMgr.CreateParticleSystem("wheelDustLeftParticle" + p.ID, "dust"); lefthelper.mud = sceneMgr.CreateParticleSystem("wheelMudLeftParticle" + p.ID, "mud"); lefthelper.grass = sceneMgr.CreateParticleSystem("wheelGrassLeftParticle" + p.ID, "grass"); lefthelper.dust.RenderingDistance = renderingDistance; lefthelper.mud.RenderingDistance = renderingDistance; lefthelper.grass.RenderingDistance = renderingDistance; p.Kart.LeftParticleNode.AttachObject(lefthelper.dust); p.Kart.LeftParticleNode.AttachObject(lefthelper.mud); //p.Kart.LeftParticleNode.AttachObject(lefthelper.grass); lefthelper.DisableDust(); lefthelper.DisableGrass(); WheelHelper righthelper = new WheelHelper(); righthelper.dust = sceneMgr.CreateParticleSystem("wheelDustRightParticle" + p.ID, "dust"); righthelper.mud = sceneMgr.CreateParticleSystem("wheelMudRightParticle" + p.ID, "mud"); righthelper.grass = sceneMgr.CreateParticleSystem("wheelGrassRightParticle" + p.ID, "grass"); righthelper.dust.RenderingDistance = renderingDistance; righthelper.mud.RenderingDistance = renderingDistance; righthelper.grass.RenderingDistance = renderingDistance; p.Kart.RightParticleNode.AttachObject(righthelper.dust); p.Kart.RightParticleNode.AttachObject(righthelper.mud); //p.Kart.RightParticleNode.AttachObject(righthelper.grass); righthelper.DisableDust(); righthelper.DisableGrass(); if (defaultDustEmissionRate == -1) defaultDustEmissionRate = lefthelper.dust.GetEmitter(0).EmissionRate; if (defaultGrassEmissionRate == -1) defaultGrassEmissionRate = lefthelper.grass.GetEmitter(0).EmissionRate; if (defaultMudEmissionRate == -1) defaultMudEmissionRate = lefthelper.mud.GetEmitter(0).EmissionRate; wheelHelpers.Add(p.ID, new Pair<WheelHelper, WheelHelper>(lefthelper, righthelper)); // add one of these to the states list kartSpeedStates.Add(KartSpeedState.None); } dirtBody = LKernel.GetG<LevelManager>().CurrentLevel.Things["SAA_Road_Combined"].Body; grassBody = LKernel.GetG<LevelManager>().CurrentLevel.Things["SAA_Ground"].Body; }