public void DrawIf(SpriteBatch sb, HUDDrawData hudDrawData) { /*if( Main.InGameUI.CurrentState != null ) { * return; * }*/ if (Main.LocalPlayer.mouseInterface) //not HUDLibraries.IsMouseInterfacingWithUI; inventory always == true { return; } if (HUDElementsLibAPI.GetDraggingElement() != null) { return; } if (hudDrawData.IsPreAimMode) { this.DrawPreAimCursor(sb, hudDrawData.AimPercent); } else if (hudDrawData.IsAimMode) { this.DrawAimCursor(sb); } else if (hudDrawData.HasGun) { this.DrawUnaimCursor(sb); } }
//////////////// public HUDDrawData(HUDDrawData prevHudData) { var myplayer = Main.LocalPlayer.GetModPlayer <TMRPlayer>(); this.HasGun = !myplayer.GunHandling.IsAnimating && PlayerLogic.IsHoldingGun(Main.LocalPlayer); this.IsReloading = myplayer.GunHandling.IsReloading; this.AimPercent = myplayer.AimMode.AimPercent; this.IsAimMode = myplayer.AimMode.IsModeActive; this.IsPreAimMode = !myplayer.AimMode.IsModeActive && myplayer.AimMode.IsModeActivating; }
//////////////// public bool ConsumesCursor(HUDDrawData hudDrawData) { /*if( Main.InGameUI.CurrentState != null ) { * return false; * }*/ if (HUDLibraries.IsMouseInterfacingWithUI) //Main.LocalPlayer.mouseInterface { return(false); } return(hudDrawData.IsAimMode || (hudDrawData.IsPreAimMode && hudDrawData.AimPercent > 0.25f)); }
//////////////// private void UpdatePreAimCursorAnimation(HUDDrawData hudDrawData) { var myplayer = Main.LocalPlayer.GetModPlayer <TMRPlayer>(); if (!myplayer.AimMode.IsModeActivating || myplayer.AimMode.IsModeActive) { return; } this.PreAimZoomAnimationPercent += 1f / 20f; if (this.PreAimZoomAnimationPercent > 1f) { this.PreAimZoomAnimationPercent = 0f; } }
private void UpdateAimCursorAnimation(HUDDrawData hudDrawData) { var myplayer = Main.LocalPlayer.GetModPlayer <TMRPlayer>(); if (!myplayer.AimMode.IsModeActive) { // Fade out and zoom out slowly, invisibly if (this.AimZoomAnimationPercent >= 0f) { this.AimZoomAnimationPercent -= 1f / CrosshairHUD.CrosshairDurationTicksMax; } else { this.AimZoomAnimationPercent = -1f; } } else { // Begin fade in and zoom in if (this.AimZoomAnimationPercent == -1f) { if (myplayer.AimMode.IsQuickDrawActive) { this.AimZoomAnimationPercent = 1f; } else { this.AimZoomAnimationPercent = 0f; } } else if (this.AimZoomAnimationPercent <= 1f) { this.AimZoomAnimationPercent += 1f / CrosshairHUD.CrosshairDurationTicksMax; // Actual fading in } if (this.AimZoomAnimationPercent > 1f) { this.AimZoomAnimationPercent = 1f; } } }
public void Update(HUDDrawData hudDrawData) { this.UpdatePreAimCursorAnimation(hudDrawData); this.UpdateAimCursorAnimation(hudDrawData); }