mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 18:45:23 -04:00
Save singleplayer physics option, only use mob texture for external urls, use bigger font size for name texture.
This commit is contained in:
parent
d05fdd1aa0
commit
70a2fc868f
@ -65,7 +65,10 @@ namespace ClassicalSharp {
|
||||
!network.IsSinglePlayer ? null :
|
||||
Make( -140, -150, "Singleplayer physics", Anchor.Centre, OnWidgetClick,
|
||||
g => ((SinglePlayerServer)network).physics.Enabled ? "yes" : "no",
|
||||
(g, v) => ((SinglePlayerServer)network).physics.Enabled = (v == "yes") ),
|
||||
(g, v) => {
|
||||
((SinglePlayerServer)network).physics.Enabled = v == "yes";
|
||||
Options.Set( OptionsKey.SingleplayerPhysics, v == "yes" );
|
||||
}),
|
||||
Make( 140, -150, "Pushback block placing", Anchor.Centre, OnWidgetClick,
|
||||
g => g.LocalPlayer.PushbackBlockPlacing
|
||||
&& g.LocalPlayer.CanPushbackBlocks ? "yes" : "no",
|
||||
|
@ -41,6 +41,7 @@ namespace ClassicalSharp {
|
||||
public LocalPlayer( Game window ) : base( window ) {
|
||||
DisplayName = window.Username;
|
||||
SkinName = window.Username;
|
||||
SkinIdentifier = "skin_" + SkinName;
|
||||
InitRenderingData();
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ namespace ClassicalSharp {
|
||||
public NetPlayer( string displayName, string skinName, Game game ) : base( game ) {
|
||||
DisplayName = displayName;
|
||||
SkinName = Utils.StripColours( skinName );
|
||||
SkinIdentifier = "skin_" + SkinName;
|
||||
InitRenderingData();
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace ClassicalSharp {
|
||||
}
|
||||
|
||||
protected void InitRenderingData() {
|
||||
using( Font font = new Font( "Arial", 14 ) ) {
|
||||
using( Font font = new Font( "Arial", 20 ) ) {
|
||||
DrawTextArgs args = new DrawTextArgs( DisplayName, font, true );
|
||||
nameTex = game.Drawer2D.MakeBitmappedTextTexture( ref args, 0, 0 );
|
||||
}
|
||||
@ -32,8 +32,8 @@ namespace ClassicalSharp {
|
||||
IGraphicsApi api = game.Graphics;
|
||||
api.BindTexture( nameTex.ID );
|
||||
|
||||
float x1 = -nameTex.Width * 0.5f / 50f, y1 = nameTex.Height / 50f;
|
||||
float x2 = nameTex.Width * 0.5f / 50f, y2 = 0;
|
||||
float x1 = -nameTex.Width * 0.5f / 70f, y1 = nameTex.Height / 70f;
|
||||
float x2 = nameTex.Width * 0.5f / 70f, y2 = 0;
|
||||
// NOTE: Do this instead with network player's yaw to have names rotate with them instead.
|
||||
//yaw = Math.Pi - Player.YawRadians;
|
||||
float angle = game.LocalPlayer.YawRadians;
|
||||
|
@ -12,7 +12,7 @@ namespace ClassicalSharp {
|
||||
get { return new Vector3( Position.X, Position.Y + Model.GetEyeY( this ), Position.Z ); }
|
||||
}
|
||||
|
||||
public string DisplayName, SkinName;
|
||||
public string DisplayName, SkinName, SkinIdentifier;
|
||||
public SkinType SkinType;
|
||||
|
||||
public Player( Game game ) : base( game ) {
|
||||
@ -42,7 +42,7 @@ namespace ClassicalSharp {
|
||||
|
||||
protected void CheckSkin() {
|
||||
DownloadedItem item;
|
||||
game.AsyncDownloader.TryGetItem( "skin_" + SkinName, out item );
|
||||
game.AsyncDownloader.TryGetItem( SkinIdentifier, out item );
|
||||
if( item != null && item.Data != null ) {
|
||||
Bitmap bmp = (Bitmap)item.Data;
|
||||
game.Graphics.DeleteTexture( ref PlayerTextureId );
|
||||
@ -55,21 +55,23 @@ namespace ClassicalSharp {
|
||||
MobTextureId = -1;
|
||||
|
||||
// Custom mob textures.
|
||||
if( Utils.IsUrlPrefix( item.Url ) && item.TimeAdded > lastModelChange ) {
|
||||
if( Utils.IsUrlPrefix( SkinName ) && item.TimeAdded > lastModelChange )
|
||||
MobTextureId = PlayerTextureId;
|
||||
}
|
||||
RenderHat = HasHat( bmp, SkinType );
|
||||
} catch( NotSupportedException ) {
|
||||
string formatString = "Skin {0} has unsupported dimensions({1}, {2}), reverting to default.";
|
||||
Utils.LogDebug( formatString, SkinName, bmp.Width, bmp.Height );
|
||||
MobTextureId = -1;
|
||||
PlayerTextureId = -1;
|
||||
SkinType = game.DefaultPlayerSkinType;
|
||||
RenderHat = false;
|
||||
ResetSkin( bmp );
|
||||
}
|
||||
bmp.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ResetSkin( Bitmap bmp ) {
|
||||
string formatString = "Skin {0} has unsupported dimensions({1}, {2}), reverting to default.";
|
||||
Utils.LogDebug( formatString, SkinName, bmp.Width, bmp.Height );
|
||||
MobTextureId = -1;
|
||||
PlayerTextureId = -1;
|
||||
SkinType = game.DefaultPlayerSkinType;
|
||||
RenderHat = false;
|
||||
}
|
||||
|
||||
DateTime lastModelChange = new DateTime( 1, 1, 1 );
|
||||
|
@ -266,6 +266,7 @@ namespace ClassicalSharp {
|
||||
game.AsyncDownloader.DownloadSkin( skinName );
|
||||
} else {
|
||||
game.LocalPlayer.SkinName = skinName;
|
||||
game.LocalPlayer.SkinIdentifier = "skin_" + game.LocalPlayer.SkinName;
|
||||
game.AsyncDownloader.DownloadSkin( skinName );
|
||||
}
|
||||
if( readPosition ) {
|
||||
|
@ -27,6 +27,7 @@ namespace ClassicalSharp.Singleplayer {
|
||||
map = game.Map;
|
||||
info = game.BlockInfo;
|
||||
game.Events.OnNewMapLoaded += ResetMap;
|
||||
enabled = Options.GetBool( OptionsKey.SingleplayerPhysics, true );
|
||||
}
|
||||
|
||||
bool CheckItem( Queue<uint> queue, out int posIndex ) {
|
||||
|
@ -14,6 +14,7 @@ namespace ClassicalSharp {
|
||||
public const string ChatLines = "chatlines";
|
||||
public const string ArialChatFont = "arialchatfont";
|
||||
public const string DefaultTexturePack = "defaulttexpack";
|
||||
public const string SingleplayerPhysics = "singleplayerphysics";
|
||||
|
||||
public const string MouseLeft = "mouseleft";
|
||||
public const string MouseMiddle = "mousemiddle";
|
||||
|
Loading…
x
Reference in New Issue
Block a user