mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 02:56:09 -04:00
Now all options show their values.
This commit is contained in:
parent
37c6d8c84e
commit
993b93558e
@ -23,7 +23,7 @@ namespace ClassicalSharp.Gui {
|
|||||||
MakeClassicBool( -1, -150, "Invert mouse", OptionsKey.InvertMouse,
|
MakeClassicBool( -1, -150, "Invert mouse", OptionsKey.InvertMouse,
|
||||||
OnWidgetClick, g => g.InvertMouse, (g, v) => g.InvertMouse = v ),
|
OnWidgetClick, g => g.InvertMouse, (g, v) => g.InvertMouse = v ),
|
||||||
|
|
||||||
MakeClassic( -1, -100, "View distance", OnWidgetClick,
|
MakeClassic2( -1, -100, "View distance", OnWidgetClick,
|
||||||
g => g.ViewDistance.ToString(),
|
g => g.ViewDistance.ToString(),
|
||||||
(g, v) => g.SetViewDistance( Int32.Parse( v ), true ) ),
|
(g, v) => g.SetViewDistance( Int32.Parse( v ), true ) ),
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ namespace ClassicalSharp.Gui {
|
|||||||
MakeClassicBool( 1, -100, "View bobbing", OptionsKey.ViewBobbing,
|
MakeClassicBool( 1, -100, "View bobbing", OptionsKey.ViewBobbing,
|
||||||
OnWidgetClick, g => g.ViewBobbing, (g, v) => g.ViewBobbing = v ),
|
OnWidgetClick, g => g.ViewBobbing, (g, v) => g.ViewBobbing = v ),
|
||||||
|
|
||||||
MakeClassic( 1, -50, "FPS limit mode", OnWidgetClick,
|
MakeClassic2( 1, -50, "FPS mode", OnWidgetClick,
|
||||||
g => g.FpsLimit.ToString(),
|
g => g.FpsLimit.ToString(),
|
||||||
(g, v) => { object raw = Enum.Parse( typeof(FpsLimitMethod), v );
|
(g, v) => { object raw = Enum.Parse( typeof(FpsLimitMethod), v );
|
||||||
g.SetFpsLimitMethod( (FpsLimitMethod)raw );
|
g.SetFpsLimitMethod( (FpsLimitMethod)raw );
|
||||||
|
@ -19,40 +19,40 @@ namespace ClassicalSharp.Gui {
|
|||||||
|
|
||||||
widgets = new Widget[] {
|
widgets = new Widget[] {
|
||||||
// Column 1
|
// Column 1
|
||||||
Make( -1, -150, "Clouds colour", OnWidgetClick,
|
Make2( -1, -150, "Clouds col", OnWidgetClick,
|
||||||
g => g.World.CloudsCol.ToRGBHexString(),
|
g => g.World.CloudsCol.ToRGBHexString(),
|
||||||
(g, v) => g.World.SetCloudsColour( FastColour.Parse( v ) ) ),
|
(g, v) => g.World.SetCloudsColour( FastColour.Parse( v ) ) ),
|
||||||
|
|
||||||
Make( -1, -100, "Sky colour", OnWidgetClick,
|
Make2( -1, -100, "Sky col", OnWidgetClick,
|
||||||
g => g.World.SkyCol.ToRGBHexString(),
|
g => g.World.SkyCol.ToRGBHexString(),
|
||||||
(g, v) => g.World.SetSkyColour( FastColour.Parse( v ) ) ),
|
(g, v) => g.World.SetSkyColour( FastColour.Parse( v ) ) ),
|
||||||
|
|
||||||
Make( -1, -50, "Fog colour", OnWidgetClick,
|
Make2( -1, -50, "Fog col", OnWidgetClick,
|
||||||
g => g.World.FogCol.ToRGBHexString(),
|
g => g.World.FogCol.ToRGBHexString(),
|
||||||
(g, v) => g.World.SetFogColour( FastColour.Parse( v ) ) ),
|
(g, v) => g.World.SetFogColour( FastColour.Parse( v ) ) ),
|
||||||
|
|
||||||
Make( -1, 0, "Clouds speed", OnWidgetClick,
|
Make2( -1, 0, "Clouds speed", OnWidgetClick,
|
||||||
g => g.World.CloudsSpeed.ToString(),
|
g => g.World.CloudsSpeed.ToString(),
|
||||||
(g, v) => g.World.SetCloudsSpeed( Single.Parse( v ) ) ),
|
(g, v) => g.World.SetCloudsSpeed( Single.Parse( v ) ) ),
|
||||||
|
|
||||||
Make( -1, 50, "Clouds height", OnWidgetClick,
|
Make2( -1, 50, "Clouds height", OnWidgetClick,
|
||||||
g => g.World.CloudHeight.ToString(),
|
g => g.World.CloudHeight.ToString(),
|
||||||
(g, v) => g.World.SetCloudsLevel( Int32.Parse( v ) ) ),
|
(g, v) => g.World.SetCloudsLevel( Int32.Parse( v ) ) ),
|
||||||
|
|
||||||
// Column 2
|
// Column 2
|
||||||
Make( 1, -100, "Sunlight colour", OnWidgetClick,
|
Make2( 1, -100, "Sunlight col", OnWidgetClick,
|
||||||
g => g.World.Sunlight.ToRGBHexString(),
|
g => g.World.Sunlight.ToRGBHexString(),
|
||||||
(g, v) => g.World.SetSunlight( FastColour.Parse( v ) ) ),
|
(g, v) => g.World.SetSunlight( FastColour.Parse( v ) ) ),
|
||||||
|
|
||||||
Make( 1, -50, "Shadow colour", OnWidgetClick,
|
Make2( 1, -50, "Shadow col", OnWidgetClick,
|
||||||
g => g.World.Shadowlight.ToRGBHexString(),
|
g => g.World.Shadowlight.ToRGBHexString(),
|
||||||
(g, v) => g.World.SetShadowlight( FastColour.Parse( v ) ) ),
|
(g, v) => g.World.SetShadowlight( FastColour.Parse( v ) ) ),
|
||||||
|
|
||||||
Make( 1, 0, "Weather", OnWidgetClick,
|
Make2( 1, 0, "Weather", OnWidgetClick,
|
||||||
g => g.World.Weather.ToString(),
|
g => g.World.Weather.ToString(),
|
||||||
(g, v) => g.World.SetWeather( (Weather)Enum.Parse( typeof(Weather), v ) ) ),
|
(g, v) => g.World.SetWeather( (Weather)Enum.Parse( typeof(Weather), v ) ) ),
|
||||||
|
|
||||||
Make( 1, 50, "Water level", OnWidgetClick,
|
Make2( 1, 50, "Water level", OnWidgetClick,
|
||||||
g => g.World.EdgeHeight.ToString(),
|
g => g.World.EdgeHeight.ToString(),
|
||||||
(g, v) => g.World.SetEdgeLevel( Int32.Parse( v ) ) ),
|
(g, v) => g.World.SetEdgeLevel( Int32.Parse( v ) ) ),
|
||||||
|
|
||||||
@ -60,7 +60,6 @@ namespace ClassicalSharp.Gui {
|
|||||||
(g, w) => g.SetNewScreen( new OptionsGroupScreen( g ) ) ),
|
(g, w) => g.SetNewScreen( new OptionsGroupScreen( g ) ) ),
|
||||||
null, null, null,
|
null, null, null,
|
||||||
};
|
};
|
||||||
widgets[7].Metadata = typeof(Weather);
|
|
||||||
MakeDefaultValues();
|
MakeDefaultValues();
|
||||||
MakeValidators();
|
MakeValidators();
|
||||||
}
|
}
|
||||||
|
@ -17,23 +17,23 @@ namespace ClassicalSharp.Gui {
|
|||||||
|
|
||||||
widgets = new Widget[] {
|
widgets = new Widget[] {
|
||||||
|
|
||||||
Make( -1, 0, "FPS limit mode", OnWidgetClick,
|
Make2( -1, 0, "FPS mode", OnWidgetClick,
|
||||||
g => g.FpsLimit.ToString(),
|
g => g.FpsLimit.ToString(),
|
||||||
(g, v) => { object raw = Enum.Parse( typeof(FpsLimitMethod), v );
|
(g, v) => { object raw = Enum.Parse( typeof(FpsLimitMethod), v );
|
||||||
g.SetFpsLimitMethod( (FpsLimitMethod)raw );
|
g.SetFpsLimitMethod( (FpsLimitMethod)raw );
|
||||||
Options.Set( OptionsKey.FpsLimit, v ); } ),
|
Options.Set( OptionsKey.FpsLimit, v ); } ),
|
||||||
|
|
||||||
Make( -1, 50, "View distance", OnWidgetClick,
|
Make2( -1, 50, "View distance", OnWidgetClick,
|
||||||
g => g.ViewDistance.ToString(),
|
g => g.ViewDistance.ToString(),
|
||||||
(g, v) => g.SetViewDistance( Int32.Parse( v ), true ) ),
|
(g, v) => g.SetViewDistance( Int32.Parse( v ), true ) ),
|
||||||
|
|
||||||
Make( 1, 0, "Names mode", OnWidgetClick,
|
Make2( 1, 0, "Names", OnWidgetClick,
|
||||||
g => g.Players.NamesMode.ToString(),
|
g => g.Players.NamesMode.ToString(),
|
||||||
(g, v) => { object raw = Enum.Parse( typeof(NameMode), v );
|
(g, v) => { object raw = Enum.Parse( typeof(NameMode), v );
|
||||||
g.Players.NamesMode = (NameMode)raw;
|
g.Players.NamesMode = (NameMode)raw;
|
||||||
Options.Set( OptionsKey.NamesMode, v ); } ),
|
Options.Set( OptionsKey.NamesMode, v ); } ),
|
||||||
|
|
||||||
Make( 1, 50, "Entity shadows", OnWidgetClick,
|
Make2( 1, 50, "Shadows", OnWidgetClick,
|
||||||
g => g.Players.ShadowMode.ToString(),
|
g => g.Players.ShadowMode.ToString(),
|
||||||
(g, v) => { object raw = Enum.Parse( typeof(EntityShadow), v );
|
(g, v) => { object raw = Enum.Parse( typeof(EntityShadow), v );
|
||||||
g.Players.ShadowMode = (EntityShadow)raw;
|
g.Players.ShadowMode = (EntityShadow)raw;
|
||||||
@ -62,15 +62,15 @@ namespace ClassicalSharp.Gui {
|
|||||||
descriptions[0] = new[] {
|
descriptions[0] = new[] {
|
||||||
"&eVSync: &fNumber of frames rendered is at most the monitor's refresh rate.",
|
"&eVSync: &fNumber of frames rendered is at most the monitor's refresh rate.",
|
||||||
"&e30/60/120 FPS: &f30/60/120 frames rendered at most each second.",
|
"&e30/60/120 FPS: &f30/60/120 frames rendered at most each second.",
|
||||||
"&eNoLimit: &Renders as many frames as the GPU can handle each second.",
|
"&eNoLimit: &Renders as many frames as possible each second.",
|
||||||
"&cUsing NoLimit mode is discouraged for general usage.",
|
"&cUsing NoLimit mode is discouraged for general usage.",
|
||||||
};
|
};
|
||||||
descriptions[2] = new[] {
|
descriptions[2] = new[] {
|
||||||
"&eNoNames: &fNo player names are drawn.",
|
"&eNoNames: &fNo player names are drawn.",
|
||||||
"&eHoveredOnly: &fName of the targeted player is drawn see-through.",
|
"&eHoveredOnly: &fName of the targeted player is drawn see-through.",
|
||||||
"&eAllNames: &fAll player names are drawn normally.",
|
"&eAll: &fAll player names are drawn normally.",
|
||||||
"&eAllNamesAndHovered: &fName of the targeted player is drawn see-through.",
|
"&eAllAndHovered: &fName of the targeted player is drawn see-through.",
|
||||||
"&f All other player names are drawn normally.",
|
"&f All other player names are drawn normally.",
|
||||||
};
|
};
|
||||||
descriptions[3] = new[] {
|
descriptions[3] = new[] {
|
||||||
"&eNone: &fNo entity shadows are drawn.",
|
"&eNone: &fNo entity shadows are drawn.",
|
||||||
|
@ -19,15 +19,15 @@ namespace ClassicalSharp.Gui {
|
|||||||
MakeBool( -1, -100, "Show FPS", OptionsKey.ShowFPS,
|
MakeBool( -1, -100, "Show FPS", OptionsKey.ShowFPS,
|
||||||
OnWidgetClick, g => g.ShowFPS, (g, v) => g.ShowFPS = v ),
|
OnWidgetClick, g => g.ShowFPS, (g, v) => g.ShowFPS = v ),
|
||||||
|
|
||||||
Make( -1, -50, "Hotbar scale", OnWidgetClick,
|
Make2( -1, -50, "Hotbar scale", OnWidgetClick,
|
||||||
g => g.HotbarScale.ToString(),
|
g => g.HotbarScale.ToString( "F1" ),
|
||||||
(g, v) => { g.HotbarScale = Single.Parse( v );
|
(g, v) => { g.HotbarScale = Single.Parse( v );
|
||||||
Options.Set( OptionsKey.HotbarScale, v );
|
Options.Set( OptionsKey.HotbarScale, v );
|
||||||
g.RefreshHud();
|
g.RefreshHud();
|
||||||
} ),
|
} ),
|
||||||
|
|
||||||
Make( -1, 0, "Inventory scale", OnWidgetClick,
|
Make2( -1, 0, "Inventory scale", OnWidgetClick,
|
||||||
g => g.InventoryScale.ToString(),
|
g => g.InventoryScale.ToString( "F1" ),
|
||||||
(g, v) => { g.InventoryScale = Single.Parse( v );
|
(g, v) => { g.InventoryScale = Single.Parse( v );
|
||||||
Options.Set( OptionsKey.InventoryScale, v );
|
Options.Set( OptionsKey.InventoryScale, v );
|
||||||
g.RefreshHud();
|
g.RefreshHud();
|
||||||
@ -40,25 +40,25 @@ namespace ClassicalSharp.Gui {
|
|||||||
MakeBool( 1, -150, "Clickable chat", OptionsKey.ClickableChat,
|
MakeBool( 1, -150, "Clickable chat", OptionsKey.ClickableChat,
|
||||||
OnWidgetClick, g => g.ClickableChat, (g, v) => g.ClickableChat = v ),
|
OnWidgetClick, g => g.ClickableChat, (g, v) => g.ClickableChat = v ),
|
||||||
|
|
||||||
Make( 1, -100, "Chat scale", OnWidgetClick,
|
Make2( 1, -100, "Chat scale", OnWidgetClick,
|
||||||
g => g.ChatScale.ToString(),
|
g => g.ChatScale.ToString( "F1" ),
|
||||||
(g, v) => { g.ChatScale = Single.Parse( v );
|
(g, v) => { g.ChatScale = Single.Parse( v );
|
||||||
Options.Set( OptionsKey.ChatScale, v );
|
Options.Set( OptionsKey.ChatScale, v );
|
||||||
g.RefreshHud();
|
g.RefreshHud();
|
||||||
} ),
|
} ),
|
||||||
|
|
||||||
Make( 1, -50, "Chat lines", OnWidgetClick,
|
Make2( 1, -50, "Chat lines", OnWidgetClick,
|
||||||
g => g.ChatLines.ToString(),
|
g => g.ChatLines.ToString(),
|
||||||
(g, v) => { g.ChatLines = Int32.Parse( v );
|
(g, v) => { g.ChatLines = Int32.Parse( v );
|
||||||
Options.Set( OptionsKey.ChatLines, v );
|
Options.Set( OptionsKey.ChatLines, v );
|
||||||
g.RefreshHud();
|
g.RefreshHud();
|
||||||
} ),
|
} ),
|
||||||
|
|
||||||
MakeBool( 1, 0, "Arial chat font", OptionsKey.ArialChatFont,
|
MakeBool( 1, 0, "Use font", OptionsKey.ArialChatFont,
|
||||||
OnWidgetClick, g => !g.Drawer2D.UseBitmappedChat,
|
OnWidgetClick, g => !g.Drawer2D.UseBitmappedChat,
|
||||||
(g, v) => { g.Drawer2D.UseBitmappedChat = !v; HandleFontChange(); } ),
|
(g, v) => { g.Drawer2D.UseBitmappedChat = !v; HandleFontChange(); } ),
|
||||||
|
|
||||||
Make( 1, 50, "Chat font name", OnWidgetClick,
|
Make2( 1, 50, "Font", OnWidgetClick,
|
||||||
g => g.FontName,
|
g => g.FontName,
|
||||||
(g, v) => { g.FontName = v;
|
(g, v) => { g.FontName = v;
|
||||||
Options.Set( OptionsKey.FontName, v );
|
Options.Set( OptionsKey.FontName, v );
|
||||||
@ -70,6 +70,7 @@ namespace ClassicalSharp.Gui {
|
|||||||
null, null,
|
null, null,
|
||||||
};
|
};
|
||||||
MakeValidators();
|
MakeValidators();
|
||||||
|
MakeDescriptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleFontChange() {
|
void HandleFontChange() {
|
||||||
@ -104,5 +105,12 @@ namespace ClassicalSharp.Gui {
|
|||||||
new StringValidator( 32 ),
|
new StringValidator( 32 ),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MakeDescriptions() {
|
||||||
|
descriptions = new string[widgets.Length][];
|
||||||
|
descriptions[8] = new[] {
|
||||||
|
"&eWhether a system font is used instead of default.png for drawing text",
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,15 +21,15 @@ namespace ClassicalSharp.Gui {
|
|||||||
(g, v) => { g.LocalPlayer.Hacks.Enabled = v;
|
(g, v) => { g.LocalPlayer.Hacks.Enabled = v;
|
||||||
g.LocalPlayer.CheckHacksConsistency(); } ),
|
g.LocalPlayer.CheckHacksConsistency(); } ),
|
||||||
|
|
||||||
Make( -1, -100, "Speed multiplier", OnWidgetClick,
|
Make2( -1, -100, "Speed multiplier", OnWidgetClick,
|
||||||
g => g.LocalPlayer.Hacks.SpeedMultiplier.ToString(),
|
g => g.LocalPlayer.Hacks.SpeedMultiplier.ToString( "F3" ),
|
||||||
(g, v) => { g.LocalPlayer.Hacks.SpeedMultiplier = Single.Parse( v );
|
(g, v) => { g.LocalPlayer.Hacks.SpeedMultiplier = Single.Parse( v );
|
||||||
Options.Set( OptionsKey.Speed, v ); } ),
|
Options.Set( OptionsKey.Speed, v ); } ),
|
||||||
|
|
||||||
MakeBool( -1, -50, "Camera clipping", OptionsKey.CameraClipping,
|
MakeBool( -1, -50, "Camera clipping", OptionsKey.CameraClipping,
|
||||||
OnWidgetClick, g => g.CameraClipping, (g, v) => g.CameraClipping = v ),
|
OnWidgetClick, g => g.CameraClipping, (g, v) => g.CameraClipping = v ),
|
||||||
|
|
||||||
Make( -1, 0, "Jump height", OnWidgetClick,
|
Make2( -1, 0, "Jump height", OnWidgetClick,
|
||||||
g => g.LocalPlayer.JumpHeight.ToString( "F3" ),
|
g => g.LocalPlayer.JumpHeight.ToString( "F3" ),
|
||||||
(g, v) => g.LocalPlayer.CalculateJumpVelocity( Single.Parse( v ) ) ),
|
(g, v) => g.LocalPlayer.CalculateJumpVelocity( Single.Parse( v ) ) ),
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ namespace ClassicalSharp.Gui {
|
|||||||
OnWidgetClick, g => g.LocalPlayer.Hacks.NoclipSlide,
|
OnWidgetClick, g => g.LocalPlayer.Hacks.NoclipSlide,
|
||||||
(g, v) => g.LocalPlayer.Hacks.NoclipSlide = v ),
|
(g, v) => g.LocalPlayer.Hacks.NoclipSlide = v ),
|
||||||
|
|
||||||
Make( 1, 50, "Field of view", OnWidgetClick,
|
Make2( 1, 50, "Field of view", OnWidgetClick,
|
||||||
g => g.FieldOfView.ToString(),
|
g => g.FieldOfView.ToString(),
|
||||||
(g, v) => { g.FieldOfView = Int32.Parse( v );
|
(g, v) => { g.FieldOfView = Int32.Parse( v );
|
||||||
Options.Set( OptionsKey.FieldOfView, v );
|
Options.Set( OptionsKey.FieldOfView, v );
|
||||||
|
@ -12,7 +12,6 @@ namespace ClassicalSharp.Gui {
|
|||||||
|
|
||||||
protected MenuInputWidget inputWidget;
|
protected MenuInputWidget inputWidget;
|
||||||
protected MenuInputValidator[] validators;
|
protected MenuInputValidator[] validators;
|
||||||
protected TextWidget descWidget;
|
|
||||||
protected string[][] descriptions;
|
protected string[][] descriptions;
|
||||||
protected ChatTextWidget[] extendedHelp;
|
protected ChatTextWidget[] extendedHelp;
|
||||||
Font extendedHelpFont;
|
Font extendedHelpFont;
|
||||||
@ -29,16 +28,12 @@ namespace ClassicalSharp.Gui {
|
|||||||
graphicsApi.Texturing = true;
|
graphicsApi.Texturing = true;
|
||||||
RenderMenuWidgets( delta );
|
RenderMenuWidgets( delta );
|
||||||
if( inputWidget != null )
|
if( inputWidget != null )
|
||||||
inputWidget.Render( delta );
|
inputWidget.Render( delta );
|
||||||
|
|
||||||
|
|
||||||
if( extendedHelp != null && extEndY <= widgets[widgets.Length - 3].Y ) {
|
if( extendedHelp != null && extEndY <= widgets[widgets.Length - 3].Y ) {
|
||||||
for( int i = 0; i < extendedHelp.Length; i++ )
|
for( int i = 0; i < extendedHelp.Length; i++ )
|
||||||
extendedHelp[i].Render( delta );
|
extendedHelp[i].Render( delta );
|
||||||
}
|
}
|
||||||
if( descWidget != null )
|
|
||||||
descWidget.Render( delta );
|
|
||||||
|
|
||||||
graphicsApi.Texturing = false;
|
graphicsApi.Texturing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,8 +70,6 @@ namespace ClassicalSharp.Gui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResize( int oldWidth, int oldHeight, int width, int height ) {
|
public override void OnResize( int oldWidth, int oldHeight, int width, int height ) {
|
||||||
if( descWidget != null )
|
|
||||||
descWidget.OnResize( oldWidth, oldHeight, width, height );
|
|
||||||
if( inputWidget != null )
|
if( inputWidget != null )
|
||||||
inputWidget.OnResize( oldWidth, oldHeight, width, height );
|
inputWidget.OnResize( oldWidth, oldHeight, width, height );
|
||||||
|
|
||||||
@ -87,10 +80,6 @@ namespace ClassicalSharp.Gui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose() {
|
public override void Dispose() {
|
||||||
if( descWidget != null ) {
|
|
||||||
descWidget.Dispose();
|
|
||||||
descWidget = null;
|
|
||||||
}
|
|
||||||
if( inputWidget != null ) {
|
if( inputWidget != null ) {
|
||||||
inputWidget.Dispose();
|
inputWidget.Dispose();
|
||||||
inputWidget = null;
|
inputWidget = null;
|
||||||
@ -114,16 +103,9 @@ namespace ClassicalSharp.Gui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void UpdateDescription( ButtonWidget widget ) {
|
protected void UpdateDescription( ButtonWidget widget ) {
|
||||||
if( descWidget != null )
|
|
||||||
descWidget.Dispose();
|
|
||||||
DisposeExtendedHelp();
|
DisposeExtendedHelp();
|
||||||
if( widget == null || widget.GetValue == null ) return;
|
if( widget == null || widget.GetValue == null ) return;
|
||||||
|
|
||||||
int index = Array.IndexOf<Widget>( widgets, widget );
|
|
||||||
if( index >= validators.Length || !(validators[index] is BooleanValidator) ) {
|
|
||||||
string text = widget.Text + ": " + widget.GetValue( game );
|
|
||||||
descWidget = TextWidget.Create( game, 0, 100, text, Anchor.Centre, Anchor.Centre, regularFont );
|
|
||||||
}
|
|
||||||
ShowExtendedHelp();
|
ShowExtendedHelp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,8 +121,13 @@ namespace ClassicalSharp.Gui {
|
|||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ButtonWidget MakeBool( int dir, int y, string optName, string optKey,
|
protected ButtonWidget Make2( int dir, int y, string text, ClickHandler onClick,
|
||||||
ClickHandler onClick, Func<Game, bool> getter, Action<Game, bool> setter ) {
|
Func<Game, string> getter, Action<Game, string> setter ) {
|
||||||
|
return Make2Impl( 160 * dir, y, 280, 35, text, onClick, getter, setter );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ButtonWidget MakeBool( int dir, int y, string optName, string optKey,
|
||||||
|
ClickHandler onClick, Func<Game, bool> getter, Action<Game, bool> setter ) {
|
||||||
return MakeBoolImpl( 160 * dir, y, 280, 35, optName, optKey, onClick, getter, setter );
|
return MakeBoolImpl( 160 * dir, y, 280, 35, optName, optKey, onClick, getter, setter );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,20 +139,38 @@ namespace ClassicalSharp.Gui {
|
|||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ButtonWidget MakeClassicBool( int dir, int y, string text, string optKey,
|
protected ButtonWidget MakeClassic2( int dir, int y, string text, ClickHandler onClick,
|
||||||
|
Func<Game, string> getter, Action<Game, string> setter ) {
|
||||||
|
return Make2Impl( 165 * dir, y, 301, 41, text, onClick, getter, setter );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ButtonWidget MakeClassicBool( int dir, int y, string text, string optKey,
|
||||||
ClickHandler onClick, Func<Game, bool> getter, Action<Game, bool> setter ) {
|
ClickHandler onClick, Func<Game, bool> getter, Action<Game, bool> setter ) {
|
||||||
return MakeBoolImpl( 165 * dir, y, 301, 41, text, optKey, onClick, getter, setter );
|
return MakeBoolImpl( 165 * dir, y, 301, 41, text, optKey, onClick, getter, setter );
|
||||||
}
|
}
|
||||||
|
|
||||||
ButtonWidget MakeBoolImpl( int x, int y, int width, int height, string text, string optKey,
|
ButtonWidget Make2Impl( int x, int y, int width, int height, string text,
|
||||||
ClickHandler onClick, Func<Game, bool> getter, Action<Game, bool> setter ) {
|
ClickHandler onClick, Func<Game, string> getter, Action<Game, string> setter ) {
|
||||||
|
ButtonWidget widget = ButtonWidget.Create( game, x, y, width, height, text + ": " + getter( game ),
|
||||||
|
Anchor.Centre, Anchor.Centre, titleFont, onClick );
|
||||||
|
widget.Metadata = text;
|
||||||
|
widget.GetValue = getter;
|
||||||
|
widget.SetValue = (g, v) => {
|
||||||
|
setter( g, v );
|
||||||
|
widget.SetText( (string)widget.Metadata + ": " + getter( g ) );
|
||||||
|
};
|
||||||
|
return widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
ButtonWidget MakeBoolImpl( int x, int y, int width, int height, string text, string optKey,
|
||||||
|
ClickHandler onClick, Func<Game, bool> getter, Action<Game, bool> setter ) {
|
||||||
string optName = text;
|
string optName = text;
|
||||||
text = text + ": " + (getter( game ) ? "ON" : "OFF");
|
text = text + ": " + (getter( game ) ? "ON" : "OFF");
|
||||||
ButtonWidget widget = ButtonWidget.Create( game, x, y, width, height, text, Anchor.Centre,
|
ButtonWidget widget = ButtonWidget.Create( game, x, y, width, height, text, Anchor.Centre,
|
||||||
Anchor.Centre, titleFont, onClick );
|
Anchor.Centre, titleFont, onClick );
|
||||||
widget.Metadata = optName;
|
widget.Metadata = optName;
|
||||||
widget.GetValue = g => getter( g ) ? "yes" : "no";
|
widget.GetValue = g => getter( g ) ? "yes" : "no";
|
||||||
widget.SetValue = (g, v) => {
|
widget.SetValue = (g, v) => {
|
||||||
setter( g, v == "yes" );
|
setter( g, v == "yes" );
|
||||||
Options.Set( optKey, v == "yes" );
|
Options.Set( optKey, v == "yes" );
|
||||||
widget.SetText( (string)widget.Metadata + ": " + (v == "yes" ? "ON" : "OFF") );
|
widget.SetText( (string)widget.Metadata + ": " + (v == "yes" ? "ON" : "OFF") );
|
||||||
|
@ -17,7 +17,7 @@ namespace ClassicalSharp.Gui {
|
|||||||
widgets = new Widget[] {
|
widgets = new Widget[] {
|
||||||
// Column 1
|
// Column 1
|
||||||
!network.IsSinglePlayer ? null :
|
!network.IsSinglePlayer ? null :
|
||||||
Make( -1, -100, "Click distance", OnWidgetClick,
|
Make2( -1, -100, "Click distance", OnWidgetClick,
|
||||||
g => g.LocalPlayer.ReachDistance.ToString(),
|
g => g.LocalPlayer.ReachDistance.ToString(),
|
||||||
(g, v) => g.LocalPlayer.ReachDistance = Single.Parse( v ) ),
|
(g, v) => g.LocalPlayer.ReachDistance = Single.Parse( v ) ),
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ namespace ClassicalSharp.Gui {
|
|||||||
MakeBool( 1, 0, "Invert mouse", OptionsKey.InvertMouse,
|
MakeBool( 1, 0, "Invert mouse", OptionsKey.InvertMouse,
|
||||||
OnWidgetClick, g => g.InvertMouse, (g, v) => g.InvertMouse = v ),
|
OnWidgetClick, g => g.InvertMouse, (g, v) => g.InvertMouse = v ),
|
||||||
|
|
||||||
Make( 1, 50, "Mouse sensitivity", OnWidgetClick,
|
Make2( 1, 50, "Mouse sensitivity", OnWidgetClick,
|
||||||
g => g.MouseSensitivity.ToString(),
|
g => g.MouseSensitivity.ToString(),
|
||||||
(g, v) => { g.MouseSensitivity = Int32.Parse( v );
|
(g, v) => { g.MouseSensitivity = Int32.Parse( v );
|
||||||
Options.Set( OptionsKey.Sensitivity, v ); } ),
|
Options.Set( OptionsKey.Sensitivity, v ); } ),
|
||||||
|
@ -5,7 +5,7 @@ using ClassicalSharp.GraphicsAPI;
|
|||||||
|
|
||||||
namespace ClassicalSharp.Entities {
|
namespace ClassicalSharp.Entities {
|
||||||
|
|
||||||
public enum NameMode { NoNames, HoveredOnly, AllNames, AllNamesAndHovered, }
|
public enum NameMode { NoNames, HoveredOnly, All, AllAndHovered, }
|
||||||
|
|
||||||
public enum EntityShadow { None, SnapToBlock, Circle, CircleAll, }
|
public enum EntityShadow { None, SnapToBlock, Circle, CircleAll, }
|
||||||
|
|
||||||
@ -19,12 +19,12 @@ namespace ClassicalSharp.Entities {
|
|||||||
|
|
||||||
/// <summary> Mode of how names of hovered entities are rendered (with or without depth testing),
|
/// <summary> Mode of how names of hovered entities are rendered (with or without depth testing),
|
||||||
/// and how other entity names are rendered. </summary>
|
/// and how other entity names are rendered. </summary>
|
||||||
public NameMode NamesMode = NameMode.AllNamesAndHovered;
|
public NameMode NamesMode = NameMode.AllAndHovered;
|
||||||
|
|
||||||
public EntityList( Game game ) {
|
public EntityList( Game game ) {
|
||||||
this.game = game;
|
this.game = game;
|
||||||
game.Events.ChatFontChanged += ChatFontChanged;
|
game.Events.ChatFontChanged += ChatFontChanged;
|
||||||
NamesMode = Options.GetEnum( OptionsKey.NamesMode, NameMode.AllNamesAndHovered );
|
NamesMode = Options.GetEnum( OptionsKey.NamesMode, NameMode.AllAndHovered );
|
||||||
if( game.ClassicMode ) NamesMode = NameMode.HoveredOnly;
|
if( game.ClassicMode ) NamesMode = NameMode.HoveredOnly;
|
||||||
ShadowMode = Options.GetEnum( OptionsKey.EntityShadow, EntityShadow.None );
|
ShadowMode = Options.GetEnum( OptionsKey.EntityShadow, EntityShadow.None );
|
||||||
if( game.ClassicMode ) ShadowMode = EntityShadow.None;
|
if( game.ClassicMode ) ShadowMode = EntityShadow.None;
|
||||||
@ -62,7 +62,7 @@ namespace ClassicalSharp.Entities {
|
|||||||
Vector3 eyePos = localP.EyePosition;
|
Vector3 eyePos = localP.EyePosition;
|
||||||
closestId = 255;
|
closestId = 255;
|
||||||
|
|
||||||
if( NamesMode != NameMode.AllNames )
|
if( NamesMode != NameMode.All )
|
||||||
closestId = GetClosetPlayer( game.LocalPlayer );
|
closestId = GetClosetPlayer( game.LocalPlayer );
|
||||||
if( NamesMode == NameMode.HoveredOnly || !game.LocalPlayer.Hacks.CanSeeAllNames ) {
|
if( NamesMode == NameMode.HoveredOnly || !game.LocalPlayer.Hacks.CanSeeAllNames ) {
|
||||||
api.Texturing = false;
|
api.Texturing = false;
|
||||||
@ -80,7 +80,7 @@ namespace ClassicalSharp.Entities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void RenderHoveredNames( IGraphicsApi api, double delta, float t ) {
|
public void RenderHoveredNames( IGraphicsApi api, double delta, float t ) {
|
||||||
if( NamesMode == NameMode.NoNames || NamesMode == NameMode.AllNames )
|
if( NamesMode == NameMode.NoNames || NamesMode == NameMode.All )
|
||||||
return;
|
return;
|
||||||
api.Texturing = true;
|
api.Texturing = true;
|
||||||
api.AlphaTest = true;
|
api.AlphaTest = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user